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) => {
//console.log(contactid);
console.log(contactid);
return axios
.get(
BASE_URL +
+27 -20
View File
@@ -109,7 +109,7 @@ const MyPortal = (props) => {
<h2 className="heading-small card-heading">
{
props.accountDetails.accountDetails[
"pinswg_typeofinvolvement@OData.Community.Display.V1.FormattedValue"
"pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
]
}{" "}
LPA Portal
@@ -121,7 +121,7 @@ const MyPortal = (props) => {
<div className="govuk-grid-row">
<div className="govuk-grid-column-full">
<div className="flex-container grid-row govuk-body ">
<MakeNewAppeal />
{isLPA ? "" : <MakeNewAppeal />}
<SearchCases />
{/* {props.awaitingSubmission.awaitingSubmission[
"@odata.count"
@@ -132,17 +132,20 @@ const MyPortal = (props) => {
}
/>
)} */}
{props.awaitingSubmission
.awaitingSubmissionFromBlob["@odata.count"] >
0 && (
<AwaitingSubmissionFromBlob
containerID={props.containerID}
awaitingSubmissionFromBlob={
props.awaitingSubmission
.awaitingSubmissionFromBlob
}
/>
)}
{isLPA
? ""
: props.awaitingSubmission
.awaitingSubmissionFromBlob[
"@odata.count"
] > 0 && (
<AwaitingSubmissionFromBlob
containerID={props.containerID}
awaitingSubmissionFromBlob={
props.awaitingSubmission
.awaitingSubmissionFromBlob
}
/>
)}
{props.myCases.myCases["@odata.count"] > 0 && (
<MyCases myCases={props.myCases} />
)}
@@ -152,13 +155,17 @@ const MyPortal = (props) => {
watchedCases={props.watchedCases}
/>
)}
{props.myRepresentations.myRepresentations[
"@odata.count"
] > 0 && (
<MyRepresentations
myRepresentations={props.myRepresentations}
/>
)}
{isLPA
? ""
: props.myRepresentations.myRepresentations[
"@odata.count"
] > 0 && (
<MyRepresentations
myRepresentations={
props.myRepresentations
}
/>
)}
{isLPA ? "" : <Dns />}
{/* <YourAccount /> */}
+82 -79
View File
@@ -1,81 +1,84 @@
{
"name": "acp",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"dev:app": "node ./server/server.js",
"build": "NODE_ENV=production node_modules/next/dist/bin/next build",
"start": "node_modules/next/dist/bin/next start",
"lint": "next lint"
},
"dependencies": {
"@auth/prisma-adapter": "^1.0.1",
"@azure/identity": "^3.1.3",
"@azure/storage-blob": "^12.12.0",
"@azure/storage-queue": "^12.11.0",
"@next-auth/prisma-adapter": "^1.0.4",
"@prisma/client": "^5.0.0",
"@redux-devtools/extension": "^3.2.5",
"applicationinsights": "^2.2.0",
"axios": "^0.24.0",
"compression": "^1.7.4",
"cookie-cutter": "^0.2.0",
"crypto-js": "^4.1.1",
"date-fns": "^2.28.0",
"dom": "^0.0.3",
"express": "^4.17.2",
"fs": "0.0.2",
"google-map-react": "^2.1.10",
"govuk-frontend": "3.13.0",
"jsonpath": "^1.1.1",
"leaflet": "^1.7.1",
"leaflet-defaulticon-compatibility": "^0.1.1",
"lodash": "^4.17.21",
"moment": "^2.29.1",
"multiparty": "^4.2.3",
"mysql": "^2.18.1",
"nanoid": "^3.2.0",
"next": "^12.0.8",
"next-auth": "^4.22.1",
"next-connect": "^0.12.2",
"next-redux-wrapper": "^7.0.5",
"next-swagger-doc": "^0.3.6",
"next-translate": "^1.2.0",
"nodemailer": "^6.9.1",
"nookies": "^2.5.2",
"notifications-node-client": "^5.1.1",
"ospoint": "^0.2.1",
"path": "^0.12.7",
"prop-types": "^15.8.1",
"react": "17.0.2",
"react-accessible-accordion": "^4.0.0",
"react-autosuggest": "^10.1.0",
"react-cookie-consent": "^7.2.1",
"react-datepicker": "4.10.0",
"react-dom": "17.0.2",
"react-dropzone": "^11.5.1",
"react-idle-timer": "4.6.4",
"react-leaflet": "^3.2.5",
"react-quill": "^2.0.0",
"react-redux": "^7.2.6",
"redux": "^4.2.1",
"redux-form": "^8.3.9",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.4.2",
"sass": "1.32",
"sass-loader": "13.2.0",
"swagger-ui": "^4.17.1",
"swagger-ui-react": "^4.17.0",
"typescript": "^4.9.5",
"uuid": "9.0.0",
"webpack": "^5.66.0",
"xpath": "^0.0.32"
},
"devDependencies": {
"eslint": "^8.6.0",
"eslint-config-next": "^13.1.6",
"eslint-plugin-jsdoc": "^40.0.1",
"prisma": "^5.0.0"
}
"name": "acp",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"dev:app": "node ./server/server.js",
"build": "NODE_ENV=production node_modules/next/dist/bin/next build",
"start": "node_modules/next/dist/bin/next start",
"lint": "next lint"
},
"browser": {
"child_process": false
},
"dependencies": {
"@auth/prisma-adapter": "^1.0.1",
"@azure/identity": "^3.2.4",
"@azure/storage-blob": "^12.12.0",
"@azure/storage-queue": "^12.11.0",
"@next-auth/prisma-adapter": "^1.0.4",
"@prisma/client": "^5.0.0",
"@redux-devtools/extension": "^3.2.5",
"applicationinsights": "^2.2.0",
"axios": "^0.24.0",
"compression": "^1.7.4",
"cookie-cutter": "^0.2.0",
"crypto-js": "^4.1.1",
"date-fns": "^2.28.0",
"dom": "^0.0.3",
"express": "^4.17.2",
"fs": "0.0.2",
"google-map-react": "^2.1.10",
"govuk-frontend": "3.13.0",
"jsonpath": "^1.1.1",
"leaflet": "^1.7.1",
"leaflet-defaulticon-compatibility": "^0.1.1",
"lodash": "^4.17.21",
"moment": "^2.29.1",
"multiparty": "^4.2.3",
"mysql": "^2.18.1",
"nanoid": "^3.2.0",
"next": "^12.0.8",
"next-auth": "^4.22.1",
"next-connect": "^0.12.2",
"next-redux-wrapper": "^7.0.5",
"next-swagger-doc": "^0.3.6",
"next-translate": "^1.2.0",
"nodemailer": "^6.9.1",
"nookies": "^2.5.2",
"notifications-node-client": "^5.1.1",
"ospoint": "^0.2.1",
"path": "^0.12.7",
"prop-types": "^15.8.1",
"react": "17.0.2",
"react-accessible-accordion": "^4.0.0",
"react-autosuggest": "^10.1.0",
"react-cookie-consent": "^7.2.1",
"react-datepicker": "4.10.0",
"react-dom": "17.0.2",
"react-dropzone": "^11.5.1",
"react-idle-timer": "4.6.4",
"react-leaflet": "^3.2.5",
"react-quill": "^2.0.0",
"react-redux": "^7.2.6",
"redux": "^4.2.1",
"redux-form": "^8.3.9",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.4.2",
"sass": "1.32",
"sass-loader": "13.2.0",
"swagger-ui": "^4.17.1",
"swagger-ui-react": "^4.17.0",
"typescript": "^4.9.5",
"uuid": "9.0.0",
"webpack": "^5.66.0",
"xpath": "^0.0.32"
},
"devDependencies": {
"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,
getAwaitingSubmission,
getMyCases,
getLPACases,
getMyLPACases,
getMyRepresentations,
getPersonalAccount,
getPortalModuleDetails,
@@ -188,9 +188,12 @@ export const getServerSideProps = wrapper.getServerSideProps(
const accountDetails = await getPersonalAccount(loggedInUser);
const lpaid = accountDetails(
"pinswg_typeofinvolvement@OData.Community.Display.V1.FormattedValue"
);
console.log("----------", accountDetails);
const lpaid =
accountDetails[
"pinswg_typeofinvolvement@OData.Community.Display.V1.FormattedValue"
];
const [
myCases,
@@ -201,8 +204,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
] = await Promise.all([
accountDetails.pinswg_typeofinvolvment == 846040012
? await getMyLPACases(lpaid)
: await getMyCases(loggedinUser),
await getMyCases(loggedInUser),
: await getMyCases(loggedInUser),
await getRepsFromBlob(thisSession.user.id),
await getWatchedCases(loggedInUser),
await getAwaitingSubmission(loggedInUser),
@@ -297,6 +300,7 @@ const getDetails = (resultsObj, detailsType) => {
resultsObj = resultsObj.value;
if (detailsType == "myRepresentations") {
const repsObj = resultsObj.map((searchDetail, index) => {
console.log(".......... ", searchDetail);
detailsArr.push(
getCase(searchDetail["incidentID"]).then((data) => {
let caseID = "";