colouring-montreal/app/src/frontend/building/data-containers/location.tsx

117 lines
3.7 KiB
TypeScript
Raw Normal View History

import React, { Fragment } from 'react';
import withCopyEdit from '../data-container';
import DataEntry from '../data-components/data-entry';
import NumericDataEntry from '../data-components/numeric-data-entry';
2019-08-14 17:20:55 -04:00
import UPRNsDataEntry from '../data-components/uprns-data-entry';
import InfoBox from '../../components/info-box';
const LocationView = (props) => (
<Fragment>
<InfoBox msg="Text-based address fields are disabled at the moment. We're looking into how best to collect this data." />
2019-08-14 17:20:55 -04:00
<DataEntry
title="Building Name"
slug="location_name"
value={props.building.location_name}
mode={props.mode}
2019-08-14 17:20:55 -04:00
copy={props.copy}
onChange={props.onChange}
2019-08-14 17:20:55 -04:00
tooltip="May not be needed for many buildings."
placeholder="Building name (if any)"
2019-08-14 17:20:55 -04:00
disabled={true}
/>
<NumericDataEntry
2019-08-14 17:20:55 -04:00
title="Building number"
slug="location_number"
value={props.building.location_number}
mode={props.mode}
2019-08-14 17:20:55 -04:00
copy={props.copy}
2019-10-16 16:13:50 -04:00
onChange={props.onUpdate}
step={1}
2019-08-14 17:20:55 -04:00
/>
<DataEntry
title="Street"
slug="location_street"
value={props.building.location_street}
mode={props.mode}
2019-08-14 17:20:55 -04:00
copy={props.copy}
onChange={props.onChange}
2019-08-14 17:20:55 -04:00
disabled={true}
/>
<DataEntry
title="Address line 2"
slug="location_line_two"
value={props.building.location_line_two}
mode={props.mode}
2019-08-14 17:20:55 -04:00
copy={props.copy}
onChange={props.onChange}
2019-08-14 17:20:55 -04:00
disabled={true}
/>
<DataEntry
title="Town"
slug="location_town"
value={props.building.location_town}
mode={props.mode}
2019-08-14 17:20:55 -04:00
copy={props.copy}
onChange={props.onChange}
2019-08-14 17:20:55 -04:00
/>
<DataEntry
title="Postcode"
slug="location_postcode"
value={props.building.location_postcode}
mode={props.mode}
2019-08-14 17:20:55 -04:00
copy={props.copy}
onChange={props.onChange}
maxLength={8}
2019-08-14 17:20:55 -04:00
/>
<DataEntry
title="TOID"
slug="ref_toid"
value={props.building.ref_toid}
mode={props.mode}
2019-08-14 17:20:55 -04:00
copy={props.copy}
tooltip="Ordnance Survey Topography Layer ID (to be filled automatically)"
onChange={props.onChange}
2019-08-14 17:20:55 -04:00
disabled={true}
/>
<UPRNsDataEntry
title="UPRNs"
value={props.building.uprns}
tooltip="Unique Property Reference Numbers (to be filled automatically)"
/>
<DataEntry
title="OSM ID"
slug="ref_osm_id"
value={props.building.ref_osm_id}
mode={props.mode}
2019-08-14 17:20:55 -04:00
copy={props.copy}
tooltip="OpenStreetMap feature ID"
maxLength={20}
onChange={props.onChange}
2019-08-14 17:20:55 -04:00
/>
<NumericDataEntry
2019-08-14 17:20:55 -04:00
title="Latitude"
slug="location_latitude"
value={props.building.location_latitude}
mode={props.mode}
2019-08-14 17:20:55 -04:00
copy={props.copy}
step={0.0001}
2019-10-16 16:13:50 -04:00
placeholder="51"
onChange={props.onUpdate}
2019-08-14 17:20:55 -04:00
/>
<NumericDataEntry
2019-08-14 17:20:55 -04:00
title="Longitude"
slug="location_longitude"
value={props.building.location_longitude}
mode={props.mode}
2019-08-14 17:20:55 -04:00
copy={props.copy}
step={0.0001}
2019-10-16 16:13:50 -04:00
placeholder="0"
onChange={props.onUpdate}
2019-08-14 17:20:55 -04:00
/>
</Fragment>
)
const LocationContainer = withCopyEdit(LocationView);
export default LocationContainer;