2019-08-14 17:12:24 -04:00
|
|
|
import React, { Fragment } from 'react';
|
2021-02-24 22:22:25 -05:00
|
|
|
import InfoBox from '../../components/info-box';
|
2022-06-01 05:35:35 -04:00
|
|
|
import { dataFields } from '../../config/data-fields-config';
|
2022-06-01 05:36:47 -04:00
|
|
|
import SelectDataEntry from '../data-components/select-data-entry';
|
2022-06-01 06:15:19 -04:00
|
|
|
import NumericDataEntry from '../data-components/numeric-data-entry';
|
2022-06-01 09:29:06 -04:00
|
|
|
import Verification from '../data-components/verification';
|
2022-06-01 11:02:11 -04:00
|
|
|
import { MultiDataEntry } from '../data-components/multi-data-entry/multi-data-entry';
|
2022-06-01 11:39:08 -04:00
|
|
|
import { LogicalDataEntry } from '../data-components/logical-data-entry/logical-data-entry';
|
2019-08-14 14:33:26 -04:00
|
|
|
|
2019-08-14 16:54:00 -04:00
|
|
|
import withCopyEdit from '../data-container';
|
2019-11-07 02:39:26 -05:00
|
|
|
|
2019-10-18 10:06:50 -04:00
|
|
|
import { CategoryViewProps } from './category-view-props';
|
2019-08-14 14:33:26 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Team view/edit section
|
|
|
|
*/
|
2022-06-01 06:12:49 -04:00
|
|
|
const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
|
|
|
|
const building = props.building;
|
2022-06-01 06:29:59 -04:00
|
|
|
const currentYear = new Date().getFullYear();
|
2022-06-01 06:12:49 -04:00
|
|
|
const currentBuildingConstructionYear = building.date_year || undefined;
|
2022-06-01 09:08:46 -04:00
|
|
|
return (
|
2022-06-06 04:52:50 -04:00
|
|
|
<form>
|
2022-06-06 04:53:47 -04:00
|
|
|
{props.building.is_extension == "The main building" ? (
|
2022-06-01 09:08:46 -04:00
|
|
|
<Fragment>
|
|
|
|
<InfoBox msg="Can you help us capture information on who built the current building?"></InfoBox>
|
|
|
|
<SelectDataEntry
|
|
|
|
title={dataFields.is_extension.title}
|
|
|
|
slug="is_extension"
|
|
|
|
value={props.building.is_extension}
|
|
|
|
mode={props.mode}
|
|
|
|
copy={props.copy}
|
|
|
|
onChange={props.onChange}
|
|
|
|
tooltip={dataFields.is_extension.tooltip}
|
|
|
|
placeholder={dataFields.is_extension.example}
|
|
|
|
options={dataFields.is_extension.items}
|
|
|
|
/>
|
2022-06-01 06:12:49 -04:00
|
|
|
|
2022-06-01 09:08:46 -04:00
|
|
|
<NumericDataEntry
|
|
|
|
slug='date_year'
|
2022-06-01 09:30:31 -04:00
|
|
|
title={dataFields.extension_year.title}
|
2022-06-01 09:08:46 -04:00
|
|
|
value={currentBuildingConstructionYear}
|
|
|
|
mode={props.mode}
|
|
|
|
copy={props.copy}
|
|
|
|
onChange={props.onChange}
|
|
|
|
step={1}
|
|
|
|
min={1}
|
|
|
|
max={currentYear}
|
2022-06-01 09:30:31 -04:00
|
|
|
tooltip={dataFields.extension_year.tooltip}
|
2022-06-01 09:08:46 -04:00
|
|
|
/>
|
2022-06-01 09:29:06 -04:00
|
|
|
<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}
|
|
|
|
/>
|
2022-06-01 10:01:22 -04:00
|
|
|
<SelectDataEntry
|
|
|
|
slug='developer_type'
|
|
|
|
title={dataFields.developer_type.title}
|
|
|
|
value={props.building.developer_type}
|
|
|
|
options={dataFields.developer_type.items}
|
|
|
|
onChange={props.onChange}
|
|
|
|
mode={props.mode}
|
|
|
|
copy={props.copy}
|
|
|
|
/>
|
2022-06-01 10:54:01 -04:00
|
|
|
<MultiDataEntry
|
|
|
|
title={dataFields.designers.title}
|
|
|
|
slug="designers"
|
|
|
|
value={props.building.designers}
|
|
|
|
mode={props.mode}
|
|
|
|
copy={props.copy}
|
|
|
|
onChange={props.onChange}
|
|
|
|
tooltip={dataFields.designers.tooltip}
|
|
|
|
editableEntries={true}
|
2022-06-01 11:12:19 -04:00
|
|
|
maxLength={747}
|
2022-06-01 10:54:01 -04:00
|
|
|
/>
|
2022-06-01 11:17:23 -04:00
|
|
|
<Verification
|
|
|
|
slug="designers"
|
|
|
|
allow_verify={props.user !== undefined && props.building.designers !== null && !props.edited}
|
|
|
|
onVerify={props.onVerify}
|
|
|
|
user_verified={props.user_verified.hasOwnProperty("designers")}
|
|
|
|
user_verified_as={props.user_verified.designers}
|
|
|
|
verified_count={props.building.verified.designers}
|
|
|
|
/>
|
2022-06-01 11:25:20 -04:00
|
|
|
<MultiDataEntry
|
|
|
|
title={dataFields.designers_source_link.title}
|
|
|
|
slug="designers_source_link"
|
|
|
|
value={props.building.designers_source_link}
|
|
|
|
mode={props.mode}
|
|
|
|
copy={props.copy}
|
|
|
|
onChange={props.onChange}
|
|
|
|
tooltip={dataFields.designers_source_link.tooltip}
|
|
|
|
placeholder="https://..."
|
|
|
|
editableEntries={true}
|
|
|
|
/>
|
2022-06-01 11:32:39 -04:00
|
|
|
<SelectDataEntry
|
|
|
|
slug='lead_designer_type'
|
|
|
|
title={dataFields.lead_designer_type.title}
|
|
|
|
value={props.building.lead_designer_type}
|
|
|
|
options={dataFields.lead_designer_type.items}
|
|
|
|
onChange={props.onChange}
|
|
|
|
mode={props.mode}
|
|
|
|
copy={props.copy}
|
|
|
|
/>
|
2022-06-01 11:39:08 -04:00
|
|
|
<LogicalDataEntry
|
|
|
|
slug='designer_awards'
|
|
|
|
title={dataFields.designer_awards.title}
|
|
|
|
tooltip={dataFields.designer_awards.tooltip}
|
|
|
|
value={props.building.designer_awards}
|
|
|
|
|
|
|
|
onChange={props.onChange}
|
|
|
|
mode={props.mode}
|
|
|
|
/>
|
2022-06-01 09:08:46 -04:00
|
|
|
</Fragment>
|
2022-06-06 04:52:50 -04:00
|
|
|
) : (
|
|
|
|
<Fragment>
|
|
|
|
<InfoBox msg="Can you help us capture information on who built the building extension?"></InfoBox>
|
|
|
|
<SelectDataEntry
|
|
|
|
title={dataFields.is_extension.title}
|
|
|
|
slug="is_extension"
|
|
|
|
value={props.building.is_extension}
|
|
|
|
mode={props.mode}
|
|
|
|
copy={props.copy}
|
|
|
|
onChange={props.onChange}
|
|
|
|
tooltip={dataFields.is_extension.tooltip}
|
|
|
|
placeholder={dataFields.is_extension.example}
|
|
|
|
options={dataFields.is_extension.items}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<NumericDataEntry
|
|
|
|
slug='extension_year'
|
|
|
|
title={dataFields.extension_year.title}
|
|
|
|
value={props.building.extension_year}
|
|
|
|
mode={props.mode}
|
|
|
|
copy={props.copy}
|
|
|
|
onChange={props.onChange}
|
|
|
|
step={1}
|
|
|
|
min={1}
|
|
|
|
max={currentYear}
|
|
|
|
tooltip={dataFields.extension_year.tooltip_extension}
|
2022-06-01 10:54:01 -04:00
|
|
|
/>
|
2022-06-06 04:52:50 -04:00
|
|
|
<Verification
|
|
|
|
slug="extension_year"
|
|
|
|
allow_verify={props.user !== undefined && props.building.extension_year !== null && !props.edited}
|
|
|
|
onVerify={props.onVerify}
|
|
|
|
user_verified={props.user_verified.hasOwnProperty("extension_year")}
|
|
|
|
user_verified_as={props.user_verified.extension_year}
|
|
|
|
verified_count={props.building.verified.extension_year}
|
|
|
|
/>
|
|
|
|
<SelectDataEntry
|
|
|
|
slug='developer_type'
|
|
|
|
title={dataFields.developer_type.title}
|
|
|
|
value={props.building.developer_type}
|
|
|
|
options={dataFields.developer_type.items}
|
|
|
|
onChange={props.onChange}
|
|
|
|
mode={props.mode}
|
|
|
|
copy={props.copy}
|
2022-06-01 11:17:23 -04:00
|
|
|
/>
|
2022-06-06 04:52:50 -04:00
|
|
|
<MultiDataEntry
|
|
|
|
title={dataFields.designers.title}
|
|
|
|
slug="designers"
|
|
|
|
value={props.building.designers}
|
|
|
|
mode={props.mode}
|
|
|
|
copy={props.copy}
|
|
|
|
onChange={props.onChange}
|
|
|
|
tooltip={dataFields.designers.tooltip}
|
|
|
|
editableEntries={true}
|
|
|
|
maxLength={747}
|
|
|
|
/>
|
|
|
|
<Verification
|
|
|
|
slug="designers"
|
|
|
|
allow_verify={props.user !== undefined && props.building.designers !== null && !props.edited}
|
|
|
|
onVerify={props.onVerify}
|
|
|
|
user_verified={props.user_verified.hasOwnProperty("designers")}
|
|
|
|
user_verified_as={props.user_verified.designers}
|
|
|
|
verified_count={props.building.verified.designers}
|
|
|
|
/>
|
|
|
|
<MultiDataEntry
|
|
|
|
title={dataFields.designers_source_link.title}
|
|
|
|
slug="designers_source_link"
|
|
|
|
value={props.building.designers_source_link}
|
|
|
|
mode={props.mode}
|
|
|
|
copy={props.copy}
|
|
|
|
onChange={props.onChange}
|
|
|
|
tooltip={dataFields.designers_source_link.tooltip}
|
|
|
|
placeholder="https://..."
|
|
|
|
editableEntries={true}
|
|
|
|
/>
|
|
|
|
<SelectDataEntry
|
|
|
|
slug='lead_designer_type'
|
|
|
|
title={dataFields.lead_designer_type.title}
|
|
|
|
value={props.building.lead_designer_type}
|
|
|
|
options={dataFields.lead_designer_type.items}
|
|
|
|
onChange={props.onChange}
|
|
|
|
mode={props.mode}
|
|
|
|
copy={props.copy}
|
2022-06-01 11:25:20 -04:00
|
|
|
/>
|
2022-06-06 04:52:50 -04:00
|
|
|
<LogicalDataEntry
|
|
|
|
slug='designer_awards'
|
|
|
|
title={dataFields.designer_awards.title}
|
|
|
|
tooltip={dataFields.designer_awards.tooltip}
|
|
|
|
value={props.building.designer_awards}
|
2022-06-01 11:39:08 -04:00
|
|
|
|
2022-06-06 04:52:50 -04:00
|
|
|
onChange={props.onChange}
|
|
|
|
mode={props.mode}
|
|
|
|
/>
|
|
|
|
</Fragment>
|
|
|
|
)}
|
|
|
|
</form>
|
|
|
|
);
|
2022-06-01 06:12:49 -04:00
|
|
|
};
|
2019-08-14 14:33:26 -04:00
|
|
|
const TeamContainer = withCopyEdit(TeamView);
|
|
|
|
|
|
|
|
export default TeamContainer;
|