From 35549b0ee47004e23f7fcfc7d3186102b18ccafd Mon Sep 17 00:00:00 2001 From: Richard Qi Date: Mon, 9 Oct 2023 23:28:37 -0700 Subject: [PATCH 1/4] show selected divisions + sections --- .../Attachments/AttachmentModal.js | 3 +- .../FileUpload/FileUploadForMCFPersonal.js | 23 +++++++++++++++ .../customComponents/Records/MCFPersonal.js | 29 ++++++++++++++++++- .../FOI/customComponents/Records/index.js | 1 + 4 files changed, 54 insertions(+), 2 deletions(-) diff --git a/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js b/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js index 130ada26a..1590e0f4f 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js +++ b/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js @@ -207,7 +207,7 @@ export default function AttachmentModal({ fileStatusTransition = attachment?.category; } else if (uploadFor === "record") { if(bcgovcode == "MCF" && requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL) { - fileStatusTransition = MCFSections?.sections?.find(division => division.divisionid === tagValue).name; + fileStatusTransition = divisions.find(division => division.divisionid === tagValue)?.divisionname || MCFSections?.sections?.find(division => division.divisionid === tagValue)?.name; } else if(bcgovcode == "MSD" && requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL) { fileStatusTransition = MSDSections?.sections?.find(division => division.divisionid === tagValue).name; } else { @@ -366,6 +366,7 @@ export default function AttachmentModal({ updateFilesCb={updateFilesCb} modalFor={modalFor} uploadFor={uploadFor} + divisions={tagList} tagList={MCFSections?.sections?.slice(0, MCFPopularSections-1)} otherTagList={MCFSections?.sections?.slice(MCFPopularSections)} handleTagChange={handleTagChange} diff --git a/forms-flow-web/src/components/FOI/customComponents/FileUpload/FileUploadForMCFPersonal.js b/forms-flow-web/src/components/FOI/customComponents/FileUpload/FileUploadForMCFPersonal.js index 433122eda..90c781b09 100644 --- a/forms-flow-web/src/components/FOI/customComponents/FileUpload/FileUploadForMCFPersonal.js +++ b/forms-flow-web/src/components/FOI/customComponents/FileUpload/FileUploadForMCFPersonal.js @@ -35,6 +35,7 @@ const FileUploadForMCFPersonal = ({ modalFor, handleTagChange, tagValue, + divisions = [], tagList = [], otherTagList = [], isMinistryCoordinator, @@ -226,6 +227,28 @@ const FileUploadForMCFPersonal = ({
Select the name of the section of records you are uploading. Once you have selected the section name you will be able to select the respective documents from your computer.
+ {divisions.length > 0 && (<> +
+ Personals Divisional Tracking: +
+
+ {divisions.map(tag => + {handleTagChange(tag.name)}} + clicked={tagValue == tag.name} + /> + )} +
+ )} +
+ Sections: +
{tagList.map(tag => { const [searchValue, setSearchValue] = useState(""); @@ -59,6 +60,32 @@ const MCFPersonal = ({ return ( <>
+ + {divisions.length > 0 && divisions.filter(div => div.divisionid !== tagValue).length > 0 && (<> +
+ Personals Divisional Tracking: +
+
+ {divisions.filter(div => { + return div.divisionid !== tagValue; + }).map(tag => + {setNewDivision(tag.divisionid)}} + clicked={divisionModalTagValue == tag.divisionid} + /> + )} +
+
+ Sections: +
+ )} +
{tagList.filter(div => { return div.divisionid !== tagValue; diff --git a/forms-flow-web/src/components/FOI/customComponents/Records/index.js b/forms-flow-web/src/components/FOI/customComponents/Records/index.js index 643b99c15..4d7cc47f9 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Records/index.js +++ b/forms-flow-web/src/components/FOI/customComponents/Records/index.js @@ -2015,6 +2015,7 @@ export const RecordsLog = ({ setNewDivision={setDivisionModalTagValue} tagValue={records.filter(r => r.isselected)[0]?.attributes.divisions[0].divisionid} divisionModalTagValue={divisionModalTagValue} + divisions={divisions} /> : (bcgovcode == "MSD") ? From 30ad612611b44f073a46f56366db908183492f8d Mon Sep 17 00:00:00 2001 From: Richard Qi Date: Tue, 10 Oct 2023 13:27:56 -0700 Subject: [PATCH 2/4] 1. get personal divisions 2. scanning team can only select sections 3. ministry can only select divisions --- .../src/apiManager/endpoints/index.js | 1 + .../services/FOI/foiMasterDataServices.js | 24 +++++++++++++++++++ .../MinistryReview/MinistryReview.js | 1 + .../MinistryReview/RequestTracking.js | 14 +++++++---- .../FileUpload/FileUploadForMCFPersonal.js | 10 +++----- .../customComponents/Records/MCFPersonal.js | 13 ++++------ .../FOI/customComponents/Records/index.js | 1 + 7 files changed, 45 insertions(+), 19 deletions(-) diff --git a/forms-flow-web/src/apiManager/endpoints/index.js b/forms-flow-web/src/apiManager/endpoints/index.js index 9bb4b9655..81994417e 100644 --- a/forms-flow-web/src/apiManager/endpoints/index.js +++ b/forms-flow-web/src/apiManager/endpoints/index.js @@ -28,6 +28,7 @@ const API = { FOI_MINISTRY_DIVISIONALSTAGES: `${FOI_BASE_API_URL}/api/foiflow/divisions/`, FOI_PERSONAL_DIVISIONS_SECTIONS: `${FOI_BASE_API_URL}/api/foiflow/divisions//true/divisionsandsections`, FOI_PERSONAL_SECTIONS: `${FOI_BASE_API_URL}/api/foiflow/divisions//true/sections`, + FOI_PERSONAL_DIVISIONS: `${FOI_BASE_API_URL}/api/foiflow/divisions//true/divisions`, FOI_POST_RAW_REQUEST_WATCHERS: `${FOI_BASE_API_URL}/api/foiwatcher/rawrequest`, FOI_GET_RAW_REQUEST_WATCHERS: `${FOI_BASE_API_URL}/api/foiwatcher/rawrequest/`, FOI_POST_MINISTRY_REQUEST_WATCHERS: `${FOI_BASE_API_URL}/api/foiwatcher/ministryrequest`, diff --git a/forms-flow-web/src/apiManager/services/FOI/foiMasterDataServices.js b/forms-flow-web/src/apiManager/services/FOI/foiMasterDataServices.js index fab69149f..b8eb8d385 100644 --- a/forms-flow-web/src/apiManager/services/FOI/foiMasterDataServices.js +++ b/forms-flow-web/src/apiManager/services/FOI/foiMasterDataServices.js @@ -414,6 +414,30 @@ import { } }; + export const fetchFOIPersonalDivisions = (bcgovcode) => { + const apiUrl = replaceUrl(API.FOI_PERSONAL_DIVISIONS, "", bcgovcode); + return (dispatch) => { + httpGETRequest(apiUrl, {}, UserService.getToken()) + .then((res) => { + if (res.data) { + const foiMinistryDivisionalStages = res.data; + dispatch(setFOIMinistryDivisionalStages({})); + dispatch(setFOIMinistryDivisionalStages(foiMinistryDivisionalStages)); + dispatch(setFOILoader(false)); + } else { + console.log(`Error while fetching ministry(${bcgovcode}) divisional stage master data`, res); + dispatch(serviceActionError(res)); + dispatch(setFOILoader(false)); + } + }) + .catch((error) => { + console.log(`Error while fetching ministry(${bcgovcode}) divisional stage master data`, error); + dispatch(serviceActionError(error)); + dispatch(setFOILoader(false)); + }); + }; + }; + export const fetchFOISubjectCodeList = () => { const firstSubjectCode = { "subjectcodeid": 0, "name": "Select Subject Code (if required)" }; return (dispatch) => { diff --git a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js index bfa3672b4..3161beb15 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js @@ -533,6 +533,7 @@ const MinistryReview = React.memo(({ userDetail }) => { createMinistrySaveRequestObject={createMinistrySaveRequestObject} requestStartDate = {requestDetails?.requestProcessStart} setHasReceivedDate={setHasReceivedDate} + requestType={requestDetails.requestType} /> ); diff --git a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/RequestTracking.js b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/RequestTracking.js index 1f8b1198d..92b6d180d 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/RequestTracking.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/RequestTracking.js @@ -3,21 +3,27 @@ import Card from '@material-ui/core/Card'; import CardContent from '@material-ui/core/CardContent'; import DivisionalStages from './Divisions/DivisionalStages'; import { useDispatch, useSelector } from "react-redux"; -import { fetchFOIMinistryDivisionalStages } from "../../../../apiManager/services/FOI/foiMasterDataServices"; +import FOI_COMPONENT_CONSTANTS from "../../../../constants/FOI/foiComponentConstants"; +import { fetchFOIMinistryDivisionalStages, fetchFOIPersonalDivisions } from "../../../../apiManager/services/FOI/foiMasterDataServices"; const RequestTracking = React.memo(({ pubmindivstagestomain, existingDivStages, ministrycode, createMinistrySaveRequestObject, requestStartDate, - setHasReceivedDate + setHasReceivedDate, + requestType }) => { const dispatch = useDispatch(); - useEffect(() => { + useEffect(() => { if(ministrycode) { - dispatch(fetchFOIMinistryDivisionalStages(ministrycode)); + if(ministrycode == "MCF" && requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL) { + dispatch(fetchFOIPersonalDivisions(ministrycode)); + } else { + dispatch(fetchFOIMinistryDivisionalStages(ministrycode)); + } } },[ministrycode,dispatch]) diff --git a/forms-flow-web/src/components/FOI/customComponents/FileUpload/FileUploadForMCFPersonal.js b/forms-flow-web/src/components/FOI/customComponents/FileUpload/FileUploadForMCFPersonal.js index 90c781b09..8fb287e9b 100644 --- a/forms-flow-web/src/components/FOI/customComponents/FileUpload/FileUploadForMCFPersonal.js +++ b/forms-flow-web/src/components/FOI/customComponents/FileUpload/FileUploadForMCFPersonal.js @@ -227,10 +227,7 @@ const FileUploadForMCFPersonal = ({
Select the name of the section of records you are uploading. Once you have selected the section name you will be able to select the respective documents from your computer.
- {divisions.length > 0 && (<> -
- Personals Divisional Tracking: -
+ {divisions.length > 0 && isMinistryCoordinator && (<>
{divisions.map(tag => )} -
- Sections: -
+ {!isMinistryCoordinator && (<>
{tagList.map(tag => )}
+ )}
)} {modalFor === "add" && (

Please drag and drop or add records associated with the section name you have selected above. All records upload will show under the selected section in the redaction application.

diff --git a/forms-flow-web/src/components/FOI/customComponents/Records/MCFPersonal.js b/forms-flow-web/src/components/FOI/customComponents/Records/MCFPersonal.js index 2ced8e743..371abf4dc 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Records/MCFPersonal.js +++ b/forms-flow-web/src/components/FOI/customComponents/Records/MCFPersonal.js @@ -17,7 +17,8 @@ const MCFPersonal = ({ setNewDivision, tagValue, divisionModalTagValue, - divisions=[] + divisions=[], + isMinistryCoordinator }) => { const [searchValue, setSearchValue] = useState(""); @@ -61,10 +62,7 @@ const MCFPersonal = ({ <>
- {divisions.length > 0 && divisions.filter(div => div.divisionid !== tagValue).length > 0 && (<> -
- Personals Divisional Tracking: -
+ {isMinistryCoordinator && divisions.length > 0 && divisions.filter(div => div.divisionid !== tagValue).length > 0 && (<>
{divisions.filter(div => { return div.divisionid !== tagValue; @@ -81,11 +79,9 @@ const MCFPersonal = ({ /> )}
-
- Sections: -
)} + {!isMinistryCoordinator && (<>
{tagList.filter(div => { return div.divisionid !== tagValue; @@ -202,6 +198,7 @@ const MCFPersonal = ({ )}
+ )}
); diff --git a/forms-flow-web/src/components/FOI/customComponents/Records/index.js b/forms-flow-web/src/components/FOI/customComponents/Records/index.js index 4d7cc47f9..8c850a75f 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Records/index.js +++ b/forms-flow-web/src/components/FOI/customComponents/Records/index.js @@ -2016,6 +2016,7 @@ export const RecordsLog = ({ tagValue={records.filter(r => r.isselected)[0]?.attributes.divisions[0].divisionid} divisionModalTagValue={divisionModalTagValue} divisions={divisions} + isMinistryCoordinator={isMinistryCoordinator} /> : (bcgovcode == "MSD") ? From 9038b3bb101a588782c7ddc829198f4dc8e11741 Mon Sep 17 00:00:00 2001 From: Richard Qi Date: Tue, 10 Oct 2023 23:30:59 -0700 Subject: [PATCH 3/4] can only edit records uploaded by the same team --- .../FOI/customComponents/Records/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/forms-flow-web/src/components/FOI/customComponents/Records/index.js b/forms-flow-web/src/components/FOI/customComponents/Records/index.js index 8c850a75f..9453cdc79 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Records/index.js +++ b/forms-flow-web/src/components/FOI/customComponents/Records/index.js @@ -256,6 +256,11 @@ export const RecordsLog = ({ const [records, setRecords] = useState(recordsObj?.records); const [totalUploadedRecordSize, setTotalUploadedRecordSize] = useState(0); const [isScanningTeamMember, setIsScanningTeamMember] = useState(isScanningTeam(userGroups)); + const [ministryCode, setMinistryCode] = useState(bcgovcode.replaceAll('"', '').toUpperCase()); + const [isMCFPersonal, setIsMCFPersonal] = useState(ministryCode == "MCF" && requestType === FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL); + + const MCFSections = useSelector((state) => state.foiRequests.foiPersonalSections); + useEffect(() => { setRecords(recordsObj?.records) let nonDuplicateRecords = recordsObj?.records?.filter(record => !record.isduplicate) @@ -1328,6 +1333,14 @@ export const RecordsLog = ({ } } // setDivisionToUpdate() + + if(isMCFPersonal && selectedDivision.size > 0) { + if(divisions.find(d => selectedDivision.has(d.divisionid))) { + return(!isMinistryCoordinator); + } else { + return(isMinistryCoordinator); + } + } return count === 0; }; @@ -1813,6 +1826,11 @@ export const RecordsLog = ({ {" "} and all records selected must be finished processing + {isMCFPersonal && (<> +
  • + you can only edit records uploaded by your team +
  • + )}
    ) : ( From 33155f87abb2d0af64249b1869ef47ad02cf19c0 Mon Sep 17 00:00:00 2001 From: Richard Qi Date: Wed, 11 Oct 2023 09:18:42 -0700 Subject: [PATCH 4/4] update message --- .../src/components/FOI/customComponents/Records/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forms-flow-web/src/components/FOI/customComponents/Records/index.js b/forms-flow-web/src/components/FOI/customComponents/Records/index.js index 9453cdc79..2779c1e30 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Records/index.js +++ b/forms-flow-web/src/components/FOI/customComponents/Records/index.js @@ -1828,7 +1828,7 @@ export const RecordsLog = ({ {isMCFPersonal && (<>
  • - you can only edit records uploaded by your team + all records selected must be uploaded by your own team
  • )}