Merged PR 1263: added caseinvolvement api for rep

added caseinvolvement api for rep

Related work items: #12499
This commit is contained in:
Robert Bond
2024-10-16 11:44:21 +00:00
14 changed files with 214 additions and 115 deletions
+6 -32
View File
@@ -10,13 +10,7 @@ CLIENT_SECRET = bFq8Q~9VX5Ra3lKnGGIXsB.G6-ZGMx7LqyqXjdr4
RELAY_ROOT = https://ar-ns-lz-pedw-cnr-uks-01.servicebus.windows.net/ar-hc-lz-pedw-cnr-uks-01/
RELAYURI = "ar-ns-lz-pedw-cnr-uks-01.servicebus.windows.net"
RELAYPATH = "ar-hc-lz-pedw-cnr-uks-01"
//Dev oauth ESNR
//CLIENT_ID = 9b834097-03d7-409b-b038-ecfec31a394a
//CLIENT_SECRET = .Jf8Q~tKMObCJjhh_hy3J5AIctFrBalU4FS~tdxk
//RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/
//RELAYURI = "dev-pedw-ns.servicebus.windows.net"
//RELAYPATH = "dev-pedw-hc"
CRMURL = "devcrm2016.llcdt.gov.wales/DVPINS"
//New Dev oauth ESNR
CLIENT_ID = 9b834097-03d7-409b-b038-ecfec31a394a
@@ -24,14 +18,7 @@ CLIENT_SECRET = .Jf8Q~tKMObCJjhh_hy3J5AIctFrBalU4FS~tdxk
RELAY_ROOT = https://ar-ns-lz-pedw-dev-uks-01.servicebus.windows.net/ar-hc-lz-pedw-dev-uks-01/
RELAYURI = "ar-ns-lz-pedw-dev-uks-01.servicebus.windows.net"
RELAYPATH = "ar-hc-lz-pedw-dev-uks-01"
//Test Oauth ESNR
//CLIENT_ID = d40b9373-96c2-4b04-8bd8-c2a2fe6444c1
//CLIENT_SECRET = 6hT8Q~glL~jloWpGmvXw3UY37QFwjUE0r._jobEM
//RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/
//RELAYURI = "test-pedw-ns.servicebus.windows.net"
//RELAYPATH = "test-pedw-hc"
CRMURL = "devcrm2016.llcdt.gov.wales/DVPINS"
//New Test
CLIENT_ID = d40b9373-96c2-4b04-8bd8-c2a2fe6444c1
@@ -39,7 +26,7 @@ CLIENT_SECRET = 6hT8Q~glL~jloWpGmvXw3UY37QFwjUE0r._jobEM
RELAY_ROOT = https://ar-ns-lz-pedw-test-uks-01.servicebus.windows.net/ar-hc-lz-pedw-test-uks-01/
RELAYURI = "ar-ns-lz-pedw-test-uks-01.servicebus.windows.net"
RELAYPATH = "ar-hc-lz-pedw-test-uks-01"
CRMURL = "tscrm2016.llcdt.gov.wales/UATPINS"
//Preprod Oauth WGO
//CLIENT_ID = ab6c4678-b31a-4eb3-b429-e039120e488a
@@ -48,8 +35,7 @@ RELAYPATH = "ar-hc-lz-pedw-test-uks-01"
//RELAY_ROOT = https://pp-pedw-ns.servicebus.windows.net/pp-pedw-hc/
//RELAYURI = "pp-pedw-ns.servicebus.windows.net"
//RELAYPATH = "pp-pedw-hc"
//CRMURL = "ppcrm2016.llc.gov.wales/PPPINSWales"
//Prod Oauth WGO
//CLIENT_ID = 3e4141a3-1fbd-454e-98f0-7f3a4f14a3cc
@@ -58,6 +44,7 @@ RELAYPATH = "ar-hc-lz-pedw-test-uks-01"
//RELAY_ROOT = https://prod-pedw-ns.servicebus.windows.net/prod-pedw-hc/
//RELAYURI = "prod-pedw-ns.servicebus.windows.net"
//RELAYPATH = "prod-pedw-hc"
//CRMURL = "crm2016.llc.gov.wales/PEDW"
//GOOGLE_TAG_MANAGER = GTM-T78CBC3
@@ -110,24 +97,11 @@ AZURE_CLIENT_SECRET = $CLIENT_SECRET
# AZURE_STORAGE_ACCOUNT_KEY = hRffHq4IwctpaTKdS/U33Xq6nyTDF1t++WJgIwsw7gzstktZin/rRwbTIAL9KKqesVsK7EHrTTG6+ASt4+7skw==
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwcnruks.blob.core.windows.net
// dev key
//AZURE_STORAGE_ACCOUNT_NAME = "pedwdev"
//AZURE_STORAGE_ACCOUNT_KEY = JS3ZIXianhYhB1lZrHB+bXbdzaLlON0alCyKrFAb+jVEwr9iqo2dty92EBxwnufNFM+CSN/fKX2R+AStDn0byg==
//AZURE_PEDW_STORAGE_ENDPOINT = https://pedwdev.blob.core.windows.net
// new dev key
AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwdevuks"
AZURE_STORAGE_ACCOUNT_KEY = JS3ZIXianhYhB1lZrHB+bXbdzaLlON0alCyKrFAb+jVEwr9iqo2dty92EBxwnufNFM+CSN/fKX2R+AStDn0byg==
AZURE_STORAGE_ACCOUNT_KEY = MmrsrCjBfop9pI2oImsP/+lJUWU2DrXsAB8nq5bOVROTmPovSGxjCjKw9+TAFr00k8WDUK9r6mVx+AStcMLyAA==
AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwdevuks.blob.core.windows.net
// test key
//AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwdevuks"
////AZURE_STORAGE_ACCOUNT_KEY = Dl8qUVEnR2mglklQorttMurmjUpe2lI3oMWl9V245U6BOLutXDwmpU36afeTrGLK+zfzNVLErsWM+AStiYsimw==
//AZURE_STORAGE_ACCOUNT_KEY = iEQKwh4TB9BT63pU5a6+ivn6ItiDkuIkYCrUwjm9STJTdMBOKWUT06EEcP8pcy/qeQ89ogK75mFQ+AStT53G/g==
//AZURE_PEDW_STORAGE_ENDPOINT = https://pedwtest.blob.core.windows.net
// New test key
AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwtestuks"
AZURE_STORAGE_ACCOUNT_KEY = bqJAz5pYQVGee8dnVhlsqW+xHwinNTjgY2AmojNyB+d4uAotMR20WcO4Op13yB+9dFaXAkkjtIA4+AStHT/IYg==
+18
View File
@@ -1924,6 +1924,24 @@ export const sendRepCompleteMessage = async (
});
};
export const setRepInvolvment = async (caseid, contactid) => {
var queryUrl = "/api/file/createrepinvolvement_api";
var data = { "incidentid": caseid, "contactid": contactid };
var config = {
method: "post",
url: queryUrl,
data: data,
};
try {
const res = await axios(config);
return res.data;
} catch (error) {
consoleLogger(error);
}
};
export const getAddressSearch = async (searchString) => {
const params = new URLSearchParams(searchString);
const str = params.toString();
+1 -1
View File
@@ -793,7 +793,7 @@ const Breadcrumbs = (props) => {
.representationCapacity != "undefined" &&
props.currentView.representationCapacity !=
"" && (
<li className="govuk-breadcrumbs__link-item">
<li className="govuk-breadcrumbs__link-item backChevron">
<a
className="govuk-breadcrumbs__link"
href="#"
@@ -26,12 +26,20 @@ const RepAgent = (props) => {
setRepresentationSubmit,
currentView,
setRepFileName,
updateRepresentation,
} = props;
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
const [savingStatus, setSavingStatus] = useState(false);
setRepFileName(formObj.representationForm.values);
let filterFilesList =
props.currentView.caseReference.repDetails.filesList.filter(function (
el
) {
return el != null;
});
const files = acceptedFiles.map((file) => (
<li key={file.path}>
{file.path} - {file.size} bytes
@@ -175,28 +183,25 @@ const RepAgent = (props) => {
props.currentView.caseReference.repDetails
.filesList.length > 0 ? (
<div className="govuk-form-group govuk-!-margin-bottom-9">
{props.currentView.caseReference.repDetails.filesList.map(
(blob, i) => (
<div
key={blob.name + "_" + i}
className="govuk-!-margin-bottom-5 fileThumb "
>
<img
src={getThumbnailIconByExtension(
blob.name
)}
alt={blob.name}
width="50"
/>
{filterFilesList.map((blob, i) => (
<div
key={blob.name + "_" + i}
className="govuk-!-margin-bottom-5 fileThumb "
>
<img
src={getThumbnailIconByExtension(
blob.name
)}
alt={blob.name}
width="50"
/>
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
{blob.name} (
{bytesToSize(blob.size)}
)
</span>
</div>
)
)}
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
{blob.name} (
{bytesToSize(blob.size)})
</span>
</div>
))}
</div>
) : (
""
@@ -252,8 +257,8 @@ const RepAgent = (props) => {
className="govuk-button progress-save "
onClick={() => {
let valuesObj =
props.props.form[props.form].values ||
{};
props.props.props.form[props.form]
.values || {};
console.log("valuesobj:", valuesObj);
@@ -30,12 +30,20 @@ const RepAppellant = (props) => {
setRepresentationSubmit,
currentView,
setRepFileName,
updateRepresentation,
} = props;
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
const [savingStatus, setSavingStatus] = useState(false);
setRepFileName(formObj.representationForm.values);
let filterFilesList =
props.currentView.caseReference.repDetails.filesList.filter(function (
el
) {
return el != null;
});
return (
<>
<div className="govuk-grid-row">
@@ -154,27 +162,25 @@ const RepAppellant = (props) => {
props.currentView.caseReference.repDetails.filesList
.length > 0 ? (
<div className="govuk-form-group govuk-!-margin-bottom-9">
{props.currentView.caseReference.repDetails.filesList.map(
(blob, i) => (
<div
key={blob.name + "_" + i}
className="govuk-!-margin-bottom-5 fileThumb "
>
<img
src={getThumbnailIconByExtension(
blob.name
)}
alt={blob.name}
width="50"
/>
{filterFilesList.map((blob, i) => (
<div
key={blob.name + "_" + i}
className="govuk-!-margin-bottom-5 fileThumb "
>
<img
src={getThumbnailIconByExtension(
blob.name
)}
alt={blob.name}
width="50"
/>
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
{blob.name} (
{bytesToSize(blob.size)})
</span>
</div>
)
)}
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
{blob.name} (
{bytesToSize(blob.size)})
</span>
</div>
))}
</div>
) : (
""
@@ -230,8 +236,8 @@ const RepAppellant = (props) => {
className="govuk-button progress-save "
onClick={() => {
let valuesObj =
props.props.form[props.form].values ||
{};
props.props.props.form[props.form]
.values || {};
console.log("valuesobj:", valuesObj);
@@ -9,6 +9,7 @@ import {
createWatchedCases,
sendEmail,
sendRepCompleteMessage,
setRepInvolvment,
} from "../../../actions";
import { setRepresentationReset } from "../../../store/currentView/action";
@@ -50,7 +51,11 @@ const RepComplete = (props) => {
};
props.props.currentView.representationMessageSent != true &&
(sendRepCompleteMessage(
(setRepInvolvment(
props.props.currentView.caseReference.incidentid,
props.props.props.props.accountDetails.loggedinUserId
),
sendRepCompleteMessage(
props.props.props.props.accountDetails.containerID,
props.props.currentView.caseReference.currentReference,
props.repFormData.repfile_name
@@ -163,6 +163,10 @@ const RepCompleteSubmit = (props) => {
// ...new Map(buildAppealFilesArray.map((v) => [v.name, v])).values(),
// ];
buildAppealFilesArray = buildAppealFilesArray.filter(function (el) {
return el != null;
});
const arrUniq = buildAppealFilesArray.filter(
(obj1, i, arr) => arr.findIndex((obj2) => obj2.name === obj1.name) === i
);
@@ -173,6 +177,7 @@ const RepCompleteSubmit = (props) => {
"filesList": arrUniq,
});
let filterFiles = [];
return (
<>
{currentView.representationSubmitConfirmation == true ? (
@@ -354,34 +359,34 @@ const RepCompleteSubmit = (props) => {
<dd className="govuk-summary-list__value">
{formObj.representationForm.values
.filesList.length > 0
? formObj.representationForm.values.filesList.map(
(blob, i) => (
<div
key={
blob.name +
"_" +
i
}
className="govuk-!-margin-bottom-5 fileThumb "
>
<img
src={getThumbnailIconByExtension(
blob.name
)}
alt={blob.name}
width="50"
/>
? ((filterFiles =
formObj.representationForm.values.filesList.filter(
function (el) {
return el != null;
}
)),
filterFiles.map((blob, i) => (
<div
key={blob.name + "_" + i}
className="govuk-!-margin-bottom-5 fileThumb "
>
<img
src={getThumbnailIconByExtension(
blob.name
)}
alt={blob.name}
width="50"
/>
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
{blob.name} (
{bytesToSize(
blob.size
)}
)
</span>
</div>
)
)
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
{blob.name} (
{bytesToSize(
blob.size
)}
)
</span>
</div>
)))
: ""}{" "}
</dd>
@@ -23,6 +23,7 @@ const RepInterestedPartyPerson = (props) => {
setRepresentationCapacity,
setRepresentationSubmit,
setRepFileName,
updateRepresentation,
} = props;
const required = (value) => (value ? undefined : "Required");
@@ -31,6 +32,13 @@ const RepInterestedPartyPerson = (props) => {
setRepFileName(formObj.representationForm.values);
let filterFilesList =
props.currentView.caseReference.repDetails.filesList.filter(function (
el
) {
return el != null;
});
const files = acceptedFiles.map((file) => (
<li key={file.path}>
{file.path} - {file.size} bytes
@@ -218,8 +226,8 @@ const RepInterestedPartyPerson = (props) => {
className="govuk-button progress-save "
onClick={() => {
let valuesObj =
props.props.form[props.form].values ||
{};
props.props.props.form[props.form]
.values || {};
console.log("valuesobj:", valuesObj);
+5 -2
View File
@@ -4,7 +4,7 @@ import {
Page,
StyleSheet,
Text,
View
View,
} from "@react-pdf/renderer";
import Html from "react-pdf-html";
import { getFormCollectionByID } from "../../components/utils";
@@ -111,6 +111,9 @@ export const statement_pdf = ({ docProps }) => {
let datestr = values.pinswg_name.split("-");
let signedDate = datestr[2] + "/" + datestr[1] + "/" + datestr[0];
let appealTypeValue = getFormCollectionByID(values.appealType);
let filterFilesList = values.filesList.filter(function (el) {
return el != null;
});
return (
<Document>
@@ -353,7 +356,7 @@ export const statement_pdf = ({ docProps }) => {
]}
>
{values.hasOwnProperty("filesList") &&
values.filesList.map(function (p) {
filterFilesList.map(function (p) {
return (
<View
key={p.name}
+1 -1
View File
@@ -6,7 +6,7 @@
"makenewappeal-card-paragraph-one": "Cyn cyflwyno apêl newydd, gwnewch yn siŵr eich bod wedi darllen y cyfan",
"makenewappeal-card-link": "berthnasol i'r math o apêl sydd gennych.",
"makenewappeal-card-paragraph-two": "Unwaith y byddwch wedi dewis y botwm 'Gwneud apêl newydd', cewch eich arwain trwy broses i'ch helpu i ddewis y math cywir o apêl.",
"makenewappeal-card-paragraph-three": "Dim ond yn erbyn y gallwch chi Gyflwyno apêl:",
"makenewappeal-card-paragraph-three": "Dim ond yn erbyn y gallwch chi gyflwyno apêl:",
"makenewappeal-card-paragraph-three-bullet-one": "gwrthod caniatâd cynllunio",
"makenewappeal-card-paragraph-three-bullet-two": "methiant i benderfynu o fewn amser",
"makenewappeal-card-paragraph-four": "Rhaid cyflwyno pob apêl arall trwy e-bost neu'r post.",
+1 -1
View File
@@ -6,7 +6,7 @@
"makenewappeal-card-paragraph-one": "Before submitting a new appeal, please ensure you have read all of the",
"makenewappeal-card-link": "relevant to your appeal type.",
"makenewappeal-card-paragraph-two": "Once you have selected the 'Make a new appeal' button, you will be guided through a process to help you choose the right type of appeal.",
"makenewappeal-card-paragraph-three": "You can only Submit an appeal against:",
"makenewappeal-card-paragraph-three": "You can only submit an appeal against:",
"makenewappeal-card-paragraph-three-bullet-one": "a refusal of planning permission",
"makenewappeal-card-paragraph-three-bullet-two": "failure to determine within time",
"makenewappeal-card-paragraph-four": "All other appeals must be submitted via email or post.",
@@ -0,0 +1,76 @@
/**
* @swagger
* /api/endpoint/createmywatchedcases_api:
* post:
* tags: [Portal,Case]
* summary: Phase 2
* description: Create my watched cases
* responses:
* 200:
* description: Success
*/
import axios from "axios";
import CryptoJS from "crypto-js";
import { consoleLogger, getToken } from "../../../actions";
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 "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var token = await getToken();
var contactid = req.body.contactid;
var queryUrl =
"incidents(" +
req.body.incidentid +
")/pinswg_incident_contact_case_involvement/$ref";
console.log(req.body, queryUrl);
var crmUrl = "https://" + process.env.CRMURL;
var data = {
"@odata.id": crmUrl + "/api/data/v8.2/contacts(" + contactid + ")",
};
var config = {
method: "post",
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"If-None-Match": "null",
"Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json",
},
data: data,
};
return axios(config)
.then(({ data }) => {
res.status(200).json(data);
})
.catch((error) => {
return error.status == 412
? res.status(200).json({ "record": "exists" })
: (consoleLogger(Object.assign(error, data)),
res.status(400).json(error));
});
}
+2 -2
View File
@@ -324,14 +324,13 @@ export const getServerSideProps = wrapper.getServerSideProps(
store.dispatch(setLoggedInUserId(loggedInUser));
store.dispatch(setLoggedInUserEmail(loggedInUserEmail));
store.dispatch(setAccountDetails(accountDetails));
store.dispatch(setAppealLPA(query.lpa));
store.dispatch(setAppealTypeID(query.apt));
store.dispatch(setCaseReference(caseReference));
store.dispatch(setForm(xmlStr, mandatoryFieldsData, pickListData));
store.dispatch(setAppealType(appealTypeData));
store.dispatch(setContainerID(thisSession.user.id));
store.dispatch(setAccountDetails(accountDetails));
store.dispatch(setFilesForAppeal(blobList));
@@ -351,6 +350,7 @@ const mapStateToProps = (state) => {
accountDetails: state.accountDetails,
awaitingSubmission: state.awaitingSubmission,
currentView: state.currentView,
initialValues: state.appealType.caseReference.caseDetails,
};
};
-1
View File
@@ -202,7 +202,6 @@ let Home = (props) => {
)}
</main>
</div>
<Footer footerLinks={footerLinks} ticketnumber={props} />
</div>
<TimeOut />