diff --git a/src/frontend/src/components/MapComponent/OpenLayersComponent/Layers/VectorLayer.js b/src/frontend/src/components/MapComponent/OpenLayersComponent/Layers/VectorLayer.js index a7ac7532a0..05f7874d30 100644 --- a/src/frontend/src/components/MapComponent/OpenLayersComponent/Layers/VectorLayer.js +++ b/src/frontend/src/components/MapComponent/OpenLayersComponent/Layers/VectorLayer.js @@ -57,6 +57,7 @@ const VectorLayer = ({ layerProperties, rotation, getAOIArea, + processGeojson, }) => { const [vectorLayer, setVectorLayer] = useState(null); useEffect(() => { @@ -185,8 +186,7 @@ const VectorLayer = ({ async function loadFgbRemote(filterExtent = true, extractGeomCol = true) { this.clear(); - const filteredFeatures = []; - + let filteredFeatures = []; for await (let feature of FGBGeoJson.deserialize(fgbUrl, fgbBoundingBox(fgbExtent.getExtent()))) { if (extractGeomCol && feature.geometry.type === 'GeometryCollection') { // Extract first geom from geomcollection @@ -209,6 +209,11 @@ const VectorLayer = ({ filteredFeatures.push(extractGeom); } } + // Process Geojson if needed i.e. filter, modify, etc + // ex: in our use case we are filtering only rejected entities + if (processGeojson) { + filteredFeatures = processGeojson(filteredFeatures); + } this.addFeatures(filteredFeatures); } diff --git a/src/frontend/src/components/ProjectDetailsV2/TaskSelectionPopup.tsx b/src/frontend/src/components/ProjectDetailsV2/TaskSelectionPopup.tsx index 15b9c5ae49..094fba0784 100644 --- a/src/frontend/src/components/ProjectDetailsV2/TaskSelectionPopup.tsx +++ b/src/frontend/src/components/ProjectDetailsV2/TaskSelectionPopup.tsx @@ -81,7 +81,10 @@ const TaskSelectionPopup = ({ taskId, body, feature }: TaskSelectionPopupPropTyp dispatch(ProjectActions.ToggleTaskModalStatus(false))} + onClick={() => { + dispatch(ProjectActions.ToggleTaskModalStatus(false)); + dispatch(CoreModules.TaskActions.SetSelectedTask(null)); + }} /> diff --git a/src/frontend/src/components/ProjectSubmissions/SubmissionsTable.tsx b/src/frontend/src/components/ProjectSubmissions/SubmissionsTable.tsx index 52edfe47bb..126a571afe 100644 --- a/src/frontend/src/components/ProjectSubmissions/SubmissionsTable.tsx +++ b/src/frontend/src/components/ProjectSubmissions/SubmissionsTable.tsx @@ -482,6 +482,8 @@ const SubmissionsTable = ({ toggleView }) => { projectId: projectId, reviewState: row?.__system?.reviewState, taskUid: taskUid, + entity_id: row?.feature, + label: row?.meta?.entity?.label, }), ); }} diff --git a/src/frontend/src/components/ProjectSubmissions/UpdateReviewStatusModal.tsx b/src/frontend/src/components/ProjectSubmissions/UpdateReviewStatusModal.tsx index e756fcbcdc..09f4812995 100644 --- a/src/frontend/src/components/ProjectSubmissions/UpdateReviewStatusModal.tsx +++ b/src/frontend/src/components/ProjectSubmissions/UpdateReviewStatusModal.tsx @@ -7,7 +7,8 @@ import { UpdateReviewStateService } from '@/api/SubmissionService'; import TextArea from '../common/TextArea'; import Button from '../common/Button'; import { useAppSelector } from '@/types/reduxTypes'; -import { PostProjectComments } from '@/api/Project'; +import { PostProjectComments, UpdateEntityState } from '@/api/Project'; +import { entity_state } from '@/types/enums'; // Note these id values must be camelCase to match what ODK Central requires const reviewList: reviewListType[] = [ @@ -23,12 +24,6 @@ const reviewList: reviewListType[] = [ className: 'fmtm-bg-[#E9DFCF] fmtm-text-[#D99F00] fmtm-border-[#D99F00]', hoverClass: 'hover:fmtm-text-[#D99F00] hover:fmtm-border-[#D99F00]', }, - { - id: 'rejected', - title: 'Rejected', - className: 'fmtm-bg-[#E8D5D5] fmtm-text-[#D73F37] fmtm-border-[#D73F37]', - hoverClass: 'hover:fmtm-text-[#D73F37] hover:fmtm-border-[#D73F37]', - }, ]; const UpdateReviewStatusModal = () => { @@ -57,6 +52,17 @@ const UpdateReviewStatusModal = () => { }, ), ); + + dispatch( + UpdateEntityState( + `${import.meta.env.VITE_API_URL}/projects/${updateReviewStatusModal.projectId}/entity/status`, + { + entity_id: updateReviewStatusModal.entity_id, + status: reviewStatus === 'approved' ? entity_state['SURVEY_SUBMITTED'] : entity_state['MARKED_BAD'], + label: updateReviewStatusModal.label, + }, + ), + ); } if (noteComments.trim().length > 0) { dispatch( @@ -79,6 +85,8 @@ const UpdateReviewStatusModal = () => { taskId: null, reviewState: '', taskUid: null, + entity_id: null, + label: null, }), ); dispatch(SubmissionActions.UpdateReviewStateLoading(false)); @@ -91,11 +99,11 @@ const UpdateReviewStatusModal = () => {

Update Review Status

} - className="!fmtm-w-fit !fmtm-outline-none fmtm-rounded-xl" + className="!fmtm-w-[23rem] !fmtm-outline-none fmtm-rounded-xl" description={
-
+
{reviewList.map((reviewBtn) => (