Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moved unSavedRequest state declaration to the top #4717

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to fix ministry view FE error

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
Loading