Verify date_year

This commit is contained in:
Tom Russell 2020-08-04 17:01:20 +01:00
parent a143b76dde
commit 8f56f96779
2 changed files with 23 additions and 1 deletions

View File

@ -1,5 +1,6 @@
import React, { Component, Fragment } from 'react'; import React, { Component, Fragment } from 'react';
import Verification from './verification';
import { dataFields } from '../../data_fields'; import { dataFields } from '../../data_fields';
import { CopyProps } from '../data-containers/category-view-props'; import { CopyProps } from '../data-containers/category-view-props';
@ -12,6 +13,12 @@ interface YearDataEntryProps {
copy?: CopyProps; copy?: CopyProps;
mode?: 'view' | 'edit' | 'multi-edit'; mode?: 'view' | 'edit' | 'multi-edit';
onChange?: (key: string, value: any) => void; onChange?: (key: string, value: any) => void;
onVerify: (slug: string, verify: boolean) => void;
user_verified: boolean;
user_verified_as: string;
verified_count: number;
allow_verify: boolean;
} }
class YearDataEntry extends Component<YearDataEntryProps, any> { class YearDataEntry extends Component<YearDataEntryProps, any> {
@ -45,6 +52,15 @@ class YearDataEntry extends Component<YearDataEntryProps, any> {
max={currentYear} max={currentYear}
// "type": "year_estimator" // "type": "year_estimator"
/> />
<Verification
allow_verify={props.allow_verify}
slug="date_year"
onVerify={props.onVerify}
user_verified={props.user_verified}
user_verified_as={props.user_verified_as}
verified_count={props.verified_count}
/>
<NumericDataEntry <NumericDataEntry
title={dataFields.date_upper.title} title={dataFields.date_upper.title}
slug="date_upper" slug="date_upper"

View File

@ -26,6 +26,12 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
mode={props.mode} mode={props.mode}
copy={props.copy} copy={props.copy}
onChange={props.onChange} onChange={props.onChange}
allow_verify={props.user !== undefined && props.building.date_year !== null}
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}
/> />
<NumericDataEntry <NumericDataEntry
title={dataFields.facade_year.title} title={dataFields.facade_year.title}
@ -40,8 +46,8 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
tooltip={dataFields.facade_year.tooltip} tooltip={dataFields.facade_year.tooltip}
/> />
<Verification <Verification
allow_verify={props.user !== undefined}
slug="facade_year" slug="facade_year"
allow_verify={props.user !== undefined && props.building.facade_year !== null}
onVerify={props.onVerify} onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("facade_year")} user_verified={props.user_verified.hasOwnProperty("facade_year")}
user_verified_as={props.user_verified.facade_year} user_verified_as={props.user_verified.facade_year}