From 0ea251f07d42ce1f828e46def2d49b05932e912c Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Wed, 4 Dec 2024 16:37:37 +0545 Subject: [PATCH 1/6] fix(submissionsTable): use task index instead of id --- .../src/components/ProjectSubmissions/SubmissionsTable.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/src/components/ProjectSubmissions/SubmissionsTable.tsx b/src/frontend/src/components/ProjectSubmissions/SubmissionsTable.tsx index 48b43bce87..52edfe47bb 100644 --- a/src/frontend/src/components/ProjectSubmissions/SubmissionsTable.tsx +++ b/src/frontend/src/components/ProjectSubmissions/SubmissionsTable.tsx @@ -464,7 +464,7 @@ const SubmissionsTable = ({ toggleView }) => { headerClassName="updatedHeader !fmtm-sticky fmtm-right-0 fmtm-shadow-[-10px_0px_20px_0px_rgba(0,0,0,0.1)] fmtm-text-center" rowClassName="updatedRow !fmtm-sticky fmtm-right-0 fmtm-bg-white fmtm-shadow-[-10px_0px_20px_0px_rgba(0,0,0,0.1)]" dataFormat={(row) => { - const taskUid = taskList?.find((task) => task?.id == row?.task_id)?.id; + const taskUid = taskList?.find((task) => task?.index == row?.task_id)?.id; return (
From c1bdea19658f07b4b0a5e8cb2f9f63f2278b0d2c Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Thu, 5 Dec 2024 10:08:23 +0545 Subject: [PATCH 2/6] fix(project): organization name add to project info section --- src/frontend/src/api/Project.ts | 1 + src/frontend/src/components/ProjectDetailsV2/ProjectInfo.tsx | 1 + src/frontend/src/models/project/projectModel.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/src/frontend/src/api/Project.ts b/src/frontend/src/api/Project.ts index ac14e5f84f..ab2e46d60e 100755 --- a/src/frontend/src/api/Project.ts +++ b/src/frontend/src/api/Project.ts @@ -48,6 +48,7 @@ export const ProjectById = (projectId: string) => { custom_tms_url: projectResp?.custom_tms_url, organisation_id: projectResp?.organisation_id, organisation_logo: projectResp?.organisation_logo, + organisation_name: projectResp?.organisation_name, created_at: projectResp?.created_at, }), ); diff --git a/src/frontend/src/components/ProjectDetailsV2/ProjectInfo.tsx b/src/frontend/src/components/ProjectDetailsV2/ProjectInfo.tsx index f55b491c88..bf68787afc 100644 --- a/src/frontend/src/components/ProjectDetailsV2/ProjectInfo.tsx +++ b/src/frontend/src/components/ProjectDetailsV2/ProjectInfo.tsx @@ -106,6 +106,7 @@ const ProjectInfo: React.FC = () => { alt="Organization Photo" />
+

{projectInfo?.organisation_name}

)} diff --git a/src/frontend/src/models/project/projectModel.ts b/src/frontend/src/models/project/projectModel.ts index 79518ce134..acdfb21793 100644 --- a/src/frontend/src/models/project/projectModel.ts +++ b/src/frontend/src/models/project/projectModel.ts @@ -51,6 +51,7 @@ export type projectInfoType = { total_tasks: any; organisation_id: number; organisation_logo: string; + organisation_name: string; instructions: string; custom_tms_url: string; created_at: string; From 9b4d69b750da6c422351d336ab2304ae2970fb6b Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Thu, 5 Dec 2024 11:34:02 +0545 Subject: [PATCH 3/6] fix(createNewProject): pass setAdditionalFeature as prop --- src/frontend/src/views/CreateNewProject.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/frontend/src/views/CreateNewProject.tsx b/src/frontend/src/views/CreateNewProject.tsx index 19840c1683..90fa1ecb93 100644 --- a/src/frontend/src/views/CreateNewProject.tsx +++ b/src/frontend/src/views/CreateNewProject.tsx @@ -67,6 +67,7 @@ const CreateNewProject = () => { geojsonFile={geojsonFile} setGeojsonFile={setGeojsonFile} setCustomDataExtractUpload={setCustomDataExtractUpload} + setAdditionalFeature={setAdditionalFeature} /> ); case '/upload-survey': From b8e36c655cc1fc1fa40a5a1cb6c12c21d96c5c4f Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Thu, 5 Dec 2024 11:36:56 +0545 Subject: [PATCH 4/6] fix(uploadArea): reset dataExtract, addGeom, taskSplit geojson to default state on geojson reset --- .../src/components/createnewproject/UploadArea.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/components/createnewproject/UploadArea.tsx b/src/frontend/src/components/createnewproject/UploadArea.tsx index 993f201f20..6d5dd1a9ae 100644 --- a/src/frontend/src/components/createnewproject/UploadArea.tsx +++ b/src/frontend/src/components/createnewproject/UploadArea.tsx @@ -31,7 +31,7 @@ const uploadAreaOptions = [ }, ]; -const UploadArea = ({ flag, geojsonFile, setGeojsonFile, setCustomDataExtractUpload }) => { +const UploadArea = ({ flag, geojsonFile, setGeojsonFile, setCustomDataExtractUpload, setAdditionalFeature }) => { useDocumentTitle('Create Project: Upload Area'); const dispatch = useDispatch(); const navigate = useNavigate(); @@ -168,11 +168,14 @@ const UploadArea = ({ flag, geojsonFile, setGeojsonFile, setCustomDataExtractUpl const resetFile = () => { setGeojsonFile(null); + setCustomDataExtractUpload(null); handleCustomChange('uploadedAreaFile', null); handleCustomChange('drawnGeojson', null); + setAdditionalFeature(null); dispatch(CreateProjectActions.SetDrawnGeojson(null)); dispatch(CreateProjectActions.SetTotalAreaSelection(null)); - dispatch(CreateProjectActions.ClearProjectStepState(formValues)); + dispatch(CreateProjectActions.SetAdditionalFeatureGeojson(null)); + dispatch(CreateProjectActions.ClearProjectStepState({ ...formValues, uploadedAreaFile: null, drawnGeojson: null })); }; useEffect(() => { From 1dc5f47b8346fd0b025f7d304e0ca639b61b8689 Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Thu, 5 Dec 2024 11:40:25 +0545 Subject: [PATCH 5/6] refactor(uploadArea): remove commented code --- .../createnewproject/UploadArea.tsx | 38 ++----------------- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/src/frontend/src/components/createnewproject/UploadArea.tsx b/src/frontend/src/components/createnewproject/UploadArea.tsx index 6d5dd1a9ae..549d2ce263 100644 --- a/src/frontend/src/components/createnewproject/UploadArea.tsx +++ b/src/frontend/src/components/createnewproject/UploadArea.tsx @@ -33,9 +33,9 @@ const uploadAreaOptions = [ const UploadArea = ({ flag, geojsonFile, setGeojsonFile, setCustomDataExtractUpload, setAdditionalFeature }) => { useDocumentTitle('Create Project: Upload Area'); + const dispatch = useDispatch(); const navigate = useNavigate(); - // const [uploadAreaFile, setUploadAreaFile] = useState(null); const [isGeojsonWGS84, setIsGeojsonWG84] = useState(true); const projectDetails = useAppSelector((state) => state.createproject.projectDetails); @@ -66,13 +66,15 @@ const UploadArea = ({ flag, geojsonFile, setGeojsonFile, setCustomDataExtractUpl navigate('/upload-survey'); dispatch(CreateProjectActions.SetToggleSplittedGeojsonEdit(false)); }; + const { handleSubmit, handleCustomChange, values: formValues, errors, }: any = useForm(projectDetails, submission, UploadAreaValidation); - const toggleStep = (step, url) => { + + const toggleStep = (step: number, url: string) => { dispatch(CommonActions.SetCurrentStepFormStep({ flag: flag, step: step })); navigate(url); dispatch(CreateProjectActions.SetToggleSplittedGeojsonEdit(false)); @@ -282,38 +284,6 @@ const UploadArea = ({ flag, geojsonFile, setGeojsonFile, setCustomDataExtractUpl btnText="Upload a Geojson" errorMsg={errors.uploadedAreaFile} /> - //
- //
- // - //
- // resetFile()} /> - //
- //
- // {geojsonFile && ( - //
- //

{geojsonFile?.name}

- //
- // )} - //

- // *The supported file formats are zipped shapefile, geojson or kml files. - //

- //

- // Total Area: 234 sq.km - //

- //
)}
From d260e459df99b14322b70d7e72f29667dcd47ccc Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Thu, 5 Dec 2024 11:48:26 +0545 Subject: [PATCH 6/6] fix(submission): clear submission details state before api call --- src/frontend/src/api/Submission.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/frontend/src/api/Submission.ts b/src/frontend/src/api/Submission.ts index e1a05122ec..d5d2f1e838 100644 --- a/src/frontend/src/api/Submission.ts +++ b/src/frontend/src/api/Submission.ts @@ -3,6 +3,7 @@ import { SubmissionActions } from '@/store/slices/SubmissionSlice'; export const SubmissionService: Function = (url: string) => { return async (dispatch) => { + dispatch(SubmissionActions.SetSubmissionDetails(null)); dispatch(SubmissionActions.SetSubmissionDetailsLoading(true)); const getSubmissionDetails = async (url: string) => { try {