Skip to content

Commit

Permalink
Merge pull request #5236 from bcgov/test-marshal
Browse files Browse the repository at this point in the history
PR to dev from test-marshal for Applicant Profile
  • Loading branch information
richard-aot authored May 29, 2024
2 parents b4eadea + bc6855a commit cc7a361
Show file tree
Hide file tree
Showing 56 changed files with 5,137 additions and 1,920 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public AXISRequest GetAXISRequest(string request)
axisRequest.ApplicantLastName = Convert.ToString(row["lastName"]);
axisRequest.BusinessName = Convert.ToString(row["businessName"]);

axisRequest.AXISApplicantID = Convert.ToString(row["axisApplicantID"]);
axisRequest.Address = Convert.ToString(row["address"]);
axisRequest.AddressSecondary = Convert.ToString(row["addressSecondary"]);
axisRequest.City = Convert.ToString(row["city"]);
Expand Down Expand Up @@ -180,7 +181,7 @@ private DataTable GetAxisRequestData(string request)
(SELECT terminology.vcTerminology from tblTerminologyLookup terminology WHERE terminology.iLabelID = deliveryModes.iLabelID and terminology.tiLocaleID = 1) as deliveryMode,
(SELECT terminology.vcTerminology from tblTerminologyLookup terminology WHERE terminology.iLabelID = countries.iLabelID and terminology.tiLocaleID = 1) as country,
(SELECT terminology.vcTerminology from tblTerminologyLookup terminology WHERE terminology.iLabelID = states.iLabelID and terminology.tiLocaleID = 1) as province,
requesters.vcAddress1 as [address], requesters.vcAddress2 as addressSecondary, requesters.vcCity as city, requesters.vcZipCode as postal,
requesters.iRequesterID as axisApplicantID, requesters.vcAddress1 as [address], requesters.vcAddress2 as addressSecondary, requesters.vcCity as city, requesters.vcZipCode as postal,
requesters.vcHome as phonePrimary,
requesters.vcMobile as phoneSecondary,
requesters.vcWork1 as workPhonePrimary,
Expand Down Expand Up @@ -229,7 +230,7 @@ LEFT OUTER JOIN dbo.TBLREQUESTCUSTOMFIELDS requestfields WITH (NOLOCK) ON reques
GROUP BY requests.sdtReceivedDate, requests.sdtTargetDate, requests.sdtOriginalTargetDate, requests.vcDescription,
requests.sdtRqtDescFromdate, requests.sdtRqtDescTodate, requests.sdtRequestedDate, office.OFFICE_CODE, requesterTypes.vcDescription,
receivedModes.iLabelID, deliveryModes.iLabelID, countries.iLabelID, states.iLabelID,
requesters.vcAddress1, requesters.vcAddress2, requesters.vcCity, requesters.vcZipCode,
requesters.iRequesterID, requesters.vcAddress1, requesters.vcAddress2, requesters.vcCity, requesters.vcZipCode,
requesters.vcHome, requesters.vcMobile, requesters.vcWork1, requesters.vcWork2, requesters.vcFirstName, requesters.vcLastName, requesters.vcMiddleName,
requests.iRequestID, requesters.vcCompany, requesters.vcEmailID, onbehalf.vcFirstName, onbehalf.vcLastName, onbehalf.vcMiddleName,
requestTypes.iLabelID, requests.vcVisibleRequestID, requests.tiOfficeID, office.OFFICE_ID,requestorfields.CUSTOMFIELD35,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ public class AXISRequest
[DataMember(Name = "lastName")]
public string ApplicantLastName { get; set; }


[DataMember(Name = "axisApplicantID")]
public string AXISApplicantID { get; set; }

[DataMember(Name = "businessName")]
public string BusinessName { get; set; }
Expand Down
3,695 changes: 1,918 additions & 1,777 deletions forms-flow-web/package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion forms-flow-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"react-dom": "^17.0.2",
"react-dropdown-select": "^4.7.4",
"react-helmet": "^6.1.0",
"react-modal-resizable-draggable": "^0.1.6",
"react-quill": "^2.0.0",
"react-redux": "^7.2.4",
"react-router-dom": "^5.1.2",
Expand Down Expand Up @@ -124,4 +125,4 @@
"node_modules/(?!(astronomia|client-zip|reactjs-popup|react-quill)/)"
]
}
}
}
2 changes: 2 additions & 0 deletions forms-flow-web/src/actions/FOI/foiActionConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const FOI_ACTION_CONSTANTS = {
CLEAR_MINISTRYVIEWREQUEST_DETAILS: "CLEAR_MINISTRYVIEWREQUEST_DETAILS",
FOI_REQUEST_DUE_DATE: "FOI_REQUEST_DUE_DATE",

FOI_REQUEST_APPLICANT_PROFILE: "FOI_REQUEST_APPLICANT_PROFILE",

FOI_IS_REQUEST_UPDATED: "FOI_IS_REQUEST_UPDATED",
FOI_REQUEST_DESCRIPTION_HISTORY: "FOI_REQUEST_DESCRIPTION_HISTORY",
FOI_MINISTRY_REQUESTSLIST: "FOI_MINISTRY_REQUESTSLIST",
Expand Down
6 changes: 6 additions & 0 deletions forms-flow-web/src/actions/FOI/foiRequestActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ export const setFOIMinistryViewRequestDetail = (data) => (dispatch) => {
payload: data,
});
};
export const setFOIRequestApplicantProfile = (data) => (dispatch) => {
dispatch({
type: FOI_ACTION_CONSTANTS.FOI_REQUEST_APPLICANT_PROFILE,
payload: data,
});
};
export const setFOIPDFStitchedRecordForHarms = (data) => (dispatch) => {
dispatch({
type: FOI_ACTION_CONSTANTS.FOI_PDF_STITCHED_RECORD_FOR_HARMS,
Expand Down
7 changes: 7 additions & 0 deletions forms-flow-web/src/apiManager/endpoints/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ const API = {
FOI_GET_MINISTRY_REQUEST_WATCHERS: `${FOI_BASE_API_URL}/api/foiwatcher/ministryrequest/<ministryid>`,
FOI_GET_CLOSING_REASONS: `${FOI_BASE_API_URL}/api/foiflow/closereasons`,
FOI_POST_OSS_HEADER: `${FOI_BASE_API_URL}/api/foiflow/oss/authheader`,

FOI_GET_REQUEST_APPLICANTS: `${FOI_BASE_API_URL}/api/foiapplicants/<email>`,
FOI_SAVE_REQUEST_APPLICANT_INFO: `${FOI_BASE_API_URL}/api/foiapplicants/save`,
FOI_REQUEST_APPLICANTS_SEARCH_KEYWORDS: `${FOI_BASE_API_URL}/api/foiapplicants/search`,
FOI_GET_APPLICANT_HISTORY: `${FOI_BASE_API_URL}/api/foiapplicants/history/<applicantid>`,
FOI_GET_APPLICANT_REQUEST_HISTORY: `${FOI_BASE_API_URL}/api/foiapplicants/requests/<applicantid>`,
FOI_GET_APPLICANT_INFO: `${FOI_BASE_API_URL}/api/foiapplicants/applicantid/<applicantid>`,

FOI_GET_PROGRAMAREADIVISIONS: `${FOI_BASE_API_URL}/api/foiadmin/divisions`,
FOI_POST_PROGRAMAREADIVISION: `${FOI_BASE_API_URL}/api/foiadmin/division`,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
import {
httpPOSTRequest,
httpGETRequest,
} from "../../httpRequestHandler";
import API from "../../endpoints";
import {
serviceActionError,
setRestrictedReqTaglist,
setFOILoader
} from "../../../actions/FOI/foiRequestActions";
import { catchError, fnDone} from './foiServicesUtil';
import UserService from "../../../services/UserService";
import { replaceUrl } from "../../../helper/FOI/helper";

export const fetchPotentialApplicants = (firstname, lastname, email, phone, ...rest) => {
// console.log("fetch applicants" + firstname)
// console.log(firstname)
// console.log(lastname)

const done = fnDone(rest);
// await new Promise(resolve => {setTimeout(resolve, 3000)});
// done(null, [
// { id: 1, lastName: 'Snow', firstName: 'Jon', age: 35 },
// { id: 2, lastName: 'Lannister', firstName: 'Cersei', age: 42 },
// { id: 3, lastName: 'Lannister', firstName: 'Jaime', age: 45 },
// { id: 4, lastName: 'Stark', firstName: 'Arya', age: 16 },
// { id: 5, lastName: 'Targaryen', firstName: 'Daenerys', age: null },
// { id: 7, lastName: 'Clifford', firstName: 'Ferrara', age: 44 },
// { id: 8, lastName: 'Frances', firstName: 'Rossini', age: 36 },
// { id: 9, lastName: 'Roxie', firstName: 'Harvey', age: 65 },
// ]);
// return;
const apiUrlgetRequestDetails = replaceUrl(
API.FOI_GET_REQUEST_APPLICANTS,
"<email>",
email
);
return (dispatch) => {
httpGETRequest(apiUrlgetRequestDetails, {}, UserService.getToken())
.then((res) => {
if (res.data) {
done(null, res.data)
} else {
dispatch(serviceActionError(res));
throw new Error(`Error in fetching potential applicants`)
}
})
.catch((error) => {
catchError(error, dispatch);
});
};
};

export const fetchApplicantInfo = (applicantid, ...rest) => {

const done = fnDone(rest);
// done(null,
// { id: 1, lastName: 'Snow', firstName: 'Jon', age: 35, email: 'jon.snow@gmail.com',
// additionalPersonalInfo: {birthDate: "2023-12-07"},
// requestHistory: [{requestId: "EDU-2023-234345", receivedDate: "2023-12-07", currentState: "Open", requestDescription: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but als"}]
// }
// );
// return;
const apiUrl = replaceUrl(
API.FOI_GET_APPLICANT_INFO,
"<applicantid>",
applicantid
);
return (dispatch) => {
httpGETRequest(apiUrl, {}, UserService.getToken())
.then((res) => {
if (res.data) {
done(null, res.data)
} else {
dispatch(serviceActionError(res));
throw new Error(`Error in fetching applicant info for applicant id # ${applicantid}`)
}
})
.catch((error) => {
catchError(error, dispatch);
});
};
};

export const fetchApplicantContactHistory = (applicantid, ...rest) => {
// const done = fnDone(rest);
// done(null,
// [{
// field: "Email",
// value: "[email protected]",
// date: "2023-12-11",
// username: "foiintake@idir",
// }]
// );

const done = fnDone(rest);
const apiUrl = replaceUrl(
API.FOI_GET_APPLICANT_HISTORY,
"<applicantid>",
applicantid
);
return (dispatch) => {
httpGETRequest(apiUrl, {}, UserService.getToken())
.then((res) => {
if (res.data) {
done(null, res.data)
} else {
dispatch(serviceActionError(res));
throw new Error(`Error in fetching potential applicants`)
}
})
.catch((error) => {
catchError(error, dispatch);
});
}
}

export const fetchApplicantRequests = (applicantid, ...rest) => {
const done = fnDone(rest);
const apiUrl = replaceUrl(
API.FOI_GET_APPLICANT_REQUEST_HISTORY,
"<applicantid>",
applicantid
);
return (dispatch) => {
httpGETRequest(apiUrl, {}, UserService.getToken())
.then((res) => {
if (res.data) {
done(null, res.data)
} else {
dispatch(serviceActionError(res));
throw new Error(`Error in fetching potential applicants`)
}
})
.catch((error) => {
catchError(error, dispatch);
});
}
};

export const saveApplicantInfo = (applicant, ...rest) => {
const done = fnDone(rest);
const apiUrlgetRequestDetails = API.FOI_SAVE_REQUEST_APPLICANT_INFO;
return (dispatch) => {
httpPOSTRequest(apiUrlgetRequestDetails, applicant, UserService.getToken())
.then((res) => {
if (res.data) {
dispatch(setRestrictedReqTaglist(res.data));
dispatch(setFOILoader(false));
done(null, res.data);
} else {
dispatch(serviceActionError(res));
throw new Error(`Error in saving applicant`);
}
})
.catch((error) => {
catchError(error, dispatch);
});
}
};

export const fetchApplicantProfileByKeyword = (keywords, ...rest) => {
const done = fnDone(rest);
const apiUrl = API.FOI_REQUEST_APPLICANTS_SEARCH_KEYWORDS;
return (dispatch) => {
httpPOSTRequest(apiUrl, keywords, UserService.getToken())
.then((res) => {
if (res.data) {
done(null, res.data)
} else {
dispatch(serviceActionError(res));
throw new Error(`Error in fetching potential applicants`)
}
})
.catch((error) => {
catchError(error, dispatch);
});
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -550,4 +550,4 @@ export const deleteOIPCDetails = (requestId, ministryId, ...rest) => {
catchError(error, dispatch);
});
};
}
}
21 changes: 17 additions & 4 deletions forms-flow-web/src/components/FOI/FOIAuthenticateRouting.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useEffect}from "react";
import React, {useEffect, useState}from "react";
import { Redirect, Route } from "react-router-dom";
import { useDispatch, useSelector } from "react-redux";
import "semantic-ui-css/semantic.min.css";
Expand All @@ -15,12 +15,21 @@ import { isMinistryLogin } from '../../helper/FOI/helper';
import UnAuthorized from "./UnAuthorized";
import Admin from "./Admin";
import Divisions from "./Admin/Divisions";
import ApplicantProfileModal from "./FOIRequest/ApplicantProfileModal";


const FOIAuthenticateRouting = React.memo((props) => {
const dispatch = useDispatch();
const isAuth = useSelector((state) => state.user.isAuthenticated);


const [applicantProfileModalOpen, setApplicantProfileModalOpen] = useState(false);
const handleApplicantModalClose = () => {
setApplicantProfileModalOpen(false);
}
const openApplicantProfileModal = () => {
setApplicantProfileModalOpen(true);
}

useEffect(()=>{
console.log('authenticate')
Expand Down Expand Up @@ -51,13 +60,13 @@ const FOIAuthenticateRouting = React.memo((props) => {
}
</Route>
<Route path="/foi/reviewrequest/:requestId">
<FOIRequest userDetail={userDetail} />
<FOIRequest userDetail={userDetail} openApplicantProfileModal={openApplicantProfileModal} />
</Route>
<Route path="/foi/addrequest">
<FOIRequest userDetail={userDetail}/>
<FOIRequest userDetail={userDetail} openApplicantProfileModal={openApplicantProfileModal}/>
</Route>
<Route path="/foi/foirequests/:requestId/ministryrequest/:ministryId">
<FOIRequest userDetail={userDetail} />
<FOIRequest userDetail={userDetail} openApplicantProfileModal={openApplicantProfileModal}/>
</Route>
<Route path="/foi/ministryreview/:requestId/ministryrequest/:ministryId">
<MinistryReview userDetail={userDetail} />
Expand All @@ -72,6 +81,10 @@ const FOIAuthenticateRouting = React.memo((props) => {
<Redirect to="/foi/dashboard"/>
</Route>
<FOIFooter />
<ApplicantProfileModal
modalOpen={applicantProfileModalOpen}
handleModalClose={handleApplicantModalClose}
/>
</>
) : (
<Route path="/foi">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import AccordionDetails from '@material-ui/core/AccordionDetails';
import Typography from '@material-ui/core/Typography';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';

const AdditionalApplicantDetails = React.memo(({requestDetails, createSaveRequestObject, disableInput}) => {
const AdditionalApplicantDetails = React.memo(({requestDetails, createSaveRequestObject, disableInput, defaultExpanded, warning}) => {
/**
* Addition Applicant details box in the UI
* No mandatory fields here
Expand All @@ -24,6 +24,15 @@ const AdditionalApplicantDetails = React.memo(({requestDetails, createSaveReques
},
accordionSummary: {
flexDirection: 'row-reverse'
},
warning: {
'& fieldset': {
borderColor: '#ed6c02 !important'
},
'& label': {
color: '#ed6c02 !important'
}

}
});
const classes = useStyles();
Expand Down Expand Up @@ -126,7 +135,7 @@ const AdditionalApplicantDetails = React.memo(({requestDetails, createSaveReques

return (
<div className='request-accordian' >
<Accordion defaultExpanded={true}>
<Accordion defaultExpanded={defaultExpanded}>
<AccordionSummary className={classes.accordionSummary} expandIcon={<ExpandMoreIcon />}
id="additionalApplicantDetails-header">
<Typography className={classes.heading}>ADDITIONAL APPLICANT DETAILS</Typography>
Expand All @@ -140,6 +149,7 @@ const AdditionalApplicantDetails = React.memo(({requestDetails, createSaveReques
inputProps={{ "aria-labelledby": "personalHealthNumber-label"}}
InputLabelProps={{ shrink: true, }}
variant="outlined"
className={warning && warning(FOI_COMPONENT_CONSTANTS.PERSONAL_HEALTH_NUMBER) && classes.warning}
value={personalHealthNumberText}
onChange={handlePersonalHealthNumber}
fullWidth
Expand All @@ -156,6 +166,7 @@ const AdditionalApplicantDetails = React.memo(({requestDetails, createSaveReques
shrink: true,
}}
variant="outlined"
className={warning && warning(FOI_COMPONENT_CONSTANTS.DOB) && classes.warning}
fullWidth
disabled={disableInput}
/>
Expand All @@ -179,6 +190,7 @@ const AdditionalApplicantDetails = React.memo(({requestDetails, createSaveReques
inputProps={{ "aria-labelledby": "correctionsNumber-label"}}
InputLabelProps={{ shrink: true, }}
variant="outlined"
className={warning && warning(FOI_COMPONENT_CONSTANTS.CORRECTIONS_NUMBER) && classes.warning}
value={correctionsNumberText}
onChange={handleCorrectionsNumber}
fullWidth
Expand All @@ -191,6 +203,7 @@ const AdditionalApplicantDetails = React.memo(({requestDetails, createSaveReques
InputLabelProps={{ shrink: true, }}
variant="outlined"
value={employeeNumberText}
className={warning && warning(FOI_COMPONENT_CONSTANTS.EMPLOYEE_NUMBER) && classes.warning}
onChange={handleEmployeeNumber}
fullWidth
disabled={disableInput}
Expand Down
Loading

0 comments on commit cc7a361

Please sign in to comment.