2019-08-21 17:20:31 -04:00
|
|
|
import React, { Fragment } from 'react';
|
2019-08-14 14:33:26 -04:00
|
|
|
|
2019-08-14 16:54:00 -04:00
|
|
|
import withCopyEdit from '../data-container';
|
|
|
|
import DataEntry from '../data-components/data-entry';
|
2019-08-23 12:35:17 -04:00
|
|
|
import NumericDataEntry from '../data-components/numeric-data-entry';
|
2019-08-14 17:20:55 -04:00
|
|
|
import UPRNsDataEntry from '../data-components/uprns-data-entry';
|
2019-08-21 17:20:31 -04:00
|
|
|
import InfoBox from '../../components/info-box';
|
2019-08-14 14:33:26 -04:00
|
|
|
|
|
|
|
const LocationView = (props) => (
|
2019-08-21 17:20:31 -04:00
|
|
|
<Fragment>
|
2019-08-23 12:35:17 -04:00
|
|
|
<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}
|
2019-08-23 12:35:17 -04:00
|
|
|
mode={props.mode}
|
2019-08-14 17:20:55 -04:00
|
|
|
copy={props.copy}
|
2019-08-23 12:35:17 -04:00
|
|
|
onChange={props.onChange}
|
2019-08-14 17:20:55 -04:00
|
|
|
tooltip="May not be needed for many buildings."
|
2019-08-23 12:35:17 -04:00
|
|
|
placeholder="Building name (if any)"
|
2019-08-14 17:20:55 -04:00
|
|
|
disabled={true}
|
|
|
|
/>
|
2019-08-23 12:35:17 -04:00
|
|
|
<NumericDataEntry
|
2019-08-14 17:20:55 -04:00
|
|
|
title="Building number"
|
|
|
|
slug="location_number"
|
|
|
|
value={props.building.location_number}
|
2019-08-23 12:35:17 -04:00
|
|
|
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}
|
2019-08-23 12:35:17 -04:00
|
|
|
step={1}
|
2019-08-14 17:20:55 -04:00
|
|
|
/>
|
|
|
|
<DataEntry
|
|
|
|
title="Street"
|
|
|
|
slug="location_street"
|
|
|
|
value={props.building.location_street}
|
2019-08-23 12:35:17 -04:00
|
|
|
mode={props.mode}
|
2019-08-14 17:20:55 -04:00
|
|
|
copy={props.copy}
|
2019-08-23 12:35:17 -04:00
|
|
|
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}
|
2019-08-23 12:35:17 -04:00
|
|
|
mode={props.mode}
|
2019-08-14 17:20:55 -04:00
|
|
|
copy={props.copy}
|
2019-08-23 12:35:17 -04:00
|
|
|
onChange={props.onChange}
|
2019-08-14 17:20:55 -04:00
|
|
|
disabled={true}
|
|
|
|
/>
|
|
|
|
<DataEntry
|
|
|
|
title="Town"
|
|
|
|
slug="location_town"
|
|
|
|
value={props.building.location_town}
|
2019-08-23 12:35:17 -04:00
|
|
|
mode={props.mode}
|
2019-08-14 17:20:55 -04:00
|
|
|
copy={props.copy}
|
2019-08-23 12:35:17 -04:00
|
|
|
onChange={props.onChange}
|
2019-08-14 17:20:55 -04:00
|
|
|
/>
|
|
|
|
<DataEntry
|
|
|
|
title="Postcode"
|
|
|
|
slug="location_postcode"
|
|
|
|
value={props.building.location_postcode}
|
2019-08-23 12:35:17 -04:00
|
|
|
mode={props.mode}
|
2019-08-14 17:20:55 -04:00
|
|
|
copy={props.copy}
|
2019-08-23 12:35:17 -04:00
|
|
|
onChange={props.onChange}
|
|
|
|
maxLength={8}
|
2019-08-14 17:20:55 -04:00
|
|
|
/>
|
|
|
|
<DataEntry
|
|
|
|
title="TOID"
|
|
|
|
slug="ref_toid"
|
|
|
|
value={props.building.ref_toid}
|
2019-08-23 12:35:17 -04:00
|
|
|
mode={props.mode}
|
2019-08-14 17:20:55 -04:00
|
|
|
copy={props.copy}
|
|
|
|
tooltip="Ordnance Survey Topography Layer ID (to be filled automatically)"
|
2019-08-23 12:35:17 -04:00
|
|
|
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}
|
2019-08-23 12:35:17 -04:00
|
|
|
mode={props.mode}
|
2019-08-14 17:20:55 -04:00
|
|
|
copy={props.copy}
|
|
|
|
tooltip="OpenStreetMap feature ID"
|
2019-08-23 12:35:17 -04:00
|
|
|
maxLength={20}
|
|
|
|
onChange={props.onChange}
|
2019-08-14 17:20:55 -04:00
|
|
|
/>
|
2019-08-23 12:35:17 -04:00
|
|
|
<NumericDataEntry
|
2019-08-14 17:20:55 -04:00
|
|
|
title="Latitude"
|
|
|
|
slug="location_latitude"
|
|
|
|
value={props.building.location_latitude}
|
2019-08-23 12:35:17 -04:00
|
|
|
mode={props.mode}
|
2019-08-14 17:20:55 -04:00
|
|
|
copy={props.copy}
|
2019-08-23 12:35:17 -04:00
|
|
|
step={0.0001}
|
2019-10-16 16:13:50 -04:00
|
|
|
placeholder="51"
|
|
|
|
onChange={props.onUpdate}
|
2019-08-14 17:20:55 -04:00
|
|
|
/>
|
2019-08-23 12:35:17 -04:00
|
|
|
<NumericDataEntry
|
2019-08-14 17:20:55 -04:00
|
|
|
title="Longitude"
|
|
|
|
slug="location_longitude"
|
|
|
|
value={props.building.location_longitude}
|
2019-08-23 12:35:17 -04:00
|
|
|
mode={props.mode}
|
2019-08-14 17:20:55 -04:00
|
|
|
copy={props.copy}
|
2019-08-23 12:35:17 -04:00
|
|
|
step={0.0001}
|
2019-10-16 16:13:50 -04:00
|
|
|
placeholder="0"
|
|
|
|
onChange={props.onUpdate}
|
2019-08-14 17:20:55 -04:00
|
|
|
/>
|
2019-08-21 17:20:31 -04:00
|
|
|
</Fragment>
|
2019-08-14 14:33:26 -04:00
|
|
|
)
|
|
|
|
const LocationContainer = withCopyEdit(LocationView);
|
|
|
|
|
|
|
|
export default LocationContainer;
|