Skip to content

Commit

Permalink
Merge pull request #4580 from bcgov/dev-RQ-4569
Browse files Browse the repository at this point in the history
CFD personal record upload for Ministry 4569
  • Loading branch information
richard-aot authored Oct 11, 2023
2 parents beab49a + 33155f8 commit 757cea9
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 6 deletions.
1 change: 1 addition & 0 deletions forms-flow-web/src/apiManager/endpoints/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const API = {
FOI_MINISTRY_DIVISIONALSTAGES: `${FOI_BASE_API_URL}/api/foiflow/divisions/<bcgovcode>`,
FOI_PERSONAL_DIVISIONS_SECTIONS: `${FOI_BASE_API_URL}/api/foiflow/divisions/<bcgovcode>/true/divisionsandsections`,
FOI_PERSONAL_SECTIONS: `${FOI_BASE_API_URL}/api/foiflow/divisions/<bcgovcode>/true/sections`,
FOI_PERSONAL_DIVISIONS: `${FOI_BASE_API_URL}/api/foiflow/divisions/<bcgovcode>/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/<requestid>`,
FOI_POST_MINISTRY_REQUEST_WATCHERS: `${FOI_BASE_API_URL}/api/foiwatcher/ministryrequest`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,30 @@ import {
}
};

export const fetchFOIPersonalDivisions = (bcgovcode) => {
const apiUrl = replaceUrl(API.FOI_PERSONAL_DIVISIONS, "<bcgovcode>", 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) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ const MinistryReview = React.memo(({ userDetail }) => {
createMinistrySaveRequestObject={createMinistrySaveRequestObject}
requestStartDate = {requestDetails?.requestProcessStart}
setHasReceivedDate={setHasReceivedDate}
requestType={requestDetails.requestType}
/>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const FileUploadForMCFPersonal = ({
modalFor,
handleTagChange,
tagValue,
divisions = [],
tagList = [],
otherTagList = [],
isMinistryCoordinator,
Expand Down Expand Up @@ -226,6 +227,23 @@ const FileUploadForMCFPersonal = ({
<div className="tagtitle">
<span>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.</span>
</div>
{divisions.length > 0 && isMinistryCoordinator && (<>
<div className="taglist">
{divisions.map(tag =>
<ClickableChip
id={`${tag.name}Tag`}
key={`${tag.name}-tag`}
label={tag.display.toUpperCase()}
sx={{width: "fit-content", marginRight: "8px", marginBottom: "8px"}}
color="primary"
size="small"
onClick={()=>{handleTagChange(tag.name)}}
clicked={tagValue == tag.name}
/>
)}
</div>
</>)}
{!isMinistryCoordinator && (<>
<div className="taglist">
{tagList.map(tag =>
<ClickableChip
Expand Down Expand Up @@ -338,6 +356,7 @@ const FileUploadForMCFPersonal = ({
</Paper>)}
</Grid>
</div>
</>)}
</div>)}
{modalFor === "add" && (<div className="tag-message-container-scanning">
<p>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.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import { MCFPopularSections } from "../../../../constants/FOI/enum";
const MCFPersonal = ({
setNewDivision,
tagValue,
divisionModalTagValue
divisionModalTagValue,
divisions=[],
isMinistryCoordinator
}) => {

const [searchValue, setSearchValue] = useState("");
Expand Down Expand Up @@ -59,6 +61,27 @@ const MCFPersonal = ({
return (
<>
<div>

{isMinistryCoordinator && divisions.length > 0 && divisions.filter(div => div.divisionid !== tagValue).length > 0 && (<>
<div className="taglist">
{divisions.filter(div => {
return div.divisionid !== tagValue;
}).map(tag =>
<ClickableChip
id={`${tag.divisionid}Tag`}
key={`${tag.divisionid}-tag`}
label={tag.divisionname.toUpperCase()}
sx={{width: "fit-content", marginRight: "8px", marginBottom: "8px"}}
color="primary"
size="small"
onClick={()=>{setNewDivision(tag.divisionid)}}
clicked={divisionModalTagValue == tag.divisionid}
/>
)}
</div>
</>)}

{!isMinistryCoordinator && (<>
<div className="taglist">
{tagList.filter(div => {
return div.divisionid !== tagValue;
Expand Down Expand Up @@ -175,6 +198,7 @@ const MCFPersonal = ({
</Paper>)}
</Grid>
</div>
</>)}
</div>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
};

Expand Down Expand Up @@ -1813,6 +1826,11 @@ export const RecordsLog = ({
{" "}
and all records selected must be finished processing
</li>
{isMCFPersonal && (<>
<li>
all records selected must be uploaded by your own team
</li>
</>)}
</ul>
</div>
) : (
Expand Down Expand Up @@ -2015,6 +2033,8 @@ export const RecordsLog = ({
setNewDivision={setDivisionModalTagValue}
tagValue={records.filter(r => r.isselected)[0]?.attributes.divisions[0].divisionid}
divisionModalTagValue={divisionModalTagValue}
divisions={divisions}
isMinistryCoordinator={isMinistryCoordinator}
/>
:
(bcgovcode == "MSD") ?
Expand Down

0 comments on commit 757cea9

Please sign in to comment.