diff --git a/src/api/axiosGeoJSON.ts b/src/api/axiosGeoJSON.ts index e6d8cedd..2652e323 100644 --- a/src/api/axiosGeoJSON.ts +++ b/src/api/axiosGeoJSON.ts @@ -58,7 +58,7 @@ const getGeoJsonData = async ( service: 'wfs', version: api_version, request: 'GetFeature', - typeNames: `Omgevingsbeleid:${type}`, + typeNames: getGeoserverLayer(), cql_filter: `UUID='${UUID}'`, outputFormat: 'application/json', } diff --git a/src/components/DynamicObject/ObjectRevision/ObjectRevision.tsx b/src/components/DynamicObject/ObjectRevision/ObjectRevision.tsx index 7083cbb9..b158d4fa 100644 --- a/src/components/DynamicObject/ObjectRevision/ObjectRevision.tsx +++ b/src/components/DynamicObject/ObjectRevision/ObjectRevision.tsx @@ -91,7 +91,8 @@ const ObjectRevision = ({ ) })} - {(!!compareA.Gebied || !!compareB.Gebied) && ( + {(!!compareA.Werkingsgebied_Statics || + !!compareB.Werkingsgebied_Statics) && ( <> @@ -100,13 +101,15 @@ const ObjectRevision = ({ - {compareA.Gebied?.UUID === compareB.Gebied?.UUID - ? `Het gebied '${compareA.Gebied?.Title}' in ${singularReadable} '${compareA.Title}' is ongewijzigd.` - : !!compareA.Gebied?.UUID && !!compareB.Gebied?.UUID - ? `${singularCapitalize} '${compareA.Title}' is gewijzigd van gebied '${compareA.Gebied?.Title}' naar gebied '${compareB.Gebied?.Title}'` - : !!compareA.Gebied?.UUID - ? `Het gebied '${compareA.Gebied?.Title}' in ${singularReadable} '${compareA.Title}' is verwijderd.` - : `Het gebied '${compareB.Gebied?.Title}' in ${singularReadable} '${compareA.Title}' is toegevoegd.`} + {compareA.Werkingsgebied_Statics?.Object_ID === + compareB.Werkingsgebied_Statics?.Object_ID + ? `Het gebied '${compareA.Werkingsgebied_Statics?.Cached_Title}' in ${singularReadable} '${compareA.Title}' is ongewijzigd.` + : !!compareA.Werkingsgebied_Statics?.Object_ID && + !!compareB.Werkingsgebied_Statics?.Object_ID + ? `${singularCapitalize} '${compareA.Title}' is gewijzigd van gebied '${compareA.Werkingsgebied_Statics?.Cached_Title}' naar gebied '${compareB.Werkingsgebied_Statics?.Cached_Title}'` + : !!compareA.Werkingsgebied_Statics?.Object_ID + ? `Het gebied '${compareA.Werkingsgebied_Statics?.Cached_Title}' in ${singularReadable} '${compareA.Title}' is verwijderd.` + : `Het gebied '${compareB.Werkingsgebied_Statics?.Cached_Title}' in ${singularReadable} '${compareA.Title}' is toegevoegd.`}
@@ -114,8 +117,8 @@ const ObjectRevision = ({ id={`revision-map-${initialObject?.UUID}`} area={{ type: 'Werkingsgebieden', - old: compareB.Gebied?.UUID, - new: compareA.Gebied?.UUID, + old: compareB.Werkingsgebied_Statics?.Object_ID, + new: compareA.Werkingsgebied_Statics?.Object_ID, }} />
diff --git a/src/components/Leaflet/LeafletLayers/LeafletAreaLayer.tsx b/src/components/Leaflet/LeafletLayers/LeafletAreaLayer.tsx index 247d9f34..1e1ae36c 100644 --- a/src/components/Leaflet/LeafletLayers/LeafletAreaLayer.tsx +++ b/src/components/Leaflet/LeafletLayers/LeafletAreaLayer.tsx @@ -55,10 +55,7 @@ const LeafletAreaLayer = ({ }} /> - - {layer.feature.properties.Onderverdeling || - layer.feature.properties.Werkingsgebied} - + {layer.feature.properties.Source_Title}
{isActive ? : } diff --git a/src/components/Leaflet/LeafletRevisionOverview/LeafletRevisionOverview.tsx b/src/components/Leaflet/LeafletRevisionOverview/LeafletRevisionOverview.tsx index c744ae32..e0571061 100644 --- a/src/components/Leaflet/LeafletRevisionOverview/LeafletRevisionOverview.tsx +++ b/src/components/Leaflet/LeafletRevisionOverview/LeafletRevisionOverview.tsx @@ -5,6 +5,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react' import { useMap } from 'react-leaflet' import { getGeoJsonData } from '@/api/axiosGeoJSON' +import { useWerkingsgebiedenLatestLineageIdGet } from '@/api/fetchers' import ToggleableSection from '@/components/ToggleableSection' import { LeafletAreaLayer, LeafletControlLayer } from '../LeafletLayers' @@ -16,8 +17,8 @@ import LeafletMap from '../LeafletMap' interface LeafletRevisionOverviewProps { area: { - old?: string - new?: string + old?: number + new?: number type: string } id?: string @@ -49,17 +50,31 @@ const LeafletRevisionOverviewInner = ({ const [werkingsgebied, setWerkingsgebied] = useState([]) + const { data: oldUUID } = useWerkingsgebiedenLatestLineageIdGet(area.old!, { + query: { + enabled: !!area.old, + select: data => data.Area_UUID, + }, + }) + + const { data: newUUID } = useWerkingsgebiedenLatestLineageIdGet(area.new!, { + query: { + enabled: !!area.new, + select: data => data.Area_UUID, + }, + }) + const geoQueries = useQueries({ queries: [ { - queryKey: ['mainDataFrom', area.type, area.old], - queryFn: () => getGeoJsonData(area.type, area.old!, { signal }), - enabled: !!area.type && !!area.old, + queryKey: ['mainDataFrom', area.type, oldUUID], + queryFn: () => getGeoJsonData(area.type, oldUUID!, { signal }), + enabled: !!area.type && !!oldUUID, }, { - queryKey: ['mainDataTo', area.type, area.new], - queryFn: () => getGeoJsonData(area.type, area.new!, { signal }), - enabled: !!area.type && !!area.new && area.old !== area.new, + queryKey: ['mainDataTo', area.type, newUUID], + queryFn: () => getGeoJsonData(area.type, newUUID!, { signal }), + enabled: !!area.type && !!newUUID && area.old !== area.new, }, ], }) @@ -95,8 +110,8 @@ const LeafletRevisionOverviewInner = ({ onEachFeature: (feature, layer) => { if (feature.properties) { layer.bindPopup( - feature.properties.Gebied - ? feature.properties.Gebied + feature.properties.Source_Title + ? feature.properties.Source_Title : 'Deze laag heeft nog geen titel' ) } @@ -116,8 +131,8 @@ const LeafletRevisionOverviewInner = ({ onEachFeature: (feature, layer) => { if (feature.properties) { layer.bindPopup( - feature.properties.Gebied - ? feature.properties.Gebied + feature.properties.Source_Title + ? feature.properties.Source_Title : 'Deze laag heeft nog geen titel' ) } diff --git a/src/pages/public/DynamicObject/DynamicObject.tsx b/src/pages/public/DynamicObject/DynamicObject.tsx index 4daa12a4..19ff0049 100644 --- a/src/pages/public/DynamicObject/DynamicObject.tsx +++ b/src/pages/public/DynamicObject/DynamicObject.tsx @@ -233,7 +233,7 @@ const DynamicObject = ({ model, isRevision }: DynamicObjectProps) => { !model.acknowledgedRelation && (
{ !!model.acknowledgedRelation && (