Disable free-text boxes on Team category

Edit Multi Data Entry to display something when editing and the box is disabled when it has no data.
This commit is contained in:
Mike Simpson 2023-06-28 16:40:45 +01:00
parent 9f842dd445
commit fd1429e2da
3 changed files with 81 additions and 72 deletions

View File

@ -76,6 +76,12 @@ export const MultiDataEntry: React.FC<MultiDataEntryProps> = ({
</div> </div>
} }
<ul className="data-entry-list"> <ul className="data-entry-list">
{
isEditing && isDisabled && values.length === 0 &&
<div className="input-group">
<input className="form-control no-entries" type="text" value="No entries" disabled={true} />
</div>
}
{ {
values.map((val, i) => ( values.map((val, i) => (
<li className="input-group" key={i /* i as key prevents input component recreation on edit */}> <li className="input-group" key={i /* i as key prevents input component recreation on edit */}>

View File

@ -146,6 +146,7 @@ const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
tooltip={dataFields.landowner.tooltip} tooltip={dataFields.landowner.tooltip}
placeholder="" placeholder=""
editableEntries={true} editableEntries={true}
disabled={true}
/> />
<Verification <Verification
slug="landowner" slug="landowner"
@ -213,6 +214,7 @@ const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
tooltip={dataFields.developer_name.tooltip} tooltip={dataFields.developer_name.tooltip}
placeholder="" placeholder=""
editableEntries={true} editableEntries={true}
disabled={true}
/> />
<Verification <Verification
slug="developer_name" slug="developer_name"
@ -263,6 +265,7 @@ const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
tooltip={dataFields.designers.tooltip} tooltip={dataFields.designers.tooltip}
placeholder="" placeholder=""
editableEntries={true} editableEntries={true}
disabled={true}
/> />
<Verification <Verification
slug="designers" slug="designers"
@ -272,7 +275,6 @@ const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
user_verified_as={props.user_verified.designers} user_verified_as={props.user_verified.designers}
verified_count={props.building.verified.designers} verified_count={props.building.verified.designers}
/> />
<SelectDataEntry <SelectDataEntry
slug='lead_designer_type' slug='lead_designer_type'
title={dataFields.lead_designer_type.title} title={dataFields.lead_designer_type.title}
@ -330,6 +332,7 @@ const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
onChange={props.onChange} onChange={props.onChange}
placeholder="" placeholder=""
editableEntries={true} editableEntries={true}
disabled={true}
/> />
<Verification <Verification
slug="builder" slug="builder"

View File

@ -969,7 +969,7 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
landowner: { landowner: {
category: Category.Team, category: Category.Team,
title: "Landowner(s) at time of construction", title: "Landowner(s) at time of construction",
tooltip: "Land owner when the building was constructed.<br/>For info on current land ownership, see 'Planning Controls'.", tooltip: "Land owner when the building was constructed.<br/><br/>Free-text entry disabled for security reasons.<br/><br/>For info on current land ownership, see 'Planning Controls'.",
example: ["", "", ""], example: ["", "", ""],
}, },
landowner_source_type: { landowner_source_type: {
@ -988,7 +988,7 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
designers: { designers: {
category: Category.Team, category: Category.Team,
title: "Who were the main designer(s)?", title: "Who were the main designer(s)?",
tooltip: "Free text. First name, space, then Last name", tooltip: "First name, space, then Last name.<br/><br/>Free-text entry disabled for security reasons.",
example: ["", "", ""], example: ["", "", ""],
}, },
designers_source_type: { designers_source_type: {
@ -1031,7 +1031,7 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
}, },
builder: { builder: {
category: Category.Team, category: Category.Team,
title: "Name of builder/construction team", title: "Name of builder/construction team.<br/><br/>Free-text entry disabled for security reasons.",
example: ["", "", ""], example: ["", "", ""],
}, },
builder_source_type: { builder_source_type: {