change logic to use has_extension

This commit is contained in:
Ed Chalstrey 2022-06-06 14:24:16 +01:00
parent b59e811412
commit d031239245

View File

@ -33,30 +33,7 @@ const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
placeholder={dataFields.has_extension.example}
options={dataFields.has_extension.items}
/>
{props.building.has_extension == "The main building" ? (
<>
<NumericDataEntry
slug='date_year'
title={dataFields.extension_year.title}
value={currentBuildingConstructionYear}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
step={1}
min={1}
max={currentYear}
tooltip={dataFields.extension_year.tooltip}
/>
<Verification
slug="date_year"
allow_verify={props.user !== undefined && props.building.date_year !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("date_year")}
user_verified_as={props.user_verified.date_year}
verified_count={props.building.verified.date_year}
/>
</>
) : (
{props.building.has_extension ? (
<>
<NumericDataEntry
slug='extension_year'
@ -79,6 +56,29 @@ const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
verified_count={props.building.verified.extension_year}
/>
</>
) : (
<>
<NumericDataEntry
slug='date_year'
title={dataFields.date_year.title}
value={currentBuildingConstructionYear}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
step={1}
min={1}
max={currentYear}
tooltip={dataFields.extension_year.tooltip}
/>
<Verification
slug="date_year"
allow_verify={props.user !== undefined && props.building.date_year !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("date_year")}
user_verified_as={props.user_verified.date_year}
verified_count={props.building.verified.date_year}
/>
</>
)}
<SelectDataEntry
slug='developer_type'