use ticketnumber not ref/title/pinswg_name
This commit is contained in:
@@ -40,6 +40,7 @@ const Case = (props) => {
|
|||||||
docsOffline={props.props.docsOffline}
|
docsOffline={props.props.docsOffline}
|
||||||
documentDetailsObj={props.documentDetailsObj}
|
documentDetailsObj={props.documentDetailsObj}
|
||||||
showFilteredDocs={props.showFilteredDocs}
|
showFilteredDocs={props.showFilteredDocs}
|
||||||
|
ticketnumber={props.ticketnumber}
|
||||||
/>
|
/>
|
||||||
{showRepresentations == true && (
|
{showRepresentations == true && (
|
||||||
<RepresentationList
|
<RepresentationList
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ let MakeRepresentation = (props) => {
|
|||||||
resultsObj = jsonpath({
|
resultsObj = jsonpath({
|
||||||
path:
|
path:
|
||||||
'$..[?(@ && @.ticketnumber=="' +
|
'$..[?(@ && @.ticketnumber=="' +
|
||||||
currentView.caseReference.currentReference +
|
currentView.caseReference.ticketnumber +
|
||||||
'")]',
|
'")]',
|
||||||
json: setCaseResultsObj,
|
json: setCaseResultsObj,
|
||||||
eval: true,
|
eval: true,
|
||||||
@@ -296,8 +296,8 @@ let MakeRepresentation = (props) => {
|
|||||||
})
|
})
|
||||||
: jsonpath({
|
: jsonpath({
|
||||||
path:
|
path:
|
||||||
'$..[?(@ && @.pinswg_name =="' +
|
'$..[?(@ && @.ticketnumber =="' +
|
||||||
currentView.caseReference.currentReference +
|
currentView.caseReference.ticketnumber +
|
||||||
'")]',
|
'")]',
|
||||||
json: setCaseDetailsObj,
|
json: setCaseDetailsObj,
|
||||||
eval: true,
|
eval: true,
|
||||||
@@ -767,6 +767,26 @@ let MakeRepresentation = (props) => {
|
|||||||
return blobList;
|
return blobList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const buildAddressStr = (detailsObj) => {
|
||||||
|
const toTitleCase = (str) =>
|
||||||
|
str.toLowerCase().replace(/\b\w/g, (char) => char.toUpperCase());
|
||||||
|
|
||||||
|
return [
|
||||||
|
detailsObj?.pinswg_siteaddressline1 ||
|
||||||
|
detailsObj?.pinswg_addressline1,
|
||||||
|
detailsObj?.pinswg_siteaddressline2 ||
|
||||||
|
detailsObj?.pinswg_addressline2,
|
||||||
|
detailsObj?.pinswg_siteaddresstown ||
|
||||||
|
detailsObj?.pinswg_addresstown,
|
||||||
|
detailsObj?.pinswg_siteaddresspostcode ||
|
||||||
|
detailsObj?.pinswg_postcode,
|
||||||
|
detailsObj?.pinswg_siteaddresscounty ||
|
||||||
|
detailsObj?.pinswg_addresscounty,
|
||||||
|
]
|
||||||
|
.filter((v) => !!v && v.trim()) // remove empty/whitespace-only values
|
||||||
|
.map((v) => toTitleCase(v.trim())) // title-case each segment
|
||||||
|
.join(" ");
|
||||||
|
};
|
||||||
const updateRepresentation = async (
|
const updateRepresentation = async (
|
||||||
values,
|
values,
|
||||||
sendSavedEmail,
|
sendSavedEmail,
|
||||||
@@ -807,14 +827,7 @@ let MakeRepresentation = (props) => {
|
|||||||
"lastname": props.props.accountDetails.accountDetails.lastname,
|
"lastname": props.props.accountDetails.accountDetails.lastname,
|
||||||
"emailAddress":
|
"emailAddress":
|
||||||
props.props.accountDetails.accountDetails.emailaddress1,
|
props.props.accountDetails.accountDetails.emailaddress1,
|
||||||
"siteAddress":
|
"siteAddress": buildAddressStr(detailsObj),
|
||||||
detailsObj.pinswg_siteaddressline1 +
|
|
||||||
(detailsObj.pinswg_siteaddressline2 != null
|
|
||||||
? " " + detailsObj.pinswg_siteaddressline2 + " "
|
|
||||||
: " ") +
|
|
||||||
detailsObj.pinswg_siteaddresstown +
|
|
||||||
" " +
|
|
||||||
detailsObj.pinswg_siteaddresspostcode,
|
|
||||||
"pinswg_siteaddressline1": detailsObj.pinswg_siteaddressline1,
|
"pinswg_siteaddressline1": detailsObj.pinswg_siteaddressline1,
|
||||||
"pinswg_siteaddressline2": detailsObj.pinswg_siteaddressline2,
|
"pinswg_siteaddressline2": detailsObj.pinswg_siteaddressline2,
|
||||||
"pinswg_siteaddresstown": detailsObj.pinswg_siteaddresstown,
|
"pinswg_siteaddresstown": detailsObj.pinswg_siteaddresstown,
|
||||||
@@ -945,7 +958,10 @@ let MakeRepresentation = (props) => {
|
|||||||
var detailsObj = {};
|
var detailsObj = {};
|
||||||
|
|
||||||
detailsObj = jsonpath({
|
detailsObj = jsonpath({
|
||||||
path: '$..[?(@ && @.pinswg_name=="' + caseReference + '")]',
|
path:
|
||||||
|
'$..[?(@ && @.ticketnumber=="' +
|
||||||
|
currentView.caseReference.ticketnumber +
|
||||||
|
'")]',
|
||||||
json: setCaseDetailsObj,
|
json: setCaseDetailsObj,
|
||||||
eval: true,
|
eval: true,
|
||||||
});
|
});
|
||||||
@@ -974,16 +990,19 @@ let MakeRepresentation = (props) => {
|
|||||||
props.props.currentView.caseReference.currentReference,
|
props.props.currentView.caseReference.currentReference,
|
||||||
"casereference":
|
"casereference":
|
||||||
props.props.currentView.caseReference.currentReference,
|
props.props.currentView.caseReference.currentReference,
|
||||||
|
"ticketnumber":
|
||||||
|
props.props.currentView.caseReference.ticketnumber,
|
||||||
"pinswg_questionnaireduedate":
|
"pinswg_questionnaireduedate":
|
||||||
detailsObj.pinswg_questionnaireduedate,
|
detailsObj?.pinswg_questionnaireduedate,
|
||||||
"pinswg_endofrepresentationperiod":
|
"pinswg_endofrepresentationperiod":
|
||||||
detailsObj.pinswg_endofrepresentationperiod,
|
detailsObj?.pinswg_endofrepresentationperiod,
|
||||||
"pinswg_applicationacceptedasvalid":
|
"pinswg_applicationacceptedasvalid":
|
||||||
detailsObj.pinswg_applicationacceptedasvalid,
|
detailsObj?.pinswg_applicationacceptedasvalid,
|
||||||
"pinswg_statementduedate": detailsObj.pinswg_statementduedate,
|
"pinswg_statementduedate": detailsObj?.pinswg_statementduedate,
|
||||||
"pinswg_statementsduedate": detailsObj.pinswg_statementsduedate,
|
"pinswg_statementsduedate":
|
||||||
|
detailsObj?.pinswg_statementsduedate,
|
||||||
"pinswg_finalcommentsduedate":
|
"pinswg_finalcommentsduedate":
|
||||||
detailsObj.pinswg_finalcommentsduedate,
|
detailsObj?.pinswg_finalcommentsduedate,
|
||||||
"pinswg_name":
|
"pinswg_name":
|
||||||
props.props.currentView.caseReference.currentReference,
|
props.props.currentView.caseReference.currentReference,
|
||||||
"firstname":
|
"firstname":
|
||||||
@@ -991,19 +1010,12 @@ let MakeRepresentation = (props) => {
|
|||||||
"lastname": props.props.accountDetails.accountDetails.lastname,
|
"lastname": props.props.accountDetails.accountDetails.lastname,
|
||||||
"emailAddress":
|
"emailAddress":
|
||||||
props.props.accountDetails.accountDetails.emailaddress1,
|
props.props.accountDetails.accountDetails.emailaddress1,
|
||||||
"siteAddress":
|
"siteAddress": buildAddressStr(detailsObj),
|
||||||
detailsObj.pinswg_siteaddressline1 +
|
"pinswg_siteaddressline1": detailsObj?.pinswg_siteaddressline1,
|
||||||
(detailsObj.pinswg_siteaddressline2 != null
|
"pinswg_siteaddressline2": detailsObj?.pinswg_siteaddressline2,
|
||||||
? " " + detailsObj.pinswg_siteaddressline2 + " "
|
"pinswg_siteaddresstown": detailsObj?.pinswg_siteaddresstown,
|
||||||
: " ") +
|
|
||||||
detailsObj.pinswg_siteaddresstown +
|
|
||||||
" " +
|
|
||||||
detailsObj.pinswg_siteaddresspostcode,
|
|
||||||
"pinswg_siteaddressline1": detailsObj.pinswg_siteaddressline1,
|
|
||||||
"pinswg_siteaddressline2": detailsObj.pinswg_siteaddressline2,
|
|
||||||
"pinswg_siteaddresstown": detailsObj.pinswg_siteaddresstown,
|
|
||||||
"pinswg_siteaddresspostcode":
|
"pinswg_siteaddresspostcode":
|
||||||
detailsObj.pinswg_siteaddresspostcode,
|
detailsObj?.pinswg_siteaddresspostcode,
|
||||||
"pinswg_lpareference": resultsObj?.pinswg_lpareference || "",
|
"pinswg_lpareference": resultsObj?.pinswg_lpareference || "",
|
||||||
"_pinswg_appellant_value":
|
"_pinswg_appellant_value":
|
||||||
detailsObj["_pinswg_appellant_value"],
|
detailsObj["_pinswg_appellant_value"],
|
||||||
@@ -1068,7 +1080,7 @@ let MakeRepresentation = (props) => {
|
|||||||
console.log("has errors:", props.invalid);
|
console.log("has errors:", props.invalid);
|
||||||
Object.assign(values, {
|
Object.assign(values, {
|
||||||
"locale": router.locale,
|
"locale": router.locale,
|
||||||
"repComplete": currentView.caseReference.currentReference,
|
"repComplete": currentView.caseReference.ticketnumber,
|
||||||
});
|
});
|
||||||
props.invalid == false &&
|
props.invalid == false &&
|
||||||
updateRepresentation(values, false, false);
|
updateRepresentation(values, false, false);
|
||||||
@@ -1169,7 +1181,9 @@ let MakeRepresentation = (props) => {
|
|||||||
dataObj,
|
dataObj,
|
||||||
[{}],
|
[{}],
|
||||||
values.containerID,
|
values.containerID,
|
||||||
props.caseReference + "/" + dataObj.repfile_name
|
props.props.currentView.caseReference.ticketnumber +
|
||||||
|
"/" +
|
||||||
|
dataObj.repfile_name
|
||||||
).then((data) => {
|
).then((data) => {
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -196,7 +196,8 @@ const RepAgent = (props) => {
|
|||||||
"myrepresentations:add-files-label"
|
"myrepresentations:add-files-label"
|
||||||
)}
|
)}
|
||||||
ticketnumber={
|
ticketnumber={
|
||||||
props.props.caseReference
|
props.currentView.caseReference
|
||||||
|
.ticketnumber
|
||||||
}
|
}
|
||||||
hint={"sdsd"}
|
hint={"sdsd"}
|
||||||
fileList={
|
fileList={
|
||||||
|
|||||||
@@ -188,7 +188,10 @@ const RepAppellant = (props) => {
|
|||||||
label={t(
|
label={t(
|
||||||
"myrepresentations:add-files-label"
|
"myrepresentations:add-files-label"
|
||||||
)}
|
)}
|
||||||
ticketnumber={props.props.caseReference}
|
ticketnumber={
|
||||||
|
props.currentView.caseReference
|
||||||
|
.ticketnumber
|
||||||
|
}
|
||||||
hint={"sdsd"}
|
hint={"sdsd"}
|
||||||
fileList={
|
fileList={
|
||||||
props.currentView.fileList
|
props.currentView.fileList
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ let RepCapacitySelection = (props) => {
|
|||||||
currentType={currentType}
|
currentType={currentType}
|
||||||
casesObj={casesObj}
|
casesObj={casesObj}
|
||||||
caseReference={props.props.caseReference}
|
caseReference={props.props.caseReference}
|
||||||
|
ticketnumber={
|
||||||
|
props.props.currentView.caseReference.ticketnumber
|
||||||
|
}
|
||||||
searchResultsObj={props.props.searchResultsObj}
|
searchResultsObj={props.props.searchResultsObj}
|
||||||
myRepresentations={props.props.myRepresentations}
|
myRepresentations={props.props.myRepresentations}
|
||||||
props={props}
|
props={props}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ const RepComplete = (props) => {
|
|||||||
),
|
),
|
||||||
sendRepCompleteMessage(
|
sendRepCompleteMessage(
|
||||||
props.props.props.props.accountDetails.containerID,
|
props.props.props.props.accountDetails.containerID,
|
||||||
props.props.currentView.caseReference.currentReference,
|
props.props.currentView.caseReference.ticketnumber,
|
||||||
props.repFormData.repfile_name
|
props.repFormData.repfile_name
|
||||||
),
|
),
|
||||||
sendEmail(templateId, emailAddress, personalisation, reference),
|
sendEmail(templateId, emailAddress, personalisation, reference),
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const RepDetails = (props) => {
|
|||||||
|
|
||||||
const { currentType, casesObj } = props;
|
const { currentType, casesObj } = props;
|
||||||
|
|
||||||
let { caseReference } = props;
|
let { caseReference, ticketnumber } = props;
|
||||||
|
|
||||||
let setCaseDetailsObj = router.query.hasOwnProperty("state")
|
let setCaseDetailsObj = router.query.hasOwnProperty("state")
|
||||||
? router.query.state == "edit"
|
? router.query.state == "edit"
|
||||||
@@ -29,7 +29,7 @@ const RepDetails = (props) => {
|
|||||||
: caseReference;
|
: caseReference;
|
||||||
|
|
||||||
detailsObj = jsonpath({
|
detailsObj = jsonpath({
|
||||||
path: '$..[?(@ && @.pinswg_name=="' + caseReference + '")]',
|
path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
|
||||||
json: setCaseDetailsObj,
|
json: setCaseDetailsObj,
|
||||||
eval: true,
|
eval: true,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -188,7 +188,8 @@ const RepInterestedPartyPerson = (props) => {
|
|||||||
"myrepresentations:add-files-label"
|
"myrepresentations:add-files-label"
|
||||||
)}
|
)}
|
||||||
ticketnumber={
|
ticketnumber={
|
||||||
props.props.caseReference
|
props.currentView.caseReference
|
||||||
|
.ticketnumber
|
||||||
}
|
}
|
||||||
hint={"sdsd"}
|
hint={"sdsd"}
|
||||||
fileList={
|
fileList={
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ let RepLPA = (props) => {
|
|||||||
"myrepresentations:add-files-label"
|
"myrepresentations:add-files-label"
|
||||||
)}
|
)}
|
||||||
ticketnumber={
|
ticketnumber={
|
||||||
props.props.caseReference
|
props.currentView.caseReference.ticketnumber
|
||||||
}
|
}
|
||||||
hint={"sdsd"}
|
hint={"sdsd"}
|
||||||
fileList={
|
fileList={
|
||||||
|
|||||||
@@ -84,7 +84,10 @@ const RepLandOwner = (props) => {
|
|||||||
label={t(
|
label={t(
|
||||||
"myrepresentations:add-files-label"
|
"myrepresentations:add-files-label"
|
||||||
)}
|
)}
|
||||||
ticketnumber={props.props.caseReference}
|
ticketnumber={
|
||||||
|
props.currentView.caseReference
|
||||||
|
.ticketnumber
|
||||||
|
}
|
||||||
hint={"sdsd"}
|
hint={"sdsd"}
|
||||||
fileList={[]}
|
fileList={[]}
|
||||||
setFilesForRepresentation={[]}
|
setFilesForRepresentation={[]}
|
||||||
|
|||||||
+4
-1
@@ -1213,7 +1213,10 @@ let Enforcement_Questionnaire = (props) => {
|
|||||||
name={"representationDocuments"}
|
name={"representationDocuments"}
|
||||||
id={"representationDocuments"}
|
id={"representationDocuments"}
|
||||||
label={t("myrepresentations:add-files-label")}
|
label={t("myrepresentations:add-files-label")}
|
||||||
ticketnumber={props.props.props.caseReference}
|
ticketnumber={
|
||||||
|
props.props.currentView.caseReference
|
||||||
|
.ticketnumber
|
||||||
|
}
|
||||||
hint={"sdsd"}
|
hint={"sdsd"}
|
||||||
fileList={
|
fileList={
|
||||||
props.currentView.fileList
|
props.currentView.fileList
|
||||||
|
|||||||
+4
-1
@@ -1022,7 +1022,10 @@ let S78_Questionnaire = (props) => {
|
|||||||
name={"representationDocuments"}
|
name={"representationDocuments"}
|
||||||
id={"representationDocuments"}
|
id={"representationDocuments"}
|
||||||
label={t("myrepresentations:add-files-label")}
|
label={t("myrepresentations:add-files-label")}
|
||||||
ticketnumber={props.props.props.caseReference}
|
ticketnumber={
|
||||||
|
props.props.currentView.caseReference
|
||||||
|
.ticketnumber
|
||||||
|
}
|
||||||
hint={"sdsd"}
|
hint={"sdsd"}
|
||||||
fileList={
|
fileList={
|
||||||
props.currentView.fileList
|
props.currentView.fileList
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ const CaseSummary = (props) => {
|
|||||||
currentView,
|
currentView,
|
||||||
messagesObj,
|
messagesObj,
|
||||||
docsOffline,
|
docsOffline,
|
||||||
|
ticketnumber,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const showLoginCheck =
|
const showLoginCheck =
|
||||||
@@ -176,13 +177,13 @@ const CaseSummary = (props) => {
|
|||||||
|
|
||||||
currentType == "searchResultsObj"
|
currentType == "searchResultsObj"
|
||||||
? (casesObj = jsonpath({
|
? (casesObj = jsonpath({
|
||||||
path: '$..[?(@ && @.title=="' + caseReference + '")]',
|
path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
|
||||||
json: searchResultsObj,
|
json: searchResultsObj,
|
||||||
eval: true,
|
eval: true,
|
||||||
}))
|
}))
|
||||||
: currentType == "watchedCases"
|
: currentType == "watchedCases"
|
||||||
? (casesObj = jsonpath({
|
? (casesObj = jsonpath({
|
||||||
path: '$..[?(@ && @.pinswg_title=="' + caseReference + '")]',
|
path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
|
||||||
json: setCaseQueryObj,
|
json: setCaseQueryObj,
|
||||||
eval: true,
|
eval: true,
|
||||||
}))
|
}))
|
||||||
@@ -194,7 +195,7 @@ const CaseSummary = (props) => {
|
|||||||
}))
|
}))
|
||||||
: currentType == "directResultsObj"
|
: currentType == "directResultsObj"
|
||||||
? (casesObj = jsonpath({
|
? (casesObj = jsonpath({
|
||||||
path: '$..[?(@ && @.ticketnumber=="' + caseReference + '")]',
|
path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
|
||||||
json: setCaseQueryObj,
|
json: setCaseQueryObj,
|
||||||
eval: true,
|
eval: true,
|
||||||
}))
|
}))
|
||||||
@@ -466,13 +467,13 @@ const CaseSummary = (props) => {
|
|||||||
case:
|
case:
|
||||||
currentType ==
|
currentType ==
|
||||||
"searchResultsObj"
|
"searchResultsObj"
|
||||||
? detailsObj.pinswg_name
|
? detailsObj.ticketnumber
|
||||||
: currentType ==
|
: currentType ==
|
||||||
"watchedCases"
|
"watchedCases"
|
||||||
? casesObj.pinswg_title
|
? casesObj.pinswg_title
|
||||||
: currentType ==
|
: currentType ==
|
||||||
"directResultsObj"
|
"directResultsObj"
|
||||||
? detailsObj.pinswg_name
|
? detailsObj.ticketnumber
|
||||||
: casesObj.reference,
|
: casesObj.reference,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user