diff --git a/app/map_styles/polygon.xml b/app/map_styles/polygon.xml
index 6da76f59..2a1043b9 100644
--- a/app/map_styles/polygon.xml
+++ b/app/map_styles/polygon.xml
@@ -534,9 +534,13 @@
- [current_landuse_order] = "Residential" and not ([current_landuse_group] = "Garden buildings") and not ([current_landuse_group] = "Hotels, boarding and guest houses")
+ [current_landuse_order] = "Residential" and not ([current_landuse_group] = "Garden buildings") and not ([current_landuse_group] = "Hotels, boarding and guest houses") and not ([current_landuse_verified])
+
+ [current_landuse_order] = "Residential" and not ([current_landuse_group] = "Garden buildings") and not ([current_landuse_group] = "Hotels, boarding and guest houses") and ([current_landuse_verified])
+
+
[current_landuse_order] = "Residential" and [current_landuse_group] = "Hotels, boarding and guest houses"
diff --git a/app/src/api/config/dataFields.ts b/app/src/api/config/dataFields.ts
index e51cf8bf..daee34da 100644
--- a/app/src/api/config/dataFields.ts
+++ b/app/src/api/config/dataFields.ts
@@ -257,7 +257,15 @@ export const buildingAttributesConfig = valueType()({ /* eslint
derivedEdit: true,
verify: false,
},
-
+ current_landuse_source: {
+ edit: true,
+ },
+ current_landuse_source_detail: {
+ edit: true,
+ },
+ current_landuse_link: {
+ edit: true,
+ },
dynamics_has_demolished_buildings: {
edit: true,
verify: true
diff --git a/app/src/api/dataAccess/verify.ts b/app/src/api/dataAccess/verify.ts
index 02e163d7..48bdd1c5 100644
--- a/app/src/api/dataAccess/verify.ts
+++ b/app/src/api/dataAccess/verify.ts
@@ -74,6 +74,15 @@ export async function updateBuildingUserVerifiedAttribute(buildingId: number, us
[buildingId, userId, attribute, value]
);
}
+ if (attribute == 'current_landuse_group'){
+ await (db).none(
+ `UPDATE buildings
+ SET current_landuse_verified = TRUE
+ WHERE buildings.building_id = $1;
+ `,
+ [buildingId]
+ );
+ }
} catch(error) {
console.error(error)
if(error.detail?.includes('already exists')) {
@@ -87,6 +96,15 @@ export async function updateBuildingUserVerifiedAttribute(buildingId: number, us
export async function removeBuildingUserVerifiedAttribute(buildingId: number, userId: string, attribute: string) : Promise {
try {
+ if (attribute == 'current_landuse_group'){
+ await (db).none(
+ `UPDATE buildings
+ SET current_landuse_verified = FALSE
+ WHERE buildings.building_id = $1;
+ `,
+ [buildingId]
+ );
+ }
return await (db).none(
`DELETE FROM
building_verification
diff --git a/app/src/frontend/building/data-containers/use.tsx b/app/src/frontend/building/data-containers/use.tsx
index 26ff6e11..04090357 100644
--- a/app/src/frontend/building/data-containers/use.tsx
+++ b/app/src/frontend/building/data-containers/use.tsx
@@ -4,6 +4,8 @@ import InfoBox from '../../components/info-box';
import { dataFields } from '../../config/data-fields-config';
import DataEntry from '../data-components/data-entry';
import { MultiDataEntry } from '../data-components/multi-data-entry/multi-data-entry';
+import SelectDataEntry from '../data-components/select-data-entry';
+import TextboxDataEntry from '../data-components/textbox-data-entry';
import withCopyEdit from '../data-container';
import { CategoryViewProps } from './category-view-props';
@@ -51,6 +53,36 @@ const UseView: React.FunctionComponent = (props) => (
copy={props.copy}
onChange={props.onChange}
/>
+
+
);
const UseContainer = withCopyEdit(UseView);
diff --git a/app/src/frontend/config/category-maps-config.ts b/app/src/frontend/config/category-maps-config.ts
index 6ccdfb15..9a79013c 100644
--- a/app/src/frontend/config/category-maps-config.ts
+++ b/app/src/frontend/config/category-maps-config.ts
@@ -193,7 +193,8 @@ export const categoryMapsConfig: {[key in Category]: CategoryMapDefinition[]} =
elements: [
{ color: '#e5050d', text: 'Mixed Use' },
{ subtitle: 'Single use:'},
- { color: '#252aa6', text: 'Residential' },
+ { color: '#252aa6', text: 'Residential (unverified)' },
+ { color: '#7025a6', text: 'Residential (verified)' },
{ color: '#ff8c00', text: 'Retail' },
{ color: '#f5f58f', text: 'Industry & Business' },
{ color: '#73ccd1', text: 'Community Services' },
diff --git a/app/src/frontend/config/data-fields-config.ts b/app/src/frontend/config/data-fields-config.ts
index fcde1459..828c8c5b 100644
--- a/app/src/frontend/config/data-fields-config.ts
+++ b/app/src/frontend/config/data-fields-config.ts
@@ -193,6 +193,24 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
tooltip: "Land use Order as classified by [NLUD](https://www.gov.uk/government/statistics/national-land-use-database-land-use-and-land-cover-classification)",
example: "",
},
+ current_landuse_source: {
+ category: Category.LandUse,
+ title: "Source of information",
+ tooltip: "Source for the current land use",
+ example: "",
+ },
+ current_landuse_source_detail: {
+ category: Category.LandUse,
+ title: "Source details",
+ tooltip: "References for current land use source (max 500 characters)",
+ example: "",
+ },
+ current_landuse_link: {
+ category: Category.LandUse,
+ title: "Source Links",
+ tooltip: "URL for current land use reference",
+ example: ["", "", ""],
+ },
building_attachment_form: {
category: Category.Type,
diff --git a/app/src/tiles/dataDefinition.ts b/app/src/tiles/dataDefinition.ts
index be20beba..d6d0d0b6 100644
--- a/app/src/tiles/dataDefinition.ts
+++ b/app/src/tiles/dataDefinition.ts
@@ -150,7 +150,8 @@ const LAYER_QUERIES = {
SELECT
geometry_id,
current_landuse_order,
- current_landuse_group[1] as current_landuse_group
+ current_landuse_group[1] as current_landuse_group,
+ current_landuse_verified
FROM
buildings
WHERE
diff --git a/migrations/028.landuse-source.down.sql b/migrations/028.landuse-source.down.sql
new file mode 100644
index 00000000..d9ededda
--- /dev/null
+++ b/migrations/028.landuse-source.down.sql
@@ -0,0 +1,7 @@
+ALTER TABLE buildings DROP COLUMN IF EXISTS current_landuse_source;
+
+ALTER TABLE buildings DROP COLUMN IF EXISTS current_landuse_source_detail;
+
+ALTER TABLE buildings DROP COLUMN IF EXISTS current_landuse_link;
+
+ALTER TABLE buildings DROP COLUMN IF NOT EXISTS current_landuse_verified;
diff --git a/migrations/028.landuse-source.up.sql b/migrations/028.landuse-source.up.sql
new file mode 100644
index 00000000..bc6925e3
--- /dev/null
+++ b/migrations/028.landuse-source.up.sql
@@ -0,0 +1,15 @@
+ALTER TABLE buildings ADD COLUMN IF NOT EXISTS current_landuse_source varchar;
+ALTER TABLE buildings ADD CONSTRAINT buildings_current_landuse_source_len CHECK (length(current_landuse_source) < 150);
+
+ALTER TABLE buildings ADD COLUMN IF NOT EXISTS current_landuse_source_detail varchar;
+ALTER TABLE buildings ADD CONSTRAINT current_landuse_source_detail_len CHECK (length(current_landuse_source_detail) < 500);
+
+ALTER TABLE buildings ADD COLUMN IF NOT EXISTS current_landuse_link text[];
+
+ALTER TABLE buildings ADD COLUMN IF NOT EXISTS current_landuse_verified BOOLEAN NOT NULL DEFAULT FALSE;
+
+UPDATE buildings as b
+SET current_landuse_verified = TRUE
+FROM building_verification as v
+WHERE b.building_id = v.building_id
+AND v.attribute = 'current_landuse_group';
\ No newline at end of file