2019-08-21 17:20:31 -04:00
|
|
|
import React, { Fragment } from 'react';
|
2019-11-07 02:39:26 -05:00
|
|
|
import { NavLink, Redirect } from 'react-router-dom';
|
2020-08-04 10:54:49 -04:00
|
|
|
import Confetti from 'canvas-confetti';
|
2021-08-22 21:26:58 -04:00
|
|
|
import _ from 'lodash';
|
2019-08-14 16:54:00 -04:00
|
|
|
|
2020-01-02 05:59:13 -05:00
|
|
|
import { apiPost } from '../apiHelpers';
|
2021-08-22 21:26:58 -04:00
|
|
|
import { sendBuildingUpdate } from '../api-data/building-update';
|
2019-08-21 17:20:31 -04:00
|
|
|
import ErrorBox from '../components/error-box';
|
|
|
|
import InfoBox from '../components/info-box';
|
2019-11-07 02:39:26 -05:00
|
|
|
import { compareObjects } from '../helpers';
|
2021-08-22 21:26:58 -04:00
|
|
|
import { Building, BuildingEdits, BuildingUserAttributes, UserVerified } from '../models/building';
|
2019-10-15 09:37:23 -04:00
|
|
|
import { User } from '../models/user';
|
2019-11-07 02:39:26 -05:00
|
|
|
|
|
|
|
import ContainerHeader from './container-header';
|
2019-10-18 10:06:50 -04:00
|
|
|
import { CategoryViewProps, CopyProps } from './data-containers/category-view-props';
|
2019-11-07 02:39:26 -05:00
|
|
|
import { CopyControl } from './header-buttons/copy-control';
|
|
|
|
import { ViewEditControl } from './header-buttons/view-edit-control';
|
2019-10-15 09:37:23 -04:00
|
|
|
|
2021-03-11 13:53:03 -05:00
|
|
|
import './data-container.css';
|
2022-06-23 05:20:25 -04:00
|
|
|
import { dataFields } from '../config/data-fields-config'
|
2021-03-11 13:53:03 -05:00
|
|
|
|
2019-10-15 09:37:23 -04:00
|
|
|
interface DataContainerProps {
|
|
|
|
title: string;
|
|
|
|
cat: string;
|
|
|
|
intro: string;
|
|
|
|
help: string;
|
|
|
|
inactive?: boolean;
|
|
|
|
|
2019-11-05 15:13:10 -05:00
|
|
|
user?: User;
|
2019-10-30 08:28:10 -04:00
|
|
|
mode: 'view' | 'edit';
|
2019-11-05 15:13:10 -05:00
|
|
|
building?: Building;
|
2020-08-04 10:54:49 -04:00
|
|
|
user_verified?: any;
|
2021-02-22 01:59:24 -05:00
|
|
|
onBuildingUpdate: (buildingId: number, updatedData: Building) => void;
|
|
|
|
onUserVerifiedUpdate: (buildingId: number, updatedData: UserVerified) => void;
|
2019-10-15 09:37:23 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
interface DataContainerState {
|
|
|
|
error: string;
|
|
|
|
copying: boolean;
|
2019-10-15 10:44:22 -04:00
|
|
|
keys_to_copy: {[key: string]: boolean};
|
2019-10-15 14:16:48 -04:00
|
|
|
currentBuildingId: number;
|
2019-10-21 06:20:10 -04:00
|
|
|
currentBuildingRevisionId: number;
|
2021-08-22 21:26:58 -04:00
|
|
|
buildingEdits: BuildingEdits;
|
2019-10-15 09:37:23 -04:00
|
|
|
}
|
2019-08-14 16:54:00 -04:00
|
|
|
|
2021-02-22 01:59:24 -05:00
|
|
|
export type DataContainerType = React.ComponentType<DataContainerProps>;
|
|
|
|
|
2019-08-14 16:54:00 -04:00
|
|
|
/**
|
|
|
|
* Shared functionality for view/edit forms
|
|
|
|
*
|
|
|
|
* See React Higher-order-component docs for the pattern
|
|
|
|
* - https://reactjs.org/docs/higher-order-components.html
|
|
|
|
*
|
|
|
|
* @param WrappedComponent
|
|
|
|
*/
|
2021-02-22 01:59:24 -05:00
|
|
|
const withCopyEdit: (wc: React.ComponentType<CategoryViewProps>) => DataContainerType = (WrappedComponent: React.ComponentType<CategoryViewProps>) => {
|
2019-10-17 12:07:34 -04:00
|
|
|
return class DataContainer extends React.Component<DataContainerProps, DataContainerState> {
|
2019-08-14 16:54:00 -04:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2019-08-21 17:20:31 -04:00
|
|
|
|
2019-08-14 16:54:00 -04:00
|
|
|
this.state = {
|
2019-10-15 09:37:23 -04:00
|
|
|
error: undefined,
|
2019-08-14 16:54:00 -04:00
|
|
|
copying: false,
|
2019-08-21 17:20:31 -04:00
|
|
|
keys_to_copy: {},
|
2019-10-15 14:16:48 -04:00
|
|
|
buildingEdits: {},
|
2019-10-21 06:20:10 -04:00
|
|
|
currentBuildingId: undefined,
|
|
|
|
currentBuildingRevisionId: undefined
|
2019-08-14 16:54:00 -04:00
|
|
|
};
|
2019-08-21 17:20:31 -04:00
|
|
|
|
|
|
|
this.handleChange = this.handleChange.bind(this);
|
2019-10-21 06:20:10 -04:00
|
|
|
this.handleReset = this.handleReset.bind(this);
|
2019-08-21 17:20:31 -04:00
|
|
|
this.handleSubmit = this.handleSubmit.bind(this);
|
2020-08-04 10:54:49 -04:00
|
|
|
this.handleVerify = this.handleVerify.bind(this);
|
2021-03-11 13:53:03 -05:00
|
|
|
this.handleSaveAdd = this.handleSaveAdd.bind(this);
|
2021-03-18 17:18:58 -04:00
|
|
|
this.handleSaveChange = this.handleSaveChange.bind(this);
|
2019-08-21 17:20:31 -04:00
|
|
|
|
2019-08-14 16:54:00 -04:00
|
|
|
this.toggleCopying = this.toggleCopying.bind(this);
|
|
|
|
this.toggleCopyAttribute = this.toggleCopyAttribute.bind(this);
|
|
|
|
}
|
|
|
|
|
2021-08-22 21:26:58 -04:00
|
|
|
static getDerivedStateFromProps(props, state): DataContainerState {
|
2019-10-16 08:11:25 -04:00
|
|
|
const newBuildingId = props.building == undefined ? undefined : props.building.building_id;
|
2019-10-21 06:20:10 -04:00
|
|
|
const newBuildingRevisionId = props.building == undefined ? undefined : props.building.revision_id;
|
2022-06-23 05:38:22 -04:00
|
|
|
const categoryKeys = {};
|
2022-06-23 05:39:55 -04:00
|
|
|
for (let key in dataFields) {
|
2022-06-23 05:38:22 -04:00
|
|
|
categoryKeys[key] = true;
|
|
|
|
}
|
2019-10-21 06:20:10 -04:00
|
|
|
if(newBuildingId !== state.currentBuildingId || newBuildingRevisionId > state.currentBuildingRevisionId) {
|
2019-10-15 14:16:48 -04:00
|
|
|
return {
|
2019-10-16 08:11:25 -04:00
|
|
|
error: undefined,
|
|
|
|
copying: false,
|
2022-06-23 05:38:22 -04:00
|
|
|
keys_to_copy: categoryKeys,
|
2019-10-15 14:16:48 -04:00
|
|
|
buildingEdits: {},
|
2019-10-21 06:20:10 -04:00
|
|
|
currentBuildingId: newBuildingId,
|
|
|
|
currentBuildingRevisionId: newBuildingRevisionId
|
2019-10-15 14:16:48 -04:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2019-08-14 16:54:00 -04:00
|
|
|
/**
|
|
|
|
* Enter or exit "copying" state - allow user to select attributes to copy
|
|
|
|
*/
|
|
|
|
toggleCopying() {
|
|
|
|
this.setState({
|
|
|
|
copying: !this.state.copying
|
2019-11-07 03:13:30 -05:00
|
|
|
});
|
2019-08-14 16:54:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Keep track of data to copy (accumulate while in "copying" state)
|
|
|
|
*
|
|
|
|
* @param {string} key
|
|
|
|
*/
|
2019-08-21 17:20:31 -04:00
|
|
|
toggleCopyAttribute(key: string) {
|
2019-10-15 09:37:23 -04:00
|
|
|
const keys = {...this.state.keys_to_copy};
|
2019-08-21 17:20:31 -04:00
|
|
|
if(this.state.keys_to_copy[key]){
|
|
|
|
delete keys[key];
|
2019-08-14 16:54:00 -04:00
|
|
|
} else {
|
2019-08-21 17:20:31 -04:00
|
|
|
keys[key] = true;
|
2019-08-14 16:54:00 -04:00
|
|
|
}
|
|
|
|
this.setState({
|
2019-08-21 17:20:31 -04:00
|
|
|
keys_to_copy: keys
|
2019-11-07 03:13:30 -05:00
|
|
|
});
|
2019-08-14 16:54:00 -04:00
|
|
|
}
|
|
|
|
|
2019-10-15 14:16:48 -04:00
|
|
|
isEdited() {
|
|
|
|
// check if the edits object has any fields
|
2021-08-22 21:26:58 -04:00
|
|
|
return !_.isEmpty(this.state.buildingEdits);
|
2019-10-15 14:16:48 -04:00
|
|
|
}
|
2019-08-23 12:35:17 -04:00
|
|
|
|
2019-10-21 06:20:10 -04:00
|
|
|
clearEdits() {
|
2019-08-23 12:35:17 -04:00
|
|
|
this.setState({
|
2019-10-21 06:20:10 -04:00
|
|
|
buildingEdits: {}
|
2019-08-23 12:35:17 -04:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-10-15 14:16:48 -04:00
|
|
|
getEditedBuilding() {
|
|
|
|
if(this.isEdited()) {
|
|
|
|
return Object.assign({}, this.props.building, this.state.buildingEdits);
|
|
|
|
} else {
|
|
|
|
return {...this.props.building};
|
2019-08-21 17:20:31 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-15 14:16:48 -04:00
|
|
|
updateBuildingState(key: string, value: any) {
|
|
|
|
const newBuilding = this.getEditedBuilding();
|
|
|
|
newBuilding[key] = value;
|
|
|
|
const [forwardPatch] = compareObjects(this.props.building, newBuilding);
|
2019-08-21 17:20:31 -04:00
|
|
|
|
2019-08-23 12:35:17 -04:00
|
|
|
this.setState({
|
2019-10-15 14:16:48 -04:00
|
|
|
buildingEdits: forwardPatch
|
2019-08-23 12:35:17 -04:00
|
|
|
});
|
2019-08-21 17:20:31 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle update directly
|
|
|
|
* - e.g. as callback from MultiTextInput where we set a list of strings
|
|
|
|
*
|
2019-08-23 12:46:22 -04:00
|
|
|
* @param {String} name
|
2019-08-21 17:20:31 -04:00
|
|
|
* @param {*} value
|
|
|
|
*/
|
2019-10-18 10:06:50 -04:00
|
|
|
handleChange(name: string, value: any) {
|
2019-08-23 12:35:17 -04:00
|
|
|
this.updateBuildingState(name, value);
|
2019-08-21 17:20:31 -04:00
|
|
|
}
|
|
|
|
|
2019-10-21 06:20:10 -04:00
|
|
|
handleReset() {
|
|
|
|
this.clearEdits();
|
|
|
|
}
|
|
|
|
|
2021-08-22 21:26:58 -04:00
|
|
|
async doSubmit(edits: Partial<Building & BuildingUserAttributes>) {
|
2019-10-15 14:16:48 -04:00
|
|
|
this.setState({error: undefined});
|
2021-08-22 21:26:58 -04:00
|
|
|
|
2019-10-15 14:16:48 -04:00
|
|
|
try {
|
2021-08-22 21:26:58 -04:00
|
|
|
const buildingUpdate = await sendBuildingUpdate(this.props.building.building_id, edits);
|
|
|
|
const updatedBuilding = Object.assign({}, this.props.building, buildingUpdate);
|
|
|
|
this.props.onBuildingUpdate(this.props.building.building_id, updatedBuilding);
|
|
|
|
} catch(error) {
|
|
|
|
this.setState({ error });
|
2019-10-15 14:16:48 -04:00
|
|
|
}
|
2019-08-21 17:20:31 -04:00
|
|
|
}
|
|
|
|
|
2021-03-18 17:18:58 -04:00
|
|
|
async handleSubmit(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
this.doSubmit(this.state.buildingEdits);
|
2020-08-04 10:54:49 -04:00
|
|
|
}
|
|
|
|
|
2021-03-11 13:49:17 -05:00
|
|
|
async handleSaveAdd(slug: string, newItem: any) {
|
|
|
|
if(this.props.building[slug] != undefined && !Array.isArray(this.props.building[slug])) {
|
|
|
|
this.setState({error: 'Unexpected error'});
|
|
|
|
console.error(`Trying to add a new item to a field (${slug}) which is not an array`);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(this.isEdited()) {
|
|
|
|
this.setState({error: 'Cannot save a new record when there are unsaved edits to existing records'});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const edits = {
|
|
|
|
[slug]: [...(this.props.building[slug] ?? []), newItem]
|
|
|
|
};
|
|
|
|
|
2021-03-18 17:18:58 -04:00
|
|
|
this.doSubmit(edits);
|
|
|
|
}
|
|
|
|
|
|
|
|
async handleSaveChange(slug: string, value: any) {
|
|
|
|
if(this.isEdited()) {
|
|
|
|
this.setState({ error: 'Cannot change this value when there are other unsaved edits. Save or discard the other edits first.'});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const edits = {
|
|
|
|
[slug]: value
|
|
|
|
};
|
|
|
|
|
|
|
|
this.doSubmit(edits);
|
|
|
|
}
|
|
|
|
|
2022-05-27 06:22:42 -04:00
|
|
|
async handleVerify(slug: string, verify: boolean, x: number, y: number) {
|
2021-03-18 17:18:58 -04:00
|
|
|
const verifyPatch = {};
|
|
|
|
if (verify) {
|
|
|
|
verifyPatch[slug] = this.props.building[slug];
|
|
|
|
} else {
|
|
|
|
verifyPatch[slug] = null;
|
|
|
|
}
|
2021-03-11 13:49:17 -05:00
|
|
|
|
|
|
|
try {
|
|
|
|
const data = await apiPost(
|
2021-03-18 17:18:58 -04:00
|
|
|
`/api/buildings/${this.props.building.building_id}/verify.json`,
|
|
|
|
verifyPatch
|
2021-03-11 13:49:17 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
if (data.error) {
|
|
|
|
this.setState({error: data.error});
|
|
|
|
} else {
|
2021-03-18 17:18:58 -04:00
|
|
|
if (verify) {
|
|
|
|
Confetti({
|
|
|
|
angle: 60,
|
|
|
|
disableForReducedMotion: true,
|
2022-01-10 08:12:49 -05:00
|
|
|
particleCount: 200,
|
|
|
|
ticks: 300,
|
2021-03-18 17:18:58 -04:00
|
|
|
origin: {x, y},
|
|
|
|
zIndex: 2000
|
|
|
|
});
|
|
|
|
}
|
|
|
|
this.props.onUserVerifiedUpdate(this.props.building.building_id, data);
|
2021-03-11 13:49:17 -05:00
|
|
|
}
|
|
|
|
} catch(err) {
|
|
|
|
this.setState({error: err});
|
|
|
|
}
|
2022-05-23 06:14:27 -04:00
|
|
|
|
2022-05-27 06:30:48 -04:00
|
|
|
if (slug == 'current_landuse_group'){
|
|
|
|
const edits = {
|
|
|
|
'current_landuse_verified': true
|
|
|
|
};
|
|
|
|
|
|
|
|
this.doSubmit(edits);
|
|
|
|
}
|
2022-05-19 08:38:08 -04:00
|
|
|
console.log(slug + " verify button clicked")
|
2021-03-11 13:49:17 -05:00
|
|
|
}
|
|
|
|
|
2019-08-14 16:54:00 -04:00
|
|
|
render() {
|
2019-10-15 14:16:48 -04:00
|
|
|
const currentBuilding = this.getEditedBuilding();
|
|
|
|
|
2019-11-07 03:13:30 -05:00
|
|
|
const values_to_copy = {};
|
2019-08-21 17:20:31 -04:00
|
|
|
for (const key of Object.keys(this.state.keys_to_copy)) {
|
2019-11-07 03:13:30 -05:00
|
|
|
values_to_copy[key] = currentBuilding[key];
|
2019-08-21 17:20:31 -04:00
|
|
|
}
|
|
|
|
const data_string = JSON.stringify(values_to_copy);
|
2019-10-15 10:44:22 -04:00
|
|
|
const copy: CopyProps = {
|
2019-08-14 16:54:00 -04:00
|
|
|
copying: this.state.copying,
|
|
|
|
toggleCopying: this.toggleCopying,
|
|
|
|
toggleCopyAttribute: this.toggleCopyAttribute,
|
2019-10-15 10:44:22 -04:00
|
|
|
copyingKey: (key: string) => this.state.keys_to_copy[key]
|
2019-11-07 03:13:30 -05:00
|
|
|
};
|
2019-10-24 07:13:07 -04:00
|
|
|
|
|
|
|
const headerBackLink = `/${this.props.mode}/categories${this.props.building != undefined ? `/${this.props.building.building_id}` : ''}`;
|
2019-10-21 06:20:10 -04:00
|
|
|
const edited = this.isEdited();
|
2019-10-29 13:58:01 -04:00
|
|
|
|
2019-09-08 20:10:52 -04:00
|
|
|
return (
|
2019-08-21 17:20:31 -04:00
|
|
|
<section
|
2019-10-15 09:37:23 -04:00
|
|
|
id={this.props.cat}
|
2019-08-21 17:20:31 -04:00
|
|
|
className="data-section">
|
2019-08-23 12:35:17 -04:00
|
|
|
<ContainerHeader
|
2019-10-24 07:13:07 -04:00
|
|
|
cat={this.props.cat}
|
|
|
|
title={this.props.title}
|
|
|
|
>
|
|
|
|
{
|
|
|
|
this.props.help && !copy.copying?
|
|
|
|
<a
|
|
|
|
className="icon-button help"
|
|
|
|
title="Find out more"
|
|
|
|
href={this.props.help}>
|
|
|
|
Info
|
|
|
|
</a>
|
|
|
|
: null
|
|
|
|
}
|
|
|
|
{
|
|
|
|
this.props.building != undefined && !this.props.inactive ?
|
|
|
|
<>
|
|
|
|
<CopyControl
|
|
|
|
cat={this.props.cat}
|
|
|
|
data_string={data_string}
|
|
|
|
copying={copy.copying}
|
|
|
|
toggleCopying={copy.toggleCopying}
|
|
|
|
/>
|
|
|
|
{
|
|
|
|
!copy.copying ?
|
|
|
|
<>
|
|
|
|
<NavLink
|
|
|
|
className="icon-button history"
|
|
|
|
to={`/${this.props.mode}/${this.props.cat}/${this.props.building.building_id}/history`}
|
|
|
|
>History</NavLink>
|
|
|
|
<ViewEditControl
|
|
|
|
cat={this.props.cat}
|
|
|
|
mode={this.props.mode}
|
|
|
|
building={this.props.building}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
:
|
|
|
|
null
|
|
|
|
}
|
|
|
|
</>
|
|
|
|
: null
|
|
|
|
}
|
|
|
|
</ContainerHeader>
|
2019-10-15 09:37:23 -04:00
|
|
|
<div className="section-body">
|
2019-09-08 20:10:52 -04:00
|
|
|
{
|
2019-10-15 09:37:23 -04:00
|
|
|
this.props.inactive ?
|
|
|
|
<Fragment>
|
2019-10-02 10:15:13 -04:00
|
|
|
<WrappedComponent
|
2019-10-18 10:06:50 -04:00
|
|
|
intro={this.props.intro}
|
2021-02-24 22:22:25 -05:00
|
|
|
building={this.props.building}
|
2019-10-02 10:15:13 -04:00
|
|
|
mode={this.props.mode}
|
2020-08-04 14:23:07 -04:00
|
|
|
edited={false}
|
2019-10-02 10:15:13 -04:00
|
|
|
copy={copy}
|
2021-02-24 22:22:25 -05:00
|
|
|
onChange={undefined}
|
|
|
|
onVerify={undefined}
|
2021-03-11 13:49:17 -05:00
|
|
|
onSaveAdd={undefined}
|
2021-03-18 17:18:58 -04:00
|
|
|
onSaveChange={undefined}
|
2020-08-04 10:54:49 -04:00
|
|
|
user_verified={[]}
|
2019-10-02 10:15:13 -04:00
|
|
|
/>
|
2019-10-15 09:37:23 -04:00
|
|
|
</Fragment> :
|
|
|
|
this.props.building != undefined ?
|
|
|
|
<form
|
|
|
|
action={`/edit/${this.props.cat}/${this.props.building.building_id}`}
|
|
|
|
method="POST"
|
|
|
|
onSubmit={this.handleSubmit}>
|
2021-03-16 15:00:54 -04:00
|
|
|
{/* this disabled button prevents form submission on enter - see https://stackoverflow.com/a/51507806/1478817 */}
|
|
|
|
<button type="submit" disabled style={{display: 'none'}}></button>
|
2019-10-15 09:37:23 -04:00
|
|
|
{
|
|
|
|
(this.props.mode === 'edit' && !this.props.inactive) ?
|
2021-03-11 13:53:03 -05:00
|
|
|
<div className='edit-bar'>
|
2019-10-15 09:37:23 -04:00
|
|
|
<ErrorBox msg={this.state.error} />
|
|
|
|
{
|
2021-03-11 13:53:03 -05:00
|
|
|
this.props.cat !== 'like' && // special-case for likes
|
2019-10-15 09:37:23 -04:00
|
|
|
<div className="buttons-container with-space">
|
|
|
|
<button
|
|
|
|
type="submit"
|
2019-10-21 06:20:10 -04:00
|
|
|
className="btn btn-primary"
|
|
|
|
disabled={!edited}
|
2021-03-11 13:53:03 -05:00
|
|
|
aria-disabled={!edited}
|
|
|
|
>
|
|
|
|
Save edits
|
2019-10-15 09:37:23 -04:00
|
|
|
</button>
|
2019-10-21 06:20:10 -04:00
|
|
|
{
|
|
|
|
edited ?
|
|
|
|
<button
|
|
|
|
type="button"
|
|
|
|
className="btn btn-warning"
|
|
|
|
onClick={this.handleReset}
|
|
|
|
>
|
2021-03-11 13:53:03 -05:00
|
|
|
Discard edits
|
2019-10-21 06:20:10 -04:00
|
|
|
</button> :
|
|
|
|
null
|
|
|
|
}
|
2021-03-11 13:53:03 -05:00
|
|
|
</div>
|
2019-10-15 09:37:23 -04:00
|
|
|
}
|
2021-03-11 13:53:03 -05:00
|
|
|
</div>
|
2019-10-15 09:37:23 -04:00
|
|
|
: null
|
|
|
|
}
|
|
|
|
<WrappedComponent
|
2019-10-18 10:06:50 -04:00
|
|
|
intro={this.props.intro}
|
2019-10-15 14:16:48 -04:00
|
|
|
building={currentBuilding}
|
2019-10-15 09:37:23 -04:00
|
|
|
mode={this.props.mode}
|
2020-08-04 14:11:08 -04:00
|
|
|
edited={edited}
|
2019-10-15 09:37:23 -04:00
|
|
|
copy={copy}
|
|
|
|
onChange={this.handleChange}
|
2020-08-04 10:54:49 -04:00
|
|
|
onVerify={this.handleVerify}
|
2021-03-11 13:49:17 -05:00
|
|
|
onSaveAdd={this.handleSaveAdd}
|
2021-03-18 17:18:58 -04:00
|
|
|
onSaveChange={this.handleSaveChange}
|
2020-08-04 10:54:49 -04:00
|
|
|
user_verified={this.props.user_verified}
|
|
|
|
user={this.props.user}
|
2019-10-15 09:37:23 -04:00
|
|
|
/>
|
|
|
|
</form> :
|
2019-10-02 10:15:13 -04:00
|
|
|
<InfoBox msg="Select a building to view data"></InfoBox>
|
2019-09-08 20:10:52 -04:00
|
|
|
}
|
2019-10-15 09:37:23 -04:00
|
|
|
</div>
|
2019-08-21 17:20:31 -04:00
|
|
|
</section>
|
2019-09-08 20:10:52 -04:00
|
|
|
);
|
2019-08-14 16:54:00 -04:00
|
|
|
}
|
2019-11-07 03:13:30 -05:00
|
|
|
};
|
|
|
|
};
|
2019-08-14 16:54:00 -04:00
|
|
|
|
2019-11-05 15:13:10 -05:00
|
|
|
export default withCopyEdit;
|