Skip to content

Commit

Permalink
Merge pull request #4985 from bcgov/dev
Browse files Browse the repository at this point in the history
#4707 changes to main
  • Loading branch information
divyav-aot authored Jan 9, 2024
2 parents 218f1ea + ee34250 commit 5d51fd5
Show file tree
Hide file tree
Showing 69 changed files with 1,411 additions and 452 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,14 @@ const AdvancedSearch = ({ userDetail }) => {
});

const intitialRequestState = {
[StateEnum.unopened.id]: false,
[StateEnum.open.id]: false,
[StateEnum.callforrecords.id]: false,
[StateEnum.review.id]: false,
[StateEnum.signoff.id]: false,
[StateEnum.closed.id]: false,
[StateEnum.callforrecordsoverdue.id]: false
[StateEnum.unopened.label]: false,
[StateEnum.open.label]: false,
[StateEnum.callforrecords.label]: false,
[StateEnum.review.label]: false,
[StateEnum.signoff.label]: false,
[StateEnum.closed.label]: false,
[StateEnum.callforrecordsoverdue.label]: false
};

const [requestState, setRequestState] = useState(() => {
if (Object.keys(advancedSearchParams).length > 0 && advancedSearchParams.requestState.length > 0) {
let savedRequestState = {...intitialRequestState}
Expand Down Expand Up @@ -579,9 +578,9 @@ const AdvancedSearch = ({ userDetail }) => {
<Checkbox
size="small"
name="unopened"
stateid={StateEnum.unopened.id}
stateid={StateEnum.unopened.label}
onChange={handleRequestStateChange}
checked={requestState[StateEnum.unopened.id]}
checked={requestState[StateEnum.unopened.label]}
color="success"
/>
}
Expand All @@ -593,9 +592,9 @@ const AdvancedSearch = ({ userDetail }) => {
<Checkbox
size="small"
name="callforrecords"
stateid={StateEnum.callforrecords.id}
stateid={StateEnum.callforrecords.label}
onChange={handleRequestStateChange}
checked={requestState[StateEnum.callforrecords.id]}
checked={requestState[StateEnum.callforrecords.label]}
color="success"
/>
}
Expand All @@ -607,9 +606,9 @@ const AdvancedSearch = ({ userDetail }) => {
<Checkbox
size="small"
name="review"
stateid={StateEnum.review.id}
stateid={StateEnum.review.label}
onChange={handleRequestStateChange}
checked={requestState[StateEnum.review.id]}
checked={requestState[StateEnum.review.label]}
color="success"
/>
}
Expand All @@ -621,9 +620,9 @@ const AdvancedSearch = ({ userDetail }) => {
<Checkbox
size="small"
name="signoff"
stateid={StateEnum.signoff.id}
stateid={StateEnum.signoff.label}
onChange={handleRequestStateChange}
checked={requestState[StateEnum.signoff.id]}
checked={requestState[StateEnum.signoff.label]}
color="success"
/>
}
Expand All @@ -635,9 +634,9 @@ const AdvancedSearch = ({ userDetail }) => {
<Checkbox
size="small"
name="closed"
stateid={StateEnum.closed.id}
stateid={StateEnum.closed.label}
onChange={handleRequestStateChange}
checked={requestState[StateEnum.closed.id]}
checked={requestState[StateEnum.closed.label]}
color="success"
/>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,12 @@ const AdvancedSearch = ({ userDetail }) => {
});

const intitialRequestState = {
[StateEnum.callforrecords.id]: false,
[StateEnum.review.id]: false,
[StateEnum.signoff.id]: false,
[StateEnum.closed.id]: false,
[StateEnum.callforrecordsoverdue.id]: false
[StateEnum.callforrecords.label]: false,
[StateEnum.review.label]: false,
[StateEnum.signoff.label]: false,
[StateEnum.closed.label]: false,
[StateEnum.callforrecordsoverdue.label]: false
};

const [requestState, setRequestState] = useState(() => {
if (Object.keys(advancedSearchParams).length > 0 && advancedSearchParams.requestState.length > 0) {
let savedRequestState = {...intitialRequestState}
Expand Down Expand Up @@ -592,9 +591,9 @@ const AdvancedSearch = ({ userDetail }) => {
<Checkbox
size="small"
name="callforrecords"
stateid={StateEnum.callforrecords.id}
stateid={StateEnum.callforrecords.label}
onChange={handleRequestStateChange}
checked={requestState[StateEnum.callforrecords.id]}
checked={requestState[StateEnum.callforrecords.label]}
color="success"
/>
}
Expand All @@ -606,9 +605,9 @@ const AdvancedSearch = ({ userDetail }) => {
<Checkbox
size="small"
name="review"
stateid={StateEnum.review.id}
stateid={StateEnum.review.label}
onChange={handleRequestStateChange}
checked={requestState[StateEnum.review.id]}
checked={requestState[StateEnum.review.label]}
color="success"
/>
}
Expand All @@ -620,9 +619,9 @@ const AdvancedSearch = ({ userDetail }) => {
<Checkbox
size="small"
name="signoff"
stateid={StateEnum.signoff.id}
stateid={StateEnum.signoff.label}
onChange={handleRequestStateChange}
checked={requestState[StateEnum.signoff.id]}
checked={requestState[StateEnum.signoff.label]}
color="success"
/>
}
Expand All @@ -634,9 +633,9 @@ const AdvancedSearch = ({ userDetail }) => {
<Checkbox
size="small"
name="closed"
stateid={StateEnum.closed.id}
stateid={StateEnum.closed.label}
onChange={handleRequestStateChange}
checked={requestState[StateEnum.closed.id]}
checked={requestState[StateEnum.closed.label]}
color="success"
/>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,9 @@ const AxisSyncModal = ({ axisSyncModalOpen, setAxisSyncModalOpen, saveRequestObj


const saveAxisData = async () => {
if (urlIndexCreateRequest > -1)
updatedSaveReqObj.requeststatusid = StateEnum.intakeinprogress.id;
if (urlIndexCreateRequest > -1) {
updatedSaveReqObj.requeststatuslabel = StateEnum.intakeinprogress.label;
}
dispatch(saveRequestDetails(updatedSaveReqObj, urlIndexCreateRequest,requestId,ministryId,
(err, res) => {
if (!err) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const BottomButtonGroup = React.memo(

const saveRequest = async (setLoader = false) => {
if (urlIndexCreateRequest > -1) {
saveRequestObject.requeststatusid = StateEnum.intakeinprogress.id;
saveRequestObject.requeststatuslabel = StateEnum.intakeinprogress.label;
setIsAddRequest(false);
}
dispatch(setFOILoader(setLoader))
Expand Down Expand Up @@ -176,7 +176,7 @@ const BottomButtonGroup = React.memo(
if (
currentSelectedStatus &&
currentSelectedStatus !== StateEnum.open.name &&
saveRequestObject.requeststatusid &&
saveRequestObject.requeststatuslabel &&
saveRequestObject.currentState
) {
//scanning team - MSD/CFD personal
Expand All @@ -200,7 +200,7 @@ const BottomButtonGroup = React.memo(
}
saveRequestModal();
} else {
saveRequestObject.requeststatusid = StateEnum.open.id;
saveRequestObject.requeststatuslabel = StateEnum.open.label;
if (currentSelectedStatus === StateEnum.open.name && ministryId) {
saveRequestModal();
}
Expand Down Expand Up @@ -231,7 +231,7 @@ const BottomButtonGroup = React.memo(
saveRequestObject.id = saveRequestObject.id
? saveRequestObject.id
: requestId;
saveRequestObject.requeststatusid = 1;
saveRequestObject.requeststatuslabel = StateEnum.open.label;
setOpenModal(true);
};

Expand Down Expand Up @@ -292,14 +292,14 @@ const BottomButtonGroup = React.memo(
if (currentSelectedStatus) {
switch (currentSelectedStatus) {
case StateEnum.closed.name:
saveRequestObject.requeststatusid = StateEnum.closed.id;
saveRequestObject.requeststatuslabel = StateEnum.closed.label;
saveRequestObject.closedate = closingDate;
saveRequestObject.closereasonid = closingReasonId;
break;

case StateEnum.callforrecords.name:
saveRequestObject.paymentExpiryDate = ""
saveRequestObject.requeststatusid = StateEnum.callforrecords.id;
saveRequestObject.requeststatuslabel = StateEnum.callforrecords.label;
if (
!("cfrDueDate" in saveRequestObject) ||
saveRequestObject.cfrDueDate === ""
Expand Down Expand Up @@ -354,7 +354,7 @@ const BottomButtonGroup = React.memo(
const status = Object.values(StateEnum).find(
(statusValue) => statusValue.name === currentSelectedStatus
);
saveRequestObject.requeststatusid = status.id;
saveRequestObject.requeststatuslabel = status.label;
if (currentSelectedStatus === StateEnum.onhold.name && !saveRequestObject.paymentExpiryDate) {
saveRequestObject.paymentExpiryDate = dueDateCalculation(new Date(), PAYMENT_EXPIRY_DAYS);
}
Expand Down
4 changes: 2 additions & 2 deletions forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ const FOIRequest = React.memo(({ userDetail }) => {
const assignedTo = getAssignedTo(requestDetails);
setAssignedToValue(assignedTo);
if (Object.entries(requestDetails)?.length !== 0) {
let requestStateFromId = findRequestState(requestDetails.requeststatusid)
? findRequestState(requestDetails.requeststatusid)
let requestStateFromId = findRequestState(requestDetails.requeststatuslabel)
? findRequestState(requestDetails.requeststatuslabel)
: StateEnum.unopened.name;
setRequestState(requestStateFromId);
settabStatus(requestStateFromId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,34 +186,34 @@ const BottomButtonGroup = React.memo(
const [successCount, setSuccessCount] = useState(0);
const [fileCount, setFileCount] = useState(0);
const [documents, setDocuments] = useState([]);

const saveStatusId = () => {
if (currentSelectedStatus) {
switch (currentSelectedStatus.toLowerCase()) {
case StateEnum.review.name.toLowerCase():
saveMinistryRequestObject.requeststatusid = StateEnum.review.id;
saveMinistryRequestObject.requeststatuslabel = StateEnum.review.label;
break;
case StateEnum.feeassessed.name.toLowerCase():
saveMinistryRequestObject.requeststatusid =
StateEnum.feeassessed.id;
saveMinistryRequestObject.requeststatuslabel =
StateEnum.feeassessed.label;
break;
case StateEnum.deduplication.name.toLowerCase():
saveMinistryRequestObject.requeststatusid =
StateEnum.deduplication.id;
saveMinistryRequestObject.requeststatuslabel =
StateEnum.deduplication.label;
break;
case StateEnum.harms.name.toLowerCase():
saveMinistryRequestObject.requeststatusid = StateEnum.harms.id;
saveMinistryRequestObject.requeststatuslabel = StateEnum.harms.label;
break;
case StateEnum.signoff.name.toLowerCase():
saveMinistryRequestObject.requeststatusid = StateEnum.signoff.id;
saveMinistryRequestObject.requeststatuslabel = StateEnum.signoff.label;
break;
case StateEnum.response.name.toLowerCase():
saveMinistryRequestObject.ministrysignoffapproval = ministryApprovalState;
saveMinistryRequestObject.requeststatusid = StateEnum.response.id;
saveMinistryRequestObject.requeststatuslabel = StateEnum.response.label;
break;
case StateEnum.callforrecords.name.toLowerCase():
saveMinistryRequestObject.requeststatusid =
StateEnum.callforrecords.id;
saveMinistryRequestObject.requeststatuslabel =
StateEnum.callforrecords.label;
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,10 +436,10 @@ const MinistryReview = React.memo(({ userDetail }) => {
break;
case StateEnum.tagging.name:
foitabheaderBG = "foitabheadercollection foitabheaderTaggingBG";
break;
break;
case StateEnum.readytoscan.name:
foitabheaderBG = "foitabheadercollection foitabheaderReadytoScanBG";
break;
break;
default:
foitabheaderBG = "foitabheadercollection foitabheaderdefaultBG";
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const RequestDetails = React.memo(
receivedDate: !!receivedDate ? formatDate(receivedDate): "",
requestStartDate: startDate ? formatDate(startDate): "",
dueDate: validateFields(requestDetails, FOI_COMPONENT_CONSTANTS.DUE_DATE, startDate ? formatDate(startDate): ""),
requestState: findRequestState(requestDetails?.requeststatusid)
requestState: findRequestState(requestDetails?.requeststatuslabel)
}
//event bubble up - sets the initial value to validate the required fields
handleRequestDetailsInitialValue(requestDetailsObject);
Expand Down
6 changes: 3 additions & 3 deletions forms-flow-web/src/components/FOI/FOIRequest/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,10 @@ export const alertUser = (e) => {
e.returnValue = "";
};

export const findRequestState = (requestStatusId) => {
if (requestStatusId != undefined) {
export const findRequestState = (requestStatusLabel) => {
if (requestStatusLabel != undefined) {
let stateArray = Object.entries(StateEnum).find(
(value) => value[1].id === requestStatusId
(value) => value[1].label === requestStatusLabel
);
return stateArray[1].name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ const NotificationPopup = ({notifications, isMinistry, ministryCode}) => {
},[notifications]);

const tabTitle = () =>{
let myRequestList = notifications?.filter(x => (x.notificationusertype === 'Assignee' || x.notificationusertype === 'Comment User'));
let myRequestList = notifications?.filter(x => (x.notificationusertype === 'Assignee' || x.notificationusertype === 'Comment User' || x.notificationusertype === 'Triggered User'));
let watchingRequestList = notifications?.filter(x => x.notificationusertype === 'Watcher');
setMyRequestTitle(myRequestList?.length > 0 ? "My Notifications ("+myRequestList.length+")": "My Notifications");
setWatchingRequestTitle(watchingRequestList?.length > 0 ? "Watching Notifications ("+watchingRequestList.length+")": "Watching Notifications");
}

const assigmentNotifications = notifications?.map((notification,index) =>
{return (notification.notificationusertype === 'Assignee' || notification.notificationusertype === "Comment User") &&
{return (notification.notificationusertype === 'Assignee' || notification.notificationusertype === "Comment User" || notification.notificationusertype === "Triggered User") &&
<NotificationList key= {index} notification={notification} isMinistry ={isMinistry}
ministryCode ={ministryCode}></NotificationList>
}
Expand All @@ -45,7 +45,7 @@ const NotificationPopup = ({notifications, isMinistry, ministryCode}) => {

const checkIfNotificationExists = (type) => {
if(type ==='assignee' && notifications.find(notification =>
(notification.notificationusertype === 'Assignee'|| notification.notificationusertype === "Comment User"))){
(notification.notificationusertype === 'Assignee'|| notification.notificationusertype === "Comment User" || notification.notificationusertype === "Triggered User"))){
return true;
}
if(type ==='watcher' && notifications.find(notification =>
Expand Down
Loading

0 comments on commit 5d51fd5

Please sign in to comment.