From 3e0137d07dfc74603532d33eff7f8e4731b83010 Mon Sep 17 00:00:00 2001 From: divyav-aot Date: Thu, 16 Nov 2023 14:32:19 -0500 Subject: [PATCH 1/2] build error fix _message --- .../Attachments/AttachmentModal.js | 1054 ++++++++++------- 1 file changed, 647 insertions(+), 407 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 77204dfe1..5ac12bd45 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js +++ b/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js @@ -1,46 +1,54 @@ -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useState } from "react"; import { useSelector } from "react-redux"; -import Dialog from '@material-ui/core/Dialog'; -import DialogActions from '@material-ui/core/DialogActions'; -import DialogContent from '@material-ui/core/DialogContent'; -import DialogContentText from '@material-ui/core/DialogContentText'; -import DialogTitle from '@material-ui/core/DialogTitle'; -import IconButton from '@material-ui/core/IconButton'; -import CloseIcon from '@material-ui/icons/Close'; -import TextField from '@material-ui/core/TextField'; -import '../ConfirmationModal/confirmationmodal.scss'; -import './attachmentmodal.scss'; -import FileUpload from '../FileUpload'; -import FileUploadForMCFPersonal from '../FileUpload/FileUploadForMCFPersonal'; -import FileUploadForMSDPersonal from '../FileUpload/FileUploadForMSDPersonal'; -import { makeStyles } from '@material-ui/core/styles'; -import { MimeTypeList, MaxFileSizeInMB, MCFPopularSections, MSDPopularSections, MinistryNeedsScanning } from "../../../../constants/FOI/enum"; -import { StateTransitionCategories, AttachmentCategories } from '../../../../constants/FOI/statusEnum'; +import Dialog from "@material-ui/core/Dialog"; +import DialogActions from "@material-ui/core/DialogActions"; +import DialogContent from "@material-ui/core/DialogContent"; +import DialogContentText from "@material-ui/core/DialogContentText"; +import DialogTitle from "@material-ui/core/DialogTitle"; +import IconButton from "@material-ui/core/IconButton"; +import CloseIcon from "@material-ui/icons/Close"; +import TextField from "@material-ui/core/TextField"; +import "../ConfirmationModal/confirmationmodal.scss"; +import "./attachmentmodal.scss"; +import FileUpload from "../FileUpload"; +import FileUploadForMCFPersonal from "../FileUpload/FileUploadForMCFPersonal"; +import FileUploadForMSDPersonal from "../FileUpload/FileUploadForMSDPersonal"; +import { makeStyles } from "@material-ui/core/styles"; +import { + MimeTypeList, + MaxFileSizeInMB, + MCFPopularSections, + MSDPopularSections, + MinistryNeedsScanning, +} from "../../../../constants/FOI/enum"; +import { + StateTransitionCategories, + AttachmentCategories, +} from "../../../../constants/FOI/statusEnum"; import { TOTAL_RECORDS_UPLOAD_LIMIT } from "../../../../constants/constants"; import FOI_COMPONENT_CONSTANTS from "../../../../constants/FOI/foiComponentConstants"; -import { ClickableChip } from '../../Dashboard/utils'; +import { ClickableChip } from "../../Dashboard/utils"; const useStyles = makeStyles((theme) => ({ root: { - width: '100%', - marginTop:'30px', - marginBottom:'50px' + width: "100%", + marginTop: "30px", + marginBottom: "50px", }, heading: { fontSize: theme.typography.pxToRem(15), fontWeight: theme.typography.fontWeightRegular, }, btndisabled: { - border: 'none', - backgroundColor: '#eceaea', - color: '#FFFFFF' + border: "none", + backgroundColor: "#eceaea", + color: "#FFFFFF", }, btnenabled: { - border: 'none', - backgroundColor: '#38598A', - color: '#FFFFFF' + border: "none", + backgroundColor: "#38598A", + color: "#FFFFFF", }, - })); export default function AttachmentModal({ @@ -55,379 +63,569 @@ export default function AttachmentModal({ handleRename, handleReclassify, isMinistryCoordinator, - uploadFor="attachment", + uploadFor = "attachment", maxNoFiles, bcgovcode, - existingDocuments=[], - divisions=[], - replacementfiletypes=[], - totalUploadedRecordSize=0, - requestType=FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_GENERAL + existingDocuments = [], + divisions = [], + replacementfiletypes = [], + totalUploadedRecordSize = 0, + requestType = FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_GENERAL, }) { - - let tagList = []; - if(uploadFor === 'attachment') { - tagList = AttachmentCategories.categorys.filter(category => category.type.includes("tag")); - if (isMinistryCoordinator) { - tagList = tagList.filter(tag => tag.name !== "applicant") - } - } else if (uploadFor === 'record') { - tagList = divisions.map(division => { - return { - name: division.divisionid, - display: division.divisionname, - } - }); + let tagList = []; + if (uploadFor === "attachment") { + tagList = AttachmentCategories.categorys.filter((category) => + category.type.includes("tag") + ); + if (isMinistryCoordinator) { + tagList = tagList.filter((tag) => tag.name !== "applicant"); } + } else if (uploadFor === "record") { + tagList = divisions.map((division) => { + return { + name: division.divisionid, + display: division.divisionname, + }; + }); + } - const recordFormats = useSelector((state) => state.foiRequests.recordFormats) - useEffect(() => { - setMimeTypes(multipleFiles ? - (uploadFor === 'attachment' ? [...recordFormats, ...MimeTypeList.additional] : (uploadFor === 'record' && (modalFor==="replace" || modalFor === "replaceattachment") ? replacementfiletypes: recordFormats)) - : MimeTypeList.stateTransition); - }, [recordFormats]) - const [mimeTypes, setMimeTypes] = useState(multipleFiles ? - (uploadFor === 'attachment' ? [...recordFormats, ...MimeTypeList.additional] : (uploadFor === 'record' && (modalFor==="replace" || modalFor === "replaceattachment") ? replacementfiletypes: recordFormats)) - : MimeTypeList.stateTransition); - const maxFileSize = uploadFor === 'record' ? MaxFileSizeInMB.totalFileSize : multipleFiles ? MaxFileSizeInMB.attachmentLog : MaxFileSizeInMB.stateTransition; - const totalFileSize = multipleFiles ? MaxFileSizeInMB.totalFileSize : MaxFileSizeInMB.stateTransition; - const classes = useStyles(); - const [files, setFiles] = useState([]); - const [newFilename, setNewFilename] = useState(""); - const [extension, setExtension] = useState(""); - const [errorMessage, setErrorMessage] = useState(); - const [tagValue, setTagValue] = useState(uploadFor === 'record' ? "" : "general"); - const attchmentFileNameList = attachmentsArray.map(_file => _file.filename.toLowerCase()); - const totalRecordUploadLimit= TOTAL_RECORDS_UPLOAD_LIMIT ; - const [isMCFMSDPersonal, setIsMCFMSDPersonal] = useState(MinistryNeedsScanning.includes(bcgovcode) && requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL); + const recordFormats = useSelector((state) => state.foiRequests.recordFormats); + useEffect(() => { + setMimeTypes( + multipleFiles + ? uploadFor === "attachment" + ? [...recordFormats, ...MimeTypeList.additional] + : uploadFor === "record" && + (modalFor === "replace" || modalFor === "replaceattachment") + ? replacementfiletypes + : recordFormats + : MimeTypeList.stateTransition + ); + }, [recordFormats]); + const [mimeTypes, setMimeTypes] = useState( + multipleFiles + ? uploadFor === "attachment" + ? [...recordFormats, ...MimeTypeList.additional] + : uploadFor === "record" && + (modalFor === "replace" || modalFor === "replaceattachment") + ? replacementfiletypes + : recordFormats + : MimeTypeList.stateTransition + ); + const maxFileSize = + uploadFor === "record" + ? MaxFileSizeInMB.totalFileSize + : multipleFiles + ? MaxFileSizeInMB.attachmentLog + : MaxFileSizeInMB.stateTransition; + const totalFileSize = multipleFiles + ? MaxFileSizeInMB.totalFileSize + : MaxFileSizeInMB.stateTransition; + const classes = useStyles(); + const [files, setFiles] = useState([]); + const [newFilename, setNewFilename] = useState(""); + const [extension, setExtension] = useState(""); + const [errorMessage, setErrorMessage] = useState(); + const [tagValue, setTagValue] = useState( + uploadFor === "record" ? "" : "general" + ); + const attchmentFileNameList = attachmentsArray.map((_file) => + _file.filename.toLowerCase() + ); + const totalRecordUploadLimit = TOTAL_RECORDS_UPLOAD_LIMIT; + const [isMCFMSDPersonal, setIsMCFMSDPersonal] = useState( + MinistryNeedsScanning.includes(bcgovcode) && + requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL + ); - useEffect(() => { - parseFileName(attachment); - }, [attachment]) + useEffect(() => { + parseFileName(attachment); + }, [attachment]); - useEffect(() => { - setIsMCFMSDPersonal(MinistryNeedsScanning.includes(bcgovcode) && requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL); - }, [bcgovcode, requestType]) + useEffect(() => { + setIsMCFMSDPersonal( + MinistryNeedsScanning.includes(bcgovcode) && + requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL + ); + }, [bcgovcode, requestType]); - const parseFileName = (_attachment) => { - setNewFilename(""); - setExtension(""); - setErrorMessage(""); - if(_attachment && _attachment.filename) { - let lastIndex = _attachment.filename.lastIndexOf("."); - setNewFilename(lastIndex>0?_attachment.filename.substr(0, lastIndex):_attachment.filename); - setExtension(lastIndex>0?_attachment.filename.substr(lastIndex+1):""); - } + const parseFileName = (_attachment) => { + setNewFilename(""); + setExtension(""); + setErrorMessage(""); + if (_attachment && _attachment.filename) { + let lastIndex = _attachment.filename.lastIndexOf("."); + setNewFilename( + lastIndex > 0 + ? _attachment.filename.substr(0, lastIndex) + : _attachment.filename + ); + setExtension( + lastIndex > 0 ? _attachment.filename.substr(lastIndex + 1) : "" + ); } + }; - const checkInvalidCharacters = (fname) => { - let rg1 = /^[^\/:*?"<>|]+$/; // forbidden characters / : * ? " < > | - return !fname || rg1.test(fname); - }; + const checkInvalidCharacters = (fname) => { + let rg1 = /^[^\/:*?"<>|]+$/; // forbidden characters / : * ? " < > | + return !fname || rg1.test(fname); + }; - const validateFilename = (fname) => { - let rg1 = /^[^\/:*?"<>|]+$/; // forbidden characters / : * ? " < > | - let rg2 = /^\./; // cannot start with dot (.) - //let rg3 = /^(nul|prn|con|lpt\d|com\d)(.|$)/i; // forbidden file names + const validateFilename = (fname) => { + let rg1 = /^[^\/:*?"<>|]+$/; // forbidden characters / : * ? " < > | + let rg2 = /^\./; // cannot start with dot (.) + //let rg3 = /^(nul|prn|con|lpt\d|com\d)(.|$)/i; // forbidden file names - return fname && rg1.test(fname) && !rg2.test(fname); - }; + return fname && rg1.test(fname) && !rg2.test(fname); + }; - const containDuplicate = (fname) => { - if(attachment.filename !== (fname+"."+extension)) { - return attchmentFileNameList.includes((fname+"."+extension).toLocaleLowerCase()); - } else { - return false; - } + const containDuplicate = (fname) => { + if (attachment.filename !== fname + "." + extension) { + return attchmentFileNameList.includes( + (fname + "." + extension).toLocaleLowerCase() + ); + } else { + return false; + } + }; + + const updateFilename = (e) => { + if (checkInvalidCharacters(e.target.value)) { + setNewFilename(e.target.value); + setErrorMessage(""); + } else { + setErrorMessage( + `File name cannot contain these characters, / : * ? " < > |` + ); + } + }; + + const saveNewCategory = () => { + handleReclassify(attachment, tagValue); + }; + + useEffect(() => { + if (attachment && attachment.category && modalFor == "reclassify") { + setTagValue(attachment.category?.toLowerCase()); } + }, [modalFor, attachment]); - const updateFilename = (e) => { - if(checkInvalidCharacters(e.target.value)) { - setNewFilename(e.target.value); + const saveNewFilename = () => { + if (validateFilename(newFilename)) { + if (!containDuplicate(newFilename)) { setErrorMessage(""); + handleRename(attachment, newFilename + "." + extension); } else { - setErrorMessage(`File name cannot contain these characters, / : * ? " < > |`); + setErrorMessage( + `File name "${newFilename}.${extension}" already exists` + ); } - }; - - const saveNewCategory = () => { - handleReclassify(attachment, tagValue); + } else { + setErrorMessage( + `File name cannot be empty and cannot contain these characters, / : * ? " < > |` + ); } + }; - useEffect(() => { - if (attachment && attachment.category && modalFor == "reclassify") { - setTagValue(attachment.category?.toLowerCase()) + const updateFilesCb = (_files, _errorMessage) => { + setFiles(_files); + }; + const handleClose = () => { + if ( + (files.length > 0 && files !== existingDocuments) || + (modalFor === "rename" && + attachment.filename !== newFilename + "." + extension) + ) { + if ( + window.confirm( + "Are you sure you want to leave? Your changes will be lost." + ) + ) { + setFiles([]); + handleModal(false); + parseFileName(attachment); } - }, [modalFor, attachment]) + } else { + handleModal(false); + parseFileName(attachment); + } + if (uploadFor === "record") setTagValue(""); + }; + + const handleTagChange = (_tagValue) => { + setTagValue(_tagValue); + }; - const saveNewFilename = () => { - if(validateFilename(newFilename)) { - if(!containDuplicate(newFilename)) { - setErrorMessage(""); - handleRename(attachment, newFilename+"."+extension); + const handleSave = () => { + if (modalFor.toLowerCase() === "delete") { + handleModal(true, null, null); + } else { + let fileInfoList = []; + + let fileStatusTransition = ""; + if (modalFor === "replace" || modalFor === "replaceattachment") { + fileStatusTransition = attachment?.category; + } else if (uploadFor === "record") { + if ( + bcgovcode == "MCF" && + requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL + ) { + 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 { - setErrorMessage(`File name "${newFilename}.${extension}" already exists`); + fileStatusTransition = divisions.find( + (division) => division.divisionid === tagValue + ).divisionname; } } else { - setErrorMessage(`File name cannot be empty and cannot contain these characters, / : * ? " < > |`); + fileStatusTransition = tagValue; } - }; + fileInfoList = files?.map((file) => { + return { + ministrycode: uploadFor === "record" ? bcgovcode : "Misc", + requestnumber: requestNumber ? requestNumber : `U-00${requestId}`, + filestatustransition: fileStatusTransition, + filename: file.filename ? file.filename : file.name, + filesize: file.size, + ...(uploadFor === "record" && { divisionid: tagValue }), + }; + }); - const updateFilesCb = (_files, _errorMessage) => { - setFiles(_files); + handleModal(true, fileInfoList, files); + setFiles([]); + if (uploadFor === "record") setTagValue(""); } - const handleClose = () => { - if ((files.length > 0 && files !== existingDocuments) || (modalFor === 'rename' && attachment.filename !== (newFilename+"."+extension))) { - if (window.confirm("Are you sure you want to leave? Your changes will be lost.")) { - setFiles([]); - handleModal(false); - parseFileName(attachment); - } + }; + const getMessage = () => { + let _message = {}; + switch (modalFor.toLowerCase()) { + case "add": + if (isMCFMSDPersonal && !isMinistryCoordinator) { + return { title: "Add Scanned Records", body: "" }; + } else { + return { title: "Add Attachment", body: "" }; } - else { - handleModal(false); - parseFileName(attachment); + case "replaceattachment": + if (uploadFor === "record") { + _message = { + title: "Replace Records", + body: ( + <> + Replace the existing record with a reformatted or updated + version of the same record.

The original file that was + uploaded will still be available for download. + + ), + }; } - if (uploadFor === 'record') setTagValue(""); - }; - - const handleTagChange = (_tagValue) => { - setTagValue(_tagValue); - }; - - const handleSave = () => { - if (modalFor.toLowerCase() === "delete") { - handleModal(true, null, null); - } - else { - let fileInfoList = []; - - let fileStatusTransition = ""; - if (modalFor === 'replace' || modalFor === "replaceattachment") { - fileStatusTransition = attachment?.category; - } else if (uploadFor === "record") { - if(bcgovcode == "MCF" && requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL) { - 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 { - fileStatusTransition = divisions.find(division => division.divisionid === tagValue).divisionname; + return _message; + case "replace": + if (uploadFor === "record") { + _message = { + title: "Replace Records", + body: ( + <> + Replace the existing record with a reformatted or updated + version of the same record.

The original file that was + uploaded will still be available for download. + + ), + }; + } else if (attachment) { + switch (attachment.category.toLowerCase()) { + case StateTransitionCategories.cfrreview.name: + _message = { + title: "Replace Attachment", + body: ( + <> + This attachment must be replaced as it was uploaded during + the state change. Please replace attachment with document + from Request #{requestNumber} changing from{" "} + {StateTransitionCategories.cfrreview.fromState} to{" "} + {StateTransitionCategories.cfrreview.toState}. + + ), + }; + break; + case StateTransitionCategories.cfrfeeassessed.name: + _message = { + title: "Replace Attachment", + body: ( + <> + This attachment must be replaced as it was uploaded during + the state change. Please replace attachment with document + from Request #{requestNumber} changing from{" "} + + {" "} + {StateTransitionCategories.cfrfeeassessed.fromState}{" "} + {" "} + to{" "} + {StateTransitionCategories.cfrfeeassessed.toState} . + + ), + }; + break; + case StateTransitionCategories.signoffresponse.name: + _message = { + title: "Replace Attachment", + body: ( + <> + This attachment must be replaced as it was uploaded during + the state change. Please replace attachment with document + from Request #{requestNumber} changing from{" "} + {StateTransitionCategories.signoffresponse.fromState}{" "} + to{" "} + {StateTransitionCategories.signoffresponse.toState}. + + ), + }; + break; + case StateTransitionCategories.harmsreview.name: + _message = { + title: "Replace Attachment", + body: ( + <> + This attachment must be replaced as it was uploaded during + the state change. Please replace attachment with document + from Request #{requestNumber} changing from{" "} + {StateTransitionCategories.harmsreview.fromState} to{" "} + {StateTransitionCategories.harmsreview.toState}. + + ), + }; + break; + case StateTransitionCategories.responsereview.name: + _message = { + title: "Replace Attachment", + body: ( + <> + This attachment must be replaced as it was uploaded during + the state change. Please replace attachment with document + from Request #{requestNumber} changing from{" "} + {StateTransitionCategories.responsereview.fromState}{" "} + to {StateTransitionCategories.responsereview.toState} + . + + ), + }; + break; + case StateTransitionCategories.signoffreview.name: + _message = { + title: "Replace Attachment", + body: ( + <> + This attachment must be replaced as it was uploaded during + the state change. Please replace attachment with document + from Request #{requestNumber} changing from{" "} + {StateTransitionCategories.signoffreview.fromState}{" "} + to {StateTransitionCategories.signoffreview.toState}. + + ), + }; + break; + default: + _message = { + title: "Replace Attachment", + body: `This attachment must be replaced as it was uploaded during the state change. Please replace attachment with document from Request #${requestNumber}`, + }; + break; } - } else { - fileStatusTransition = tagValue } - fileInfoList = files?.map(file => { + return _message; + case "rename": + return { title: "Rename Attachment", body: "" }; + case "reclassify": + return { title: "Reclassify Attachment", body: "" }; + case "delete": + if (uploadFor === "record") { return { - ministrycode: uploadFor === "record" ? bcgovcode : "Misc", - requestnumber: requestNumber ? requestNumber : `U-00${requestId}`, - filestatustransition: fileStatusTransition, - filename: file.filename? file.filename : file.name, - filesize: file.size, - ...(uploadFor === "record") && {divisionid: tagValue} - } - }); - - handleModal(true, fileInfoList, files); - setFiles([]); - if (uploadFor === 'record') setTagValue(""); - } - } - const getMessage = () => { - switch(modalFor.toLowerCase()) { - case "add": - if(isMCFMSDPersonal && !isMinistryCoordinator) { - return {title: "Add Scanned Records", body: ""}; - } - else - { - return {title: "Add Attachment", body: ""}; - } - case "replaceattachment": - if (uploadFor === 'record') { - _message = {title: "Replace Records", body:<>Replace the existing record with a reformatted or updated version of the same record.

The original file that was uploaded will still be available for download. } - } - return _message; - case "replace": - let _message = {}; - if (uploadFor === 'record') { - _message = {title: "Replace Records", body:<>Replace the existing record with a reformatted or updated version of the same record.

The original file that was uploaded will still be available for download. } - } else if (attachment) { - switch(attachment.category.toLowerCase()) { - case StateTransitionCategories.cfrreview.name: - _message = {title: "Replace Attachment", body: <>This attachment must be replaced as it was uploaded during the state change. Please replace attachment with document from Request #{requestNumber} changing from {StateTransitionCategories.cfrreview.fromState} to {StateTransitionCategories.cfrreview.toState}.}; - break; - case StateTransitionCategories.cfrfeeassessed.name: - _message = {title: "Replace Attachment", body: <>This attachment must be replaced as it was uploaded during the state change. Please replace attachment with document from Request #{requestNumber} changing from {StateTransitionCategories.cfrfeeassessed.fromState} to {StateTransitionCategories.cfrfeeassessed.toState} .}; - break; - case StateTransitionCategories.signoffresponse.name: - _message = {title: "Replace Attachment", body: <>This attachment must be replaced as it was uploaded during the state change. Please replace attachment with document from Request #{requestNumber} changing from {StateTransitionCategories.signoffresponse.fromState} to {StateTransitionCategories.signoffresponse.toState}.}; - break; - case StateTransitionCategories.harmsreview.name: - _message = {title: "Replace Attachment", body: <>This attachment must be replaced as it was uploaded during the state change. Please replace attachment with document from Request #{requestNumber} changing from {StateTransitionCategories.harmsreview.fromState} to {StateTransitionCategories.harmsreview.toState}.}; - break; - case StateTransitionCategories.responsereview.name: - _message = {title: "Replace Attachment", body: <>This attachment must be replaced as it was uploaded during the state change. Please replace attachment with document from Request #{requestNumber} changing from {StateTransitionCategories.responsereview.fromState} to {StateTransitionCategories.responsereview.toState}.}; - break; - case StateTransitionCategories.signoffreview.name: - _message = {title: "Replace Attachment", body: <>This attachment must be replaced as it was uploaded during the state change. Please replace attachment with document from Request #{requestNumber} changing from {StateTransitionCategories.signoffreview.fromState} to {StateTransitionCategories.signoffreview.toState}.}; - break; - default: - _message = {title: "Replace Attachment", body:`This attachment must be replaced as it was uploaded during the state change. Please replace attachment with document from Request #${requestNumber}` } - break; - } - } - return _message; - case "rename": - return {title: "Rename Attachment", body: ""}; - case "reclassify": - return {title: "Reclassify Attachment", body: ""} - case "delete": - if (uploadFor === 'record') { - return {title: "Delete Record", body: <>Are you sure you want to delete this record?

If you delete this record, the record will not appear in the redaction app for review by IAO.}; - } else { - return {title: "Delete Attachment", body: "Are you sure you want to delete the attachment?"}; - } - default: - return {title: "", body: ""}; - } + title: "Delete Record", + body: ( + <> + Are you sure you want to delete this record?

+ + If you delete this record, the record will not appear in the + redaction app for review by IAO. + + + ), + }; + } else { + return { + title: "Delete Attachment", + body: "Are you sure you want to delete the attachment?", + }; + } + default: + return { title: "", body: "" }; } - let message = getMessage(); + }; + let message = getMessage(); - const isSaveDisabled = () => { - if (modalFor === 'delete') { - return false; - } else if (files.length === 0 && existingDocuments.length === 0) { - return true; - } else if (modalFor === 'add') { - return tagValue === ""; - } else if (modalFor === 'replace' || modalFor === 'replaceattachment') { - return false; - } + const isSaveDisabled = () => { + if (modalFor === "delete") { + return false; + } else if (files.length === 0 && existingDocuments.length === 0) { + return true; + } else if (modalFor === "add") { + return tagValue === ""; + } else if (modalFor === "replace" || modalFor === "replaceattachment") { + return false; } - - const MCFSections = useSelector((state) => state.foiRequests.foiPersonalSections); - const MSDSections = useSelector((state) => state.foiRequests.foiPersonalDivisionsAndSections); + }; + + const MCFSections = useSelector( + (state) => state.foiRequests.foiPersonalSections + ); + const MSDSections = useSelector( + (state) => state.foiRequests.foiPersonalDivisionsAndSections + ); - return ( -
- + + - -

{message.title}

- - - -
- - -
- - {message.body} - -
- {modalFor === 'reclassify' && +

{message.title}

+ + + +
+ + +
+ {message.body} +
+ {modalFor === "reclassify" && (
- Select the tag that you would like to reclassify this document with + + Select the tag that you would like to reclassify this + document with +
- {tagList.map(tag => + {tagList.map((tag) => ( {handleTagChange(tag.name)}} + onClick={() => { + handleTagChange(tag.name); + }} clicked={tagValue == tag.name} /> - )} + ))}
- } - { - (['replaceattachment','replace','add'].includes(modalFor)) ? - (requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL) ? - (bcgovcode == "MCF") ? - - : - (bcgovcode == "MSD" && MSDSections?.divisions?.length > 0) ? - - : - - : - + ) : bcgovcode == "MSD" && MSDSections?.divisions?.length > 0 ? ( + + ) : ( + - : - - } -
-
- - { - modalFor === 'reclassify' && - - } - { - modalFor === 'rename' && - - } - { - modalFor !== 'rename' && modalFor !== 'reclassify' && - - } - - -
-
- ); + )} + {modalFor === "rename" && ( + + )} + {modalFor !== "rename" && modalFor !== "reclassify" && ( + + )} + + + + + ); } -const ModalForRename = ({modalFor, newFilename, updateFilename, errorMessage, extension}) => { - - return( - modalFor === 'rename'? -
-
-
- -
-
- .{extension} -
-
-
- : null - ) -} +const ModalForRename = ({ + modalFor, + newFilename, + updateFilename, + errorMessage, + extension, +}) => { + return modalFor === "rename" ? ( +
+
+
+ +
+
.{extension}
+
+
+ ) : null; +}; From 4166929f279e71090b4d4761fc6062d0778f7cee Mon Sep 17 00:00:00 2001 From: divyav-aot Date: Fri, 17 Nov 2023 16:55:54 -0500 Subject: [PATCH 2/2] Added response in the onhold state dropdown --- .../FOI/customComponents/StateDropDown.js | 101 +++--- .../src/constants/FOI/statusEnum.js | 310 +++++++++++++----- 2 files changed, 293 insertions(+), 118 deletions(-) diff --git a/forms-flow-web/src/components/FOI/customComponents/StateDropDown.js b/forms-flow-web/src/components/FOI/customComponents/StateDropDown.js index 459aa806b..c2a637b52 100644 --- a/forms-flow-web/src/components/FOI/customComponents/StateDropDown.js +++ b/forms-flow-web/src/components/FOI/customComponents/StateDropDown.js @@ -21,13 +21,17 @@ const StateDropDown = ({ stateTransition, updateStateDropDown, requestType, - isDivisionalCoordinator + isDivisionalCoordinator, }) => { const _isMinistryCoordinator = isMinistryCoordinator; const [status, setStatus] = useState(requestState); - const cfrFeeData = useSelector((reduxState) => reduxState.foiRequests.foiRequestCFRForm.feedata); - const cfrStatus = useSelector((reduxState) => reduxState.foiRequests.foiRequestCFRForm.status); + const cfrFeeData = useSelector( + (reduxState) => reduxState.foiRequests.foiRequestCFRForm.feedata + ); + const cfrStatus = useSelector( + (reduxState) => reduxState.foiRequests.foiRequestCFRForm.status + ); let requestDetails = useSelector( (state) => state.foiRequests.foiRequestDetail @@ -94,9 +98,12 @@ const StateDropDown = ({ if (_isMinistryCoordinator) { _stateList = MinistryStateList; } - const personalRequest = requestType?.toLowerCase() === FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL; + const personalRequest = + requestType?.toLowerCase() === + FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL; const personalIAO = !_isMinistryCoordinator && personalRequest; - + const previousState = + stateTransition?.length > 0 && stateTransition[1]?.status; switch (_state.toLowerCase()) { case StateEnum.unopened.name.toLowerCase(): return _stateList.unopened; @@ -104,27 +111,24 @@ const StateDropDown = ({ if (personalIAO) { return _stateList.intakeinprogressforpersonals; } else { - return _stateList.intakeinprogress; + return _stateList.intakeinprogress; } case StateEnum.peerreview.name.toLowerCase(): - if(!isMinistryCoordinator){ - //const currentStatusVersion = stateTransition[0]?.version; - const previousState = stateTransition?.length > 0 && stateTransition[1]?.status; - if(previousState === StateEnum.intakeinprogress.name){ + if (!isMinistryCoordinator) { + //const currentStatusVersion = stateTransition[0]?.version; + if (previousState === StateEnum.intakeinprogress.name) { return _stateList.intakeinprogress; - } - else if(previousState === StateEnum.open.name) + } else if (previousState === StateEnum.open.name) return _stateList.open; - else if(previousState === StateEnum.review.name) + else if (previousState === StateEnum.review.name) return _stateList.review; - else if(previousState === StateEnum.consult.name) + else if (previousState === StateEnum.consult.name) return _stateList.consult; - else if(previousState === StateEnum.response.name) + else if (previousState === StateEnum.response.name) return _stateList.response; - else if(previousState === StateEnum.appfeeowing.name) - return _stateList.appfeeowing - } - else{ + else if (previousState === StateEnum.appfeeowing.name) + return _stateList.appfeeowing; + } else { return _stateList.peerreview; } case StateEnum.open.name.toLowerCase(): @@ -136,50 +140,69 @@ const StateDropDown = ({ case StateEnum.callforrecords.name.toLowerCase(): if (_isMinistryCoordinator && personalRequest) return _stateList.callforrecordsforpersonal; - if(personalIAO && (requestDetails.bcgovcode.toLowerCase() === "mcf" || requestDetails.bcgovcode.toLowerCase() === "msd")) - return _stateList.callforrecordscfdmsdpersonal + if ( + personalIAO && + (requestDetails.bcgovcode.toLowerCase() === "mcf" || + requestDetails.bcgovcode.toLowerCase() === "msd") + ) + return _stateList.callforrecordscfdmsdpersonal; return _stateList.callforrecords; case StateEnum.tagging.name.toLowerCase(): - return _stateList.tagging; + return _stateList.tagging; case StateEnum.readytoscan.name.toLowerCase(): - return _stateList.readytoscan; + return _stateList.readytoscan; case StateEnum.review.name.toLowerCase(): - if(personalIAO && (requestDetails.bcgovcode.toLowerCase() === "mcf" || requestDetails.bcgovcode.toLowerCase() === "msd")) - return _stateList.reviewcfdmsdpersonal + if ( + personalIAO && + (requestDetails.bcgovcode.toLowerCase() === "mcf" || + requestDetails.bcgovcode.toLowerCase() === "msd") + ) + return _stateList.reviewcfdmsdpersonal; return _stateList.review; case StateEnum.onhold.name.toLowerCase(): + if (previousState === StateEnum.response.name) { + return _stateList.onhold.filter( + (_state) => + _state.status.toLowerCase() !== + StateEnum.callforrecords.name.toLowerCase() + ); + } else if (previousState === StateEnum.feeassessed.name) { + return _stateList.onhold.filter( + (_state) => + _state.status.toLowerCase() !== + StateEnum.response.name.toLowerCase() + ); + } return _stateList.onhold; case StateEnum.consult.name.toLowerCase(): return _stateList.consult; case StateEnum.signoff.name.toLowerCase(): return _stateList.signoff; case StateEnum.feeassessed.name.toLowerCase(): - if (personalIAO) - return _stateList.feeassessedforpersonal; + if (personalIAO) return _stateList.feeassessedforpersonal; return _stateList.feeassessed; - case StateEnum.onhold.name.toLowerCase(): - return _stateList.onhold; case StateEnum.deduplication.name.toLowerCase(): return _stateList.deduplication; case StateEnum.harms.name.toLowerCase(): return _stateList.harms; case StateEnum.response.name.toLowerCase(): - if (personalIAO) - return _stateList.responseforpersonal; - else if (cfrFeeData?.balanceremaining > 0 && cfrStatus === 'approved') { + if (personalIAO) return _stateList.responseforpersonal; + else if (cfrFeeData?.balanceremaining > 0 && cfrStatus === "approved") { return _stateList.response; - } - else { - return _stateList.response.filter(val => val.status.toLowerCase() !== StateEnum.onhold.name.toLowerCase()); + } else { + return _stateList.response.filter( + (val) => + val.status.toLowerCase() !== StateEnum.onhold.name.toLowerCase() + ); } case StateEnum.section5pending.name.toLowerCase(): if (personalIAO) { return _stateList.section5pending; - } - break + } + break; case StateEnum.appfeeowing.name.toLowerCase(): return _stateList.appfeeowing; - + default: return []; } @@ -217,7 +240,7 @@ const StateDropDown = ({ label="Status" className="foi-state-dropdown" InputLabelProps={{ shrink: false }} - inputProps={{'aria-labelledby': 'foi-status-dropdown-label'}} + inputProps={{ "aria-labelledby": "foi-status-dropdown-label" }} select value={status} onChange={handleChange} diff --git a/forms-flow-web/src/constants/FOI/statusEnum.js b/forms-flow-web/src/constants/FOI/statusEnum.js index 67f6bed93..aae8ef2ae 100644 --- a/forms-flow-web/src/constants/FOI/statusEnum.js +++ b/forms-flow-web/src/constants/FOI/statusEnum.js @@ -1,74 +1,214 @@ const StateList = Object.freeze({ - unopened: [{status: "Unopened", isSelected: false}, {status:"Intake in Progress", isSelected: false}], - intakeinprogress: [{status:"Intake in Progress", isSelected: false}, {status: "Open", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Redirect", isSelected: false}, {status: "App Fee Owing", isSelected: false}, {status: "Closed", isSelected: false}], - intakeinprogressforpersonals: [{status:"Intake in Progress", isSelected: false}, {status: "Open", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Redirect", isSelected: false}, {status: "Section 5 Pending", isSelected: false}, {status: "Closed", isSelected: false}], - redirect: [{status: "Redirect", isSelected: false}, {status:"Intake in Progress", isSelected: false}, {status: "Closed", isSelected: false}], - open: [{status: "Open", isSelected: false}, {status: "Call For Records", isSelected: false}, {status:"Peer Review", isSelected: false},{status: "Closed", isSelected: false}], - callforrecords: [{status: "Call For Records", isSelected: false}, {status: "Open", isSelected: false}, {status: "Closed", isSelected: false}], - callforrecordscfdmsdpersonal: [{status: "Call For Records", isSelected: false}, {status: "Open", isSelected: false}, {status: "Tagging", isSelected: false},{status: "Ready to Scan", isSelected: false}, {status: "Closed", isSelected: false}], - tagging :[{status: "Tagging", isSelected: true},{status: "Call For Records", isSelected: false}, {status: "Ready to Scan", isSelected: false},{status: "Records Review", isSelected: false}, {status: "Closed", isSelected: false}], - readytoscan : [{status: "Ready to Scan", isSelected: true},{status: "Call For Records", isSelected: false}, {status: "Tagging", isSelected: false},{status: "Records Review", isSelected: false}, {status: "Closed", isSelected: false}], - feeassessed: [{status: "Fee Estimate", isSelected: false}, {status: "On Hold", isSelected: false}, {status: "Call For Records", isSelected: false}, {status: "Closed", isSelected: false}], - feeassessedforpersonal: [{status: "Fee Estimate", isSelected: false}, {status: "Call For Records", isSelected: false}, {status: "Closed", isSelected: false}], - onhold: [{status: "On Hold", isSelected: false}, {status: "Call For Records", isSelected: false}, {status: "Closed", isSelected: false}], - deduplication: [{status: "Deduplication", isSelected: false}, {status: "Harms Assessment", isSelected: false}, {status: "Records Review", isSelected: false}, {status: "Closed", isSelected: false}], - harms: [{status: "Harms Assessment", isSelected: false}, {status: "Closed", isSelected: false}], - consult: [{status: "Consult", isSelected: false}, {status: "Records Review", isSelected: false}, {status: "Ministry Sign Off", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Closed", isSelected: false}], - review: [{status: "Records Review", isSelected: false}, {status: "Call For Records", isSelected: false}, {status: "Consult", isSelected: false}, {status: "Ministry Sign Off", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Response", isSelected: false}, {status: "Closed", isSelected: false}], - reviewcfdmsdpersonal: [{status: "Records Review", isSelected: false}, {status: "Call For Records", isSelected: false},{status: "Tagging", isSelected: false}, {status: "Consult", isSelected: false}, {status: "Ministry Sign Off", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Response", isSelected: false}, {status: "Closed", isSelected: false}], - signoff: [{status: "Ministry Sign Off", isSelected: false}, {status: "Closed", isSelected: false}], - response: [{status: "Response", isSelected: false}, {status: "On Hold", isSelected: false}, {status: "Records Review", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Closed", isSelected: false}], - responseforpersonal: [{status: "Response", isSelected: false}, {status: "Records Review", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Closed", isSelected: false}], - //peerreview: [{status:"Peer Review", isSelected: false},{status:"Intake in Progress", isSelected: false}, {status: "Open", isSelected: false},{status: "Records Review", isSelected: false},{status: "Consult", isSelected: false},{status: "Response", isSelected: false}], - peerreview: [{status:"Peer Review", isSelected: false}], - section5pending: [{status: "Section 5 Pending", isSelected: false}, {status: "Open", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Redirect", isSelected: false}, {status: "Closed", isSelected: false}], - appfeeowing: [{status: "App Fee Owing", isSelected: false}, {status: "Open", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Redirect", isSelected: false}, {status: "Closed", isSelected: false}] - }); + unopened: [ + { status: "Unopened", isSelected: false }, + { status: "Intake in Progress", isSelected: false }, + ], + intakeinprogress: [ + { status: "Intake in Progress", isSelected: false }, + { status: "Open", isSelected: false }, + { status: "Peer Review", isSelected: false }, + { status: "Redirect", isSelected: false }, + { status: "App Fee Owing", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + intakeinprogressforpersonals: [ + { status: "Intake in Progress", isSelected: false }, + { status: "Open", isSelected: false }, + { status: "Peer Review", isSelected: false }, + { status: "Redirect", isSelected: false }, + { status: "Section 5 Pending", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + redirect: [ + { status: "Redirect", isSelected: false }, + { status: "Intake in Progress", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + open: [ + { status: "Open", isSelected: false }, + { status: "Call For Records", isSelected: false }, + { status: "Peer Review", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + callforrecords: [ + { status: "Call For Records", isSelected: false }, + { status: "Open", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + callforrecordscfdmsdpersonal: [ + { status: "Call For Records", isSelected: false }, + { status: "Open", isSelected: false }, + { status: "Tagging", isSelected: false }, + { status: "Ready to Scan", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + tagging: [ + { status: "Tagging", isSelected: true }, + { status: "Call For Records", isSelected: false }, + { status: "Ready to Scan", isSelected: false }, + { status: "Records Review", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + readytoscan: [ + { status: "Ready to Scan", isSelected: true }, + { status: "Call For Records", isSelected: false }, + { status: "Tagging", isSelected: false }, + { status: "Records Review", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + feeassessed: [ + { status: "Fee Estimate", isSelected: false }, + { status: "On Hold", isSelected: false }, + { status: "Call For Records", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + feeassessedforpersonal: [ + { status: "Fee Estimate", isSelected: false }, + { status: "Call For Records", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + onhold: [ + { status: "On Hold", isSelected: false }, + { status: "Call For Records", isSelected: false }, + { status: "Response", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + deduplication: [ + { status: "Deduplication", isSelected: false }, + { status: "Harms Assessment", isSelected: false }, + { status: "Records Review", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + harms: [ + { status: "Harms Assessment", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + consult: [ + { status: "Consult", isSelected: false }, + { status: "Records Review", isSelected: false }, + { status: "Ministry Sign Off", isSelected: false }, + { status: "Peer Review", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + review: [ + { status: "Records Review", isSelected: false }, + { status: "Call For Records", isSelected: false }, + { status: "Consult", isSelected: false }, + { status: "Ministry Sign Off", isSelected: false }, + { status: "Peer Review", isSelected: false }, + { status: "Response", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + reviewcfdmsdpersonal: [ + { status: "Records Review", isSelected: false }, + { status: "Call For Records", isSelected: false }, + { status: "Tagging", isSelected: false }, + { status: "Consult", isSelected: false }, + { status: "Ministry Sign Off", isSelected: false }, + { status: "Peer Review", isSelected: false }, + { status: "Response", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + signoff: [ + { status: "Ministry Sign Off", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + response: [ + { status: "Response", isSelected: false }, + { status: "On Hold", isSelected: false }, + { status: "Records Review", isSelected: false }, + { status: "Peer Review", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + responseforpersonal: [ + { status: "Response", isSelected: false }, + { status: "Records Review", isSelected: false }, + { status: "Peer Review", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + //peerreview: [{status:"Peer Review", isSelected: false},{status:"Intake in Progress", isSelected: false}, {status: "Open", isSelected: false},{status: "Records Review", isSelected: false},{status: "Consult", isSelected: false},{status: "Response", isSelected: false}], + peerreview: [{ status: "Peer Review", isSelected: false }], + section5pending: [ + { status: "Section 5 Pending", isSelected: false }, + { status: "Open", isSelected: false }, + { status: "Peer Review", isSelected: false }, + { status: "Redirect", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + appfeeowing: [ + { status: "App Fee Owing", isSelected: false }, + { status: "Open", isSelected: false }, + { status: "Peer Review", isSelected: false }, + { status: "Redirect", isSelected: false }, + { status: "Closed", isSelected: false }, + ], +}); const MinistryStateList = Object.freeze({ - unopened: [{status: "Unopened", isSelected: false}], - intakeinprogress: [{status:"Intake in Progress", isSelected: false}], - redirect: [{status: "Redirect", isSelected: false}], - open: [{status: "Open", isSelected: false}], - callforrecords: [{status: "Call For Records", isSelected: false}, {status: "Fee Estimate", isSelected: false}, {status: "Harms Assessment", isSelected: false}, {status: "Deduplication", isSelected: false}, {status: "Records Review", isSelected: false}, {status: "Ministry Sign Off", isSelected: false}], - callforrecordsforpersonal: [{status: "Call For Records", isSelected: false}, {status: "Harms Assessment", isSelected: false}, {status: "Deduplication", isSelected: false}, {status: "Records Review", isSelected: false}, {status: "Ministry Sign Off", isSelected: false}], - feeassessed: [{status: "Fee Estimate", isSelected: false}], - onhold: [{status: "On Hold", isSelected: false}], - deduplication: [{status: "Deduplication", isSelected: false}], - harms: [{status: "Harms Assessment", isSelected: false}, {status: "Call For Records", isSelected: false}, {status: "Records Review", isSelected: false}], - consult: [{status: "Consult", isSelected: false}], - review: [{status: "Records Review", isSelected: false}], - signoff: [{status: "Ministry Sign Off", isSelected: false}, {status: "Records Review", isSelected: false}, {status: "Response", isSelected: false}], - response: [{status: "Response", isSelected: false}], - closed: [{status: "Closed", isSelected: false}], - peerreview: [{status: "Peer Review", isSelected: false}], - tagging :[{status: "Tagging", isSelected: true}], - readytoscan : [{status: "Ready to Scan", isSelected: true}] + unopened: [{ status: "Unopened", isSelected: false }], + intakeinprogress: [{ status: "Intake in Progress", isSelected: false }], + redirect: [{ status: "Redirect", isSelected: false }], + open: [{ status: "Open", isSelected: false }], + callforrecords: [ + { status: "Call For Records", isSelected: false }, + { status: "Fee Estimate", isSelected: false }, + { status: "Harms Assessment", isSelected: false }, + { status: "Deduplication", isSelected: false }, + { status: "Records Review", isSelected: false }, + { status: "Ministry Sign Off", isSelected: false }, + ], + callforrecordsforpersonal: [ + { status: "Call For Records", isSelected: false }, + { status: "Harms Assessment", isSelected: false }, + { status: "Deduplication", isSelected: false }, + { status: "Records Review", isSelected: false }, + { status: "Ministry Sign Off", isSelected: false }, + ], + feeassessed: [{ status: "Fee Estimate", isSelected: false }], + onhold: [{ status: "On Hold", isSelected: false }], + deduplication: [{ status: "Deduplication", isSelected: false }], + harms: [ + { status: "Harms Assessment", isSelected: false }, + { status: "Call For Records", isSelected: false }, + { status: "Records Review", isSelected: false }, + ], + consult: [{ status: "Consult", isSelected: false }], + review: [{ status: "Records Review", isSelected: false }], + signoff: [ + { status: "Ministry Sign Off", isSelected: false }, + { status: "Records Review", isSelected: false }, + { status: "Response", isSelected: false }, + ], + response: [{ status: "Response", isSelected: false }], + closed: [{ status: "Closed", isSelected: false }], + peerreview: [{ status: "Peer Review", isSelected: false }], + tagging: [{ status: "Tagging", isSelected: true }], + readytoscan: [{ status: "Ready to Scan", isSelected: true }], }); // This corresponds to rows in the FOIRequestStatuses table on the backend const StateEnum = Object.freeze({ - open: {name: "Open", id: 1}, - callforrecords: {name: "Call For Records", id: 2}, - callforrecordsoverdue: {name: "Call For Records Overdue", id: -100}, - closed: {name: "Closed", id: 3}, - redirect: {name: "Redirect", id: 4}, - unopened: {name: "Unopened", id: 5}, - intakeinprogress: {name: "Intake in Progress", id: 6}, - review: {name: "Records Review", id: 7}, - feeassessed: {name: "Fee Estimate", id: 8}, - consult: {name: "Consult", id: 9}, - signoff: {name: "Ministry Sign Off", id: 10}, - onhold: {name: "On Hold", id: 11}, - deduplication: {name: "Deduplication", id: 12}, - harms: {name: "Harms Assessment", id: 13}, - response: {name: "Response", id: 14}, - archived: {name: "Archived", id: 15}, - peerreview: {name: "Peer Review", id: 16}, - tagging: {name: "Tagging", id: 17}, - readytoscan: {name: "Ready to Scan", id: 18}, - appfeeowing: {name: "App Fee Owing", id: 19}, - section5pending: {name: "Section 5 Pending", id: 20}, + open: { name: "Open", id: 1 }, + callforrecords: { name: "Call For Records", id: 2 }, + callforrecordsoverdue: { name: "Call For Records Overdue", id: -100 }, + closed: { name: "Closed", id: 3 }, + redirect: { name: "Redirect", id: 4 }, + unopened: { name: "Unopened", id: 5 }, + intakeinprogress: { name: "Intake in Progress", id: 6 }, + review: { name: "Records Review", id: 7 }, + feeassessed: { name: "Fee Estimate", id: 8 }, + consult: { name: "Consult", id: 9 }, + signoff: { name: "Ministry Sign Off", id: 10 }, + onhold: { name: "On Hold", id: 11 }, + deduplication: { name: "Deduplication", id: 12 }, + harms: { name: "Harms Assessment", id: 13 }, + response: { name: "Response", id: 14 }, + archived: { name: "Archived", id: 15 }, + peerreview: { name: "Peer Review", id: 16 }, + tagging: { name: "Tagging", id: 17 }, + readytoscan: { name: "Ready to Scan", id: 18 }, + appfeeowing: { name: "App Fee Owing", id: 19 }, + section5pending: { name: "Section 5 Pending", id: 20 }, }); const StateTransitionCategories = Object.freeze({ @@ -172,14 +312,16 @@ const AttachmentCategories = Object.freeze({ bgcolor: "#04596C", type: ["transition"], }, - { // tag: Add Attachment Modal + { + // tag: Add Attachment Modal name: "applicant", tags: ["applicant"], display: "Applicant", bgcolor: "#F99F16", type: ["tag"], }, - { // transition: Fee estimate -> On hold + { + // transition: Fee estimate -> On hold name: "feeassessed-onhold", tags: ["applicant", "feeassessed-onhold"], display: "Applicant", @@ -229,11 +371,11 @@ const AttachmentCategories = Object.freeze({ type: ["tag"], }, { - name: "ministrysignoff", - tags: ["ministrysignoff"], - display: "Ministry Sign Off", - bgcolor: "#4B296B", - type: ["tag"], + name: "ministrysignoff", + tags: ["ministrysignoff"], + display: "Ministry Sign Off", + bgcolor: "#4B296B", + type: ["tag"], }, { name: "response", @@ -249,28 +391,31 @@ const AttachmentCategories = Object.freeze({ bgcolor: "#595959", type: ["tag"], }, - { // transition: Response -> On hold + { + // transition: Response -> On hold name: "response-onhold", tags: ["response-onhold"], display: "Response > On Hold", bgcolor: "#F99F16", type: ["transition"], }, - { // transition: Records Review -> Response + { + // transition: Records Review -> Response name: "response-review", tags: ["response-review"], display: "Response > Review", bgcolor: "#04596C", type: ["transition"], }, - { // transition: Records Review -> Response + { + // transition: Records Review -> Response name: "signoff-review", tags: ["signoff-review"], display: "Sign Off > Review", bgcolor: "#04596C", type: ["transition"], }, - ] + ], }); const AttachmentLetterCategories = Object.freeze({ @@ -284,17 +429,24 @@ const AttachmentLetterCategories = Object.freeze({ name: "fee estimate - successful", }, feeestimatepaymentreceipt: { - name: "fee estimate - payment receipt" + name: "fee estimate - payment receipt", }, feeestimatepaymentcorrespondencesuccessful: { - name: "fee estimate - payment success" + name: "fee estimate - payment success", }, feeestimatepaymentcorrespondencefailed: { - name: "fee estimate - payment success - correspondence failed" + name: "fee estimate - payment success - correspondence failed", }, feeestimateoutstandingletter: { name: "fee balance outstanding - letter", }, }); -export { StateList, MinistryStateList, StateEnum, StateTransitionCategories, AttachmentCategories, AttachmentLetterCategories }; \ No newline at end of file +export { + StateList, + MinistryStateList, + StateEnum, + StateTransitionCategories, + AttachmentCategories, + AttachmentLetterCategories, +};