From fcb9b5249567656040b8fb8ef0461a49d66fc244 Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Thu, 9 May 2024 12:57:50 +0545 Subject: [PATCH 1/9] fix(customDrawer/primaryAppBar): replace img_url key with profile_img key to display profile picture --- src/frontend/src/utilities/CustomDrawer.jsx | 4 ++-- src/frontend/src/utilities/PrimaryAppBar.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/frontend/src/utilities/CustomDrawer.jsx b/src/frontend/src/utilities/CustomDrawer.jsx index 757eea0c9c..007a66668f 100644 --- a/src/frontend/src/utilities/CustomDrawer.jsx +++ b/src/frontend/src/utilities/CustomDrawer.jsx @@ -140,12 +140,12 @@ export default function CustomDrawer({ open, placement, size, type, onClose, onS ml={'3%'} spacing={1} > - {authDetails['img_url'] !== 'null' && authDetails['img_url'] ? ( + {authDetails['profile_img'] !== 'null' && authDetails['profile_img'] ? ( - Profile Picture + Profile Picture ) : ( diff --git a/src/frontend/src/utilities/PrimaryAppBar.tsx b/src/frontend/src/utilities/PrimaryAppBar.tsx index 4b2309a656..b0fbc6cd22 100755 --- a/src/frontend/src/utilities/PrimaryAppBar.tsx +++ b/src/frontend/src/utilities/PrimaryAppBar.tsx @@ -134,12 +134,12 @@ export default function PrimaryAppBar() { alignItems="center" className="fmtm-text-ellipsis fmtm-max-w-[9.5rem]" > - {authDetails['img_url'] !== 'null' && authDetails['img_url'] ? ( + {authDetails['profile_img'] !== 'null' && authDetails['profile_img'] ? ( - Profile Picture + Profile Picture ) : ( From 58797fbcc01fb84700e36c66b935aa9e2425a94c Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Thu, 9 May 2024 13:00:25 +0545 Subject: [PATCH 2/9] fix(taskSubmissionMap): replace comparision with taskId with task index --- .../src/components/ProjectSubmissions/TaskSubmissionsMap.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/components/ProjectSubmissions/TaskSubmissionsMap.tsx b/src/frontend/src/components/ProjectSubmissions/TaskSubmissionsMap.tsx index 1358404aba..cbdc3cfb30 100644 --- a/src/frontend/src/components/ProjectSubmissions/TaskSubmissionsMap.tsx +++ b/src/frontend/src/components/ProjectSubmissions/TaskSubmissionsMap.tsx @@ -159,7 +159,7 @@ const TaskSubmissionsMap = () => { if (!taskBoundaries) return; const filteredSelectedTaskGeojson = { ...basicGeojsonTemplate, - features: taskBoundaries?.features?.filter((task) => task.properties.uid === selectedTask), + features: taskBoundaries?.features?.filter((task) => task?.properties?.fid === selectedTask), }; const vectorSource = new VectorSource({ features: new GeoJSON().readFeatures(filteredSelectedTaskGeojson, { @@ -168,7 +168,7 @@ const TaskSubmissionsMap = () => { }); const extent = vectorSource.getExtent(); - setDataExtractExtent(vectorSource.getFeatures()[0].getGeometry()); + setDataExtractExtent(vectorSource.getFeatures()[0]?.getGeometry()); setDataExtractUrl(projectInfo.data_extract_url); map.getView().fit(extent, { From a603b374c4bf29fdfb3b297377e02b9f85be5433 Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Thu, 9 May 2024 13:57:12 +0545 Subject: [PATCH 3/9] fix(submissionDetails): replace decodedProjectId with projectId --- src/frontend/src/views/SubmissionDetails.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/src/views/SubmissionDetails.tsx b/src/frontend/src/views/SubmissionDetails.tsx index f15dfd82af..07db8aba9a 100644 --- a/src/frontend/src/views/SubmissionDetails.tsx +++ b/src/frontend/src/views/SubmissionDetails.tsx @@ -160,7 +160,7 @@ const SubmissionDetails = () => { SubmissionActions.SetUpdateReviewStatusModal({ toggleModalStatus: true, instanceId: paramsInstanceId, - projectId: decodedProjectId, + projectId: projectId, taskId: taskId, reviewState: submissionDetails?.__system?.reviewState, }), From 519f2e2962d5b72c75c1c668c3bda66cbebbd640 Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Thu, 9 May 2024 13:58:03 +0545 Subject: [PATCH 4/9] fix(submissionDetails): replace decodedProjectId with projectId & show recieved status by defualt if no reviewState --- .../src/components/ProjectSubmissions/SubmissionsTable.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/components/ProjectSubmissions/SubmissionsTable.tsx b/src/frontend/src/components/ProjectSubmissions/SubmissionsTable.tsx index c7547f1899..53b44537d6 100644 --- a/src/frontend/src/components/ProjectSubmissions/SubmissionsTable.tsx +++ b/src/frontend/src/components/ProjectSubmissions/SubmissionsTable.tsx @@ -395,7 +395,7 @@ const SubmissionsTable = ({ toggleView }) => { rowClassName="codeRow" dataFormat={(row) => (
- {row?.__system?.reviewState ? camelToFlat(row?.__system?.reviewState) : '-'} + {row?.__system?.reviewState ? camelToFlat(row?.__system?.reviewState) : 'Recieved'}
)} /> @@ -440,8 +440,8 @@ const SubmissionsTable = ({ toggleView }) => { SubmissionActions.SetUpdateReviewStatusModal({ toggleModalStatus: true, instanceId: row?.meta?.instanceID, - taskId: row?.phonenumber, - projectId: decodedId, + taskId: row?.all?.task_id, + projectId: projectId, reviewState: row?.__system?.reviewState, }), ); From 88da6410447b8351f1a58ba1d11395b263343eec Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Thu, 9 May 2024 14:09:16 +0545 Subject: [PATCH 5/9] fix(projectSubmissions): statuses endpoint fetch to display taskList and display taskList options --- src/frontend/src/views/ProjectSubmissions.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/views/ProjectSubmissions.tsx b/src/frontend/src/views/ProjectSubmissions.tsx index 98307a35d3..3ebd573ae7 100644 --- a/src/frontend/src/views/ProjectSubmissions.tsx +++ b/src/frontend/src/views/ProjectSubmissions.tsx @@ -5,7 +5,7 @@ import SubmissionsInfographics from '@/components/ProjectSubmissions/Submissions import SubmissionsTable from '@/components/ProjectSubmissions/SubmissionsTable.js'; import CoreModules from '@/shared/CoreModules'; import { ProjectActions } from '@/store/slices/ProjectSlice'; -import { ProjectById } from '@/api/Project'; +import { ProjectById, GetEntityInfo } from '@/api/Project'; import { GetProjectDashboard } from '@/api/Project'; import { useSearchParams } from 'react-router-dom'; import { projectInfoType } from '@/models/project/projectModel'; @@ -43,6 +43,12 @@ const ProjectSubmissions = () => { dispatch(GetProjectDashboard(`${import.meta.env.VITE_API_URL}/projects/project_dashboard/${projectId}`)); }, []); + // for hot fix to diplay task-list and show option of task-list for submission table filter + // better solution needs to be researched + useEffect(() => { + dispatch(GetEntityInfo(`${import.meta.env.VITE_API_URL}/projects/${projectId}/entities/statuses`)); + }, []); + useEffect(() => { if (!searchParams.get('tab')) { setSearchParams({ tab: 'infographics' }); From 5ab1da4177423c9ddc44616888f7e9cfcdcf3756 Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Thu, 9 May 2024 14:45:57 +0545 Subject: [PATCH 6/9] fix(taskSubmission): replace uid with fid --- .../components/ProjectSubmissions/TaskSubmissionsMap.tsx | 8 ++++---- src/frontend/src/views/ProjectDetailsV2.tsx | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/frontend/src/components/ProjectSubmissions/TaskSubmissionsMap.tsx b/src/frontend/src/components/ProjectSubmissions/TaskSubmissionsMap.tsx index cbdc3cfb30..b3d6acb9a0 100644 --- a/src/frontend/src/components/ProjectSubmissions/TaskSubmissionsMap.tsx +++ b/src/frontend/src/components/ProjectSubmissions/TaskSubmissionsMap.tsx @@ -148,7 +148,7 @@ const TaskSubmissionsMap = () => { features: [ ...projectTaskBoundries?.[0]?.taskBoundries?.map((task) => ({ ...task.outline_geojson, - id: task.outline_geojson.properties.uid, + id: task?.outline_geojson?.properties?.fid, })), ], }; @@ -184,7 +184,7 @@ const TaskSubmissionsMap = () => { }, [selectedTask]); const taskOnSelect = (properties, feature) => { - dispatch(CoreModules.TaskActions.SetSelectedTask(properties.uid)); + dispatch(CoreModules.TaskActions.SetSelectedTask(properties?.fid)); }; const setChoropleth = useCallback( @@ -216,7 +216,7 @@ const TaskSubmissionsMap = () => { }); const taskSubmissionsPopupUI = (properties: taskFeaturePropertyType) => { - const currentTask = taskInfo?.filter((task) => +task.task_id === properties.uid); + const currentTask = taskInfo?.filter((task) => +task?.task_id === properties?.fid); if (currentTask?.length === 0) return; return (
@@ -285,7 +285,7 @@ const TaskSubmissionsMap = () => { collapsed={true} />
- {taskInfo?.length > 0 && } + {taskInfo?.length > 0 && } {dataExtractUrl && isValidUrl(dataExtractUrl) && ( )} diff --git a/src/frontend/src/views/ProjectDetailsV2.tsx b/src/frontend/src/views/ProjectDetailsV2.tsx index 982a5ab8ff..62f7e7913c 100644 --- a/src/frontend/src/views/ProjectDetailsV2.tsx +++ b/src/frontend/src/views/ProjectDetailsV2.tsx @@ -183,7 +183,7 @@ const Home = () => { behavior: 'smooth', }); - dispatch(CoreModules.TaskActions.SetSelectedTask(properties.uid)); + dispatch(CoreModules.TaskActions.SetSelectedTask(properties?.fid)); dispatch(ProjectActions.ToggleTaskModalStatus(true)); // Fit the map view to the clicked feature's extent based on the window size From d99dc065b196ef7ff146eda9bce7be192cdd4b21 Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Thu, 9 May 2024 16:01:37 +0545 Subject: [PATCH 7/9] fix(taskSelectionPopup): use task index instead of taskId --- .../src/components/ProjectDetailsV2/TaskSelectionPopup.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/components/ProjectDetailsV2/TaskSelectionPopup.tsx b/src/frontend/src/components/ProjectDetailsV2/TaskSelectionPopup.tsx index f03bcff6a9..93f316bf57 100644 --- a/src/frontend/src/components/ProjectDetailsV2/TaskSelectionPopup.tsx +++ b/src/frontend/src/components/ProjectDetailsV2/TaskSelectionPopup.tsx @@ -29,7 +29,7 @@ const TaskSelectionPopup = ({ taskId, body, feature }: TaskSelectionPopupPropTyp const authDetails = CoreModules.useAppSelector((state) => state.login.authDetails); const selectedTask = { ...projectData?.[projectIndex]?.taskBoundries?.filter((indTask, i) => { - return indTask.id == taskId; + return indTask?.index == taskId; })?.[0], }; const checkIfTaskAssignedOrNot = @@ -40,7 +40,7 @@ const TaskSelectionPopup = ({ taskId, body, feature }: TaskSelectionPopupPropTyp if (projectIndex != -1) { const currentStatus = { ...projectData[projectIndex].taskBoundries.filter((task) => { - return task.id == taskId; + return task?.index == taskId; })[0], }; const findCorrectTaskStatusIndex = environment.tasksStatus.findIndex( From a09f74985fd45aeab6b99e886d647dadd65d7eab Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Thu, 9 May 2024 16:02:24 +0545 Subject: [PATCH 8/9] fix(dialogTaskActions): use taskId instead of task index on api fetch, post --- src/frontend/src/components/DialogTaskActions.jsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/frontend/src/components/DialogTaskActions.jsx b/src/frontend/src/components/DialogTaskActions.jsx index a75b48f7d0..6f499d9360 100755 --- a/src/frontend/src/components/DialogTaskActions.jsx +++ b/src/frontend/src/components/DialogTaskActions.jsx @@ -30,20 +30,22 @@ export default function Dialog({ taskId, feature, map, view }) { const projectIndex = projectData.findIndex((project) => project.id == currentProjectId); const currentStatus = { ...taskBoundaryData?.[projectIndex]?.taskBoundries?.filter((task) => { - return task.id == taskId; + return task?.index == taskId; })?.[0], }; const projectTaskActivityList = CoreModules.useAppSelector((state) => state?.project?.projectTaskActivity); useEffect(() => { if (taskId) { - dispatch(GetProjectTaskActivity(`${import.meta.env.VITE_API_URL}/tasks/${taskId}/history/?comment=false`)); + dispatch( + GetProjectTaskActivity(`${import.meta.env.VITE_API_URL}/tasks/${currentStatus?.id}/history/?comment=false`), + ); } }, [taskId]); useEffect(() => { if (taskInfo?.length === 0) return; - const currentTaskInfo = taskInfo?.filter((task) => taskId === task?.task_id); + const currentTaskInfo = taskInfo?.filter((task) => taskId == task?.index); if (currentTaskInfo?.[0]) { setCurrentTaskInfo(currentTaskInfo?.[0]); } @@ -70,7 +72,7 @@ export default function Dialog({ taskId, feature, map, view }) { if (authDetailsCopy.hasOwnProperty('id')) { dispatch( ProjectTaskStatus( - `${import.meta.env.VITE_API_URL}/tasks/${taskId}/new-status/${status}`, + `${import.meta.env.VITE_API_URL}/tasks/${currentStatus?.id}/new-status/${status}`, geoStyle, taskBoundaryData, currentProjectId, From b5355554f4ffb1381d1496a1710427e0a211a421 Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Thu, 9 May 2024 16:23:02 +0545 Subject: [PATCH 9/9] fix(activitiesPanel): zoom to task using taskIndex --- .../src/components/ProjectDetailsV2/ActivitiesPanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/src/components/ProjectDetailsV2/ActivitiesPanel.tsx b/src/frontend/src/components/ProjectDetailsV2/ActivitiesPanel.tsx index ee5bf815a2..d759004a0e 100644 --- a/src/frontend/src/components/ProjectDetailsV2/ActivitiesPanel.tsx +++ b/src/frontend/src/components/ProjectDetailsV2/ActivitiesPanel.tsx @@ -40,7 +40,7 @@ const ActivitiesPanel = ({ defaultTheme, state, params, map, view, mapDivPostion let geojson = {}; const index = state.findIndex((project) => project.id == params.id); if (index != -1) { - const taskIndex = state[index]?.taskBoundries.findIndex((task) => task.id == taskId); + const taskIndex = state[index]?.taskBoundries.findIndex((task) => task?.index == taskId); if (index != -1) { geojson = state[index]?.taskBoundries[taskIndex]?.outline_geojson; }