diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js
index 64f95c009..2a55ca8c1 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");
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..a9f772b0e 100644
--- a/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx
+++ b/forms-flow-web/src/components/FOI/FOIRequest/OIPCDetails/OIPCItem.jsx
@@ -148,11 +148,14 @@ const OIPCItem = (props) => {
return (
<>
-
- {showDeleteModal && }
+ {showDeleteModal && }
{showOutcomeModal && }
{showAmendModal && }
@@ -191,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}
>
+
{uniqueReviewTypes(oipcReviewtypes).map((reviewtype) => {
return
})}
@@ -209,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}
>
+
{oipc.reviewtypeid ?
oipcReviewtypes.map((reviewtype) => {
if (reviewtype.reviewtypeid === oipc.reviewtypeid) {
@@ -230,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}
>
+
{oipcStatuses.map((status) => {
return
})}
@@ -261,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"
>
+
{oipcOutcomes.map((outcome) => {
if (outcome.outcomeid !== 5) {
return
@@ -378,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}
- >
+ >
+
{oipcInquiryoutcomes.map((inquiryoutcome) => {
return
})}
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);
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..851651746 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) => {
@@ -39,7 +38,6 @@ const useOIPCHook = () => {
setOipcData(stagedOIPCData);
}, [isOIPCReview])
-
//OIPC Functions
const addOIPC = () => {
setOipcData((prev) => {