Merged PR 451: Split Search to deploy to test
Related work items: #5868
This commit is contained in:
+320
-159
@@ -1,5 +1,7 @@
|
||||
import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
|
||||
//import {XMLHttpRequest} from 'xmlhttprequest';
|
||||
|
||||
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
|
||||
@@ -13,9 +15,61 @@ if (process.browser) {
|
||||
BASE_URL = process.env.API_ROOT || `http://localhost:${port}`;
|
||||
}
|
||||
|
||||
const API_PATH = "/api/data/v8.2/";
|
||||
|
||||
//const WEBAPI_URL = "https://devcrm2016.llcdt.gov.wales/DVPINS" + API_PATH;
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const agent = new https.Agent({
|
||||
rejectUnauthorized: false,
|
||||
});
|
||||
|
||||
export const getSASToken = () => {
|
||||
var m_ResourceURI =
|
||||
process.env.RELAYURI || "dev-pedw-ns.servicebus.windows.net";
|
||||
var m_Path = process.env.RELAYPATH || "dev-pedw-hc";
|
||||
var m_SasKey =
|
||||
process.env.SASKEY || "Ml0Y/S/nfRcmIrHFRkO4jNm2J3iH52TSxPiak7+E1+Y=";
|
||||
var m_SasKeyName = process.env.SASKEYNAME || "devpedwnspolicy";
|
||||
|
||||
var encodedResourceUri = encodeURIComponent(
|
||||
"https://" + m_ResourceURI + "/" + m_Path + "/"
|
||||
);
|
||||
|
||||
var t0 = new Date(1970, 1, 1, 0, 0, 0, 0);
|
||||
var t1 = new Date();
|
||||
var expireInSeconds =
|
||||
+(31 * 24 * 3600) + 3600 + (((t1.getTime() - t0.getTime()) / 1000) | 0);
|
||||
|
||||
//the line below is a hack that converts to UTF8
|
||||
var plainSignature = JSON.parse(
|
||||
JSON.stringify(encodedResourceUri + "\n" + expireInSeconds)
|
||||
);
|
||||
|
||||
var hash = CryptoJS.HmacSHA256(plainSignature, m_SasKey);
|
||||
var base64HashValue = CryptoJS.enc.Base64.stringify(hash);
|
||||
|
||||
var token =
|
||||
"SharedAccessSignature sr=" +
|
||||
encodedResourceUri +
|
||||
"&sig=" +
|
||||
encodeURIComponent(base64HashValue) +
|
||||
"&se=" +
|
||||
expireInSeconds +
|
||||
"&skn=" +
|
||||
m_SasKeyName;
|
||||
|
||||
return token;
|
||||
};
|
||||
|
||||
const accessToken =
|
||||
"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IlVXelVaa0U3OEx0NVBGRkJ0LV9seVdoMjdjTSIsImtpZCI6IlVXelVaa0U3OEx0NVBGRkJ0LV9seVdoMjdjTSJ9.eyJhdWQiOiJodHRwczovL2RldmNybTIwMTYubGxjZHQuZ292LndhbGVzLyIsImlzcyI6Imh0dHA6Ly9mcy50ZXN0Lmdvdi53YWxlcy9hZGZzL3NlcnZpY2VzL3RydXN0IiwiaWF0IjoxNjMyMTIxMjkxLCJuYmYiOjE2MzIxMjEyOTEsImV4cCI6MTYzMjE1MDA5MSwidXBuIjpbIlJvYmVydC5Cb25kQHRlc3QuZ292LndhbGVzIiwicm9iZXJ0LmJvbmRAdGVzdC5nb3Yud2FsZXMiXSwicHJpbWFyeXNpZCI6IlMtMS01LTIxLTE4MDA4NDIwNzYtMjQ1NTYwNjU5LTQyMTU3NzU0NjktMTY2MjgiLCJ1bmlxdWVfbmFtZSI6IlhNXFxCb25kUiIsImFwcHR5cGUiOiJQdWJsaWMiLCJhcHBpZCI6IjQyN2ZhNzljLWI1ZmMtNDJhZC04M2Q0LTQxMGIwMzk0OGFiNiIsImF1dGhtZXRob2QiOiJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL3dzLzIwMDgvMDYvaWRlbnRpdHkvYXV0aGVudGljYXRpb25tZXRob2Qvd2luZG93cyIsImF1dGhfdGltZSI6IjIwMjEtMDktMjBUMDc6MDE6MzEuNDYzWiIsInZlciI6IjEuMCJ9.W0ID2nCBYVxh8T1eQqWKk2Wh45kRbRzCICfzrZNAs-4u54yl0UJUcVihyI8EBmQeALCEc5eY99DjK0gaqzCdJqxbxol8yk5LrFvhV5UkCiZ7SO2Wq1cLReWHVsgz39qBtrZ8vlqqZsv7DsEaRJQbtj8Djnx26Wb_kcNu-tuXwUBF0uR5GLFFvJfM3PzkRCY-ZPOTbvPTb73oN_NKe6BrsVjyaR9xSXsRJjgHPmJgWgnvq-2X0Dj7LCwXSEygDDOGlF1yqqN0Lv6qplhQoH-heZlC1K6qe_92nHPswXag6uN5nxTmk1Qw6zJt_aHMnXdwa18ghh4hGx5R0Jz53X113Q";
|
||||
|
||||
const SASToken = getSASToken();
|
||||
|
||||
const crmHeaders = {
|
||||
withCredentials: true,
|
||||
headers: {
|
||||
@@ -23,62 +77,129 @@ const crmHeaders = {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*"',
|
||||
agent,
|
||||
},
|
||||
auth: {
|
||||
username: "xm\bondr",
|
||||
password: "!Sky9fish1972",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Authorization": "Bearer " + accessToken,
|
||||
},
|
||||
};
|
||||
|
||||
const crmHeadersReturn = {
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": "return=representation",
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + accessToken,
|
||||
},
|
||||
};
|
||||
|
||||
const azureHeaders = {
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
"ServiceBusAuthorization": SASToken,
|
||||
},
|
||||
};
|
||||
|
||||
// const azureHeaders = {
|
||||
// headers: {
|
||||
// "OData-MaxVersion": "4.0",
|
||||
// "OData-Version": "4.0",
|
||||
// "Accept": "application/json",
|
||||
// "Prefer": 'odata.include-annotations="*",return=representation',
|
||||
// "Content-Type": "application/json",
|
||||
// "Authorization": "Bearer " + accessToken,
|
||||
// },
|
||||
// };
|
||||
|
||||
export const getBasicSearch = (searchString) => {
|
||||
console.log("got to axios", searchString);
|
||||
console.log("api_root: ", BASE_URL);
|
||||
return (
|
||||
axios
|
||||
//.get("https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title&$filter=contains(title, '" + searchString + "')&$count=true", crmHeaders)
|
||||
//.get("https://jsonplaceholder.typicode.com/todos/1",{proxy:{protocol: 'http',host:'lon3.sme.zscloud.net',port: 80}})
|
||||
.get(BASE_URL + "/api/searchresults2", {
|
||||
httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||
})
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thiserror", error);
|
||||
})
|
||||
);
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
"incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=contains(title, '" +
|
||||
searchString +
|
||||
"') and pinswg_appealcasetype ne null &$count=true",
|
||||
azureHeaders
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thiserror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getBasicSearchDetails = (appealType, caseReference) => {
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
appealType +
|
||||
"?$filter=pinswg_name eq '" +
|
||||
caseReference +
|
||||
"'&$count=true",
|
||||
azureHeaders
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thiserror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getFormData = (whichForm) => {
|
||||
console.log("got to axios", whichForm);
|
||||
console.log("api_root: ", BASE_URL);
|
||||
return (
|
||||
axios
|
||||
//.get("api/appealforms/pinswg_dns", {
|
||||
//.get("api/appealforms/pinswg_planningobligationappeals106", {
|
||||
//.get("api/appealforms/pinswg_planningconditionss73s79", {
|
||||
//.get("api/appealforms/pinswg_row", {
|
||||
//.get("api/appealforms/pinswg_transportandworkact", {
|
||||
//.get("api/appealforms/pinswg_harbourrevisionorder", {
|
||||
//.get("api/appealforms/pinswg_planningappeals78", {
|
||||
//.get(api/appealforms/pinswg_householderappealhas", {
|
||||
.get(BASE_URL + "/api/appealforms/pinswg_" + whichForm, {
|
||||
httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||
})
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thiserror", error);
|
||||
})
|
||||
);
|
||||
//console.log("got to axios", whichForm);
|
||||
//console.log("api_root: ", BASE_URL);
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
"systemforms?$select=formid,name,formxml,type,objecttypecode&$filter=(objecttypecode%20eq%20%27pinswg_" +
|
||||
whichForm +
|
||||
"%27and%20type%20eq%202)&$count=true",
|
||||
azureHeaders
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thiserror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getMandatoryFields = (whichForm) => {
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
"EntityDefinitions(LogicalName='pinswg_" +
|
||||
whichForm +
|
||||
"')/Attributes?$count=true&$select=LogicalName,RequiredLevel",
|
||||
azureHeaders
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thiserror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPickLists = (whichForm) => {
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
"EntityDefinitions(LogicalName='pinswg_" +
|
||||
whichForm +
|
||||
"')/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet,GlobalOptionSet&$count=true",
|
||||
azureHeaders
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thiserror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getAppealsTypes = () => {
|
||||
console.log("got to axios: appeal types");
|
||||
console.log("api_root: ", BASE_URL);
|
||||
return axios
|
||||
.get(BASE_URL + "/api/lookups/pinswg_appealcasetype", {
|
||||
httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||
})
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
"stringmaps?$filter=attributename%20eq%20%27pinswg_appealcasetype%27&$count=true&$select=value,stringmapid,organizationid,attributevalue",
|
||||
azureHeaders
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thiserror", error);
|
||||
@@ -188,14 +309,9 @@ export const getAppealTypeDetail = (caseReference, appealcasetype) => {
|
||||
//https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/pinswg_planningappeals78s?$filter=pinswg_name eq 'CAS-00015-L7J9H1'
|
||||
|
||||
export const getLPA = () => {
|
||||
console.log("api_root: ", BASE_URL);
|
||||
// console.log("api_root: ", BASE_URL);
|
||||
return axios
|
||||
|
||||
.get(
|
||||
BASE_URL + "/api/lookups/pinswg_lpa",
|
||||
//.get("https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/accounts?$select=name",
|
||||
{ httpsAgent: new https.Agent({ rejectUnauthorized: false }) }
|
||||
)
|
||||
.get(WEBAPI_URL + "accounts?$count=true&$select=name", azureHeaders)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thi serror", error);
|
||||
@@ -217,99 +333,117 @@ export const getPersonalAccount = () => {
|
||||
});
|
||||
};
|
||||
|
||||
function makeid(length) {
|
||||
var result = "";
|
||||
var characters =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
var charactersLength = characters.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
result += characters.charAt(
|
||||
Math.floor(Math.random() * charactersLength)
|
||||
);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
export const getAppealID = (
|
||||
caseReference,
|
||||
updateFormCollection,
|
||||
primaryAttribute
|
||||
) => {
|
||||
const weburl =
|
||||
"/api/proxy/" +
|
||||
updateFormCollection +
|
||||
"?$count=true&$select=_" +
|
||||
primaryAttribute +
|
||||
"s_value&$filter=pinswg_name eq '" +
|
||||
caseReference +
|
||||
"'";
|
||||
|
||||
export const createCase = (lpaType, appealType) => {
|
||||
console.log();
|
||||
|
||||
const lastPart = makeid(6);
|
||||
|
||||
const middlePart = Math.floor(100000 + Math.random() * 900000);
|
||||
|
||||
return "CAS-" + middlePart + "-" + lastPart.toUpperCase();
|
||||
console.log("proxy url", weburl);
|
||||
return axios
|
||||
.get(weburl, azureHeaders)
|
||||
.then((res) => {
|
||||
var appealID = res.data.value[0][primaryAttribute];
|
||||
return appealID;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("thi serror", error);
|
||||
});
|
||||
};
|
||||
|
||||
// var req = new XMLHttpRequest();
|
||||
// req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title&$filter=contains(title, '000')&$count=true", true);
|
||||
// req.setRequestHeader("OData-MaxVersion", "4.0");
|
||||
// req.setRequestHeader("OData-Version", "4.0");
|
||||
// req.setRequestHeader("Accept", "application/json");
|
||||
// req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
|
||||
// req.setRequestHeader("Prefer", "odata.include-annotations=\"*\"");
|
||||
// req.onreadystatechange = function() {
|
||||
// if (this.readyState === 4) {
|
||||
// req.onreadystatechange = null;
|
||||
// if (this.status === 200) {
|
||||
// var results = JSON.parse(this.response);
|
||||
// var recordCount = results["@odata.count"];
|
||||
// for (var i = 0; i < results.value.length; i++) {
|
||||
// var _accountid_value = results.value[i]["_accountid_value"];
|
||||
// var _accountid_value_formatted = results.value[i]["_accountid_value@OData.Community.Display.V1.FormattedValue"];
|
||||
// var _accountid_value_lookuplogicalname = results.value[i]["_accountid_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
|
||||
// var _customerid_value = results.value[i]["_customerid_value"];
|
||||
// var _customerid_value_formatted = results.value[i]["_customerid_value@OData.Community.Display.V1.FormattedValue"];
|
||||
// var _customerid_value_lookuplogicalname = results.value[i]["_customerid_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
|
||||
// var pinswg_appealcasetype = results.value[i]["pinswg_appealcasetype"];
|
||||
// var pinswg_appealcasetype_formatted = results.value[i]["pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"];
|
||||
// var statuscode = results.value[i]["statuscode"];
|
||||
// var ticketnumber = results.value[i]["ticketnumber"];
|
||||
// var title = results.value[i]["title"];
|
||||
// }
|
||||
// } else {
|
||||
// Xrm.Utility.alertDialog(this.statusText);
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
// req.send();
|
||||
export const createCase = (appealTypeId) => {
|
||||
appealTypeId = parseInt(appealTypeId);
|
||||
var data = JSON.stringify({
|
||||
"title": "insertion test case",
|
||||
"customerid_contact@odata.bind":
|
||||
"/contacts(f8b454ed-eded-eb11-aac7-00224800be9c)",
|
||||
"pinswg_appealcasetype": appealTypeId,
|
||||
});
|
||||
|
||||
// //jquery version to get case number from an lpa and an appeal type
|
||||
// var entity = {};
|
||||
// entity.caseorigincode = 3;
|
||||
// entity["customerid_account@odata.bind"] = "/accounts(c75f6f84-49da-eb11-aabd-00224800d1bd)";
|
||||
// entity.pinswg_appealcasetype = 846040004;
|
||||
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// contentType: "application/json; charset=utf-8",
|
||||
// datatype: "json",
|
||||
// url: Xrm.Page.context.getClientUrl() + "/api/data/v8.2/incidents",
|
||||
// data: JSON.stringify(entity),
|
||||
// beforeSend: function(XMLHttpRequest) {
|
||||
// XMLHttpRequest.setRequestHeader("OData-MaxVersion", "4.0");
|
||||
// XMLHttpRequest.setRequestHeader("OData-Version", "4.0");
|
||||
// XMLHttpRequest.setRequestHeader("Accept", "application/json");
|
||||
// XMLHttpRequest.setRequestHeader("Prefer", "odata.include-annotations=\"*\",return=representation");
|
||||
// },
|
||||
// async: true,
|
||||
// success: function(data, textStatus, xhr) {
|
||||
// var uri = xhr.getResponseHeader("OData-EntityId");
|
||||
// var regExp = /\(([^)]+)\)/;
|
||||
// var matches = regExp.exec(uri);
|
||||
// var newEntityId = matches[1];
|
||||
// //Handle returned attributes
|
||||
// },
|
||||
// error: function(xhr, textStatus, errorThrown) {
|
||||
// Xrm.Utility.alertDialog(textStatus + " " + errorThrown);
|
||||
// }
|
||||
// });
|
||||
|
||||
export const getMyCases = () => {
|
||||
return axios
|
||||
|
||||
.get(BASE_URL + "/api/lookups/myCases", {
|
||||
httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||
var config = {
|
||||
method: "post",
|
||||
url: WEBAPI_URL + "incidents",
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
"ServiceBusAuthorization": SASToken,
|
||||
},
|
||||
data: data,
|
||||
};
|
||||
// console.log(config);
|
||||
return axios(config)
|
||||
.then((res) => {
|
||||
// console.log("posted ", res.data);
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("this serror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const updateCase = async (
|
||||
incidentId,
|
||||
updateBody,
|
||||
updateFormCollection,
|
||||
primaryAttribute,
|
||||
caseReference
|
||||
) => {
|
||||
var data = JSON.stringify(updateBody);
|
||||
|
||||
var appealObj = await getAppealID(
|
||||
caseReference,
|
||||
updateFormCollection,
|
||||
primaryAttribute
|
||||
);
|
||||
|
||||
console.log("appeal obj ", appealObj);
|
||||
|
||||
var config = {
|
||||
method: "patch",
|
||||
//url: WEBAPI_URL + updateFormCollection + "(" + incidentId + ")",
|
||||
url: "/api/proxy/" + updateFormCollection + "(" + appealObj + ")",
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
"ServiceBusAuthorization": SASToken,
|
||||
},
|
||||
data: data,
|
||||
};
|
||||
|
||||
console.log(config);
|
||||
return axios(config)
|
||||
.then((res) => {
|
||||
console.log("patched ", res.data);
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("thi serror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getMyCases = (loggedInUserId) => {
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
"incidents?$select=ticketnumber,casetypecode,createdon,_customerid_value,description,incidentid,pinswg_appealcasetype,_pinswg_assignedinspectrids_value,statecode,statuscode,title&$filter=_customerid_value eq " +
|
||||
loggedInUserId +
|
||||
" and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3",
|
||||
azureHeaders
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thi serror", error);
|
||||
@@ -317,33 +451,44 @@ export const getMyCases = () => {
|
||||
};
|
||||
|
||||
export const getMyRepresentations = () => {
|
||||
return axios
|
||||
|
||||
.get(BASE_URL + "/api/lookups/myRepresentations", {
|
||||
httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||
})
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thi serror", error);
|
||||
});
|
||||
return (
|
||||
axios
|
||||
// .get(BASE_URL + "/api/lookups/myRepresentations", {
|
||||
// httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||
// })
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
"incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype ne null &$count=true&$top=3",
|
||||
azureHeaders
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thi serror", error);
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
export const getWatchedCases = () => {
|
||||
return axios
|
||||
return (
|
||||
axios
|
||||
|
||||
.get(BASE_URL + "/api/lookups/watchedCases", {
|
||||
httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||
})
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
w;
|
||||
console.log("thi serror", error);
|
||||
});
|
||||
// .get(BASE_URL + "/api/lookups/watchedCases", {
|
||||
// httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||
// })
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
"incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype ne null &$count=true&$top=3",
|
||||
azureHeaders
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("this serror", error);
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
export const getAwaitingSubmission = () => {
|
||||
return axios
|
||||
|
||||
.get(BASE_URL + "/api/lookups/awaitingSubmission", {
|
||||
httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||
})
|
||||
@@ -352,3 +497,19 @@ export const getAwaitingSubmission = () => {
|
||||
console.log("thi serror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPortalModuelDetails = (appealType, caseReference) => {
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
appealType +
|
||||
"?$filter=pinswg_name eq '" +
|
||||
caseReference +
|
||||
"'&$count=true",
|
||||
azureHeaders
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thiserror", error);
|
||||
});
|
||||
};
|
||||
|
||||
+50
-13
@@ -69,17 +69,26 @@ const Breadcrumbs = (props) => {
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/searchresults" ? (
|
||||
{router.pathname == "/myportal/searchresults" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link href="/myportal">
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
My Portal
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
Search results
|
||||
{t("common:breadcrumb-search-results")}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/searchresults" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-search-results")}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
@@ -129,7 +138,7 @@ const Breadcrumbs = (props) => {
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link href="/myportal">
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
My Portal
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
@@ -145,7 +154,7 @@ const Breadcrumbs = (props) => {
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link href="/myportal">
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
My Portal
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
@@ -156,12 +165,12 @@ const Breadcrumbs = (props) => {
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/case" ? (
|
||||
{router.pathname == "/myportal/case" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link href="/myportal">
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
My Portal
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
@@ -173,7 +182,7 @@ const Breadcrumbs = (props) => {
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
Case Reference:{" "}
|
||||
{t("common:breadcrumb-case-reference")}:{" "}
|
||||
{
|
||||
props.props.currentView.caseReference
|
||||
.currentReference
|
||||
@@ -183,12 +192,40 @@ const Breadcrumbs = (props) => {
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/representation" ? (
|
||||
{router.pathname == "/case" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
"/searchresults?q=" +
|
||||
props.props.search.searchString
|
||||
}
|
||||
>
|
||||
<a
|
||||
onClick={() => router.back()}
|
||||
className="govuk-breadcrumbs__link"
|
||||
>
|
||||
{t("common:breadcrumb-search-results")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-case-reference")}:{" "}
|
||||
{
|
||||
props.props.currentView.caseReference
|
||||
.currentReference
|
||||
}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{router.pathname == "/myportal/representation" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link href="/myportal">
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
My Portal
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
@@ -208,7 +245,7 @@ const Breadcrumbs = (props) => {
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link href="/myportal">
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
My Portal
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
@@ -233,7 +270,7 @@ const Breadcrumbs = (props) => {
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link href="/myportal">
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
My Portal
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
@@ -316,7 +353,7 @@ const Breadcrumbs = (props) => {
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link href="/myportal">
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
My Portal
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
|
||||
@@ -21,12 +21,14 @@ const CaseSummary = (props) => {
|
||||
<div className="govuk-grid-column-full">
|
||||
<Summary
|
||||
myCases={props.myCases}
|
||||
myCasesDetails={props.myCasesDetails}
|
||||
myRepresentations={props.myRepresentations}
|
||||
watchedCases={props.watchedCases}
|
||||
awaitingSubmission={props.awaitingSubmission}
|
||||
caseReference={props.caseReference}
|
||||
currentType={props.currentType}
|
||||
searchResultsObj={props.searchResultsObj}
|
||||
searchDetailsObj={props.searchDetailsObj}
|
||||
searchString={props.searchString}
|
||||
/>
|
||||
<Documents />
|
||||
|
||||
@@ -93,7 +93,7 @@ let MakeRepresentation = (props) => {
|
||||
? setRepresentationCapacity(false)
|
||||
: setRepresentationCapacity(
|
||||
formObj["representationForm"].values.representationCapacity
|
||||
.replace(/[\s\-\+\(\)\,\/]/g, "")
|
||||
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
||||
.toLowerCase()
|
||||
);
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ let MakeRepresentation = (props) => {
|
||||
)
|
||||
? false
|
||||
: formObj["representationForm"].values.representationCapacity
|
||||
.replace(/[\s\-\+\(\)\,\/]/g, "")
|
||||
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
||||
.toLowerCase();
|
||||
};
|
||||
|
||||
@@ -215,14 +215,14 @@ let MakeRepresentation = (props) => {
|
||||
// console.log(_.isEmpty(currentView.representationCapacity));
|
||||
// console.log(
|
||||
// values.representationCapacity
|
||||
// .replace(/[\s\-\+\(\)\,\/]/g, "")
|
||||
// .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
||||
// .toLowerCase() == currentView.representationCapacity
|
||||
// );
|
||||
|
||||
_.isEmpty(currentView.representationCapacity)
|
||||
? setRepresentationCapacity(
|
||||
values.representationCapacity
|
||||
.replace(/[\s\-\+\(\)\,\/]/g, "")
|
||||
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
||||
.toLowerCase()
|
||||
)
|
||||
: setRepresentationSubmit(true);
|
||||
|
||||
+166
-46
@@ -16,15 +16,18 @@ const CaseSummary = (props) => {
|
||||
watchedCases,
|
||||
awaitingSubmission,
|
||||
searchResultsObj,
|
||||
searchDetailsObj,
|
||||
currentType,
|
||||
} = props;
|
||||
|
||||
let setCaseQueryObj = props[currentType];
|
||||
let setCaseDetailsObj = props[currentType + "Details"];
|
||||
|
||||
var casesObj = {};
|
||||
|
||||
currentType == "searchResultsObj"
|
||||
? (casesObj = jsonpath.query(
|
||||
setCaseQueryObj,
|
||||
searchResultsObj,
|
||||
'$..[?(@.title=="' + caseReference + '")]'
|
||||
))
|
||||
: (casesObj = jsonpath.query(
|
||||
@@ -34,6 +37,19 @@ const CaseSummary = (props) => {
|
||||
|
||||
casesObj = Object.assign({}, ...casesObj);
|
||||
|
||||
var detailsObj = {};
|
||||
|
||||
currentType == "searchResultsObj"
|
||||
? (detailsObj = jsonpath.query(
|
||||
searchDetailsObj,
|
||||
'$..[?(@.pinswg_name=="' + caseReference + '")]'
|
||||
))
|
||||
: (detailsObj = jsonpath.query(
|
||||
setCaseDetailsObj,
|
||||
'$..[?(@.pinswg_name=="' + caseReference + '")]'
|
||||
));
|
||||
|
||||
detailsObj = detailsObj[0];
|
||||
return (
|
||||
<div>
|
||||
<div className="govuk-grid-row">
|
||||
@@ -41,7 +57,7 @@ const CaseSummary = (props) => {
|
||||
<h1 className="govuk-heading-xl govuk-!-margin-bottom-7">
|
||||
Reference:{" "}
|
||||
{currentType == "searchResultsObj"
|
||||
? casesObj.title
|
||||
? detailsObj.pinswg_name
|
||||
: casesObj.reference}
|
||||
</h1>
|
||||
|
||||
@@ -51,7 +67,9 @@ const CaseSummary = (props) => {
|
||||
{t("case:summary-applicant-label")}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{casesObj.appellantApplicant || ""}
|
||||
{detailsObj[
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
|
||||
] || "not entered"}
|
||||
</dd>
|
||||
</div>
|
||||
<div className="govuk-summary-list__row">
|
||||
@@ -59,7 +77,9 @@ const CaseSummary = (props) => {
|
||||
{t("case:summary-agent-label")}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
Mr A Agent
|
||||
{_.has(detailsObj, "pinswg_agentcontactname")
|
||||
? detailsObj.pinswg_agentcontactname
|
||||
: ""}
|
||||
</dd>
|
||||
</div>
|
||||
<div className="govuk-summary-list__row">
|
||||
@@ -67,12 +87,25 @@ const CaseSummary = (props) => {
|
||||
{t("case:summary-site-address-label")}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{casesObj.address1 || ""}
|
||||
{_.has(detailsObj, "pinswg_siteaddressline1")
|
||||
? detailsObj.pinswg_siteaddressline1
|
||||
: ""}
|
||||
<br />
|
||||
{casesObj.town || ""}
|
||||
|
||||
{_.has(detailsObj, "pinswg_siteaddressline1")
|
||||
? detailsObj.pinswg_siteaddressline2
|
||||
: ""}
|
||||
<br />
|
||||
{casesObj.postcode || ""}
|
||||
{_.has(detailsObj, "pinswg_siteaddressline1")
|
||||
? detailsObj.pinswg_siteaddresstown
|
||||
: ""}
|
||||
<br />
|
||||
{_.has(detailsObj, "pinswg_siteaddressline1")
|
||||
? detailsObj.pinswg_siteaddresscounty
|
||||
: ""}
|
||||
<br />
|
||||
{_.has(detailsObj, "pinswg_siteaddressline1")
|
||||
? detailsObj.pinswg_siteaddresspostcode
|
||||
: ""}
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
@@ -81,11 +114,19 @@ const CaseSummary = (props) => {
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full">
|
||||
<div className="govuk-button-group">
|
||||
<Link href="/representation">
|
||||
<a className="govuk-button">
|
||||
{t("case:summary-make-representation-label")}
|
||||
</a>
|
||||
</Link>
|
||||
{router.pathname != "/case" ? (
|
||||
<>
|
||||
<Link href="/representation">
|
||||
<a className="govuk-button">
|
||||
{t(
|
||||
"case:summary-make-representation-label"
|
||||
)}
|
||||
</a>
|
||||
</Link>
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
<a
|
||||
onClick={() => router.back()}
|
||||
className="govuk-button govuk-button--secondary"
|
||||
@@ -120,7 +161,13 @@ const CaseSummary = (props) => {
|
||||
{t("case:summary-lpa-label")}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{casesObj.lpaname || ""}
|
||||
{_.has(detailsObj, [
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue",
|
||||
])
|
||||
? detailsObj[
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: ""}
|
||||
</dd>
|
||||
</div>
|
||||
<div className="govuk-summary-list__row">
|
||||
@@ -130,8 +177,12 @@ const CaseSummary = (props) => {
|
||||
)}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{casesObj.caseDetails.caseSummary ||
|
||||
""}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_casedescription"
|
||||
)
|
||||
? detailsObj.pinswg_casedescription
|
||||
: ""}
|
||||
</dd>
|
||||
</div>
|
||||
<div className="govuk-summary-list__row">
|
||||
@@ -142,8 +193,14 @@ const CaseSummary = (props) => {
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{" "}
|
||||
{casesObj.caseDetails.caseOfficer ||
|
||||
""}
|
||||
{/* {casesObj.caseDetails.caseOfficer ||
|
||||
""} */}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_casedescription"
|
||||
)
|
||||
? detailsObj.pinswg_casedescription
|
||||
: ""}
|
||||
</dd>
|
||||
</div>
|
||||
<div className="govuk-summary-list__row">
|
||||
@@ -151,8 +208,13 @@ const CaseSummary = (props) => {
|
||||
{t("case:summary-procedure-label")}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{casesObj.caseDetails.procedure ||
|
||||
""}
|
||||
{_.has(detailsObj, [
|
||||
"pinswg_procedure@OData.Community.Display.V1.FormattedValue",
|
||||
])
|
||||
? detailsObj[
|
||||
"pinswg_procedure@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: ""}
|
||||
</dd>
|
||||
</div>
|
||||
<div className="govuk-summary-list__row">
|
||||
@@ -170,15 +232,21 @@ const CaseSummary = (props) => {
|
||||
{t("case:summary-decision-label")}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{casesObj.caseDetails.decision ||
|
||||
""}
|
||||
{_.has(detailsObj, [
|
||||
"pinswg_decision@OData.Community.Display.V1.FormattedValue",
|
||||
])
|
||||
? detailsObj[
|
||||
"pinswg_decision@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: ""}
|
||||
|
||||
<br />
|
||||
<Link href="/">
|
||||
{/* <Link href="/">
|
||||
<a>
|
||||
{casesObj.caseDetails
|
||||
.outcome_document || ""}
|
||||
</a>
|
||||
</Link>
|
||||
</Link> */}
|
||||
</dd>
|
||||
</div>
|
||||
<div className="govuk-summary-list__row">
|
||||
@@ -188,8 +256,13 @@ const CaseSummary = (props) => {
|
||||
)}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{casesObj.caseDetails
|
||||
.caseLinkStatus || ""}
|
||||
{_.has(detailsObj, [
|
||||
"pinswg_linkedstatus@OData.Community.Display.V1.FormattedValue",
|
||||
])
|
||||
? detailsObj[
|
||||
"pinswg_linkedstatus@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: "Not linked"}
|
||||
</dd>
|
||||
</div>
|
||||
<div className="govuk-summary-list__row">
|
||||
@@ -199,8 +272,8 @@ const CaseSummary = (props) => {
|
||||
)}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{casesObj.caseDetails.linkedCases ||
|
||||
""}
|
||||
{/* {casesObj.caseDetails.linkedCases ||
|
||||
""} */}
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
@@ -219,8 +292,14 @@ const CaseSummary = (props) => {
|
||||
{t("case:summary-start-date-label")}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{casesObj.caseDates.start_date ||
|
||||
"N/A"}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_startdate@OData.Community.Display.V1.FormattedValue"
|
||||
)
|
||||
? detailsObj[
|
||||
"pinswg_startdate@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: "N/A"}
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
@@ -231,8 +310,14 @@ const CaseSummary = (props) => {
|
||||
)}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{casesObj.caseDates
|
||||
.questionnaireDue || "N/A"}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_questionnaireduedate@OData.Community.Display.V1.FormattedValue"
|
||||
)
|
||||
? detailsObj[
|
||||
"pinswg_questionnaireduedate@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: "N/A"}
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
@@ -243,8 +328,14 @@ const CaseSummary = (props) => {
|
||||
)}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{casesObj.caseDates.statementsDue ||
|
||||
"N/A"}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_statementduedate@OData.Community.Display.V1.FormattedValue"
|
||||
)
|
||||
? detailsObj[
|
||||
"pinswg_statementduedate@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: "N/A"}
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
@@ -255,9 +346,14 @@ const CaseSummary = (props) => {
|
||||
)}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{casesObj.caseDates
|
||||
.interestedPartyCommentsdue ||
|
||||
"N/A"}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_otherpartiesstatement@OData.Community.Display.V1.FormattedValue"
|
||||
)
|
||||
? detailsObj[
|
||||
"pinswg_otherpartiesstatement@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: "N/A"}
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
@@ -268,9 +364,14 @@ const CaseSummary = (props) => {
|
||||
)}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{casesObj.caseDates
|
||||
.appellantLPAFinalCommentsdue ||
|
||||
"N/A"}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_finalcommentsduedate@OData.Community.Display.V1.FormattedValue"
|
||||
)
|
||||
? detailsObj[
|
||||
"pinswg_finalcommentsduedate@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: "N/A"}
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
@@ -281,8 +382,14 @@ const CaseSummary = (props) => {
|
||||
)}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{casesObj.caseDates
|
||||
.inquiryEvidenceDue || "N/A"}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_finalcommentsduedate@OData.Community.Display.V1.FormattedValue"
|
||||
)
|
||||
? detailsObj[
|
||||
"pinswg_finalcommentsduedate@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: "N/A"}
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
@@ -291,8 +398,14 @@ const CaseSummary = (props) => {
|
||||
{t("case:summary-event-date-label")}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{casesObj.caseDates.eventDate ||
|
||||
"N/A"}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_dateeventrequested@OData.Community.Display.V1.FormattedValue"
|
||||
)
|
||||
? detailsObj[
|
||||
"pinswg_dateeventrequested@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: "N/A"}
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
@@ -303,8 +416,14 @@ const CaseSummary = (props) => {
|
||||
)}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{casesObj.caseDates.decisionDate ||
|
||||
"N/A"}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_dateoflpadecision@OData.Community.Display.V1.FormattedValue"
|
||||
)
|
||||
? detailsObj[
|
||||
"pinswg_dateoflpadecision@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: "N/A"}
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
@@ -313,6 +432,7 @@ const CaseSummary = (props) => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* <div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full">
|
||||
<div className="govuk-button-group">
|
||||
|
||||
@@ -5,6 +5,7 @@ import DatePicker from "react-datepicker";
|
||||
import React, { useState } from "react";
|
||||
import "react-datepicker/dist/react-datepicker.css";
|
||||
import moment from "moment";
|
||||
import jsonpath from "jsonpath";
|
||||
|
||||
const RenderTextfield = ({
|
||||
id,
|
||||
@@ -43,21 +44,39 @@ const RenderTextfield = ({
|
||||
};
|
||||
|
||||
export function Textfield(props) {
|
||||
const { name, label, validate } = props;
|
||||
const { name, label, validate, ticketnumber } = props;
|
||||
const required = (value) => (value ? undefined : "Required");
|
||||
|
||||
return (
|
||||
<Field
|
||||
name={props.name}
|
||||
id={props.name}
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
//validate={[required]}
|
||||
label={props.label}
|
||||
errorMsg="Is required"
|
||||
/>
|
||||
);
|
||||
if (name == "pinswg_name") {
|
||||
return (
|
||||
<div className="govuk-form-group">
|
||||
<label className="govuk-label " htmlFor={props.name}>
|
||||
{label}
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
name={name}
|
||||
id={props.name}
|
||||
component={RenderCaseID}
|
||||
value={ticketnumber}
|
||||
className="govuk-input govuk-input--width-20"
|
||||
disabled
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<Field
|
||||
name={props.name}
|
||||
id={props.name}
|
||||
component={RenderTextfield}
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
//validate={[required]}
|
||||
label={props.label}
|
||||
errorMsg="Is required"
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const RenderMultiline = ({
|
||||
@@ -348,7 +367,7 @@ export function YesNofield(props) {
|
||||
id={props.name}
|
||||
className="govuk-radios__input"
|
||||
//validate={[required]}
|
||||
errorMsg="Select and option"
|
||||
errorMsg="Select an option"
|
||||
component={RenderYesNo}
|
||||
/>
|
||||
);
|
||||
@@ -356,48 +375,24 @@ export function YesNofield(props) {
|
||||
|
||||
const RenderPickList = ({
|
||||
datafieldname,
|
||||
picklistData,
|
||||
name,
|
||||
label,
|
||||
input,
|
||||
meta: { touched, errorStr },
|
||||
}) => {
|
||||
const fetcher = (url) => fetch(url).then((res) => res.json());
|
||||
|
||||
const { data, error } = useSWR("/api/lookups/" + datafieldname, fetcher);
|
||||
if (error)
|
||||
return (
|
||||
<div className="govuk-form-group">
|
||||
<label className="govuk-label govuk-body-m" htmlFor={name}>
|
||||
{label}
|
||||
</label>
|
||||
<select className="govuk-select" id={name} name={name}>
|
||||
<option value="">empty</option>
|
||||
</select>
|
||||
</div>
|
||||
);
|
||||
if (!data)
|
||||
return (
|
||||
<div>
|
||||
<div className="govuk-form-group">{label} loading...</div>
|
||||
</div>
|
||||
);
|
||||
//console.log(JSON.stringify(data.GlobalOptionSet.Options));
|
||||
|
||||
const dropdownObj = data.GlobalOptionSet.Options;
|
||||
|
||||
var dropdownObj = jsonpath.query(
|
||||
picklistData,
|
||||
"$..value[?(@.LogicalName=='" + datafieldname + "')]..Options"
|
||||
);
|
||||
dropdownObj = dropdownObj[0];
|
||||
return (
|
||||
<div>
|
||||
<select {...input} className="govuk-select " id={name} name={name}>
|
||||
<option>Select...</option>
|
||||
{Object.keys(dropdownObj).map((key, index) => {
|
||||
return (
|
||||
<option
|
||||
key={key}
|
||||
value={
|
||||
dropdownObj[key].Label.LocalizedLabels[0].value
|
||||
}
|
||||
// value={dropdownObj[key].Label.LocalizedLabels[0].MetadataId}
|
||||
>
|
||||
<option key={key} value={dropdownObj[key].Value}>
|
||||
{dropdownObj[key].Label.LocalizedLabels[0].Label}
|
||||
</option>
|
||||
);
|
||||
@@ -421,6 +416,7 @@ export function PickList(props) {
|
||||
name={props.name}
|
||||
component={RenderPickList}
|
||||
datafieldname={datafieldname}
|
||||
picklistData={props.picklistData}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
@@ -438,12 +434,13 @@ export function NumericField(props) {
|
||||
name={props.name}
|
||||
id={props.name}
|
||||
component="input"
|
||||
type="text"
|
||||
type="number"
|
||||
className="govuk-input govuk-input--width-20"
|
||||
spellCheck="false"
|
||||
//aria-describedby="account-number-hint"
|
||||
pattern="[0-9]*"
|
||||
inputMode="numeric"
|
||||
parse={Number}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
@@ -461,12 +458,13 @@ export function DecimalField(props) {
|
||||
name={props.name}
|
||||
id={props.name}
|
||||
component="input"
|
||||
type="text"
|
||||
className="govuk-input govuk-input--width-10"
|
||||
type="number"
|
||||
className="govuk-input govuk-input--width-10"
|
||||
spellCheck="false"
|
||||
//aria-describedby="account-number-hint"
|
||||
pattern="[0-9]*"
|
||||
inputMode="numeric"
|
||||
parse={Number}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
+18
-2
@@ -18,6 +18,8 @@ const Header = (props) => {
|
||||
"/dns/contact-us",
|
||||
"/dns/applications",
|
||||
"/dns/application-view",
|
||||
"/searchresults",
|
||||
"/case",
|
||||
];
|
||||
const hasContactLink = [
|
||||
"/dns",
|
||||
@@ -150,7 +152,15 @@ const Header = (props) => {
|
||||
<Link
|
||||
href={
|
||||
locale == "en"
|
||||
? router.pathname
|
||||
? router.query.q != null
|
||||
? router.pathname +
|
||||
"?q=" +
|
||||
router.query.q
|
||||
: router.pathname
|
||||
: router.query.q != null
|
||||
? router.pathname +
|
||||
"?q=" +
|
||||
router.query.q
|
||||
: router.pathname
|
||||
}
|
||||
locale={
|
||||
@@ -213,7 +223,13 @@ const Header = (props) => {
|
||||
<Link
|
||||
href={
|
||||
locale == "en"
|
||||
? router.pathname
|
||||
? router.query.q != null
|
||||
? router.pathname +
|
||||
"?q=" +
|
||||
router.query.q
|
||||
: router.pathname
|
||||
: router.query.q != null
|
||||
? router.pathname + "?q=" + router.query.q
|
||||
: router.pathname
|
||||
}
|
||||
locale={locale == "en" ? "cy" : "en"}
|
||||
|
||||
@@ -2,81 +2,106 @@ import Link from "next/link";
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { connect } from "react-redux";
|
||||
import { Field, reduxForm } from "redux-form";
|
||||
|
||||
export default function CaseSearch() {
|
||||
const required = (errorMsg) => (value) =>
|
||||
value || typeof value === "number" ? undefined : errorMsg;
|
||||
|
||||
export const minLength = (errorMsg) => (value) =>
|
||||
value && value.length < 4
|
||||
? errorMsg //`Must be ${min} characters or more`
|
||||
: undefined;
|
||||
|
||||
const RenderTextfield = ({
|
||||
id,
|
||||
className,
|
||||
rows,
|
||||
datafieldname,
|
||||
name,
|
||||
label,
|
||||
input,
|
||||
hint1,
|
||||
hint2,
|
||||
meta: { touched, error },
|
||||
...custom
|
||||
}) => {
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
className={
|
||||
touched && error
|
||||
? "govuk-form-group govuk-form-group--error"
|
||||
: "govuk-form-group "
|
||||
}
|
||||
>
|
||||
<div id="basicSearch-hint" className="govuk-hint ">
|
||||
{hint1}
|
||||
<br />
|
||||
<span className="govuk-body-s">
|
||||
<span className="govuk-!-font-weight-bold">
|
||||
{hint2}
|
||||
</span>{" "}
|
||||
CAS-00009-W8N6W4
|
||||
</span>
|
||||
</div>
|
||||
<label className="govuk-label " htmlFor={id} id={id + "_label"}>
|
||||
{label}
|
||||
</label>
|
||||
{touched && error && (
|
||||
<span id={id + "-error"} className="govuk-error-message">
|
||||
<span className="govuk-visually-hidden">Error:</span>{" "}
|
||||
{error}
|
||||
</span>
|
||||
)}
|
||||
<input {...input} className={className} name={name} id={id} />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
let CaseSearch = (props) => {
|
||||
let { t } = useTranslation();
|
||||
const { handleSubmit, pristine, reset, submitting } = props;
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
const [query, setQuery] = useState("");
|
||||
const [validationError, setValidationError] = useState("");
|
||||
const handleParam = (setValue) => (e) => setValue(e.target.value);
|
||||
|
||||
const basicSearch = (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
if (query == "" || query == null) {
|
||||
setValidationError(true);
|
||||
} else {
|
||||
setValidationError(false);
|
||||
console.log(query);
|
||||
// /searchresults
|
||||
|
||||
router.push({
|
||||
pathname: "/searchresults",
|
||||
query: { q: query },
|
||||
});
|
||||
}
|
||||
const onHandleSubmit = (values) => {
|
||||
router.replace({
|
||||
pathname: "/searchresults",
|
||||
query: { q: values.basicSearch },
|
||||
shallow: true,
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="card" id="casesearch-card">
|
||||
<form onSubmit={basicSearch}>
|
||||
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
||||
<div className="card-body">
|
||||
<h3 className="heading-small card-heading">
|
||||
{t("home:casesearch-card-title")}
|
||||
</h3>
|
||||
<div
|
||||
className={
|
||||
validationError
|
||||
? "govuk-form-group govuk-form-group--error"
|
||||
: "govuk-form-group "
|
||||
}
|
||||
>
|
||||
<div id="basicSearch-hint" className="govuk-hint ">
|
||||
{t("home:casesearch-card-search-hint")}:
|
||||
<br />
|
||||
<span className="govuk-body-s">
|
||||
{" "}
|
||||
<span className="govuk-!-font-weight-bold">
|
||||
{t(
|
||||
"home:casesearch-card-search-example-label"
|
||||
)}
|
||||
:
|
||||
</span>{" "}
|
||||
CAS-00009-W8N6W4
|
||||
</span>
|
||||
</div>
|
||||
{validationError && (
|
||||
<span
|
||||
id="basicSearch-error"
|
||||
className="govuk-error-message"
|
||||
>
|
||||
<span className="govuk-visually-hidden">
|
||||
Error:
|
||||
</span>{" "}
|
||||
Case reference is required
|
||||
</span>
|
||||
)}
|
||||
<input
|
||||
className="govuk-input"
|
||||
id="basicSearch"
|
||||
name="basicSearch"
|
||||
type="text"
|
||||
aria-describedby="basicSearch-hint"
|
||||
onChange={handleParam(setQuery)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Field
|
||||
validate={[
|
||||
required(
|
||||
t("home:casesearch-search-validation-required")
|
||||
),
|
||||
minLength(
|
||||
t("home:casesearch-search-validation-minlength")
|
||||
),
|
||||
]}
|
||||
className="govuk-input"
|
||||
component={RenderTextfield}
|
||||
id="basicSearch"
|
||||
name="basicSearch"
|
||||
type="text"
|
||||
aria-describedby="basicSearch-hint"
|
||||
hint1={t("home:casesearch-card-search-hint")}
|
||||
hint2={t("home:casesearch-card-search-example-label")}
|
||||
/>
|
||||
|
||||
<div className="govuk-form-group">
|
||||
<button type="submit" className="govuk-button">
|
||||
{t("home:casesearch-card-button")}
|
||||
@@ -89,4 +114,24 @@ export default function CaseSearch() {
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
...state,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(
|
||||
reduxForm({
|
||||
form: "basicSearchForm",
|
||||
destroyOnUnmount: false,
|
||||
})(CaseSearch)
|
||||
);
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import Link from "next/link";
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
|
||||
export default function Dns() {
|
||||
let { t } = useTranslation();
|
||||
return (
|
||||
<div className="card" id="casesearch-card">
|
||||
<div className="card-body">
|
||||
<h3 className="heading-small card-heading">
|
||||
{t("home:dns-card-title")}
|
||||
</h3>
|
||||
<div className="govuk-form-group">
|
||||
<p className="govuk-body-s">
|
||||
{t("home:dns-card-paragraph")}
|
||||
</p>
|
||||
</div>
|
||||
<div className="govuk-form-group">
|
||||
<button type="submit" className="govuk-button">
|
||||
{t("home:dns-card-button")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
|
||||
export default function LoginSoon() {
|
||||
let { t } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
return (
|
||||
<div className="card" id="login-card">
|
||||
<div className="card-body active">
|
||||
<h3 className="heading-small card-heading">
|
||||
{t("home:login-card-title-temp")}
|
||||
</h3>
|
||||
|
||||
<div className="govuk-form-group govuk-!-margin-top-4">
|
||||
<p className="govuk-body-s">
|
||||
{t("home:login-comingsoon-temp-1")}
|
||||
</p>
|
||||
<p className="govuk-body-s">
|
||||
{t("home:login-comingsoon-temp-2")}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+29
-27
@@ -2,35 +2,37 @@ import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import { useContext } from "react";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Login from "./homepage/login";
|
||||
import CaseSearch from "./homepage/casesearch";
|
||||
import Inspectorate from "./homepage/inspectorate";
|
||||
import CaseComment from "./homepage/casecomment";
|
||||
|
||||
import Login from "./homepage/login";
|
||||
import LoginSoon from "./homepage/loginSoon";
|
||||
import CaseSearch from "./homepage/casesearch";
|
||||
import Inspectorate from "./homepage/inspectorate";
|
||||
import CaseComment from "./homepage/casecomment";
|
||||
import Dns from "./homepage/dns";
|
||||
|
||||
export default function Home({ children, pages }) {
|
||||
let { t } = useTranslation();
|
||||
let { t } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
|
||||
return (
|
||||
<main
|
||||
className="govuk-main-wrapper govuk-main-wrapper--auto-spacing"
|
||||
id="main-content"
|
||||
role="main"
|
||||
>
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full">
|
||||
|
||||
<div className="flex-container grid-row govuk-body ">
|
||||
<Login />
|
||||
<CaseSearch/>
|
||||
<CaseComment/>
|
||||
<Inspectorate/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
return (
|
||||
<main
|
||||
className="govuk-main-wrapper govuk-main-wrapper--auto-spacing"
|
||||
id="main-content"
|
||||
role="main"
|
||||
>
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full">
|
||||
<div className="flex-container grid-row govuk-body ">
|
||||
<LoginSoon />
|
||||
<CaseSearch />
|
||||
<CaseComment />
|
||||
<Dns />
|
||||
{/* <Login /> */}
|
||||
<Inspectorate />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ const MyCases = (props) => {
|
||||
<div className="cardModuleContainer">
|
||||
<TopThree
|
||||
showTopThree={props.myCases.myCases}
|
||||
showDetails={props.myCases.myCasesDetails}
|
||||
topThreeType={"myCases"}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -23,7 +23,7 @@ export default function SearchCases() {
|
||||
// /searchresults
|
||||
|
||||
router.push({
|
||||
pathname: "/searchresults",
|
||||
pathname: "/myportal/searchresults",
|
||||
query: { q: query },
|
||||
});
|
||||
}
|
||||
|
||||
+120
-49
@@ -1,4 +1,5 @@
|
||||
import Link from "next/link";
|
||||
import _ from "lodash";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { setCurrentReference } from "../../store/currentView/action";
|
||||
@@ -6,64 +7,134 @@ import { connect } from "react-redux";
|
||||
|
||||
const TopThree = (props) => {
|
||||
let { t } = useTranslation();
|
||||
const { showTopThree, setCurrentReference, topThreeType } = props;
|
||||
const { showTopThree, showDetails, setCurrentReference, topThreeType } =
|
||||
props;
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
|
||||
let topthreeRow = [];
|
||||
|
||||
for (var i = 0; i < 3; i++) {
|
||||
(function (i) {
|
||||
topthreeRow.push(
|
||||
<div className="cardModuleItem" key={i}>
|
||||
<div className="cardModuleDetails">
|
||||
<div className="cardModuleReference">
|
||||
<b>Case reference:</b>{" "}
|
||||
<Link
|
||||
href={
|
||||
topThreeType == "awaitingSubmission"
|
||||
? "/representation"
|
||||
: "/case"
|
||||
}
|
||||
>
|
||||
<a
|
||||
data-id={i}
|
||||
onClick={() => {
|
||||
setCurrentReference({
|
||||
"currentReference":
|
||||
showTopThree.value[i].reference,
|
||||
"currentType": topThreeType,
|
||||
});
|
||||
}}
|
||||
>
|
||||
{showTopThree.value[i].reference}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
{topThreeType != "awaitingSubmission" ? (
|
||||
<div className="carModuleAddress">
|
||||
<b>Address: </b>
|
||||
{showTopThree.value[i].address1}
|
||||
</div>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
// for (var i = 0; i < 3; i++) {
|
||||
// (function (i) {
|
||||
// topthreeRow.push(
|
||||
// <div className="cardModuleItem" key={i}>
|
||||
// <div className="cardModuleDetails">
|
||||
// <div className="cardModuleReference">
|
||||
// <b>Case reference:</b>{" "}
|
||||
// <Link
|
||||
// href={
|
||||
// topThreeType == "awaitingSubmission"
|
||||
// ? "/representation"
|
||||
// : "/case"
|
||||
// }
|
||||
// >
|
||||
// <a
|
||||
// data-id={i}
|
||||
// onClick={() => {
|
||||
// setCurrentReference({
|
||||
// "currentReference":
|
||||
// showTopThree.value[i]
|
||||
// .ticketnumber,
|
||||
// "currentType": topThreeType,
|
||||
// });
|
||||
// }}
|
||||
// >
|
||||
// {showTopThree.value[i].ticketnumber}
|
||||
// </a>
|
||||
// </Link>
|
||||
// </div>
|
||||
// {topThreeType != "awaitingSubmission" ? (
|
||||
// <div className="carModuleAddress">
|
||||
// <b>Addressaa: </b>
|
||||
// {showDetails[i].value[0]
|
||||
// .pinswg_siteaddressline1 == null
|
||||
// ? "not entered"
|
||||
// : showDetails[i].value[0]
|
||||
// .pinswg_siteaddressline1}
|
||||
// </div>
|
||||
// ) : (
|
||||
// ""
|
||||
// )}
|
||||
|
||||
{topThreeType == "awaitingSubmission" ? (
|
||||
<div className="carModuleAddress">
|
||||
Make Representation on Case Incomplete, not
|
||||
submitted
|
||||
</div>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
// {topThreeType == "awaitingSubmission" ? (
|
||||
// <div className="carModuleAddress">
|
||||
// Make Representation on Case Incomplete, not
|
||||
// submitted
|
||||
// </div>
|
||||
// ) : (
|
||||
// ""
|
||||
// )}
|
||||
// </div>
|
||||
// <div className="cardModuleRemoveCase"> —</div>
|
||||
// </div>
|
||||
// );
|
||||
// })(i);
|
||||
// }
|
||||
|
||||
let showTopThreeArr = showTopThree.value;
|
||||
|
||||
Object.keys(showTopThreeArr).map((key, index) => {
|
||||
topthreeRow.push(
|
||||
<div className="cardModuleItem" key={index}>
|
||||
<div className="cardModuleDetails">
|
||||
<div className="cardModuleReference">
|
||||
<b>Case reference:</b>{" "}
|
||||
<Link
|
||||
href={
|
||||
topThreeType == "awaitingSubmission"
|
||||
? "/representation"
|
||||
: "/case"
|
||||
}
|
||||
>
|
||||
<a
|
||||
data-id={index}
|
||||
onClick={() => {
|
||||
setCurrentReference({
|
||||
"currentReference":
|
||||
showTopThreeArr[key].ticketnumber,
|
||||
"currentType": topThreeType,
|
||||
});
|
||||
}}
|
||||
>
|
||||
{showTopThreeArr[key].ticketnumber}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
<div className="cardModuleRemoveCase"> —</div>
|
||||
{topThreeType != "awaitingSubmission" ? (
|
||||
<div className="carModuleAddress">
|
||||
<b>Addressa:</b>{" "}
|
||||
{_.isEmpty(showDetails)
|
||||
? "not entered"
|
||||
: _.isEmpty(showDetails[index])
|
||||
? "not entered"
|
||||
: _.isEmpty(showDetails[index].value[0])
|
||||
? "not entered"
|
||||
: _.isEmpty(
|
||||
showDetails[index].value[0]
|
||||
.pinswg_siteaddressline1
|
||||
)
|
||||
? "not entered"
|
||||
: showDetails[index].value[0]
|
||||
.pinswg_siteaddressline1}
|
||||
</div>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
|
||||
{topThreeType == "awaitingSubmission" ? (
|
||||
<div className="carModuleAddress">
|
||||
Make Representation on Case Incomplete, not
|
||||
submitted
|
||||
</div>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})(i);
|
||||
}
|
||||
<div className="cardModuleRemoveCase"> —</div>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
return <>{topthreeRow}</>;
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ const ViewAllResults = (props) => {
|
||||
<span className="results-visually-hidden">
|
||||
Case Reference:
|
||||
</span>
|
||||
{resultsArr[index].reference}
|
||||
{resultsArr[index].ticketnumber}
|
||||
</a>
|
||||
</Link>
|
||||
</dd>
|
||||
@@ -51,11 +51,15 @@ const ViewAllResults = (props) => {
|
||||
<span className="results-visually-hidden">
|
||||
Appellant/Applicant:
|
||||
</span>
|
||||
{resultsArr[index].appellantApplicant}
|
||||
Mr smith
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-14">
|
||||
<span className="results-visually-hidden">Authority:</span>
|
||||
{resultsArr[index].lpaname}
|
||||
{
|
||||
resultsArr[index][
|
||||
"_customerid_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-14">
|
||||
<span className="results-visually-hidden">Case Type:</span>
|
||||
|
||||
@@ -2,6 +2,7 @@ import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import xpath from "xpath";
|
||||
import jsonpath from "jsonpath";
|
||||
import BuildCheckField from "./buildCheckfield";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import {
|
||||
@@ -22,6 +23,7 @@ let BuildCheckRow = (props) => {
|
||||
sectionCount,
|
||||
onSubmit,
|
||||
updateCurrentSection,
|
||||
mandatoryFieldsData,
|
||||
} = props;
|
||||
|
||||
const parser = new DOMParser();
|
||||
@@ -56,44 +58,59 @@ let BuildCheckRow = (props) => {
|
||||
rowXML[key].outerHTML,
|
||||
"text/xml"
|
||||
);
|
||||
var rows = xpath.select("//label/@description", doc);
|
||||
var fieldtype = xpath.select("//@classid", doc);
|
||||
var datafieldname = xpath.select("//@datafieldname", doc);
|
||||
if (_.isEmpty(rowXML[key].innerHTML)) {
|
||||
("");
|
||||
} else {
|
||||
var rows = xpath.select("//label/@description", doc);
|
||||
var fieldtype = xpath.select("//@classid", doc);
|
||||
var datafieldname = xpath.select("//@datafieldname", doc);
|
||||
const isRequiredField = jsonpath.query(
|
||||
mandatoryFieldsData,
|
||||
"$..value[?(@.LogicalName=='" +
|
||||
datafieldname[0].value +
|
||||
"')]"
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="govuk-summary-list__row" key={key}>
|
||||
<dt className="govuk-summary-list__key">
|
||||
{rows[0].value}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{fieldtype[0].value ==
|
||||
"{5B773807-9FB2-42db-97C3-7A91EFF8ADFF}"
|
||||
? formatDate(
|
||||
props.props.form["appealForm"].values[
|
||||
datafieldname[0].value
|
||||
]
|
||||
)
|
||||
: props.props.form["appealForm"].values[
|
||||
datafieldname[0].value
|
||||
]}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__actions">
|
||||
<a
|
||||
className="govuk-link"
|
||||
href="#"
|
||||
onClick={() => {
|
||||
updateCurrentSection(whichSection);
|
||||
}}
|
||||
>
|
||||
Change
|
||||
<span className="govuk-visually-hidden">
|
||||
{" "}
|
||||
name
|
||||
</span>
|
||||
</a>
|
||||
</dd>
|
||||
</div>
|
||||
);
|
||||
if (isRequiredField[0].RequiredLevel.Value != "None") {
|
||||
return (
|
||||
<div className="govuk-summary-list__row" key={key}>
|
||||
<dt className="govuk-summary-list__key">
|
||||
{rows[0].value}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{fieldtype[0].value ==
|
||||
"{5B773807-9FB2-42db-97C3-7A91EFF8ADFF}"
|
||||
? formatDate(
|
||||
props.props.form["appealForm"]
|
||||
.values[
|
||||
datafieldname[0].value
|
||||
]
|
||||
)
|
||||
: props.props.form["appealForm"].values[
|
||||
datafieldname[0].value
|
||||
]}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__actions">
|
||||
<a
|
||||
className="govuk-link"
|
||||
href="#"
|
||||
onClick={() => {
|
||||
updateCurrentSection(whichSection);
|
||||
}}
|
||||
>
|
||||
Change
|
||||
<span className="govuk-visually-hidden">
|
||||
{" "}
|
||||
name
|
||||
</span>
|
||||
</a>
|
||||
</dd>
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
})}
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -28,6 +28,7 @@ let BuildCheckSection = (props) => {
|
||||
handleSubmit,
|
||||
formTitle,
|
||||
setCurrentSection,
|
||||
mandatoryFieldsData,
|
||||
} = props;
|
||||
|
||||
const parser = new DOMParser();
|
||||
@@ -56,32 +57,29 @@ let BuildCheckSection = (props) => {
|
||||
|
||||
return (
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-two-thirds">
|
||||
<div className="govuk-grid-column-full">
|
||||
<div>
|
||||
<h1 className="govuk-heading-m">
|
||||
Are these answers correct?
|
||||
</h1>
|
||||
{Object.keys(titles).map((key) => (
|
||||
<>
|
||||
<h2 className="govuk-heading-m">
|
||||
<dl className="govuk-summary-list ">
|
||||
{Object.keys(titles).map((key) => (
|
||||
<>
|
||||
{/* <h2 className="govuk-heading-m">
|
||||
{titles[key].value}
|
||||
</h2>
|
||||
</h2> */}
|
||||
|
||||
<dl
|
||||
className="govuk-summary-list govuk-!-margin-bottom-9"
|
||||
key={key}
|
||||
>
|
||||
<BuildCheckRow
|
||||
formXML={formXML}
|
||||
whichSection={parseInt(key) + 1}
|
||||
sectionCount={key}
|
||||
props={props}
|
||||
key={key}
|
||||
mandatoryFieldsData={mandatoryFieldsData}
|
||||
/>
|
||||
</dl>
|
||||
</>
|
||||
))}
|
||||
|
||||
</>
|
||||
))}
|
||||
</dl>
|
||||
<dl className="govuk-summary-list govuk-!-margin-bottom-9 at-summary-list"></dl>
|
||||
</div>
|
||||
<div className="govuk-button-group">
|
||||
@@ -94,7 +92,6 @@ let BuildCheckSection = (props) => {
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div className="govuk-grid-column-one-third"></div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -2,6 +2,7 @@ import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import xpath from "xpath";
|
||||
|
||||
import {
|
||||
Textfield,
|
||||
DateField,
|
||||
@@ -20,7 +21,7 @@ export default function BuildField(props) {
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
|
||||
const { fieldType, label, datafieldname } = props;
|
||||
const { fieldType, label, datafieldname, mandatoryFieldData } = props;
|
||||
|
||||
const parser = new DOMParser();
|
||||
|
||||
@@ -31,7 +32,15 @@ export default function BuildField(props) {
|
||||
<ReadOnlyfield
|
||||
name={props.datafieldname}
|
||||
label={props.label}
|
||||
value={props.props.props.appealType.caseReference}
|
||||
value={
|
||||
props.props.props.appealType.caseReference
|
||||
.ticketnumber
|
||||
}
|
||||
props={props}
|
||||
ticketnumber={
|
||||
props.props.props.appealType.caseReference
|
||||
.ticketnumber
|
||||
}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
@@ -41,6 +50,7 @@ export default function BuildField(props) {
|
||||
name={props.datafieldname}
|
||||
label={props.label}
|
||||
datafieldname={props.datafieldname}
|
||||
picklistData={props.picklistData}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
@@ -52,9 +62,17 @@ export default function BuildField(props) {
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "{ 4273EDBD-AC1D-40d3-9FB2-095C621B552D}":
|
||||
case "{4273EDBD-AC1D-40d3-9FB2-095C621B552D}":
|
||||
return (
|
||||
<Textfield name={props.datafieldname} label={props.label} />
|
||||
<Textfield
|
||||
name={props.datafieldname}
|
||||
label={props.label}
|
||||
props={props}
|
||||
ticketnumber={
|
||||
props.props.props.appealType.caseReference
|
||||
.ticketnumber
|
||||
}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "{5B773807-9FB2-42db-97C3-7A91EFF8ADFF}":
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import Link from "next/link";
|
||||
import _ from "lodash";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import xpath from "xpath";
|
||||
import BuildField from "./buildfield";
|
||||
import jsonpath from "jsonpath";
|
||||
|
||||
export default function BuildRow(props) {
|
||||
let { t } = useTranslation();
|
||||
@@ -10,7 +12,13 @@ export default function BuildRow(props) {
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
|
||||
const { rowXML, whichSection, sectionCount, onSubmit } = props;
|
||||
const {
|
||||
rowXML,
|
||||
whichSection,
|
||||
sectionCount,
|
||||
onSubmit,
|
||||
mandatoryFieldsData,
|
||||
} = props;
|
||||
|
||||
const parser = new DOMParser();
|
||||
|
||||
@@ -21,18 +29,38 @@ export default function BuildRow(props) {
|
||||
rowXML[key].outerHTML,
|
||||
"text/xml"
|
||||
);
|
||||
var rows = xpath.select("//label/@description", doc);
|
||||
var fieldtype = xpath.select("//@classid", doc);
|
||||
var datafieldname = xpath.select("//@datafieldname", doc);
|
||||
return (
|
||||
<BuildField
|
||||
fieldType={fieldtype[0].value}
|
||||
label={rows[0].value}
|
||||
datafieldname={datafieldname[0].value}
|
||||
key={key}
|
||||
props={props}
|
||||
/>
|
||||
);
|
||||
if (_.isEmpty(rowXML[key].innerHTML)) {
|
||||
("");
|
||||
} else {
|
||||
var rows = xpath.select("//label/@description", doc);
|
||||
var fieldtype = xpath.select("//@classid", doc);
|
||||
var datafieldname = xpath.select("//@datafieldname", doc);
|
||||
|
||||
const isRequiredField = jsonpath.query(
|
||||
mandatoryFieldsData,
|
||||
"$..value[?(@.LogicalName=='" +
|
||||
datafieldname[0].value +
|
||||
"')]"
|
||||
);
|
||||
|
||||
if (isRequiredField[0].RequiredLevel.Value != "None") {
|
||||
return (
|
||||
<BuildField
|
||||
fieldType={fieldtype[0].value}
|
||||
label={rows[0].value}
|
||||
datafieldname={datafieldname[0].value}
|
||||
key={key}
|
||||
props={props}
|
||||
picklistData={
|
||||
props.props.props.formData.pickListData
|
||||
}
|
||||
mandatoryFieldsData={mandatoryFieldsData}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -32,19 +32,21 @@ let BuildSection = (props) => {
|
||||
setCurrentSection,
|
||||
refno,
|
||||
gotoSection,
|
||||
mandatoryFieldsData,
|
||||
} = props;
|
||||
|
||||
const currentSection = props.appealType.currentSection;
|
||||
const parser = new DOMParser();
|
||||
var doc = parser.parseFromString(props.formXML, "text/xml");
|
||||
var titles = xpath.select(
|
||||
"//form/tabs/tab[" + currentSection + " ]/labels/label/@description",
|
||||
doc
|
||||
);
|
||||
// var titles = xpath.select(
|
||||
// "//form/tabs/tab[" + currentSection + " ]/labels/label/@description",
|
||||
// doc
|
||||
// );
|
||||
var rowXML = xpath.select(
|
||||
"/form/tabs/tab[" +
|
||||
currentSection +
|
||||
"]/columns//sections/section/rows/row",
|
||||
// "/form/tabs/tab[" +
|
||||
// currentSection +
|
||||
// "]/columns//sections/section/rows/row",
|
||||
"/form/tabs/tab/columns//sections/section/rows/row",
|
||||
doc
|
||||
);
|
||||
|
||||
@@ -129,7 +131,8 @@ let BuildSection = (props) => {
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-two-thirds">
|
||||
<h1 className="govuk-heading-m govuk-!-margin-top-5">
|
||||
{titles[0].value}{" "}
|
||||
{/* {titles[0].value}{" "} */}
|
||||
Enter your appeal information
|
||||
</h1>
|
||||
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
||||
{hasErrors == true ? (
|
||||
@@ -141,17 +144,17 @@ let BuildSection = (props) => {
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
|
||||
<BuildRow
|
||||
rowXML={rowXML}
|
||||
whichSection={props.whichSection}
|
||||
sectionCount={props.sectionCount}
|
||||
onSubmit={onSubmit}
|
||||
mandatoryFieldsData={mandatoryFieldsData}
|
||||
props={props}
|
||||
/>
|
||||
{}
|
||||
<div className="govuk-button-group">
|
||||
{props.sectionCount != currentSection ? (
|
||||
{/* {props.sectionCount != currentSection ? (
|
||||
<button
|
||||
type="submit"
|
||||
className="govuk-button"
|
||||
@@ -163,15 +166,15 @@ let BuildSection = (props) => {
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{props.sectionCount == currentSection ? (
|
||||
<button
|
||||
type="submit"
|
||||
className="govuk-button"
|
||||
data-module="govuk-button"
|
||||
>
|
||||
Submit
|
||||
</button>
|
||||
) : (
|
||||
{props.sectionCount == currentSection ? ( */}
|
||||
<button
|
||||
type="submit"
|
||||
className="govuk-button"
|
||||
data-module="govuk-button"
|
||||
>
|
||||
Submit
|
||||
</button>
|
||||
{/* ) : (
|
||||
""
|
||||
)}
|
||||
{currentSection > 1 ? (
|
||||
@@ -186,11 +189,11 @@ let BuildSection = (props) => {
|
||||
</a>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
)} */}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div className="govuk-grid-column-one-third">
|
||||
{/* <div className="govuk-grid-column-one-third">
|
||||
<nav
|
||||
role="navigation"
|
||||
aria-labelledby="progress-list"
|
||||
@@ -239,7 +242,7 @@ let BuildSection = (props) => {
|
||||
</ul>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -7,11 +7,82 @@ import BuildRow from "./buildrow";
|
||||
import { reduxForm, formValueSelector } from "redux-form";
|
||||
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { setCurrentSection } from "../../store/appealType/action";
|
||||
import { updateCase } from "../../actions";
|
||||
import jsonpath from "jsonpath";
|
||||
|
||||
import data from "../../data/collections.json";
|
||||
|
||||
let CompleteAppeal = (props) => {
|
||||
// useEffect(() => {
|
||||
// window.scrollTo(0, 0);
|
||||
// });
|
||||
// un comment to update incident with an appealtype id
|
||||
useEffect(() => {
|
||||
let incidentId = props.appealType.caseReference.incidentid;
|
||||
let updateBody = props.props.form.appealForm.values;
|
||||
|
||||
let updateBindAppealTypeToIncident =
|
||||
"pinswg_" +
|
||||
props.appealType.caseReference[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
].replace(/(\band|[\s\-\+\(\)\,\&])/g, "") +
|
||||
"Ids";
|
||||
|
||||
Object.assign(updateBody, {
|
||||
"pinswg_Appellant@odata.bind":
|
||||
"/contacts(" + props.props.accountDetails.loggedinUserId + ")",
|
||||
"pinswg_AssociatedLPA@odata.bind":
|
||||
"/accounts(" + props.appealType.appealLPA + ")",
|
||||
"pinswg_name": props.appealType.caseReference.ticketnumber,
|
||||
[updateBindAppealTypeToIncident + "@odata.bind"]:
|
||||
"/incidents(" + incidentId + ")",
|
||||
});
|
||||
|
||||
updateBody = JSON.stringify(updateBody);
|
||||
|
||||
updateBody = updateBody.replace(/:"Yes"/gm, `:true`);
|
||||
updateBody = updateBody.replace(/:"No"/gm, `:false`);
|
||||
updateBody = JSON.parse(updateBody);
|
||||
let updateFormCollection = getFormCollection(
|
||||
"pinswg_" +
|
||||
props.appealType.caseReference[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
||||
.toLowerCase()
|
||||
);
|
||||
|
||||
let primaryAttribute = getPrimaryAttr(
|
||||
"pinswg_" +
|
||||
props.appealType.caseReference[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
||||
.toLowerCase()
|
||||
);
|
||||
|
||||
updateCase(
|
||||
incidentId,
|
||||
updateBody,
|
||||
updateFormCollection,
|
||||
primaryAttribute,
|
||||
props.appealType.caseReference.ticketnumber
|
||||
);
|
||||
}, [props.appealType.caseReference, props.props.form.appealForm.values]);
|
||||
|
||||
const getFormCollection = (formtype) => {
|
||||
const collectionName = jsonpath.query(
|
||||
data,
|
||||
"$..[?(@.LogicalName=='" + formtype + "')].LogicalCollectionName"
|
||||
);
|
||||
//console.log(collectionName[0]);
|
||||
return collectionName[0];
|
||||
};
|
||||
|
||||
const getPrimaryAttr = (formtype) => {
|
||||
const attrName = jsonpath.query(
|
||||
data,
|
||||
"$..[?(@.LogicalName=='" + formtype + "')].PrimaryIdAttribute"
|
||||
);
|
||||
return attrName[0];
|
||||
};
|
||||
|
||||
let { t } = useTranslation();
|
||||
|
||||
@@ -52,6 +123,9 @@ let CompleteAppeal = (props) => {
|
||||
setCurrentSection(currentSection + 1);
|
||||
};
|
||||
|
||||
// console.log(JSON.stringify(props.props.form.appealForm.values, null, 2));
|
||||
//alert(JSON.stringify(props.props.form.appealForm.values, null, 2));
|
||||
|
||||
return (
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-two-thirds">
|
||||
@@ -60,7 +134,9 @@ let CompleteAppeal = (props) => {
|
||||
<div className="govuk-panel__body">
|
||||
Your reference number
|
||||
<br />
|
||||
<strong>{props.appealType.caseReference}</strong>
|
||||
<strong>
|
||||
{props.appealType.caseReference.ticketnumber}
|
||||
</strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ import BuildRow from "./buildrow";
|
||||
import { reduxForm, formValueSelector, Field } from "redux-form";
|
||||
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
||||
import jsonpath from "jsonpath";
|
||||
|
||||
import data from "../../data/collections.json";
|
||||
import {
|
||||
setAppealType,
|
||||
setAppealTypeTitle,
|
||||
@@ -33,11 +35,9 @@ let CreateCase = (props) => {
|
||||
? [{}]
|
||||
: _.isEmpty(props.appealType.appealTypeOptions)
|
||||
? [{}]
|
||||
: _.isEmpty(props.appealType.appealTypeOptions.GlobalOptionSet)
|
||||
: _.isEmpty(props.appealType.appealTypeOptions.value)
|
||||
? [{}]
|
||||
: _.isEmpty(props.appealType.appealTypeOptions.GlobalOptionSet.Options)
|
||||
? [{}]
|
||||
: props.appealType.appealTypeOptions.GlobalOptionSet.Options;
|
||||
: props.appealType.appealTypeOptions.value;
|
||||
|
||||
let lpaOptionsObj = _.isEmpty(props)
|
||||
? [{}]
|
||||
@@ -45,7 +45,9 @@ let CreateCase = (props) => {
|
||||
? [{}]
|
||||
: _.isEmpty(props.LPAData.LPAData)
|
||||
? [{}]
|
||||
: jsonpath.query(props.LPAData.LPAData, "$..name");
|
||||
: _.isEmpty(props.LPAData.LPAData)
|
||||
? [{}]
|
||||
: props.LPAData.LPAData.value;
|
||||
|
||||
const RenderLPAList = ({
|
||||
name,
|
||||
@@ -96,9 +98,9 @@ let CreateCase = (props) => {
|
||||
return (
|
||||
<option
|
||||
key={key}
|
||||
value={optionsObj[key]}
|
||||
value={optionsObj[key].accountid}
|
||||
>
|
||||
{optionsObj[key]}
|
||||
{optionsObj[key].name}
|
||||
</option>
|
||||
);
|
||||
})}
|
||||
@@ -158,51 +160,37 @@ let CreateCase = (props) => {
|
||||
<option
|
||||
key={key}
|
||||
value={
|
||||
_.isEmpty(
|
||||
optionsObj[key].Label
|
||||
)
|
||||
_.isEmpty(optionsObj[key])
|
||||
? ""
|
||||
: _.isEmpty(
|
||||
optionsObj[key]
|
||||
.Label
|
||||
.LocalizedLabels
|
||||
)
|
||||
? ""
|
||||
: _.isEmpty(
|
||||
optionsObj[key]
|
||||
.Label
|
||||
.LocalizedLabels[0]
|
||||
.Label
|
||||
.value
|
||||
)
|
||||
? ""
|
||||
: optionsObj[
|
||||
key
|
||||
].Label.LocalizedLabels[0].Label.replace(
|
||||
/[\s\-\+\(\)\,]/g,
|
||||
""
|
||||
).toLowerCase()
|
||||
: optionsObj[key]
|
||||
.attributevalue +
|
||||
"," +
|
||||
optionsObj[key].value
|
||||
.replace(
|
||||
/(\band|[\s\-\+\(\)\,\&])/g,
|
||||
""
|
||||
)
|
||||
.toLowerCase()
|
||||
}
|
||||
>
|
||||
{_.isEmpty(optionsObj[key])
|
||||
? ""
|
||||
: _.isEmpty(
|
||||
optionsObj[key].Label
|
||||
)
|
||||
: _.isEmpty(optionsObj[key])
|
||||
? ""
|
||||
: _.isEmpty(
|
||||
optionsObj[key].Label
|
||||
.LocalizedLabels
|
||||
optionsObj[key].value
|
||||
)
|
||||
? ""
|
||||
: _.isEmpty(
|
||||
optionsObj[key].Label
|
||||
.LocalizedLabels[0]
|
||||
.Label
|
||||
)
|
||||
? ""
|
||||
: optionsObj[key].Label
|
||||
.LocalizedLabels[0]
|
||||
.Label}
|
||||
: optionsObj[key].value}
|
||||
</option>
|
||||
);
|
||||
})}
|
||||
@@ -215,11 +203,42 @@ let CreateCase = (props) => {
|
||||
|
||||
const required = (value) => (value ? undefined : "Required");
|
||||
|
||||
const getFormCollection = (formtype) => {
|
||||
formtype =
|
||||
"pinswg_" +
|
||||
(formtype.length > 39 ? formtype.slice(0, 39) : formtype);
|
||||
|
||||
const collectionName = jsonpath.query(
|
||||
data,
|
||||
"$..[?(@.LogicalName=='" + formtype + "')].UrlName"
|
||||
);
|
||||
//console.log(collectionName[0]);
|
||||
return collectionName[0];
|
||||
};
|
||||
|
||||
const onHandleSubmit = (values) => {
|
||||
event.preventDefault();
|
||||
router.replace("/newappeal/" + values.appealTypes, null, {
|
||||
shallow: true,
|
||||
});
|
||||
|
||||
var appTypeCollection = values.appealTypes.split(",")[1];
|
||||
|
||||
appTypeCollection = getFormCollection(
|
||||
appTypeCollection.length > 39
|
||||
? appTypeCollection.slice(0, 39)
|
||||
: appTypeCollection
|
||||
);
|
||||
|
||||
router.replace(
|
||||
"/newappeal/" +
|
||||
appTypeCollection +
|
||||
"?lpa=" +
|
||||
values.lpaTypes +
|
||||
"&apt=" +
|
||||
values.appealTypes.split(",")[0],
|
||||
null,
|
||||
{
|
||||
shallow: true,
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -273,8 +292,8 @@ const mapDispatchToProps = (dispatch) => {
|
||||
);
|
||||
dispatch(setAppealTypeID(event.target.value));
|
||||
},
|
||||
onChangeSelectLPA: (event) => {
|
||||
dispatch(setAppealLPA(event.target.value));
|
||||
onChangeSelectLPA: (lpaId) => {
|
||||
dispatch(setAppealLPA(lpaId));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -3,54 +3,22 @@ import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { setCurrentReference } from "../../store/currentView/action";
|
||||
import { connect } from "react-redux";
|
||||
import jsonpath from "jsonpath";
|
||||
import _ from "lodash";
|
||||
|
||||
const SearchResults = (props) => {
|
||||
const { searchString, searchResultsObj, setCurrentReference } = props;
|
||||
const {
|
||||
searchString,
|
||||
searchResultsObj,
|
||||
searchDetailsObj,
|
||||
setCurrentReference,
|
||||
} = props;
|
||||
let { t } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
|
||||
var resultsArr = searchResultsObj.value || [{}];
|
||||
const resultRow = Object.keys(resultsArr).map((key, index) => {
|
||||
<div className="govuk-summary-list__row">
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-14 ">
|
||||
<Link href="/case">
|
||||
<a>
|
||||
<span className="results-visually-hidden">
|
||||
wwwwwwwCase Reference:
|
||||
</span>
|
||||
{resultsArr[key].title}
|
||||
</a>
|
||||
</Link>
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-14">
|
||||
<span className="results-visually-hidden">Site Address: </span>
|
||||
23 Martineau Lane
|
||||
<br /> HASTINGS
|
||||
<br />
|
||||
TN35 5DS
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-14">
|
||||
<span className="results-visually-hidden">
|
||||
Appellant/Applicant:
|
||||
</span>
|
||||
Mr J Pocknell
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-14">
|
||||
<span className="results-visually-hidden">Authority:</span>
|
||||
Hastings Borough Council{" "}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-14">
|
||||
<span className="results-visually-hidden">Case Type:</span>
|
||||
Planning (W){" "}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-14">
|
||||
<span className="results-visually-hidden">Status:</span>
|
||||
In Progress
|
||||
</dd>
|
||||
</div>;
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="govuk-grid-row">
|
||||
@@ -87,6 +55,12 @@ const SearchResults = (props) => {
|
||||
</div>
|
||||
|
||||
{resultsArr.map((item, key) => {
|
||||
let detailsObj = jsonpath.query(
|
||||
searchDetailsObj,
|
||||
"$..value[?(@.pinswg_name=='" + item.title + "')]"
|
||||
);
|
||||
detailsObj = detailsObj[0];
|
||||
|
||||
return (
|
||||
<div className="govuk-summary-list__row" key={key}>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-14 ">
|
||||
@@ -112,26 +86,64 @@ const SearchResults = (props) => {
|
||||
<span className="results-visually-hidden">
|
||||
Site Address:{" "}
|
||||
</span>
|
||||
23 Martineau Lane
|
||||
<br /> HASTINGS
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddressline1"
|
||||
)
|
||||
? detailsObj.pinswg_siteaddressline1
|
||||
: ""}
|
||||
<br />
|
||||
TN35 5DS
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddressline1"
|
||||
)
|
||||
? detailsObj.pinswg_siteaddressline2
|
||||
: ""}
|
||||
<br />
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddressline1"
|
||||
)
|
||||
? detailsObj.pinswg_siteaddresstown
|
||||
: ""}
|
||||
<br />
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddressline1"
|
||||
)
|
||||
? detailsObj.pinswg_siteaddresscounty
|
||||
: ""}
|
||||
<br />
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddressline1"
|
||||
)
|
||||
? detailsObj.pinswg_siteaddresspostcode
|
||||
: ""}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-14">
|
||||
<span className="results-visually-hidden">
|
||||
Appellant/Applicant:
|
||||
</span>
|
||||
Mr J Pocknell
|
||||
{_.has(detailsObj, [
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue",
|
||||
])
|
||||
? detailsObj[
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: ""}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-14">
|
||||
<span className="results-visually-hidden">
|
||||
Authority:
|
||||
</span>
|
||||
{
|
||||
item[
|
||||
"_customerid_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
}
|
||||
{_.has(detailsObj, [
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue",
|
||||
])
|
||||
? detailsObj[
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: ""}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-14">
|
||||
<span className="results-visually-hidden">
|
||||
|
||||
@@ -23,6 +23,7 @@ export default function Search(props) {
|
||||
<SearchResults
|
||||
searchString={searchString}
|
||||
searchResultsObj={searchResultsObj.searchResultsObj}
|
||||
searchDetailsObj={searchResultsObj.searchDetailsObj}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,459 @@
|
||||
{
|
||||
"value": [
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_planningobligationss106flows",
|
||||
"LogicalName": "pinswg_planningobligationss106flow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "efb4c590-19be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_dnsflows",
|
||||
"LogicalName": "pinswg_dnsflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "328e015f-dabe-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_harbourrevisionorderflows",
|
||||
"LogicalName": "pinswg_harbourrevisionorderflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "98bbb26e-e7be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_transportandworkactflows",
|
||||
"LogicalName": "pinswg_transportandworkactflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "ad4bfc8c-e1be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_maintenanceoflands127flows",
|
||||
"LogicalName": "pinswg_maintenanceoflands127flow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "2b26362c-d3be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_environmentalpermittingflows",
|
||||
"LogicalName": "pinswg_environmentalpermittingflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "74dd4767-f2be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_dnses",
|
||||
"LogicalName": "pinswg_dns",
|
||||
"PrimaryIdAttribute": "pinswg_dnsid",
|
||||
"UrlName": "dns",
|
||||
"MetadataId": "36f07225-4a82-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_planningobligationappeals106s",
|
||||
"LogicalName": "pinswg_planningobligationappeals106",
|
||||
"PrimaryIdAttribute": "pinswg_planningobligationappeals106id",
|
||||
"UrlName": "planningobligationappeals106",
|
||||
"MetadataId": "cb8beeae-8f81-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_planningconditionss73s79s",
|
||||
"LogicalName": "pinswg_planningconditionss73s79",
|
||||
"PrimaryIdAttribute": "pinswg_planningconditionss73s79id",
|
||||
"UrlName": "planningconditionss73s79",
|
||||
"MetadataId": "093bf9ff-8d81-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_rows",
|
||||
"LogicalName": "pinswg_row",
|
||||
"PrimaryIdAttribute": "pinswg_rowid",
|
||||
"UrlName": "row",
|
||||
"MetadataId": "4ccc6e93-4f82-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_transportandworkacts",
|
||||
"LogicalName": "pinswg_transportworksact",
|
||||
"PrimaryIdAttribute": "pinswg_transportandworkactid",
|
||||
"UrlName": "transportandworkact",
|
||||
"MetadataId": "bc3edc4b-7d82-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_transportandworkacts",
|
||||
"LogicalName": "pinswg_transportandworkact",
|
||||
"PrimaryIdAttribute": "pinswg_transportandworkactid",
|
||||
"UrlName": "transportandworkact",
|
||||
"MetadataId": "bc3edc4b-7d82-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_transportandworkacts",
|
||||
"LogicalName": "pinswg_transportandworksact",
|
||||
"PrimaryIdAttribute": "pinswg_transportandworkactid",
|
||||
"UrlName": "transportandworksact",
|
||||
"MetadataId": "bc3edc4b-7d82-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_wayleaveflows",
|
||||
"LogicalName": "pinswg_wayleaveflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "a28054b9-e3be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_planningappeals78flows",
|
||||
"LogicalName": "pinswg_planningappeals78flow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "ddaebde1-0fbe-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_harbourrevisionorders",
|
||||
"LogicalName": "pinswg_harbourrevisionorder",
|
||||
"PrimaryIdAttribute": "pinswg_harbourrevisionorderid",
|
||||
"UrlName": "harbourrevisionorder",
|
||||
"MetadataId": "dc8dcd0d-4f82-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_miscellaneouscaseworks",
|
||||
"LogicalName": "pinswg_miscellaneouscasework",
|
||||
"PrimaryIdAttribute": "pinswg_miscellaneouscaseworkid",
|
||||
"UrlName": "miscellaneouscasework",
|
||||
"MetadataId": "f519aa8e-5782-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_miscellaneouscaseworks",
|
||||
"LogicalName": "pinswg_misccasework",
|
||||
"PrimaryIdAttribute": "pinswg_miscellaneouscaseworkid",
|
||||
"UrlName": "miscellaneouscasework",
|
||||
"MetadataId": "f519aa8e-5782-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_localdevelopmentplanses",
|
||||
"LogicalName": "pinswg_localdevelopmentplans",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "localdevelopmentplans",
|
||||
"MetadataId": "38ed3835-c1e0-eb11-aac5-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_planningappeals78s",
|
||||
"LogicalName": "pinswg_planningappeals78",
|
||||
"PrimaryIdAttribute": "pinswg_planningappeals78id",
|
||||
"UrlName": "planningappeals78",
|
||||
"MetadataId": "8d7f813a-4183-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_enforcementnoticeappealsflow174s",
|
||||
"LogicalName": "pinswg_enforcementnoticeappealsflow174",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "enforcementnoticeappealsflow174",
|
||||
"MetadataId": "a933cf28-20be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_lawfuldevelopmentcertificates",
|
||||
"LogicalName": "pinswg_lawfuldevelopmentcertificate",
|
||||
"PrimaryIdAttribute": "pinswg_lawfuldevelopmentcertificateid",
|
||||
"UrlName": "lawfuldevelopmentcertificate",
|
||||
"MetadataId": "184e4861-9681-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_lawfuldevelopmentcertificates",
|
||||
"LogicalName": "pinswg_lawfuldevelopmentcertificateappeals194195",
|
||||
"PrimaryIdAttribute": "pinswg_lawfuldevelopmentcertificateid",
|
||||
"UrlName": "lawfuldevelopmentcertificateappeals1941",
|
||||
"MetadataId": "184e4861-9681-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_lawfuldevelopmentcertificates",
|
||||
"LogicalName": "pinswg_lawfuldevelopmentcertificateappeals1941",
|
||||
"PrimaryIdAttribute": "pinswg_lawfuldevelopmentcertificateid",
|
||||
"UrlName": "lawfuldevelopmentcertificate",
|
||||
"MetadataId": "184e4861-9681-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_highhedgestreepreservationflows",
|
||||
"LogicalName": "pinswg_highhedgestreepreservationflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "c365b924-f3be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_householderappealhases",
|
||||
"LogicalName": "pinswg_householderappealhas",
|
||||
"PrimaryIdAttribute": "pinswg_householderappealhasid",
|
||||
"UrlName": "householderappealhas",
|
||||
"MetadataId": "a6c728b0-9081-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_enforcementlistedbuildingconservationaps",
|
||||
"LogicalName": "pinswg_enforcementlistedbuildingconservationap",
|
||||
"PrimaryIdAttribute": "pinswg_enforcementlistedbuildingconservationapid",
|
||||
"UrlName": "enforcementlistedbuildingconservationap",
|
||||
"MetadataId": "c697be96-9481-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_enforcementlistedbuildingconservationaps",
|
||||
"LogicalName": "pinswg_enforcementlistedbuildingandconservationappeals39",
|
||||
"PrimaryIdAttribute": "pinswg_enforcementlistedbuildingconservationapid",
|
||||
"UrlName": "enforcementlistedbuildingconservationap",
|
||||
"MetadataId": "c697be96-9481-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_enforcementlistedbuildingconservationaps",
|
||||
"LogicalName": "pinswg_enforcementlistedbuildingandconservationap",
|
||||
"PrimaryIdAttribute": "pinswg_enforcementlistedbuildingconservationapid",
|
||||
"UrlName": "enforcementlistedbuildingconservationap",
|
||||
"MetadataId": "c697be96-9481-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_callinss77s",
|
||||
"LogicalName": "pinswg_callinss77",
|
||||
"PrimaryIdAttribute": "pinswg_callinss77id",
|
||||
"UrlName": "callinss77",
|
||||
"MetadataId": "dd309e51-4982-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_commonlands",
|
||||
"LogicalName": "pinswg_commonland",
|
||||
"PrimaryIdAttribute": "pinswg_commonlandid",
|
||||
"UrlName": "commonland",
|
||||
"MetadataId": "4161a618-5082-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_advertses",
|
||||
"LogicalName": "pinswg_adverts",
|
||||
"PrimaryIdAttribute": "pinswg_advertsid",
|
||||
"UrlName": "adverts",
|
||||
"MetadataId": "0735866b-5482-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_hedgeshedgerowstreepreservationreplacems",
|
||||
"LogicalName": "pinswg_hedgeshedgerowstreepreservationreplacem",
|
||||
"PrimaryIdAttribute": "pinswg_hedgeshedgerowstreepreservationreplacemid",
|
||||
"UrlName": "hedgeshedgerowstreepreservationreplacem",
|
||||
"MetadataId": "60f38fed-5382-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_hedgeshedgerowstreepreservationreplacems",
|
||||
"LogicalName": "pinswg_highhedgestreepreservationordershedgerowstreereplacementnotice",
|
||||
"PrimaryIdAttribute": "pinswg_hedgeshedgerowstreepreservationreplacemid",
|
||||
"UrlName": "hedgeshedgerowstreepreservationreplacem",
|
||||
"MetadataId": "60f38fed-5382-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_hedgeshedgerowstreepreservationreplacems",
|
||||
"LogicalName": "pinswg_highhedgestreepreservationordershedgero",
|
||||
"PrimaryIdAttribute": "pinswg_hedgeshedgerowstreepreservationreplacemid",
|
||||
"UrlName": "hedgeshedgerowstreepreservationreplacem",
|
||||
"MetadataId": "60f38fed-5382-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_compulsorypurchaseorderses",
|
||||
"LogicalName": "pinswg_compulsorypurchaseorders",
|
||||
"PrimaryIdAttribute": "pinswg_compulsorypurchaseordersid",
|
||||
"UrlName": "compulsorypurchaseorders",
|
||||
"MetadataId": "054da4c7-5582-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_communityinfrastructurelevys117118119s",
|
||||
"LogicalName": "pinswg_communityinfrastructurelevys117118119",
|
||||
"PrimaryIdAttribute": "pinswg_communityinfrastructurelevys117118119id",
|
||||
"UrlName": "communityinfrastructurelevys117118119",
|
||||
"MetadataId": "0c309f3c-4882-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_objectiveconfigs",
|
||||
"LogicalName": "pinswg_objectiveconfig",
|
||||
"PrimaryIdAttribute": "pinswg_objectiveconfigid",
|
||||
"UrlName": "objectiveconfig",
|
||||
"MetadataId": "f89ae20c-4777-eb11-aabd-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_nonvalidations",
|
||||
"LogicalName": "pinswg_nonvalidation",
|
||||
"PrimaryIdAttribute": "pinswg_nonvalidationid",
|
||||
"UrlName": "nonvalidation",
|
||||
"MetadataId": "37f31a93-5882-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_rightofwayflows",
|
||||
"LogicalName": "pinswg_rightofwayflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "b26c1d43-efbe-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_caseinvolvements",
|
||||
"LogicalName": "pinswg_caseinvolvement",
|
||||
"PrimaryIdAttribute": "pinswg_caseinvolvementid",
|
||||
"UrlName": "caseinvolvement",
|
||||
"MetadataId": "65677cd9-4aae-eb11-aac3-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_commonlandflows",
|
||||
"LogicalName": "pinswg_commonlandflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "338fac85-e6be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_lawfuldevelopmentcertificates195flows",
|
||||
"LogicalName": "pinswg_lawfuldevelopmentcertificates195flow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "0b8f5046-1dbe-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_advertisementappealanddiscontinuances",
|
||||
"LogicalName": "pinswg_advertisementappealanddiscontinuance",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "advertisementappealanddiscontinuance",
|
||||
"MetadataId": "79b9ab3a-f1be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_documenthistories",
|
||||
"LogicalName": "pinswg_documenthistory",
|
||||
"PrimaryIdAttribute": "pinswg_documenthistoryid",
|
||||
"UrlName": "documenthistory",
|
||||
"MetadataId": "0d8e78a7-33a3-eb11-aac3-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_documents",
|
||||
"LogicalName": "pinswg_document",
|
||||
"PrimaryIdAttribute": "pinswg_documentid",
|
||||
"UrlName": "documents",
|
||||
"MetadataId": "e6cbbbca-026a-eb11-aabb-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_electricityactflows",
|
||||
"LogicalName": "pinswg_electricityactflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "699c4318-e3be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_planningconditionss73s79flows",
|
||||
"LogicalName": "pinswg_planningconditionss73s79flow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "510154b1-15be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_wayleaves",
|
||||
"LogicalName": "pinswg_wayleave",
|
||||
"PrimaryIdAttribute": "pinswg_wayleaveid",
|
||||
"UrlName": "wayleave",
|
||||
"MetadataId": "a0652117-5782-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_listedbuildingandconservationareaconsens",
|
||||
"LogicalName": "pinswg_listedbuildingandconservationareaconsen",
|
||||
"PrimaryIdAttribute": "pinswg_listedbuildingandconservationareaconsenid",
|
||||
"UrlName": "listedbuildingandconservationareaconsen",
|
||||
"MetadataId": "4cd95405-8f81-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_listedbuildingandconservationareaconsens",
|
||||
"LogicalName": "pinswg_listedbuildingconservationareaconsents7",
|
||||
"PrimaryIdAttribute": "pinswg_listedbuildingandconservationareaconsenid",
|
||||
"UrlName": "listedbuildingandconservationareaconsen",
|
||||
"MetadataId": "4cd95405-8f81-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_callinapplicationss77flows",
|
||||
"LogicalName": "pinswg_callinapplicationss77flow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "2a4f3d43-d4be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_transfercodes",
|
||||
"LogicalName": "pinswg_transfercode",
|
||||
"PrimaryIdAttribute": "pinswg_transfercodeid",
|
||||
"UrlName": "transfercode",
|
||||
"MetadataId": "a551ad5c-29f5-eb11-aac7-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_compulsorypurchaseordersflows",
|
||||
"LogicalName": "pinswg_compulsorypurchaseordersflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "a94f098b-f0be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_environmentalpermittings",
|
||||
"LogicalName": "pinswg_environmentalpermitting",
|
||||
"PrimaryIdAttribute": "pinswg_environmentalpermittingid",
|
||||
"UrlName": "environmentalpermitting",
|
||||
"MetadataId": "62d4aa9a-5682-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_nonvaidationflows",
|
||||
"LogicalName": "pinswg_nonvaidationflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "e5ca3ceb-c1e0-eb11-aac5-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_enforcementnoticeappeals174s",
|
||||
"LogicalName": "pinswg_enforcementnoticeappeals174",
|
||||
"PrimaryIdAttribute": "pinswg_enforcementnoticeappeals174id",
|
||||
"UrlName": "enforcementnoticeappeals174",
|
||||
"MetadataId": "930a3cc4-9181-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_ldps",
|
||||
"LogicalName": "pinswg_ldp",
|
||||
"PrimaryIdAttribute": "pinswg_ldpid",
|
||||
"UrlName": "ldp",
|
||||
"MetadataId": "af424d4d-5882-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_maintenanceoflands217s",
|
||||
"LogicalName": "pinswg_maintenanceoflands217",
|
||||
"PrimaryIdAttribute": "pinswg_maintenanceoflands217id",
|
||||
"UrlName": "maintenanceoflands217",
|
||||
"MetadataId": "bb302784-9581-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_enforcelistbuild39flows",
|
||||
"LogicalName": "pinswg_enforcelistbuild39flow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "9423206e-d2be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_householderappealflows",
|
||||
"LogicalName": "pinswg_householderappealflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "330541bd-d5be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_miscellaneouscaseworkflows",
|
||||
"LogicalName": "pinswg_miscellaneouscaseworkflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "87db8649-f4be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_communityinfrastructurelevyflows",
|
||||
"LogicalName": "pinswg_communityinfrastructurelevyflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "92bc1e3d-e0be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_listedbuildconserv20flows",
|
||||
"LogicalName": "pinswg_listedbuildconserv20flow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"UrlName": "",
|
||||
"MetadataId": "4c11cbe9-27be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_electricityacts",
|
||||
"LogicalName": "pinswg_electricityact",
|
||||
"PrimaryIdAttribute": "pinswg_electricityactid",
|
||||
"UrlName": "electricityact",
|
||||
"MetadataId": "6aedaab1-4a82-eb11-aac0-00224800be9c"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -17,6 +17,15 @@
|
||||
"/myportal/viewall": [
|
||||
"search"
|
||||
],
|
||||
"/myportal/advancedsearch": [
|
||||
"search"
|
||||
],
|
||||
"/myportal/searchresults": [
|
||||
"search"
|
||||
],
|
||||
"/myportal/case": [
|
||||
"case"
|
||||
],
|
||||
"/advancedsearch": [
|
||||
"search"
|
||||
],
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"page-title": "Cyfeirnod",
|
||||
"case-card-title": "Reference: APP/B1415/W/20/3271702",
|
||||
"summary-applicant-label": "Apelydd/Ymgeisydd",
|
||||
"summary-agent-label": "Asiant",
|
||||
|
||||
@@ -16,5 +16,8 @@
|
||||
"signout-label": "Cofrestrwch allan",
|
||||
"back-to-top-link": "Nôl i dop y dudalen",
|
||||
"social-bar-share-link": "Rhannu’r dudalen hon",
|
||||
"social-bar-share-via-link": "Rhannu’r dudalen hon ar"
|
||||
"social-bar-share-via-link": "Rhannu’r dudalen hon ar",
|
||||
"breadcrumb-search-results" : "Canlyniadau chwilio",
|
||||
"breadcrumb-my-portal": "Fy mhorth",
|
||||
"breadcrumb-case-reference": "Cyfeirnod Achos"
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
{
|
||||
"login-card-title-temp": "W-Log in or Register soon",
|
||||
"login-comingsoon-temp-1": "W-First paragraph says something about being able to create accounts",
|
||||
"login-comingsoon-temp-2": "W-Second paragraph content to go here to explaine something else.",
|
||||
"login-card-title": "Mewngofnodi neu cofrestru",
|
||||
"login-card-id-label": "Dynodydd Defnyddiwr (ID) Porth y Llywodraeth",
|
||||
"login-card-id-hint": "Gallai hyn fod hyd at 12 o gymeriadau.",
|
||||
@@ -13,9 +16,14 @@
|
||||
"casesearch-card-search-example-label": "Enghraifft",
|
||||
"casesearch-card-button": "Cyflwyno Chwiliad",
|
||||
"casesearch-card-advanced-link": "Fel arall, gallwch chwilio gan ddefnyddio ein meini prawf eraill gyda'n chwiliad uwch",
|
||||
"casesearch-search-validation-required": "Angenrheidiol",
|
||||
"casesearch-search-validation-minlength": "Rhaid bod yn 4 nod neu fwy",
|
||||
"casescomment-card-title": "Gwneud sylw ar achos",
|
||||
"casescomment-card-paragraph-one": "Chwiliwch am eich achos a chliciwch y botwm 'Gwneud Sylw'. Y ffordd orau o roi sylwadau ar achos cyfredol yw trwy gofrestru gyda ni'n gyntaf gan fod hynny'n gwneud olrhain achosion a chyflwyno sylwadau yn haws.",
|
||||
"casescomment-card-paragraph-two": "Yn achos apeliadau deiliaid tai ac apeliadau masnachol, nid yw partïon â buddiant yn gallu gwneud sylwadau yn y cam apelio. Caiff unrhyw sylwadau a wneir yn y cam ymgeisio eu darparu gan yr awdurdod cynllunio lleol ac fe'u hystyrir gan yr Arolygydd.",
|
||||
"inspectorate-card-visit-label" : "Ymweld Yr Arolygiaeth Gynllunio",
|
||||
"inspectorate-card-visit-link": "Hafan"
|
||||
"inspectorate-card-visit-link": "Hafan",
|
||||
"dns-card-title":"Datblygiadau o Arwyddocâd Cenedlaethol",
|
||||
"dns-card-paragraph":"Mae Datblygiad o Arwyddocâd Cenedlaethol (DAC) yn fath o gais cynllunio ar gyfer prosiect seilwaith mawr sydd o bwysigrwydd cenedlaethol yng Nghymru. Yn y fan hon, gallwch gael gwybod am geisiadau DAC arfaethedig. Rheolir y safle hwn gan yr Arolygiaeth Gynllunio.",
|
||||
"dns-card-button":"Gweld pob cais"
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"page-title": "Reference",
|
||||
"case-card-title": "Reference: APP/B1415/W/20/3271702",
|
||||
"summary-applicant-label": "Appellant/Applicant",
|
||||
"summary-agent-label": "Agent",
|
||||
|
||||
@@ -16,5 +16,8 @@
|
||||
"signout-label": "Sign out",
|
||||
"back-to-top-link": "Back to top",
|
||||
"social-bar-share-link": "Share this page",
|
||||
"social-bar-share-via-link": "Share this page via"
|
||||
"social-bar-share-via-link": "Share this page via",
|
||||
"breadcrumb-search-results" : "Search results",
|
||||
"breadcrumb-my-portal": "My portal",
|
||||
"breadcrumb-case-reference": "Case Reference"
|
||||
}
|
||||
+10
-2
@@ -1,4 +1,7 @@
|
||||
{
|
||||
"login-card-title-temp": "Log in or Register soon",
|
||||
"login-comingsoon-temp-1": "First paragraph says something about being able to create accounts",
|
||||
"login-comingsoon-temp-2": "Second paragraph content to go here to explaine something else.",
|
||||
"login-card-title": "Log in or Register",
|
||||
"login-card-id-label": "Government Gateway user ID",
|
||||
"login-card-id-hint": "This could be up to 12 characters.",
|
||||
@@ -9,13 +12,18 @@
|
||||
"login-card-forgotten-label": "Forgotten your password or username?",
|
||||
"login-card-forgotten-link": "Click here",
|
||||
"casesearch-card-title": "Search for a case",
|
||||
"casesearch-card-search-hint": "Search by entering the 7 digit case reference number:",
|
||||
"casesearch-card-search-hint": "Search by entering the 7 digit case reference number",
|
||||
"casesearch-card-search-example-label": "Example",
|
||||
"casesearch-card-button": "Submit Search",
|
||||
"casesearch-card-advanced-link": "Advanced Search",
|
||||
"casesearch-search-validation-required": "Required",
|
||||
"casesearch-search-validation-minlength": "Must be 4 characters or more",
|
||||
"casescomment-card-title": "Comment on a case",
|
||||
"casescomment-card-paragraph-one": "Simply search for your case and click on the 'Make Representation' button. The best way to comment on an existing case is to register with us first as that makes it easier to track cases and submit comments.",
|
||||
"casescomment-card-paragraph-two": "For Householder and Commercial appeals, interested parties are unable to make representations at appeal stage. Any representations made at application stage will be provided by the local planning authority and considered by the Inspector.",
|
||||
"inspectorate-card-visit-label" : "Visit the Planning Inspectorate",
|
||||
"inspectorate-card-visit-link": "Home"
|
||||
"inspectorate-card-visit-link": "Home",
|
||||
"dns-card-title":"Developments of National Significance",
|
||||
"dns-card-paragraph":"A Development of National Significance (DNS) is a type of planning application for a large infrastructure project of national importance in Wales. Here you can find out about proposed DNS applications. This site is managed by the Planning Inspectorate.",
|
||||
"dns-card-button":"View all applications"
|
||||
}
|
||||
+4
-2
@@ -4,7 +4,7 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"dev:app": "node ./server/server.js && yarn lint:js",
|
||||
"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"
|
||||
},
|
||||
@@ -14,11 +14,13 @@
|
||||
"axios": "^0.21.1",
|
||||
"compression": "^1.7.4",
|
||||
"cookies": "^0.8.0",
|
||||
"crypto-js": "^4.1.1",
|
||||
"dom": "^0.0.3",
|
||||
"dynamics-web-api": "^1.7.4",
|
||||
"express": "^4.17.1",
|
||||
"govuk-frontend": "^3.13.0",
|
||||
"https": "^1.0.0",
|
||||
"hyco-https": "^1.4.5",
|
||||
"jsonpath": "^1.1.1",
|
||||
"jsonpath-plus": "^5.1.0",
|
||||
"lodash": "^4.17.21",
|
||||
@@ -55,4 +57,4 @@
|
||||
"eslint-config-next": "^11.0.1",
|
||||
"prettier": "2.3.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
import Link from "next/link";
|
||||
import _ from "lodash";
|
||||
import Head from "next/head";
|
||||
import Header from "../../components/header";
|
||||
import Banner from "../../components/banner";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import Footer from "../../components/footer";
|
||||
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../../store/store";
|
||||
import Cookies from "cookies";
|
||||
import { useRouter } from "next/router";
|
||||
import { useState } from "react";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import jsonpath from "jsonpath";
|
||||
import { reduxForm, formValueSelector } from "redux-form";
|
||||
|
||||
import RegisterForm from "../../components/account/registerform";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, formData } = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
const { appealtypes } = router.query;
|
||||
|
||||
const [registerFormComplete, setRegisterFormComplete] = useState(false);
|
||||
const [accountCreatedComplete, setAccountCreatedComplete] = useState(false);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Head>
|
||||
<title>
|
||||
{t("search:page-title")} - {t("common:service-name")}
|
||||
</title>
|
||||
</Head>
|
||||
<div id="page_wrapper">
|
||||
<CookieBanner />
|
||||
<Header courseName={t("common:service-name")} />
|
||||
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full">
|
||||
<div className="govuk-width-container">
|
||||
<Banner />
|
||||
<Breadcrumbs slug={appealtypes} />
|
||||
<main
|
||||
className="govuk-main-wrapper--auto-spacing"
|
||||
id="main-content"
|
||||
role="main"
|
||||
>
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-two-thirds">
|
||||
<h1>Forgotten password</h1>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Footer footerLinks={footerLinks} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
// export const getServerSideProps = wrapper.getServerSideProps(
|
||||
// (store) =>
|
||||
// async ({ query, req, res }) => {
|
||||
// const appealTypeData = await getAppealsTypes();
|
||||
// const lpaData = await getLPA();
|
||||
// console.log("appeal types", appealTypeData);
|
||||
// console.log("lpa typeswwwww", lpaData);
|
||||
// store.dispatch(setAppealType(appealTypeData));
|
||||
// store.dispatch(setLPA(lpaData));
|
||||
// }
|
||||
// );
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
LPAData: state.LPAData,
|
||||
form: state.form,
|
||||
accountDetails: state.accountDetails,
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps)(Home);
|
||||
@@ -0,0 +1,93 @@
|
||||
import Link from "next/link";
|
||||
import _ from "lodash";
|
||||
import Head from "next/head";
|
||||
import Header from "../../components/header";
|
||||
import Banner from "../../components/banner";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import Footer from "../../components/footer";
|
||||
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../../store/store";
|
||||
import Cookies from "cookies";
|
||||
import { useRouter } from "next/router";
|
||||
import { useState } from "react";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import jsonpath from "jsonpath";
|
||||
import { reduxForm, formValueSelector } from "redux-form";
|
||||
|
||||
import RegisterForm from "../../components/account/registerform";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, formData } = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
const { appealtypes } = router.query;
|
||||
|
||||
const [registerFormComplete, setRegisterFormComplete] = useState(false);
|
||||
const [accountCreatedComplete, setAccountCreatedComplete] = useState(false);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Head>
|
||||
<title>
|
||||
{t("search:page-title")} - {t("common:service-name")}
|
||||
</title>
|
||||
</Head>
|
||||
<div id="page_wrapper">
|
||||
<CookieBanner />
|
||||
<Header courseName={t("common:service-name")} />
|
||||
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full">
|
||||
<div className="govuk-width-container">
|
||||
<Banner />
|
||||
<Breadcrumbs slug={appealtypes} />
|
||||
<main
|
||||
className="govuk-main-wrapper--auto-spacing"
|
||||
id="main-content"
|
||||
role="main"
|
||||
>
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-two-thirds">
|
||||
<h1>Forgotten user</h1>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Footer footerLinks={footerLinks} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
// export const getServerSideProps = wrapper.getServerSideProps(
|
||||
// (store) =>
|
||||
// async ({ query, req, res }) => {
|
||||
// const appealTypeData = await getAppealsTypes();
|
||||
// const lpaData = await getLPA();
|
||||
// console.log("appeal types", appealTypeData);
|
||||
// console.log("lpa typeswwwww", lpaData);
|
||||
// store.dispatch(setAppealType(appealTypeData));
|
||||
// store.dispatch(setLPA(lpaData));
|
||||
// }
|
||||
// );
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
LPAData: state.LPAData,
|
||||
form: state.form,
|
||||
accountDetails: state.accountDetails,
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps)(Home);
|
||||
@@ -0,0 +1,124 @@
|
||||
import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
|
||||
const WEBAPI_URL = "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
// const azureHeaders = {
|
||||
// headers: {
|
||||
// "OData-MaxVersion": "4.0",
|
||||
// "OData-Version": "4.0",
|
||||
// "Accept": "application/json",
|
||||
// "Prefer": 'odata.include-annotations="*",return=representation',
|
||||
// "Content-Type": "application/json",
|
||||
// "ServiceBusAuthorization": SASToken,
|
||||
// },
|
||||
// };
|
||||
|
||||
const getSASToken = () => {
|
||||
var m_ResourceURI = "dev-pedw-ns.servicebus.windows.net";
|
||||
var m_Path = "dev-pedw-hc";
|
||||
var m_SasKey = "Ml0Y/S/nfRcmIrHFRkO4jNm2J3iH52TSxPiak7+E1+Y=";
|
||||
var m_SasKeyName = "devpedwnspolicy";
|
||||
|
||||
var encodedResourceUri = encodeURIComponent(
|
||||
"https://" + m_ResourceURI + "/" + m_Path + "/"
|
||||
);
|
||||
|
||||
var t0 = new Date(1970, 1, 1, 0, 0, 0, 0);
|
||||
var t1 = new Date();
|
||||
var expireInSeconds =
|
||||
+(31 * 24 * 3600) + 3600 + (((t1.getTime() - t0.getTime()) / 1000) | 0);
|
||||
|
||||
//the line below is a hack that converts to UTF8
|
||||
var plainSignature = JSON.parse(
|
||||
JSON.stringify(encodedResourceUri + "\n" + expireInSeconds)
|
||||
);
|
||||
|
||||
var hash = CryptoJS.HmacSHA256(plainSignature, m_SasKey);
|
||||
var base64HashValue = CryptoJS.enc.Base64.stringify(hash);
|
||||
|
||||
var token =
|
||||
"SharedAccessSignature sr=" +
|
||||
encodedResourceUri +
|
||||
"&sig=" +
|
||||
encodeURIComponent(base64HashValue) +
|
||||
"&se=" +
|
||||
expireInSeconds +
|
||||
"&skn=" +
|
||||
m_SasKeyName;
|
||||
|
||||
return token;
|
||||
};
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
// console.log(req.method);
|
||||
|
||||
var updateBody = {
|
||||
"pinswg_areaofsiteinhectaresdec": 21,
|
||||
"pinswg_developmentaffectsettingifalisted": false,
|
||||
"pinswg_floorspaceinsquaremeters": "123123124",
|
||||
"pinswg_incarelatestoca": false,
|
||||
"pinswg_isfloodinganissue": true,
|
||||
"pinswg_isthesitewithinanaonb": false,
|
||||
"pinswg_landuse": "846040002",
|
||||
"pinswg_sitewithinsssi": true,
|
||||
"pinswg_sitewithinagreenbelt": false,
|
||||
"pinswg_siteviewablefromroad": false,
|
||||
"pinswg_typeofplanningapplication": "846040000",
|
||||
};
|
||||
var data = JSON.stringify(req.body);
|
||||
const SASToken = getSASToken();
|
||||
|
||||
// console.log(SASToken);
|
||||
|
||||
var configNoData = {
|
||||
method: req.method,
|
||||
//url: WEBAPI_URL + updateFormCollection + "(" + incidentId + ")",
|
||||
url: WEBAPI_URL + req.url.split("/api/proxy/")[1],
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Authorization": SASToken,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
};
|
||||
|
||||
var config = {
|
||||
method: req.method,
|
||||
//url: WEBAPI_URL + updateFormCollection + "(" + incidentId + ")",
|
||||
url: WEBAPI_URL + req.query.route[0],
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Authorization": SASToken,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
data: data,
|
||||
};
|
||||
|
||||
console.log(req.url.split("/api/proxy/")[1]);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
// console.log(config);
|
||||
axios(req.method == "GET" ? configNoData : config)
|
||||
.then((response) => {
|
||||
res.statusCode = 200;
|
||||
res.setHeader("Content-Type", "application/json");
|
||||
res.setHeader("Cache-Control", "max-age=1800000");
|
||||
res.end(JSON.stringify(response.data));
|
||||
// console.log("response data", response.data);
|
||||
resolve();
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("proxy response error", error);
|
||||
res.json(error);
|
||||
res.status(405).end();
|
||||
return resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
+8
-1
@@ -27,7 +27,9 @@ const Home = (props) => {
|
||||
<div>
|
||||
<Head>
|
||||
<title>
|
||||
{t("case:page-title")} - {t("common:service-name")}
|
||||
{t("case:page-title")}:{" "}
|
||||
{props.currentView.caseReference.currentReference}{" "}
|
||||
{t("common:service-name")}
|
||||
</title>
|
||||
</Head>
|
||||
<div id="page_wrapper">
|
||||
@@ -37,10 +39,15 @@ const Home = (props) => {
|
||||
<Banner />
|
||||
<Breadcrumbs slug={appealtypes} props={props} />
|
||||
<Case
|
||||
props={props}
|
||||
myCases={props.myCases.myCases}
|
||||
myCasesDetails={props.myCases.myCasesDetails}
|
||||
searchResultsObj={
|
||||
props.searchResultsObj.searchResultsObj
|
||||
}
|
||||
searchDetailsObj={
|
||||
props.searchResultsObj.searchDetailsObj
|
||||
}
|
||||
myRepresentations={
|
||||
props.myRepresentations.myRepresentations
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
import _ from "lodash";
|
||||
import Head from "next/head";
|
||||
import Header from "../../components/header";
|
||||
import Banner from "../../components/banner";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import CaseSummary from "../../components/case";
|
||||
import Footer from "../../components/footer";
|
||||
import Errorpage from "../../components/errorpage";
|
||||
import styles from "../../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../../store/store";
|
||||
import Cookies from "cookies";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Case from "../../components/case";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
const { appealtypes } = router.query;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Head>
|
||||
<title>
|
||||
{t("case:page-title")} - {t("common:service-name")}
|
||||
</title>
|
||||
</Head>
|
||||
<div id="page_wrapper">
|
||||
<CookieBanner />
|
||||
<Header courseName={t("common:service-name")} />
|
||||
<div className="govuk-width-container">
|
||||
<Banner />
|
||||
<Breadcrumbs slug={appealtypes} props={props} />
|
||||
<Case
|
||||
myCases={props.myCases.myCases}
|
||||
searchResultsObj={
|
||||
props.searchResultsObj.searchResultsObj
|
||||
}
|
||||
searchDetailsObj={
|
||||
props.searchResultsObj.searchDetailsObj
|
||||
}
|
||||
myRepresentations={
|
||||
props.myRepresentations.myRepresentations
|
||||
}
|
||||
watchedCases={props.watchedCases.watchedCases}
|
||||
awaitingSubmission={
|
||||
props.awaitingSubmission.awaitingSubmission
|
||||
}
|
||||
caseReference={
|
||||
props.currentView.caseReference.currentReference
|
||||
}
|
||||
currentType={
|
||||
props.currentView.caseReference.currentType
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<Footer footerLinks={footerLinks} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
//console.log(state);
|
||||
|
||||
return {
|
||||
currentView: state.currentView,
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
form: state.form,
|
||||
myCases: state.myCases,
|
||||
watchedCases: state.watchedCases,
|
||||
myRepresentations: state.myRepresentations,
|
||||
awaitingSubmission: state.awaitingSubmission,
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps)(Home);
|
||||
+89
-12
@@ -1,4 +1,6 @@
|
||||
import _ from "lodash";
|
||||
import Cookies from "cookies";
|
||||
import jsonpath from "jsonpath";
|
||||
import Head from "next/head";
|
||||
import Header from "../../components/header";
|
||||
import Banner from "../../components/banner";
|
||||
@@ -10,18 +12,32 @@ import Errorpage from "../../components/errorpage";
|
||||
import styles from "../../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../../store/store";
|
||||
import Cookies from "cookies";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { setMyCases } from "../../store/myCases/action";
|
||||
import { setMyRepresentations } from "../../store/myRepresentations/action";
|
||||
import { setWatchedCases } from "../../store/watchedCases/action";
|
||||
import { setAwaitingSubmission } from "../../store/awaitingSubmission/action";
|
||||
import data from "../../data/collections.json";
|
||||
import {
|
||||
setLoggedInUserId,
|
||||
setAccountDetails,
|
||||
} from "../../store/accountDetails/action";
|
||||
import { setMyCases, setMyCasesDetails } from "../../store/myCases/action";
|
||||
import {
|
||||
setMyRepresentations,
|
||||
setMyRepresentationsDetails,
|
||||
} from "../../store/myRepresentations/action";
|
||||
import {
|
||||
setWatchedCases,
|
||||
setWatchedCasesDetails,
|
||||
} from "../../store/watchedCases/action";
|
||||
import {
|
||||
setAwaitingSubmission,
|
||||
setAwaitingSubmissionDetails,
|
||||
} from "../../store/awaitingSubmission/action";
|
||||
import {
|
||||
getMyCases,
|
||||
getMyRepresentations,
|
||||
getWatchedCases,
|
||||
getAwaitingSubmission,
|
||||
getPortalModuelDetails,
|
||||
} from "../../actions";
|
||||
|
||||
const Home = (props) => {
|
||||
@@ -69,35 +85,96 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
//console.log("the query", query);
|
||||
|
||||
res.setHeader(
|
||||
"Cache-Control",
|
||||
"public, s-maxage=604800, stale-while-revalidate"
|
||||
);
|
||||
|
||||
const [
|
||||
myCases,
|
||||
myRepresentations,
|
||||
watchedCases,
|
||||
awaitingSubmission,
|
||||
] = await Promise.all([
|
||||
await getMyCases(),
|
||||
await getMyCases("f8b454ed-eded-eb11-aac7-00224800be9c"),
|
||||
await getMyRepresentations(),
|
||||
await getWatchedCases(),
|
||||
await getAwaitingSubmission(),
|
||||
]);
|
||||
|
||||
const cookies = new Cookies(req, res);
|
||||
|
||||
cookies.set("pinsUser", "f8b454ed-eded-eb11-aac7-00224800be9c", {
|
||||
httpOnly: true, // true by default
|
||||
});
|
||||
//console.log("my cases ", myCases);
|
||||
const [
|
||||
myCasesDetails,
|
||||
// myRepresentationsDetails,
|
||||
// watchedCasesDetails,
|
||||
// awaitingSubmissionDetails,
|
||||
] = await Promise.all([
|
||||
await getDetails(myCases),
|
||||
// await getDetails(myRepresentations),
|
||||
// await getDetails(watchedCases),
|
||||
// await getDetails(awaitingSubmission),
|
||||
]);
|
||||
|
||||
store.dispatch(
|
||||
setLoggedInUserId("f8b454ed-eded-eb11-aac7-00224800be9c")
|
||||
);
|
||||
store.dispatch(setMyCases(myCases));
|
||||
store.dispatch(setMyCasesDetails(myCasesDetails));
|
||||
store.dispatch(setMyRepresentations(myRepresentations));
|
||||
// store.dispatch(
|
||||
// setMyRepresentationsDetails(myRepresentationsDetails)
|
||||
// );
|
||||
store.dispatch(setWatchedCases(watchedCases));
|
||||
//store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
||||
store.dispatch(setAwaitingSubmission(awaitingSubmission));
|
||||
// store.dispatch(
|
||||
// setAwaitingSubmissionDetails(awaitingSubmissionDetails)
|
||||
// );
|
||||
}
|
||||
);
|
||||
|
||||
const getFormCollection = (formtype) => {
|
||||
const collectionName = jsonpath.query(
|
||||
data,
|
||||
"$..[?(@.LogicalName=='" + formtype + "')].LogicalCollectionName"
|
||||
);
|
||||
//console.log(collectionName[0]);
|
||||
return collectionName[0];
|
||||
};
|
||||
|
||||
const getDetails = (resultsObj) => {
|
||||
//console.log(resultsObj);
|
||||
let detailsArr = [];
|
||||
resultsObj = resultsObj.value;
|
||||
const detailsObj = resultsObj.map((searchDetail, index) => {
|
||||
if (searchDetail.pinswg_appealcasetype == null) {
|
||||
console.log(searchDetail.ticketnumber);
|
||||
} else {
|
||||
detailsArr.push(
|
||||
getPortalModuelDetails(
|
||||
getFormCollection(
|
||||
"pinswg_" +
|
||||
searchDetail[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
||||
.toLowerCase()
|
||||
.slice(0, 39)
|
||||
),
|
||||
searchDetail.ticketnumber
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
//console.log(detailsArr);
|
||||
return Promise.all(detailsArr);
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
//console.log(state);
|
||||
|
||||
return {
|
||||
accountDetails: state.accountDetails,
|
||||
currentView: state.currentView,
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
import _ from "lodash";
|
||||
import Head from "next/head";
|
||||
import Header from "../../components/header";
|
||||
import Banner from "../../components/banner";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import SearchResults from "../../components/searchresults";
|
||||
import Footer from "../../components/footer";
|
||||
import Errorpage from "../../components/errorpage";
|
||||
import styles from "../../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../../store/store";
|
||||
import Cookies from "cookies";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import jsonpath from "jsonpath";
|
||||
import data from "../../data/collections.json";
|
||||
|
||||
import { setSearch, getSearchObj } from "../../store/search/action";
|
||||
import {
|
||||
setSearchResults,
|
||||
setSearchDetails,
|
||||
getSearchResultsObj,
|
||||
} from "../../store/searchOutput/action";
|
||||
import { getBasicSearch, getBasicSearchDetails } from "../../actions";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
const { appealtypes } = router.query;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Head>
|
||||
<title>
|
||||
{t("search:page-title")} - {t("common:service-name")}
|
||||
</title>
|
||||
</Head>
|
||||
<div id="page_wrapper">
|
||||
<CookieBanner />
|
||||
<Header courseName={t("common:service-name")} />
|
||||
<div className="govuk-width-container">
|
||||
<Banner />
|
||||
<Breadcrumbs slug={appealtypes} />
|
||||
<SearchResults
|
||||
searchString={props.search.searchString}
|
||||
searchResultsObj={props.searchResultsObj}
|
||||
/>
|
||||
</div>
|
||||
<Footer footerLinks={footerLinks} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
console.log("query-", query);
|
||||
// const [searchResultsObj, searchDetailsObj] = await Promise.all(
|
||||
// await getBasicSearch(query.q),
|
||||
// await getBasicSearchDetails(query.d)
|
||||
// );
|
||||
|
||||
const searchResultsObj = await getBasicSearch(query.q);
|
||||
const searchDetailsObj = await getSearchDetails(searchResultsObj);
|
||||
// console.log(searchDetailsObj);
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
store.dispatch(setSearch(query.q));
|
||||
}
|
||||
);
|
||||
|
||||
const getFormCollection = (formtype) => {
|
||||
const collectionName = jsonpath.query(
|
||||
data,
|
||||
"$..[?(@.LogicalName=='" + formtype + "')].LogicalCollectionName"
|
||||
);
|
||||
//console.log(collectionName[0]);
|
||||
return collectionName[0];
|
||||
};
|
||||
|
||||
const getSearchDetails = (searchResultsObj) => {
|
||||
//console.log(searchResultsObj);
|
||||
|
||||
let detailsArr = [];
|
||||
searchResultsObj = searchResultsObj.value;
|
||||
const detailsObj = searchResultsObj.map((searchDetail, index) => {
|
||||
if (searchDetail.pinswg_appealcasetype == null) {
|
||||
console.log(searchDetail.ticketnumber);
|
||||
} else {
|
||||
detailsArr.push(
|
||||
getBasicSearchDetails(
|
||||
getFormCollection(
|
||||
"pinswg_" +
|
||||
searchDetail[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
.replace(/[\s\-\+\(\)\,\&\.]/g, "")
|
||||
.toLowerCase()
|
||||
),
|
||||
searchDetail.ticketnumber
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
//console.log(detailsArr);
|
||||
return Promise.all(detailsArr);
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
currentView: state.currentView,
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
form: state.form,
|
||||
myCases: state.myCases,
|
||||
watchedCases: state.watchedCases,
|
||||
myRepresentations: state.myRepresentations,
|
||||
awaitingSubmission: state.awaitingSubmission,
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps)(Home);
|
||||
@@ -72,6 +72,7 @@ const Home = (props) => {
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
accountDetails: state.accountDetails,
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
|
||||
@@ -14,15 +14,27 @@ import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import jsonpath from "jsonpath";
|
||||
import { useEffect } from "react";
|
||||
import {
|
||||
setLoggedInUserId,
|
||||
setAccountDetails,
|
||||
} from "../../store/accountDetails/action";
|
||||
import {
|
||||
setAppealType,
|
||||
setAppealTypeTitle,
|
||||
setAppealTypeID,
|
||||
getAppealTypeObj,
|
||||
setAppealLPA,
|
||||
setCaseReference,
|
||||
} from "../../store/appealType/action";
|
||||
import { setForm, getFormObj } from "../../store/formData/action";
|
||||
import { getFormData, getAppealsTypes, createCase } from "../../actions";
|
||||
import {
|
||||
getFormData,
|
||||
getAppealsTypes,
|
||||
getMandatoryFields,
|
||||
createCase,
|
||||
getPickLists,
|
||||
updateCase,
|
||||
} from "../../actions";
|
||||
|
||||
import xpath from "xpath";
|
||||
import { reduxForm, FormName } from "redux-form";
|
||||
@@ -52,24 +64,22 @@ let Home = (props) => {
|
||||
doc
|
||||
);
|
||||
var sectionCount = xpath.select("/form/tabs/tab[*]", doc);
|
||||
sectionCount = sectionCount.length;
|
||||
sectionCount = 1; //sectionCount.length;
|
||||
|
||||
var tabs = xpath.select("//form/tabs/tab[*]", doc);
|
||||
|
||||
let optionsStr = props.appealType.appealTypeOptions.GlobalOptionSet.Options;
|
||||
let optionsStr = props.appealType.appealTypeOptions.value;
|
||||
|
||||
let selectedObj = jsonpath.query(
|
||||
optionsStr,
|
||||
"$..LocalizedLabels[?(@.Label)].Label"
|
||||
);
|
||||
let selectedObj = jsonpath.query(optionsStr, "$..value");
|
||||
|
||||
//let optionsTitleObj = [];
|
||||
|
||||
const optionsTitleObj = selectedObj.reduce(
|
||||
(obj, arrValue) => (
|
||||
(obj[arrValue] = arrValue
|
||||
.replace(/[\s\-\+\(\)\,]/g, "")
|
||||
.toLowerCase()),
|
||||
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
||||
.toLowerCase()
|
||||
.slice(0, 39)),
|
||||
obj
|
||||
),
|
||||
{}
|
||||
@@ -121,7 +131,7 @@ let Home = (props) => {
|
||||
role="main"
|
||||
>
|
||||
{props.appealType.currentSection == 9999 ? (
|
||||
<CompleteAppeal />
|
||||
<CompleteAppeal props={props} />
|
||||
) : props.appealType.currentSection ==
|
||||
sectionCount + 1 ? (
|
||||
<BuildCheckSection
|
||||
@@ -131,6 +141,9 @@ let Home = (props) => {
|
||||
formTitle={formTitle}
|
||||
appealType={props.appealType}
|
||||
props={props}
|
||||
mandatoryFieldsData={
|
||||
props.formData.mandatoryFieldsData
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<BuildSection
|
||||
@@ -138,6 +151,9 @@ let Home = (props) => {
|
||||
sectionCount={sectionCount}
|
||||
onSubmit={onSubmit}
|
||||
formTitle={formTitle}
|
||||
mandatoryFieldsData={
|
||||
props.formData.mandatoryFieldsData
|
||||
}
|
||||
props={props}
|
||||
/>
|
||||
)}
|
||||
@@ -153,20 +169,45 @@ let Home = (props) => {
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
//console.log("the query", query);
|
||||
const [appealTypeData, formdata] = await Promise.all([
|
||||
console.log("the query", query);
|
||||
|
||||
const [
|
||||
caseReferenceData,
|
||||
appealTypeData,
|
||||
mandatoryFieldsData,
|
||||
pickListData,
|
||||
formdata,
|
||||
] = await Promise.all([
|
||||
await createCase(query.apt),
|
||||
await getAppealsTypes(),
|
||||
await getMandatoryFields(query.appealtypes),
|
||||
await getPickLists(query.appealtypes),
|
||||
await getFormData(query.appealtypes),
|
||||
]);
|
||||
|
||||
const caseReference = createCase("asasa", "asasa");
|
||||
// let updateCaseReferenceData = await updateCase(
|
||||
// caseReferenceData.incidentid,
|
||||
// query.apt
|
||||
// );
|
||||
|
||||
const cookies = new Cookies(req, res);
|
||||
// Get a cookie
|
||||
|
||||
console.log(cookies.get("pipinsUser"));
|
||||
|
||||
let caseReference = caseReferenceData;
|
||||
let xmlStr = formdata;
|
||||
xmlStr = formdata.value[0].formxml;
|
||||
xmlStr = xmlStr.replace(/\\"/g, "");
|
||||
store.dispatch(setAppealTypeID(query.appealtypes));
|
||||
|
||||
//console.log(caseReference, query.appealtypes, formdata);
|
||||
store.dispatch(
|
||||
setLoggedInUserId("f8b454ed-eded-eb11-aac7-00224800be9c")
|
||||
);
|
||||
store.dispatch(setAppealLPA(query.lpa));
|
||||
store.dispatch(setAppealTypeID(query.apt));
|
||||
store.dispatch(setCaseReference(caseReference));
|
||||
store.dispatch(setForm(xmlStr));
|
||||
store.dispatch(setForm(xmlStr, mandatoryFieldsData, pickListData));
|
||||
store.dispatch(setAppealType(appealTypeData));
|
||||
}
|
||||
);
|
||||
@@ -178,6 +219,7 @@ const mapStateToProps = (state) => {
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
form: state.form,
|
||||
accountDetails: state.accountDetails,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../../store/store";
|
||||
import Cookies from "cookies";
|
||||
import { useRouter } from "next/router";
|
||||
import { useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import jsonpath from "jsonpath";
|
||||
import { reduxForm, formValueSelector } from "redux-form";
|
||||
@@ -26,10 +26,15 @@ import {
|
||||
setAppealLPA,
|
||||
getAppealTypeObj,
|
||||
} from "../../store/appealType/action";
|
||||
import { getAppealsTypes, getLPA } from "../../actions";
|
||||
import { getAppealsTypes, getLPA, updateCase, createCase } from "../../actions";
|
||||
import { setLPA } from "../../store/lpa/action";
|
||||
|
||||
const Home = (props) => {
|
||||
// useEffect(() => {
|
||||
// // updateCase("3ffcf47c-5811-ec11-aac9-00224800be9c", "846040004");
|
||||
// createCase();
|
||||
// });
|
||||
|
||||
const { footerLinks, pages, formData } = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
@@ -75,14 +80,11 @@ const Home = (props) => {
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
res.setHeader(
|
||||
"Cache-Control",
|
||||
"public, s-maxage=604800, stale-while-revalidate"
|
||||
);
|
||||
const [appealTypeData, lpaData] = await Promise.all([
|
||||
const [appealTypeData, lpaData, caseData] = await Promise.all([
|
||||
await getAppealsTypes(),
|
||||
await getLPA(),
|
||||
]);
|
||||
|
||||
store.dispatch(setAppealType(appealTypeData));
|
||||
store.dispatch(setLPA(lpaData));
|
||||
}
|
||||
@@ -96,6 +98,7 @@ const mapStateToProps = (state) => {
|
||||
appealType: state.appealType,
|
||||
LPAData: state.LPAData,
|
||||
form: state.form,
|
||||
accountDetails: state.accountDetails,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
+50
-2
@@ -13,13 +13,16 @@ import { wrapper } from "../store/store";
|
||||
import Cookies from "cookies";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import jsonpath from "jsonpath";
|
||||
import data from "../data/collections.json";
|
||||
|
||||
import { setSearch, getSearchObj } from "../store/search/action";
|
||||
import {
|
||||
setSearchResults,
|
||||
setSearchDetails,
|
||||
getSearchResultsObj,
|
||||
} from "../store/searchOutput/action";
|
||||
import { getBasicSearch } from "../actions";
|
||||
import { getBasicSearch, getBasicSearchDetails } from "../actions";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
@@ -57,12 +60,57 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
console.log("query-", query);
|
||||
const searchResultsObj = (await getBasicSearch(query.q)) || null;
|
||||
// const [searchResultsObj, searchDetailsObj] = await Promise.all(
|
||||
// await getBasicSearch(query.q),
|
||||
// await getBasicSearchDetails(query.d)
|
||||
// );
|
||||
|
||||
const searchResultsObj = await getBasicSearch(query.q);
|
||||
const searchDetailsObj = await getSearchDetails(searchResultsObj);
|
||||
// console.log(searchDetailsObj);
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
store.dispatch(setSearch(query.q));
|
||||
}
|
||||
);
|
||||
|
||||
const getFormCollection = (formtype) => {
|
||||
const collectionName = jsonpath.query(
|
||||
data,
|
||||
"$..[?(@.LogicalName=='" + formtype + "')].LogicalCollectionName"
|
||||
);
|
||||
//console.log(collectionName[0]);
|
||||
return collectionName[0];
|
||||
};
|
||||
|
||||
const getSearchDetails = (searchResultsObj) => {
|
||||
//console.log(searchResultsObj);
|
||||
|
||||
let detailsArr = [];
|
||||
searchResultsObj = searchResultsObj.value;
|
||||
const detailsObj = searchResultsObj.map((searchDetail, index) => {
|
||||
if (searchDetail.pinswg_appealcasetype == null) {
|
||||
console.log(searchDetail.ticketnumber);
|
||||
} else {
|
||||
detailsArr.push(
|
||||
getBasicSearchDetails(
|
||||
getFormCollection(
|
||||
"pinswg_" +
|
||||
searchDetail[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
||||
.toLowerCase()
|
||||
),
|
||||
searchDetail.ticketnumber
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
//console.log(detailsArr);
|
||||
return Promise.all(detailsArr);
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
currentView: state.currentView,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
export const AccountDetailsDataActionTypes = {
|
||||
GETACCOUNTDETAILSDATA: "GETACCOUNTDETAILSDATA",
|
||||
SETACCOUNTDETAILSDATA: "SETACCOUNTDETAILSDATA",
|
||||
SETLOGGEDINUSER: "SETLOGGEDINUSER",
|
||||
};
|
||||
|
||||
export const getAccountDetailsObj = () => (dispatch) => {
|
||||
@@ -16,6 +17,13 @@ export const setAccountDetails = (accountDetails) => (dispatch) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const setLoggedInUserId = (loggedinUserId) => (dispatch) => {
|
||||
return dispatch({
|
||||
type: AccountDetailsDataActionTypes.SETLOGGEDINUSER,
|
||||
loggedinUserId: loggedinUserId,
|
||||
});
|
||||
};
|
||||
|
||||
export const setLogout = () => (dispatch) => {
|
||||
return dispatch({
|
||||
type: "USER_LOGOUT",
|
||||
|
||||
@@ -2,6 +2,7 @@ import { AccountDetailsDataActionTypes } from "./action";
|
||||
|
||||
const AccountDetailsDataInitialState = {
|
||||
accountDetails: {},
|
||||
loggedinUserId: "",
|
||||
};
|
||||
|
||||
export default function reducer(
|
||||
@@ -14,6 +15,11 @@ export default function reducer(
|
||||
...state,
|
||||
accountDetails: action.accountDetails,
|
||||
};
|
||||
case AccountDetailsDataActionTypes.SETLOGGEDINUSER:
|
||||
return {
|
||||
...state,
|
||||
loggedinUserId: action.loggedinUserId,
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ const appealTypeDataInitialState = {
|
||||
appealTypeID: {},
|
||||
currentSection: 1,
|
||||
appealLPA: "",
|
||||
caseReference: "",
|
||||
caseReference: {},
|
||||
formComplete: "false",
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
export const awaitingSubmissionActionTypes = {
|
||||
GETAWAITINGSUBMISSION: "GETAWAITINGSUBMISSION",
|
||||
SETAWAITINGSUBMISSION: "SETAWAITINGSUBMISSION",
|
||||
SETAWAITINGSUBMISSIONDETAILS: "SETAWAITINGSUBMISSIONDETAILS",
|
||||
UPDATEAWAITINGSUBMISSION: "UPDATEAWAITINGSUBMISSION",
|
||||
};
|
||||
|
||||
@@ -16,3 +17,11 @@ export const setAwaitingSubmission = (awaitingSubmission) => (dispatch) => {
|
||||
awaitingSubmission: awaitingSubmission,
|
||||
});
|
||||
};
|
||||
|
||||
export const setAwaitingSubmissionDetails =
|
||||
(awaitingSubmissionDetails) => (dispatch) => {
|
||||
return dispatch({
|
||||
type: awaitingSubmissionActionTypes.SETAWAITINGSUBMISSIONDETAILS,
|
||||
awaitingSubmissionDetails: awaitingSubmissionDetails,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2,6 +2,7 @@ import { awaitingSubmissionActionTypes } from "./action";
|
||||
|
||||
const awaitingSubmissionInitialState = {
|
||||
awaitingSubmission: {},
|
||||
awaitingSubmissionDetails: {},
|
||||
};
|
||||
|
||||
export default function reducer(
|
||||
@@ -11,8 +12,14 @@ export default function reducer(
|
||||
switch (action.type) {
|
||||
case awaitingSubmissionActionTypes.SETAWAITINGSUBMISSION:
|
||||
return {
|
||||
...state,
|
||||
awaitingSubmission: action.awaitingSubmission,
|
||||
};
|
||||
case awaitingSubmissionActionTypes.SETAWAITINGSUBMISSIONDETAILS:
|
||||
return {
|
||||
...state,
|
||||
awaitingSubmissionDetails: action.awaitingSubmissionDetails,
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -10,9 +10,12 @@ export const getFormObj = () => (dispatch) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const setForm = (formData) => (dispatch) => {
|
||||
return dispatch({
|
||||
type: formDataActionTypes.SETFORMDATA,
|
||||
formData: formData,
|
||||
});
|
||||
};
|
||||
export const setForm =
|
||||
(formData, mandatoryFieldsData, pickListData) => (dispatch) => {
|
||||
return dispatch({
|
||||
type: formDataActionTypes.SETFORMDATA,
|
||||
formData: formData,
|
||||
mandatoryFieldsData: mandatoryFieldsData,
|
||||
pickListData: pickListData,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2,6 +2,8 @@ import { formDataActionTypes } from "./action";
|
||||
|
||||
const formDataInitialState = {
|
||||
formData: {},
|
||||
mandatoryFieldsData: {},
|
||||
pickListData: {},
|
||||
};
|
||||
|
||||
export default function reducer(state = formDataInitialState, action) {
|
||||
@@ -9,6 +11,8 @@ export default function reducer(state = formDataInitialState, action) {
|
||||
case formDataActionTypes.SETFORMDATA:
|
||||
return {
|
||||
formData: action.formData,
|
||||
mandatoryFieldsData: action.mandatoryFieldsData,
|
||||
pickListData: action.pickListData,
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
|
||||
@@ -2,6 +2,7 @@ export const myCasesActionTypes = {
|
||||
GETMYCASES: "GETMYCASES",
|
||||
SETMYCASES: "SETMYCASES",
|
||||
UPDATEMYCASES: "UPDATEMYCASES",
|
||||
SETMYCASESDETAILS: "SETMYCASESDETAILS",
|
||||
};
|
||||
|
||||
export const getMyCasesObj = () => (dispatch) => {
|
||||
@@ -16,3 +17,9 @@ export const setMyCases = (myCases) => (dispatch) => {
|
||||
myCases: myCases,
|
||||
});
|
||||
};
|
||||
export const setMyCasesDetails = (myCasesDetails) => (dispatch) => {
|
||||
return dispatch({
|
||||
type: myCasesActionTypes.SETMYCASESDETAILS,
|
||||
myCasesDetails: myCasesDetails,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2,14 +2,21 @@ import { myCasesActionTypes } from "./action";
|
||||
|
||||
const myCasesInitialState = {
|
||||
myCases: {},
|
||||
myCasesDetails: {},
|
||||
};
|
||||
|
||||
export default function reducer(state = myCasesInitialState, action) {
|
||||
switch (action.type) {
|
||||
case myCasesActionTypes.SETMYCASES:
|
||||
return {
|
||||
...state,
|
||||
myCases: action.myCases,
|
||||
};
|
||||
case myCasesActionTypes.SETMYCASESDETAILS:
|
||||
return {
|
||||
...state,
|
||||
myCasesDetails: action.myCasesDetails,
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
export const myRepresentationsActionTypes = {
|
||||
GETMYREPRESENTATIONS: "GETMYREPRESENTATIONS",
|
||||
SETMYREPRESENTATIONS: "SETMYREPRESENTATIONS",
|
||||
SETMYREPRESENTATIONSDETAILS: "SETMYREPRESENTATIONSDETAILS",
|
||||
UPDATEMYREPRESENTATIONS: "UPDATEMYREPRESENTATIONS",
|
||||
};
|
||||
|
||||
@@ -16,3 +17,11 @@ export const setMyRepresentations = (myRepresentations) => (dispatch) => {
|
||||
myRepresentations: myRepresentations,
|
||||
});
|
||||
};
|
||||
|
||||
export const setMyRepresentationsDetails =
|
||||
(myRepresentationsDetails) => (dispatch) => {
|
||||
return dispatch({
|
||||
type: myRepresentationsActionTypes.SETMYREPRESENTATIONSDETAILS,
|
||||
myRepresentationsDetails: myRepresentationsDetails,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2,14 +2,21 @@ import { myRepresentationsActionTypes } from "./action";
|
||||
|
||||
const myRepresentationsInitialState = {
|
||||
myRepresentations: {},
|
||||
myRepresentationsDetails: {},
|
||||
};
|
||||
|
||||
export default function reducer(state = myRepresentationsInitialState, action) {
|
||||
switch (action.type) {
|
||||
case myRepresentationsActionTypes.SETMYREPRESENTATIONS:
|
||||
return {
|
||||
...state,
|
||||
myRepresentations: action.myRepresentations,
|
||||
};
|
||||
case myRepresentationsActionTypes.SETMYREPRESENTATIONSDETAILS:
|
||||
return {
|
||||
...state,
|
||||
myRepresentationsDetails: action.myRepresentationsDetails,
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ export const searchResultsActionTypes = {
|
||||
GETSEARCHRESULTS: "GETSEARCHRESULTS",
|
||||
SETSEARCHRESULTS: "SETSEARCHRESULTS",
|
||||
UPDATESEARCHRESULTS: "UPDATESEARCHRESULTS",
|
||||
SETSEARCHDETAILS: "SETSEARCHDETAILS",
|
||||
};
|
||||
|
||||
export const getSearchResultshObj = () => (dispatch) => {
|
||||
@@ -16,3 +17,10 @@ export const setSearchResults = (searchResults) => (dispatch) => {
|
||||
searchResultsObj: searchResults,
|
||||
});
|
||||
};
|
||||
|
||||
export const setSearchDetails = (searchDetails) => (dispatch) => {
|
||||
return dispatch({
|
||||
type: searchResultsActionTypes.SETSEARCHDETAILS,
|
||||
searchDetailsObj: searchDetails,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2,14 +2,21 @@ import { searchResultsActionTypes } from "./action";
|
||||
|
||||
const searchResultsInitialState = {
|
||||
searchResultsObj: {},
|
||||
searchDetailsObj: {},
|
||||
};
|
||||
|
||||
export default function reducer(state = searchResultsInitialState, action) {
|
||||
switch (action.type) {
|
||||
case searchResultsActionTypes.SETSEARCHRESULTS:
|
||||
return {
|
||||
...state,
|
||||
searchResultsObj: action.searchResultsObj,
|
||||
};
|
||||
case searchResultsActionTypes.SETSEARCHDETAILS:
|
||||
return {
|
||||
...state,
|
||||
searchDetailsObj: action.searchDetailsObj,
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
+7
-2
@@ -1,5 +1,5 @@
|
||||
import { createStore, applyMiddleware, combineReducers } from "redux";
|
||||
import { createWrapper, HYDRATE } from "next-redux-wrapper";
|
||||
import { createWrapper, HYDRATE, REHYDRATE } from "next-redux-wrapper";
|
||||
import thunkMiddleware from "redux-thunk";
|
||||
import { reducer as formReducer } from "redux-form";
|
||||
import autoMergeLevel2 from "redux-persist/lib/stateReconciler/autoMergeLevel2";
|
||||
@@ -47,6 +47,11 @@ const reducer = (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
case HYDRATE:
|
||||
return { ...state, ...action.payload };
|
||||
case REHYDRATE: {
|
||||
console.log("am rhydrating........");
|
||||
return { ...state, ...action.payload };
|
||||
}
|
||||
|
||||
case "SERVER_ACTION":
|
||||
return {
|
||||
...state,
|
||||
@@ -103,7 +108,7 @@ const makeStore = ({ isServer }) => {
|
||||
const storage = require("redux-persist/lib/storage").default;
|
||||
|
||||
const persistConfig = {
|
||||
key: "acp_" + Math.floor(100000 + Math.random() * 900000),
|
||||
key: "acp",
|
||||
whitelist: [
|
||||
"currentView",
|
||||
"search",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
export const watchedCasesActionTypes = {
|
||||
GETWATCHEDCASES: "GETWATCHEDCASES",
|
||||
SETWATCHEDCASES: "SETWATCHEDCASES",
|
||||
SETWATCHEDCASESDETAILS: "SETWATCHEDCASESDETAILS",
|
||||
UPDATEWATCHEDCASES: "UPDATEWATCHEDCASES",
|
||||
};
|
||||
|
||||
@@ -16,3 +17,10 @@ export const setWatchedCases = (watchedCases) => (dispatch) => {
|
||||
watchedCases: watchedCases,
|
||||
});
|
||||
};
|
||||
|
||||
export const setWatchedCasesDetails = (watchedCasesDetails) => (dispatch) => {
|
||||
return dispatch({
|
||||
type: watchedCasesActionTypes.SETWATCHEDCASESDETAILS,
|
||||
watchedCasesDetails: watchedCasesDetails,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2,14 +2,21 @@ import { watchedCasesActionTypes } from "./action";
|
||||
|
||||
const watchedCasesInitialState = {
|
||||
watchedCases: {},
|
||||
watchedCasesDetails: {},
|
||||
};
|
||||
|
||||
export default function reducer(state = watchedCasesInitialState, action) {
|
||||
switch (action.type) {
|
||||
case watchedCasesActionTypes.SETWATCHEDCASES:
|
||||
return {
|
||||
...state,
|
||||
watchedCases: action.watchedCases,
|
||||
};
|
||||
case watchedCasesActionTypes.SETWATCHEDCASESDETAILS:
|
||||
return {
|
||||
...state,
|
||||
watchedCasesDetails: action.watchedCasesDetails,
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user