From 2736d2e605525656f522c98623f84fd0469b423a Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 30 Nov 2023 11:34:31 -0800 Subject: [PATCH 01/10] Consoles to debug delete refresh issue --- forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js | 2 ++ .../components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx | 2 ++ .../src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js | 2 ++ 3 files changed, 6 insertions(+) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index 64f95c009..d6132bbc2 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -919,6 +919,8 @@ const FOIRequest = React.memo(({ userDetail }) => { requestState !== StateEnum.appfeeowing.name && requestDetails?.requestType === FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_GENERAL) } + + console.log("REQ OBJ", requestDetails) return (!isLoading && requestDetails && diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx index a4c825ce8..f8d67c07c 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx @@ -5,6 +5,8 @@ import './oipcdetails.scss'; const OIPCDetailsList = (props) => { const {oipcData, removeOIPC, updateOIPC} = props; + console.log("COMPONENT", oipcData) + const OIPCItems = oipcData?.map((oipcObj, index) => { return ( <> diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js index 5cdf4b4a5..c7d6da1ad 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js @@ -39,6 +39,8 @@ const useOIPCHook = () => { setOipcData(stagedOIPCData); }, [isOIPCReview]) + console.log("HOOK", oipcData) + //OIPC Functions const addOIPC = () => { From cd04784086410dcdd939e0ff1cc9bc1579b106f1 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 30 Nov 2023 12:16:23 -0800 Subject: [PATCH 02/10] Debugging for delete modal refrehs bug --- .../src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 6 ++++-- .../FOI/FOIRequest/OIPCDetails/RemoveOIPCModal.jsx | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 483518590..10ebd19e3 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -22,6 +22,8 @@ const OIPCItem = (props) => { const [showDeleteModal, setShowDeleteModal] = useState(false); const [showOutcomeModal, setShowOutcomeModal] = useState(false); const [showAmendModal, setShowAmendModal] = useState(false); + + console.log("ITEM", oipc) //Functions const generateNamesFromOIPCId = (oipcObj) => { @@ -147,12 +149,12 @@ const OIPCItem = (props) => { return ( <> -
+
- {showDeleteModal && } + {showDeleteModal && } {showOutcomeModal && } {showAmendModal && } diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/RemoveOIPCModal.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/RemoveOIPCModal.jsx index 853c28b54..878d8bea8 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/RemoveOIPCModal.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/RemoveOIPCModal.jsx @@ -10,12 +10,12 @@ const RemoveOIPCModal= ({ showModal, removeOIPC, setShowModal, - oipcid, + oipc, }) =>{ const handleSave = () => { setShowModal(false); - removeOIPC(oipcid) + removeOIPC(oipc.id) }; const handleClose = () => { setShowModal(false); From 3e3d313f494849d83a920668c0723242987d3e2e Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 30 Nov 2023 12:25:48 -0800 Subject: [PATCH 03/10] Adjust to previous merge --- .../src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 10ebd19e3..507665ebf 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -154,7 +154,7 @@ const OIPCItem = (props) => {
- {showDeleteModal && } + {showDeleteModal && } {showOutcomeModal && } {showAmendModal && } From 0616672c6e09dd5323ad6cf456cea0a9fe83b9f4 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 30 Nov 2023 13:15:31 -0800 Subject: [PATCH 04/10] removal of debug code not needed --- .../src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 507665ebf..0d998b9e2 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -149,7 +149,7 @@ const OIPCItem = (props) => { return ( <> -
+
From 59237f78e13e37f318987c240b1ec59ad9f1c3f4 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Thu, 30 Nov 2023 13:30:43 -0800 Subject: [PATCH 05/10] Add e.preventDefault --- .../src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 0d998b9e2..07401afc7 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -150,7 +150,10 @@ const OIPCItem = (props) => { return ( <>
-
From d1241350a0e45ae24d134ef47d00919e8274a4d0 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 30 Nov 2023 14:14:01 -0800 Subject: [PATCH 06/10] removal of console logs --- forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js | 2 -- .../components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx | 2 -- .../src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 2 -- .../src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js | 2 -- 4 files changed, 8 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index d6132bbc2..64f95c009 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -919,8 +919,6 @@ const FOIRequest = React.memo(({ userDetail }) => { requestState !== StateEnum.appfeeowing.name && requestDetails?.requestType === FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_GENERAL) } - - console.log("REQ OBJ", requestDetails) return (!isLoading && requestDetails && diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx index f8d67c07c..a4c825ce8 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCDetailsList.jsx @@ -5,8 +5,6 @@ import './oipcdetails.scss'; const OIPCDetailsList = (props) => { const {oipcData, removeOIPC, updateOIPC} = props; - console.log("COMPONENT", oipcData) - const OIPCItems = oipcData?.map((oipcObj, index) => { return ( <> diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 07401afc7..545480682 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -22,8 +22,6 @@ const OIPCItem = (props) => { const [showDeleteModal, setShowDeleteModal] = useState(false); const [showOutcomeModal, setShowOutcomeModal] = useState(false); const [showAmendModal, setShowAmendModal] = useState(false); - - console.log("ITEM", oipc) //Functions const generateNamesFromOIPCId = (oipcObj) => { diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js index c7d6da1ad..0d2a06c70 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js @@ -5,7 +5,6 @@ const useOIPCHook = () => { //OIPC State const requestDetails = useSelector((state) => state.foiRequests.foiRequestDetail); const stageOIPCData = (isoipcreview, oipcData) => { - console.log(isoipcreview) if (isoipcreview) { if (oipcData?.length > 0) { return oipcData.map((item, index) => { @@ -41,7 +40,6 @@ const useOIPCHook = () => { console.log("HOOK", oipcData) - //OIPC Functions const addOIPC = () => { setOipcData((prev) => { From 9973d3756294c506bae7193c86aea67933b1000d Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 30 Nov 2023 14:14:27 -0800 Subject: [PATCH 07/10] removal of console logs --- .../src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js index 0d2a06c70..55538aac9 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/oipcHook.js @@ -38,7 +38,7 @@ const useOIPCHook = () => { setOipcData(stagedOIPCData); }, [isOIPCReview]) - console.log("HOOK", oipcData) + // console.log("HOOK", oipcData) //OIPC Functions const addOIPC = () => { From edc4765b87de43853cf5239d2c5a7e79e1d897cb Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 30 Nov 2023 16:31:43 -0800 Subject: [PATCH 08/10] Styling changes --- .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 545480682..557f0c31d 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -194,13 +194,16 @@ const OIPCItem = (props) => { select variant="outlined" fullWidth - value={oipc.reviewtypeid} + value={oipc.reviewtypeid ? oipc.reviewtypeid : -1} label="Review Type" onChange={(event) => handleReviewType(event.target.value)} error={(!oipc.outcomeid || oipc.outcomeid === 5) && oipc.reviewtypeid === null} required disabled={oipc.outcomeid && oipc.outcomeid !== 5} > + + Select Review Type + {uniqueReviewTypes(oipcReviewtypes).map((reviewtype) => { return {reviewtype.type_name} })} @@ -212,13 +215,16 @@ const OIPCItem = (props) => { select variant="outlined" fullWidth - value={oipc.reasonid} + value={oipc.reasonid ? oipc.reasonid : -1} label="Reason" onChange = {(event) => handleReason(event.target.value)} error={(!oipc.outcomeid || oipc.outcomeid === 5) && oipc.reasonid === null} required disabled={oipc.outcomeid && oipc.outcomeid !== 5} > + + Select Review Type & Reason + {oipc.reviewtypeid ? oipcReviewtypes.map((reviewtype) => { if (reviewtype.reviewtypeid === oipc.reviewtypeid) { @@ -233,13 +239,16 @@ const OIPCItem = (props) => { select variant="outlined" fullWidth - value={oipc.statusid} + value={oipc.statusid ? oipc.statusid : -1} label="Status" onChange = {(event) => handleStatus(event.target.value)} error={(!oipc.outcomeid || oipc.outcomeid === 5) && oipc.statusid === null} required disabled={oipc.outcomeid && oipc.outcomeid !== 5} > + + Select Status + {oipcStatuses.map((status) => { return {status.name} })} @@ -264,9 +273,12 @@ const OIPCItem = (props) => { variant="outlined" onChange = {(event) => handleOutcome(event.target.value)} fullWidth - value={oipc.outcomeid} + value={oipc.outcomeid ? oipc.outcomeid : -1} label="Outcome" > + + Select Outcome + {oipcOutcomes.map((outcome) => { if (outcome.outcomeid !== 5) { return {outcome.name} From ea3da2e7538a3848117fc61c8fe28d2ab730e62c Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 30 Nov 2023 16:42:12 -0800 Subject: [PATCH 09/10] Default value stylying completed --- .../FOI/FOIRequest/OIPCDetails/OIPCItem.jsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx index 557f0c31d..a9f772b0e 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx +++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx @@ -202,7 +202,7 @@ const OIPCItem = (props) => { disabled={oipc.outcomeid && oipc.outcomeid !== 5} > - Select Review Type + Select Review Type {uniqueReviewTypes(oipcReviewtypes).map((reviewtype) => { return {reviewtype.type_name} @@ -223,7 +223,7 @@ const OIPCItem = (props) => { disabled={oipc.outcomeid && oipc.outcomeid !== 5} > - Select Review Type & Reason + Select Review Type & Reason {oipc.reviewtypeid ? oipcReviewtypes.map((reviewtype) => { @@ -247,7 +247,7 @@ const OIPCItem = (props) => { disabled={oipc.outcomeid && oipc.outcomeid !== 5} > - Select Status + Select Status {oipcStatuses.map((status) => { return {status.name} @@ -277,7 +277,7 @@ const OIPCItem = (props) => { label="Outcome" > - Select Outcome + Select Outcome {oipcOutcomes.map((outcome) => { if (outcome.outcomeid !== 5) { @@ -393,12 +393,15 @@ const OIPCItem = (props) => { variant="outlined" onChange = {(event) => handleInquiryFields(event.target.value, "INQUIRYOUTCOME")} fullWidth - value={oipc.inquiryattributes.inquiryoutcome} + value={oipc.inquiryattributes.inquiryoutcome ? oipc.inquiryattributes.inquiryoutcome : -1} label="Outcome" error={(!oipc.outcomeid || oipc.outcomeid === 5) && oipc.inquiryattributes.inquiryoutcome === null} required disabled={oipc.outcomeid && oipc.outcomeid !== 5} - > + > + + Select Inquiry Outcome + {oipcInquiryoutcomes.map((inquiryoutcome) => { return {inquiryoutcome.name} })} From 6d58e93a464277eb2339b8d2ed70a50883821576 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Thu, 30 Nov 2023 17:13:16 -0800 Subject: [PATCH 10/10] Update disableInput when oipcData is changed --- .../components/FOI/FOIRequest/FOIRequest.js | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index d6132bbc2..2fab44743 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -163,8 +163,7 @@ const FOIRequest = React.memo(({ userDetail }) => { const [attachments, setAttachments] = useState(requestAttachments); const [comment, setComment] = useState([]); const [requestState, setRequestState] = useState(StateEnum.unopened.name); - const disableInput = - requestState?.toLowerCase() === StateEnum.closed.name.toLowerCase(); + const [disableInput, setDisableInput] = useState(requestState?.toLowerCase() === StateEnum.closed.name.toLowerCase()); const [_tabStatus, settabStatus] = React.useState(requestState); let foitabheaderBG = getTabBG(_tabStatus, requestState); @@ -258,7 +257,24 @@ const FOIRequest = React.memo(({ userDetail }) => { const [redactedSections, setRedactedSections] = useState(""); const [isMCFPersonal, setIsMCFPersonal] = useState(bcgovcode.replaceAll('"', '') == "MCF" && requestDetails.requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL); const {oipcData, addOIPC, removeOIPC, updateOIPC, isOIPCReview, setIsOIPCReview} = useOIPCHook(); - + const [oipcDataInitial, setOipcDataInitial] = useState(oipcData); + + //Update disableInput when requestState changes + useEffect(() => { + setDisableInput(requestState?.toLowerCase() === StateEnum.closed.name.toLowerCase()) + }, [requestState]) + + useEffect(() => { + if (!oipcDataInitial) { + setOipcDataInitial(oipcData); + return; + } + //check to see if oipcData has been updated, if so, enable save button + if (JSON.stringify(oipcData) != JSON.stringify(oipcDataInitial)) { + setDisableInput(false) + } + }, [oipcData]); + useEffect(() => { if (window.location.href.indexOf("comments") > -1) { tabclick("Comments");