Skip to content

Commit

Permalink
Merge pull request #4717 from bcgov/main-DV-4715
Browse files Browse the repository at this point in the history
moved unSavedRequest state declaration to the top
  • Loading branch information
divyav-aot authored Nov 10, 2023
2 parents 60769de + 9b8770b commit 91aaee2
Showing 1 changed file with 34 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {

import {
fetchFOIMinistryAssignedToList,
fetchFOIPersonalDivisionsAndSections
fetchFOIPersonalDivisionsAndSections,
} from "../../../../apiManager/services/FOI/foiMasterDataServices";

import { fetchFOIRequestAttachmentsList } from "../../../../apiManager/services/FOI/foiAttachmentServices";
Expand Down Expand Up @@ -227,8 +227,12 @@ const MinistryReview = React.memo(({ userDetail }) => {
const [originalDivisions, setOriginalDivisions] = React.useState([]);
const [hasReceivedDate, setHasReceivedDate] = React.useState(true);
const [isMinistryRestricted, setIsMinistryRestricted] = useState(false);
const [isMCFPersonal, setIsMCFPersonal] = useState(bcgovcode.replaceAll('"', '') == "MCF" && requestDetails.requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL);

const [isMCFPersonal, setIsMCFPersonal] = useState(
bcgovcode.replaceAll('"', "") == "MCF" &&
requestDetails.requestType ==
FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL
);
const [unSavedRequest, setUnSavedRequest] = React.useState(false);
let ministryassignedtousername = "Unassigned";
useEffect(() => {
const requestDetailsValue = requestDetails;
Expand All @@ -249,9 +253,15 @@ const MinistryReview = React.memo(({ userDetail }) => {
);
}

if(MinistryNeedsScanning.includes(bcgovcode.replaceAll('"', '')) && requestDetails.requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL) {
dispatch(fetchFOIPersonalDivisionsAndSections(bcgovcode.replaceAll('"', '')));
if(bcgovcode.replaceAll('"', '') == "MCF") {
if (
MinistryNeedsScanning.includes(bcgovcode.replaceAll('"', "")) &&
requestDetails.requestType ==
FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL
) {
dispatch(
fetchFOIPersonalDivisionsAndSections(bcgovcode.replaceAll('"', ""))
);
if (bcgovcode.replaceAll('"', "") == "MCF") {
setIsMCFPersonal(true);
}
}
Expand All @@ -269,7 +279,6 @@ const MinistryReview = React.memo(({ userDetail }) => {
}
}, [isMinistryRestricted, requestWatchers]);

const [unSavedRequest, setUnSavedRequest] = React.useState(false);
const [recordsUploading, setRecordsUploading] = React.useState(false);
const [CFRUnsaved, setCFRUnsaved] = React.useState(false);
const hideBottomText = [
Expand Down Expand Up @@ -426,11 +435,11 @@ const MinistryReview = React.memo(({ userDetail }) => {
foitabheaderBG = "foitabheadercollection foitabheaderPeerreviewBG";
break;
case StateEnum.tagging.name:
foitabheaderBG = "foitabheadercollection foitabheaderTaggingBG";
break;
foitabheaderBG = "foitabheadercollection foitabheaderTaggingBG";
break;
case StateEnum.readytoscan.name:
foitabheaderBG = "foitabheadercollection foitabheaderReadytoScanBG";
break;
foitabheaderBG = "foitabheadercollection foitabheaderReadytoScanBG";
break;
default:
foitabheaderBG = "foitabheadercollection foitabheaderdefaultBG";
break;
Expand Down Expand Up @@ -632,15 +641,18 @@ const MinistryReview = React.memo(({ userDetail }) => {
? `(${requestNotes.length})`
: ""}
</div>
{(originalDivisions?.length > 0 || isMCFPersonal) && DISABLE_GATHERINGRECORDS_TAB?.toLowerCase() =='false' &&<div
className={clsx("tablinks", {
active: tabLinksStatuses.Records.active,
})}
name="Records"
onClick={() => tabclick("Records")}
>
Records
</div>}
{(originalDivisions?.length > 0 || isMCFPersonal) &&
DISABLE_GATHERINGRECORDS_TAB?.toLowerCase() == "false" && (
<div
className={clsx("tablinks", {
active: tabLinksStatuses.Records.active,
})}
name="Records"
onClick={() => tabclick("Records")}
>
Records
</div>
)}
</div>

<div className="foileftpanelstatus">
Expand Down Expand Up @@ -938,7 +950,8 @@ const MinistryReview = React.memo(({ userDetail }) => {
[classes.hidden]: !tabLinksStatuses.Records.display,
})}
>
{!isAttachmentListLoading && (originalDivisions?.length > 0 || isMCFPersonal) ? (
{!isAttachmentListLoading &&
(originalDivisions?.length > 0 || isMCFPersonal) ? (
<>
{url.indexOf("records") > -1 ? (
<Breadcrumbs
Expand Down

0 comments on commit 91aaee2

Please sign in to comment.