parent
1708d6e5f0
commit
ff8618beb8
@ -15,7 +15,22 @@ import { MultiDataEntry } from '../data-components/multi-data-entry/multi-data-e
|
|||||||
/**
|
/**
|
||||||
* Size view/edit section
|
* Size view/edit section
|
||||||
*/
|
*/
|
||||||
const SizeView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
const SizeView: React.FunctionComponent<CategoryViewProps> = (props) => {
|
||||||
|
|
||||||
|
// Calculate the total number of floors
|
||||||
|
let total_floors = 0;
|
||||||
|
|
||||||
|
if (props.building.size_storeys_attic != null) {
|
||||||
|
total_floors += props.building.size_storeys_attic;
|
||||||
|
}
|
||||||
|
if (props.building.size_storeys_core != null) {
|
||||||
|
total_floors += props.building.size_storeys_core;
|
||||||
|
}
|
||||||
|
if (props.building.size_storeys_basement != null) {
|
||||||
|
total_floors += props.building.size_storeys_basement;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<DataEntryGroup name="Number of floors/storeys">
|
<DataEntryGroup name="Number of floors/storeys">
|
||||||
<NumericDataEntry
|
<NumericDataEntry
|
||||||
@ -75,6 +90,18 @@ const SizeView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
|||||||
user_verified_as={props.user_verified.size_storeys_basement}
|
user_verified_as={props.user_verified.size_storeys_basement}
|
||||||
verified_count={props.building.verified.size_storeys_basement}
|
verified_count={props.building.verified.size_storeys_basement}
|
||||||
/>
|
/>
|
||||||
|
<NumericDataEntry
|
||||||
|
title="Total number of floors"
|
||||||
|
slug="size_total_floors"
|
||||||
|
value={total_floors}
|
||||||
|
mode={props.mode}
|
||||||
|
copy={props.copy}
|
||||||
|
tooltip="Total number of floors, calculated from other values."
|
||||||
|
onChange={props.onChange}
|
||||||
|
step={1}
|
||||||
|
min={0}
|
||||||
|
disabled={true}
|
||||||
|
/>
|
||||||
<SelectDataEntry
|
<SelectDataEntry
|
||||||
title={dataFields.size_storeys_source_type.title}
|
title={dataFields.size_storeys_source_type.title}
|
||||||
slug="size_storeys_source_type"
|
slug="size_storeys_source_type"
|
||||||
@ -449,7 +476,8 @@ const SizeView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
|||||||
}
|
}
|
||||||
</DataEntryGroup>
|
</DataEntryGroup>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
)
|
||||||
|
};
|
||||||
const SizeContainer = withCopyEdit(SizeView);
|
const SizeContainer = withCopyEdit(SizeView);
|
||||||
|
|
||||||
export default SizeContainer;
|
export default SizeContainer;
|
||||||
|
Loading…
Reference in New Issue
Block a user