update lpa portal

This commit is contained in:
2023-07-27 12:46:02 +01:00
parent 3ff708737c
commit daa8b1c96d
5 changed files with 198 additions and 106 deletions
+1 -1
View File
@@ -583,7 +583,7 @@ export const getPickLists = (whichForm) => {
}; };
export const getPersonalAccount = (contactid) => { export const getPersonalAccount = (contactid) => {
//console.log(contactid); console.log(contactid);
return axios return axios
.get( .get(
BASE_URL + BASE_URL +
+27 -20
View File
@@ -109,7 +109,7 @@ const MyPortal = (props) => {
<h2 className="heading-small card-heading"> <h2 className="heading-small card-heading">
{ {
props.accountDetails.accountDetails[ props.accountDetails.accountDetails[
"pinswg_typeofinvolvement@OData.Community.Display.V1.FormattedValue" "pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
] ]
}{" "} }{" "}
LPA Portal LPA Portal
@@ -121,7 +121,7 @@ const MyPortal = (props) => {
<div className="govuk-grid-row"> <div className="govuk-grid-row">
<div className="govuk-grid-column-full"> <div className="govuk-grid-column-full">
<div className="flex-container grid-row govuk-body "> <div className="flex-container grid-row govuk-body ">
<MakeNewAppeal /> {isLPA ? "" : <MakeNewAppeal />}
<SearchCases /> <SearchCases />
{/* {props.awaitingSubmission.awaitingSubmission[ {/* {props.awaitingSubmission.awaitingSubmission[
"@odata.count" "@odata.count"
@@ -132,17 +132,20 @@ const MyPortal = (props) => {
} }
/> />
)} */} )} */}
{props.awaitingSubmission {isLPA
.awaitingSubmissionFromBlob["@odata.count"] > ? ""
0 && ( : props.awaitingSubmission
<AwaitingSubmissionFromBlob .awaitingSubmissionFromBlob[
containerID={props.containerID} "@odata.count"
awaitingSubmissionFromBlob={ ] > 0 && (
props.awaitingSubmission <AwaitingSubmissionFromBlob
.awaitingSubmissionFromBlob containerID={props.containerID}
} awaitingSubmissionFromBlob={
/> props.awaitingSubmission
)} .awaitingSubmissionFromBlob
}
/>
)}
{props.myCases.myCases["@odata.count"] > 0 && ( {props.myCases.myCases["@odata.count"] > 0 && (
<MyCases myCases={props.myCases} /> <MyCases myCases={props.myCases} />
)} )}
@@ -152,13 +155,17 @@ const MyPortal = (props) => {
watchedCases={props.watchedCases} watchedCases={props.watchedCases}
/> />
)} )}
{props.myRepresentations.myRepresentations[ {isLPA
"@odata.count" ? ""
] > 0 && ( : props.myRepresentations.myRepresentations[
<MyRepresentations "@odata.count"
myRepresentations={props.myRepresentations} ] > 0 && (
/> <MyRepresentations
)} myRepresentations={
props.myRepresentations
}
/>
)}
{isLPA ? "" : <Dns />} {isLPA ? "" : <Dns />}
{/* <YourAccount /> */} {/* <YourAccount /> */}
+82 -79
View File
@@ -1,81 +1,84 @@
{ {
"name": "acp", "name": "acp",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",
"dev:app": "node ./server/server.js", "dev:app": "node ./server/server.js",
"build": "NODE_ENV=production node_modules/next/dist/bin/next build", "build": "NODE_ENV=production node_modules/next/dist/bin/next build",
"start": "node_modules/next/dist/bin/next start", "start": "node_modules/next/dist/bin/next start",
"lint": "next lint" "lint": "next lint"
}, },
"dependencies": { "browser": {
"@auth/prisma-adapter": "^1.0.1", "child_process": false
"@azure/identity": "^3.1.3", },
"@azure/storage-blob": "^12.12.0", "dependencies": {
"@azure/storage-queue": "^12.11.0", "@auth/prisma-adapter": "^1.0.1",
"@next-auth/prisma-adapter": "^1.0.4", "@azure/identity": "^3.2.4",
"@prisma/client": "^5.0.0", "@azure/storage-blob": "^12.12.0",
"@redux-devtools/extension": "^3.2.5", "@azure/storage-queue": "^12.11.0",
"applicationinsights": "^2.2.0", "@next-auth/prisma-adapter": "^1.0.4",
"axios": "^0.24.0", "@prisma/client": "^5.0.0",
"compression": "^1.7.4", "@redux-devtools/extension": "^3.2.5",
"cookie-cutter": "^0.2.0", "applicationinsights": "^2.2.0",
"crypto-js": "^4.1.1", "axios": "^0.24.0",
"date-fns": "^2.28.0", "compression": "^1.7.4",
"dom": "^0.0.3", "cookie-cutter": "^0.2.0",
"express": "^4.17.2", "crypto-js": "^4.1.1",
"fs": "0.0.2", "date-fns": "^2.28.0",
"google-map-react": "^2.1.10", "dom": "^0.0.3",
"govuk-frontend": "3.13.0", "express": "^4.17.2",
"jsonpath": "^1.1.1", "fs": "0.0.2",
"leaflet": "^1.7.1", "google-map-react": "^2.1.10",
"leaflet-defaulticon-compatibility": "^0.1.1", "govuk-frontend": "3.13.0",
"lodash": "^4.17.21", "jsonpath": "^1.1.1",
"moment": "^2.29.1", "leaflet": "^1.7.1",
"multiparty": "^4.2.3", "leaflet-defaulticon-compatibility": "^0.1.1",
"mysql": "^2.18.1", "lodash": "^4.17.21",
"nanoid": "^3.2.0", "moment": "^2.29.1",
"next": "^12.0.8", "multiparty": "^4.2.3",
"next-auth": "^4.22.1", "mysql": "^2.18.1",
"next-connect": "^0.12.2", "nanoid": "^3.2.0",
"next-redux-wrapper": "^7.0.5", "next": "^12.0.8",
"next-swagger-doc": "^0.3.6", "next-auth": "^4.22.1",
"next-translate": "^1.2.0", "next-connect": "^0.12.2",
"nodemailer": "^6.9.1", "next-redux-wrapper": "^7.0.5",
"nookies": "^2.5.2", "next-swagger-doc": "^0.3.6",
"notifications-node-client": "^5.1.1", "next-translate": "^1.2.0",
"ospoint": "^0.2.1", "nodemailer": "^6.9.1",
"path": "^0.12.7", "nookies": "^2.5.2",
"prop-types": "^15.8.1", "notifications-node-client": "^5.1.1",
"react": "17.0.2", "ospoint": "^0.2.1",
"react-accessible-accordion": "^4.0.0", "path": "^0.12.7",
"react-autosuggest": "^10.1.0", "prop-types": "^15.8.1",
"react-cookie-consent": "^7.2.1", "react": "17.0.2",
"react-datepicker": "4.10.0", "react-accessible-accordion": "^4.0.0",
"react-dom": "17.0.2", "react-autosuggest": "^10.1.0",
"react-dropzone": "^11.5.1", "react-cookie-consent": "^7.2.1",
"react-idle-timer": "4.6.4", "react-datepicker": "4.10.0",
"react-leaflet": "^3.2.5", "react-dom": "17.0.2",
"react-quill": "^2.0.0", "react-dropzone": "^11.5.1",
"react-redux": "^7.2.6", "react-idle-timer": "4.6.4",
"redux": "^4.2.1", "react-leaflet": "^3.2.5",
"redux-form": "^8.3.9", "react-quill": "^2.0.0",
"redux-persist": "^6.0.0", "react-redux": "^7.2.6",
"redux-thunk": "^2.4.2", "redux": "^4.2.1",
"sass": "1.32", "redux-form": "^8.3.9",
"sass-loader": "13.2.0", "redux-persist": "^6.0.0",
"swagger-ui": "^4.17.1", "redux-thunk": "^2.4.2",
"swagger-ui-react": "^4.17.0", "sass": "1.32",
"typescript": "^4.9.5", "sass-loader": "13.2.0",
"uuid": "9.0.0", "swagger-ui": "^4.17.1",
"webpack": "^5.66.0", "swagger-ui-react": "^4.17.0",
"xpath": "^0.0.32" "typescript": "^4.9.5",
}, "uuid": "9.0.0",
"devDependencies": { "webpack": "^5.66.0",
"eslint": "^8.6.0", "xpath": "^0.0.32"
"eslint-config-next": "^13.1.6", },
"eslint-plugin-jsdoc": "^40.0.1", "devDependencies": {
"prisma": "^5.0.0" "eslint": "^8.6.0",
} "eslint-config-next": "^13.1.6",
"eslint-plugin-jsdoc": "^40.0.1",
"prisma": "^5.0.0"
}
} }
+78
View File
@@ -0,0 +1,78 @@
/**
* @swagger
* /api/endpoint/getmylpacases_api:
* get:
* tags: [Portal]
* description: Get My LPA Cases
* summary: Phase 2
* parameters:
* - name: lpaid
* in: query
* required: true
* example: 726158c6-708d-ec11-aad8-00224800be9c
* schema:
* type: string
* responses:
* 200:
* description: Success
*/
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders, consoleLogger } from "../../../actions";
import jsonpath from "jsonpath";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
process.env.RELAY_ROOT ||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
const hashAPIPath = (queryPath) => {
var hashlink = CryptoJS.HmacSHA256(
queryPath,
CryptoJS.enc.Hex.parse(WORDKEY)
);
hashlink = hashlink.toString(CryptoJS.enc.Hex);
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var lpaid = req.query.lpaid;
var token = await getToken();
const lpaList = await getLPA();
const lpaGUID = jsonpath.query(lpaList, '$..[?(@.name="' + lpaid + '")]');
console.log(
'$..[?(@.name="' + lpaid + '")]',
lpaList,
lpaid,
"LPAGUID=",
lpaGUID
);
var queryUrl =
"incidents?$select=description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_appellantlastname,pinswg_appellantfirstname,pinswg_appellantagent,pinswg_agentfirstname,pinswg_agentlastname,pinswg_agentcompanyname&$expand=primarycontactid($select=fullname)&$filter=_pinswg_associatedlpa_value eq " +
lpaGUID[0].accountid +
" and servicestage eq 0 and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true";
//console.log("///////////\nPortal query: ", queryUrl, "<<<<end query");
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
data.value.forEach(function (element) {
element.pinswg_title = element.title;
});
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
});
}
+10 -6
View File
@@ -9,7 +9,7 @@ import {
getAwaitingSubmissionFromBlob, getAwaitingSubmissionFromBlob,
getAwaitingSubmission, getAwaitingSubmission,
getMyCases, getMyCases,
getLPACases, getMyLPACases,
getMyRepresentations, getMyRepresentations,
getPersonalAccount, getPersonalAccount,
getPortalModuleDetails, getPortalModuleDetails,
@@ -188,9 +188,12 @@ export const getServerSideProps = wrapper.getServerSideProps(
const accountDetails = await getPersonalAccount(loggedInUser); const accountDetails = await getPersonalAccount(loggedInUser);
const lpaid = accountDetails( console.log("----------", accountDetails);
"pinswg_typeofinvolvement@OData.Community.Display.V1.FormattedValue"
); const lpaid =
accountDetails[
"pinswg_typeofinvolvement@OData.Community.Display.V1.FormattedValue"
];
const [ const [
myCases, myCases,
@@ -201,8 +204,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
] = await Promise.all([ ] = await Promise.all([
accountDetails.pinswg_typeofinvolvment == 846040012 accountDetails.pinswg_typeofinvolvment == 846040012
? await getMyLPACases(lpaid) ? await getMyLPACases(lpaid)
: await getMyCases(loggedinUser), : await getMyCases(loggedInUser),
await getMyCases(loggedInUser),
await getRepsFromBlob(thisSession.user.id), await getRepsFromBlob(thisSession.user.id),
await getWatchedCases(loggedInUser), await getWatchedCases(loggedInUser),
await getAwaitingSubmission(loggedInUser), await getAwaitingSubmission(loggedInUser),
@@ -297,6 +300,7 @@ const getDetails = (resultsObj, detailsType) => {
resultsObj = resultsObj.value; resultsObj = resultsObj.value;
if (detailsType == "myRepresentations") { if (detailsType == "myRepresentations") {
const repsObj = resultsObj.map((searchDetail, index) => { const repsObj = resultsObj.map((searchDetail, index) => {
console.log(".......... ", searchDetail);
detailsArr.push( detailsArr.push(
getCase(searchDetail["incidentID"]).then((data) => { getCase(searchDetail["incidentID"]).then((data) => {
let caseID = ""; let caseID = "";