diff --git a/actions/azurestorage.js b/actions/azurestorage.js index 16e7fdfa..ee392b9f 100644 --- a/actions/azurestorage.js +++ b/actions/azurestorage.js @@ -309,7 +309,7 @@ export const createRepBlob = async (formContent, containerName, caseref) => { const tags = { containerid: containerName, - caseID: formContent.caseRef, + caseID: formContent.ticketnumber, blobType: "Representation", }; @@ -317,7 +317,7 @@ export const createRepBlob = async (formContent, containerName, caseref) => { const withTags = await blockBlobClient.setTags(tags); const withMeta = await blockBlobClient.setMetadata(tags); - return formContent.pinswg_name; + return formContent.ticketnumber; }; export const createAppealPDFBlob = async ( diff --git a/components/case.js b/components/case.js index 6d98d253..695c9657 100644 --- a/components/case.js +++ b/components/case.js @@ -41,6 +41,7 @@ const Case = (props) => { docsOffline={props.props.docsOffline} documentDetailsObj={props.documentDetailsObj} showFilteredDocs={props.showFilteredDocs} + ticketnumber={props.ticketnumber} /> {showRepresentations == true && ( { resultsObj = jsonpath({ path: '$..[?(@ && @.ticketnumber=="' + - currentView.caseReference.currentReference + + currentView.caseReference.ticketnumber + '")]', json: setCaseResultsObj, eval: true, @@ -296,8 +296,8 @@ let MakeRepresentation = (props) => { }) : jsonpath({ path: - '$..[?(@ && @.pinswg_name =="' + - currentView.caseReference.currentReference + + '$..[?(@ && @.ticketnumber =="' + + currentView.caseReference.ticketnumber + '")]', json: setCaseDetailsObj, eval: true, @@ -767,6 +767,26 @@ let MakeRepresentation = (props) => { 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 ( values, sendSavedEmail, @@ -790,7 +810,6 @@ let MakeRepresentation = (props) => { "caseRef": props.props.currentView.caseReference.currentReference, "casereference": props.props.currentView.caseReference.currentReference, - "ticketnumber": props.props.currentView.caseReference.ticketnumber, "pinswg_questionnaireduedate": detailsObj.pinswg_questionnaireduedate, "pinswg_statementduedate": @@ -808,14 +827,7 @@ let MakeRepresentation = (props) => { "lastname": props.props.accountDetails.accountDetails.lastname, "emailAddress": props.props.accountDetails.accountDetails.emailaddress1, - "siteAddress": - detailsObj.pinswg_siteaddressline1 + - (detailsObj.pinswg_siteaddressline2 != null - ? " " + detailsObj.pinswg_siteaddressline2 + " " - : " ") + - detailsObj.pinswg_siteaddresstown + - " " + - detailsObj.pinswg_siteaddresspostcode, + "siteAddress": buildAddressStr(detailsObj), "pinswg_siteaddressline1": detailsObj.pinswg_siteaddressline1, "pinswg_siteaddressline2": detailsObj.pinswg_siteaddressline2, "pinswg_siteaddresstown": detailsObj.pinswg_siteaddresstown, @@ -859,7 +871,6 @@ let MakeRepresentation = (props) => { props.props.currentView.caseReference.repDetails.appealType, "casereference": props.props.currentView.caseReference.currentReference, - "ticketnumber": props.props.currentView.caseReference.ticketnumber, "incidentID": props.props.currentView.caseReference.incidentid || props.props.currentView.caseReference.repDetails.incidentid, @@ -947,7 +958,10 @@ let MakeRepresentation = (props) => { var detailsObj = {}; detailsObj = jsonpath({ - path: '$..[?(@ && @.pinswg_name=="' + caseReference + '")]', + path: + '$..[?(@ && @.ticketnumber=="' + + currentView.caseReference.ticketnumber + + '")]', json: setCaseDetailsObj, eval: true, }); @@ -979,15 +993,16 @@ let MakeRepresentation = (props) => { "ticketnumber": props.props.currentView.caseReference.ticketnumber, "pinswg_questionnaireduedate": - detailsObj.pinswg_questionnaireduedate, + detailsObj?.pinswg_questionnaireduedate, "pinswg_endofrepresentationperiod": - detailsObj.pinswg_endofrepresentationperiod, + detailsObj?.pinswg_endofrepresentationperiod, "pinswg_applicationacceptedasvalid": - detailsObj.pinswg_applicationacceptedasvalid, - "pinswg_statementduedate": detailsObj.pinswg_statementduedate, - "pinswg_statementsduedate": detailsObj.pinswg_statementsduedate, + detailsObj?.pinswg_applicationacceptedasvalid, + "pinswg_statementduedate": detailsObj?.pinswg_statementduedate, + "pinswg_statementsduedate": + detailsObj?.pinswg_statementsduedate, "pinswg_finalcommentsduedate": - detailsObj.pinswg_finalcommentsduedate, + detailsObj?.pinswg_finalcommentsduedate, "pinswg_name": props.props.currentView.caseReference.currentReference, "firstname": @@ -995,19 +1010,12 @@ let MakeRepresentation = (props) => { "lastname": props.props.accountDetails.accountDetails.lastname, "emailAddress": props.props.accountDetails.accountDetails.emailaddress1, - "siteAddress": - detailsObj.pinswg_siteaddressline1 + - (detailsObj.pinswg_siteaddressline2 != null - ? " " + detailsObj.pinswg_siteaddressline2 + " " - : " ") + - detailsObj.pinswg_siteaddresstown + - " " + - detailsObj.pinswg_siteaddresspostcode, - "pinswg_siteaddressline1": detailsObj.pinswg_siteaddressline1, - "pinswg_siteaddressline2": detailsObj.pinswg_siteaddressline2, - "pinswg_siteaddresstown": detailsObj.pinswg_siteaddresstown, + "siteAddress": buildAddressStr(detailsObj), + "pinswg_siteaddressline1": detailsObj?.pinswg_siteaddressline1, + "pinswg_siteaddressline2": detailsObj?.pinswg_siteaddressline2, + "pinswg_siteaddresstown": detailsObj?.pinswg_siteaddresstown, "pinswg_siteaddresspostcode": - detailsObj.pinswg_siteaddresspostcode, + detailsObj?.pinswg_siteaddresspostcode, "pinswg_lpareference": resultsObj?.pinswg_lpareference || "", "_pinswg_appellant_value": detailsObj["_pinswg_appellant_value"], @@ -1072,7 +1080,7 @@ let MakeRepresentation = (props) => { console.log("has errors:", props.invalid); Object.assign(values, { "locale": router.locale, - "repComplete": currentView.caseReference.currentReference, + "repComplete": currentView.caseReference.ticketnumber, }); props.invalid == false && updateRepresentation(values, false, false); @@ -1094,7 +1102,7 @@ let MakeRepresentation = (props) => { generateRepPDF( values, props.props.accountDetails.containerID, - currentView.caseReference.ticketnumber + currentView.caseReference.currentReference ).then((data) => { console.log(data); data.status == "success" && @@ -1173,7 +1181,9 @@ let MakeRepresentation = (props) => { dataObj, [{}], values.containerID, - props.ticketnumber + "/" + dataObj.repfile_name + props.props.currentView.caseReference.ticketnumber + + "/" + + dataObj.repfile_name ).then((data) => { return data; }); diff --git a/components/case/representation/representationAgent.js b/components/case/representation/representationAgent.js index b84619a4..46a43952 100644 --- a/components/case/representation/representationAgent.js +++ b/components/case/representation/representationAgent.js @@ -196,7 +196,8 @@ const RepAgent = (props) => { "myrepresentations:add-files-label" )} ticketnumber={ - props.props.ticketnumber + props.currentView.caseReference + .ticketnumber } hint={"sdsd"} fileList={ diff --git a/components/case/representation/representationAppellant.js b/components/case/representation/representationAppellant.js index a951c831..3b6950e7 100644 --- a/components/case/representation/representationAppellant.js +++ b/components/case/representation/representationAppellant.js @@ -188,7 +188,10 @@ const RepAppellant = (props) => { label={t( "myrepresentations:add-files-label" )} - ticketnumber={props.props.ticketnumber} + ticketnumber={ + props.currentView.caseReference + .ticketnumber + } hint={"sdsd"} fileList={ props.currentView.fileList diff --git a/components/case/representation/representationCapacitySelection.js b/components/case/representation/representationCapacitySelection.js index 25b5df15..31742d83 100644 --- a/components/case/representation/representationCapacitySelection.js +++ b/components/case/representation/representationCapacitySelection.js @@ -35,6 +35,9 @@ let RepCapacitySelection = (props) => { currentType={currentType} casesObj={casesObj} caseReference={props.props.caseReference} + ticketnumber={ + props.props.currentView.caseReference.ticketnumber + } searchResultsObj={props.props.searchResultsObj} myRepresentations={props.props.myRepresentations} props={props} diff --git a/components/case/representation/representationDetails.js b/components/case/representation/representationDetails.js index 0276a089..ade7b9d0 100644 --- a/components/case/representation/representationDetails.js +++ b/components/case/representation/representationDetails.js @@ -10,7 +10,7 @@ const RepDetails = (props) => { const { currentType, casesObj } = props; - let { caseReference } = props; + let { caseReference, ticketnumber } = props; let setCaseDetailsObj = router.query.hasOwnProperty("state") ? router.query.state == "edit" @@ -29,7 +29,7 @@ const RepDetails = (props) => { : caseReference; detailsObj = jsonpath({ - path: '$..[?(@ && @.pinswg_name=="' + caseReference + '")]', + path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]', json: setCaseDetailsObj, eval: true, }); diff --git a/components/case/representation/representationInterestedPartyPerson.js b/components/case/representation/representationInterestedPartyPerson.js index cf770d99..6d0b41ca 100644 --- a/components/case/representation/representationInterestedPartyPerson.js +++ b/components/case/representation/representationInterestedPartyPerson.js @@ -188,7 +188,8 @@ const RepInterestedPartyPerson = (props) => { "myrepresentations:add-files-label" )} ticketnumber={ - props.props.ticketnumber + props.currentView.caseReference + .ticketnumber } hint={"sdsd"} fileList={ diff --git a/components/case/representation/representationLPA.js b/components/case/representation/representationLPA.js index c540b0ce..b543b284 100644 --- a/components/case/representation/representationLPA.js +++ b/components/case/representation/representationLPA.js @@ -353,7 +353,7 @@ let RepLPA = (props) => { "myrepresentations:add-files-label" )} ticketnumber={ - props.props.ticketnumber + props.currentView.caseReference.ticketnumber } hint={"sdsd"} fileList={ diff --git a/components/case/representation/representationLandowner.js b/components/case/representation/representationLandowner.js index b6fe247b..90782bf6 100644 --- a/components/case/representation/representationLandowner.js +++ b/components/case/representation/representationLandowner.js @@ -84,7 +84,10 @@ const RepLandOwner = (props) => { label={t( "myrepresentations:add-files-label" )} - ticketnumber={props.props.ticketnumber} + ticketnumber={ + props.currentView.caseReference + .ticketnumber + } hint={"sdsd"} fileList={[]} setFilesForRepresentation={[]} diff --git a/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_enforcement.js b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_enforcement.js index c9c9e594..92437b28 100644 --- a/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_enforcement.js +++ b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_enforcement.js @@ -1213,7 +1213,10 @@ let Enforcement_Questionnaire = (props) => { name={"representationDocuments"} id={"representationDocuments"} label={t("myrepresentations:add-files-label")} - ticketnumber={props.props.props.ticketnumber} + ticketnumber={ + props.props.currentView.caseReference + .ticketnumber + } hint={"sdsd"} fileList={ props.currentView.fileList diff --git a/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js index e5c089bd..5c10936a 100644 --- a/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js +++ b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js @@ -1022,7 +1022,10 @@ let S78_Questionnaire = (props) => { name={"representationDocuments"} id={"representationDocuments"} label={t("myrepresentations:add-files-label")} - ticketnumber={props.props.props.ticketnumber} + ticketnumber={ + props.props.currentView.caseReference + .ticketnumber + } hint={"sdsd"} fileList={ props.currentView.fileList diff --git a/components/case/summary.js b/components/case/summary.js index 66c85cc2..24225170 100644 --- a/components/case/summary.js +++ b/components/case/summary.js @@ -177,13 +177,13 @@ const CaseSummary = (props) => { currentType == "searchResultsObj" ? (casesObj = jsonpath({ - path: '$..[?(@ && @.title=="' + caseReference + '")]', + path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]', json: searchResultsObj, eval: true, })) : currentType == "watchedCases" ? (casesObj = jsonpath({ - path: '$..[?(@ && @.pinswg_title=="' + caseReference + '")]', + path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]', json: setCaseQueryObj, eval: true, })) @@ -467,13 +467,13 @@ const CaseSummary = (props) => { case: currentType == "searchResultsObj" - ? detailsObj.pinswg_name + ? detailsObj.ticketnumber : currentType == "watchedCases" ? casesObj.pinswg_title : currentType == "directResultsObj" - ? casesObj.ticketnumber + ? detailsObj.ticketnumber : casesObj.reference, }, }} diff --git a/components/dnssearchresults.js b/components/dnssearchresults.js index c70dd317..15c8dcd0 100644 --- a/components/dnssearchresults.js +++ b/components/dnssearchresults.js @@ -4,8 +4,14 @@ import CRMError from "./crmError"; import DNSSearchResults from "./search/dnssearchresults"; export default function Search(props) { - const { searchString, searchResultsObj, myportal, watchedCases, showMap } = - props; + const { + searchString, + searchResultsObj, + myportal, + watchedCases, + showMap, + showLoginCheck, + } = props; let { t } = useTranslation(); const router = useRouter(); @@ -41,6 +47,7 @@ export default function Search(props) { myportal={myportal} watchedCases={watchedCases} showMap={showMap} + showLoginCheck={showLoginCheck} /> diff --git a/components/myportal/topthree.js b/components/myportal/topthree.js index 88443468..2617bb34 100644 --- a/components/myportal/topthree.js +++ b/components/myportal/topthree.js @@ -239,9 +239,8 @@ const TopThree = (props) => { : showTopThreeArr[key][ "_pinswg_case_value@OData.Community.Display.V1.FormattedValue" ] - : showTopThreeArr[key][ - "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" - ], + : showTopThreeArr[key] + .ticketnumber, "currentType": topThreeType, "incidentid": getIncidentId( @@ -255,7 +254,8 @@ const TopThree = (props) => { }); }} > - {topThreeType != "watchedCases" + {showTopThreeArr[key].pinswg_title} + {/* {topThreeType != "watchedCases" ? topThreeType != "myRepresentations" ? topThreeType == "mySubmittedReps" ? showTopThreeArr[key].pinswg_title @@ -265,7 +265,7 @@ const TopThree = (props) => { ] : showTopThreeArr[key][ "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" - ]}{" "} + ]}{" "} */} )} {topThreeType == "watchedCases" && !props.myReps && ( diff --git a/components/myportal/viewall.js b/components/myportal/viewall.js index 06686339..f671884c 100644 --- a/components/myportal/viewall.js +++ b/components/myportal/viewall.js @@ -36,6 +36,8 @@ import { setMyRepresentationsDetails, } from "../../store/myRepresentations/action"; +import RepsOnResults from "../search/repsonresults"; + const ViewAllResults = (props) => { const { searchString, @@ -268,10 +270,7 @@ const ViewAllResults = (props) => { ? currentView.viewKey == "myRepresentations" ? resultsArr[key].caseRef - : currentView.viewKey == - "mySubmittedReps" - ? resultsArr[key].pinswg_title - : resultsArr[key].ticketnumber + : resultsArr[key].pinswg_title : resultsArr[key][ "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" ]} @@ -284,6 +283,8 @@ const ViewAllResults = (props) => { )} + + )} diff --git a/components/search/addresssearchresults.js b/components/search/addresssearchresults.js index 51fb4479..86310831 100644 --- a/components/search/addresssearchresults.js +++ b/components/search/addresssearchresults.js @@ -247,8 +247,8 @@ const SearchResults = (props) => { resultsArrPaged.map((item, key) => { let detailsObj = jsonpath({ path: - '$..value[?(@ && @.pinswg_name=="' + - item.pinswg_name + + '$..value[?(@ && @.ticketnumber=="' + + item.ticketnumber + '")]', json: searchDetailsObj, diff --git a/components/search/dnssearchresults.js b/components/search/dnssearchresults.js index 6afce67f..8fabc38b 100644 --- a/components/search/dnssearchresults.js +++ b/components/search/dnssearchresults.js @@ -32,6 +32,8 @@ import { setWatchedCasesDetails, } from "../../store/watchedCases/action"; import { getDetailsProxy, getSearchDetailsPaged } from "../utils"; +import RepsOnResults from "./repsonresults"; +import { signIn, useSession } from "next-auth/react"; const DNSSearchResults = (props) => { const { @@ -49,11 +51,13 @@ const DNSSearchResults = (props) => { setWatchedCases, setWatchedCasesDetails, showMap, + showLoginCheck, } = props; let { t } = useTranslation(); const router = useRouter(); const { locale } = router; + const { data: session } = useSession(); var resultsArr = searchResultsObj.value || []; @@ -300,8 +304,8 @@ const DNSSearchResults = (props) => { resultsArr.map((item, key) => { let detailsObj = jsonpath({ path: - '$..value[?(@ && @.pinswg_name=="' + - item.title + + '$..value[?(@ && @.ticketnumber=="' + + item.ticketnumber + '")]', json: searchDetailsObj, eval: true, @@ -340,6 +344,8 @@ const DNSSearchResults = (props) => { "appealType": item.pinswg_appealcasetype, "showMap": showMap, + "showLoginCheck": + props.showLoginCheck, }); }} > @@ -557,6 +563,51 @@ const DNSSearchResults = (props) => { )} )} + + {(showLoginCheck == "true" || + showLoginCheck == true) && + !session && ( +
+ + {t( + "case:watch-this-case-link" + )} + + +
+ )} ); }) diff --git a/components/search/searchresults.js b/components/search/searchresults.js index 983cee61..2656f674 100644 --- a/components/search/searchresults.js +++ b/components/search/searchresults.js @@ -244,8 +244,8 @@ const SearchResults = (props) => { resultsArr.map((item, key) => { let detailsObj = jsonpath({ path: - '$..value[?(@ && @.pinswg_name=="' + - item.title + + '$..value[?(@ && @.ticketnumber=="' + + item.ticketnumber + '")]', json: searchDetailsObj, eval: true, diff --git a/components/utils/index.js b/components/utils/index.js index ba9b616c..eaef542b 100644 --- a/components/utils/index.js +++ b/components/utils/index.js @@ -34,6 +34,15 @@ export const getFormCollectionByID = (appealTypeID) => { return collectionName[0]; }; +export const getNavigationPropertyByPrimaryAttribute = (primaryAttribute) => { + const collectionName = jsonpath({ + path: "$..[?(@ && @.PrimaryIdAttribute =='" + primaryAttribute + "')]", + json: data, + eval: true, + }); + return collectionName[0]; +}; + export const getFormIDByLogicalName = (appealTypeLogicalName) => { const collectionName = jsonpath({ path: "$..[?(@ && @.LogicalName =='" + appealTypeLogicalName + "')]", diff --git a/i18n.js b/i18n.js index 6c2676b0..1e050b32 100644 --- a/i18n.js +++ b/i18n.js @@ -21,10 +21,10 @@ module.exports = { "/myportal/case": ["case"], "/myportal/case/[ticketnumber]": ["case"], "/myportal/dnsapplications": [ - "case", "search", "dnsCommon", "dnsApplications", + "case", ], "/myportal/dnsdetails": [ "case", @@ -64,7 +64,7 @@ module.exports = { "/dns": ["dnsCommon", "dnsHome"], "/dns/applications": ["dnsCommon", "dnsApplications"], "/dns/application-view": ["dnsCommon", "dnsApplicationView"], - "/dnsapplications": ["case", "search", "dnsCommon", "dnsApplications"], + "/dnsapplications": ["search", "dnsCommon", "dnsApplications", "case"], "/dnsdetails": ["case", "search", "dnsCommon", "dnsApplications"], "/help/cookies": ["common", "cookies"], "/account/register": ["common", "account"], diff --git a/pages/api/endpoint/getbasicsearchdetails_api.js b/pages/api/endpoint/getbasicsearchdetails_api.js index 83574a81..f33aeb65 100644 --- a/pages/api/endpoint/getbasicsearchdetails_api.js +++ b/pages/api/endpoint/getbasicsearchdetails_api.js @@ -33,7 +33,7 @@ import axios from "axios"; import CryptoJS from "crypto-js"; import { azureHeaders, consoleLogger, getToken } from "../../../actions"; import { getSelectQuery } from "../../../actions/selectQueryTypes"; - +import { getNavigationPropertyByPrimaryAttribute } from "../../../components/utils"; const WORDKEY = process.env.HASHKEY; const WEBAPI_URL = @@ -55,13 +55,22 @@ export default async function ApiProxy(req, res) { var incidentID = req.query.incidentID; var token = await getToken(); + let navigationProperty = + getNavigationPropertyByPrimaryAttribute( + primaryIdAttribute + ).NavigationProperty; + var queryUrl = appealTypeName + "?$filter=_" + primaryIdAttribute + "s_value eq " + incidentID + - "&$count=true"; + "&$count=true" + + "&$expand=" + + navigationProperty + + "($select=ticketnumber)"; + //" and statuscode eq 1&$count=true"; queryUrl = queryUrl + getSelectQuery(appealTypeName); @@ -81,6 +90,13 @@ export default async function ApiProxy(req, res) { azureHeaders(token.access_token) ) .then(({ data }) => { + let flattened = data.value.map((r) => ({ + ...r, + ticketnumber: r[navigationProperty]?.ticketnumber || null, + })); + + data.value = flattened; + res.status(200).json(data); }) .catch((error) => { diff --git a/pages/api/endpoint/getbasicsearchdetailspaged_api.js b/pages/api/endpoint/getbasicsearchdetailspaged_api.js index 544d42fb..b2acaa78 100644 --- a/pages/api/endpoint/getbasicsearchdetailspaged_api.js +++ b/pages/api/endpoint/getbasicsearchdetailspaged_api.js @@ -34,7 +34,7 @@ import CryptoJS from "crypto-js"; import _ from "lodash"; import { azureHeadersPaged, consoleLogger, getToken } from "../../../actions"; import { getSelectQuery } from "../../../actions/selectQueryTypes"; - +import { getNavigationPropertyByPrimaryAttribute } from "../../../components/utils"; const WORDKEY = process.env.HASHKEY; const WEBAPI_URL = @@ -59,13 +59,22 @@ export default async function ApiProxy(req, res) { var incidentID = req.query.incidentID; var token = await getToken(); + let navigationProperty = + getNavigationPropertyByPrimaryAttribute( + primaryIdAttribute + ).NavigationProperty; + var queryUrl = appealTypeName + "?$filter=_" + primaryIdAttribute + "s_value eq " + incidentID + - "&$count=true"; + "&$count=true" + + "&$expand=" + + navigationProperty + + "($select=ticketnumber)"; + //" and statuscode eq 1&$count=true"; queryUrl = queryUrl + getSelectQuery(appealTypeName); @@ -78,10 +87,18 @@ export default async function ApiProxy(req, res) { azureHeadersPaged(token.access_token) ) .then(({ data }) => { + let flattened = data.value.map((r) => ({ + ...r, + ticketnumber: r[navigationProperty]?.ticketnumber || null, + })); + + data.value = flattened; + var dataStr; _.has(data, "@odata.nextLink") == true && ((dataStr = JSON.stringify(data["@odata.nextLink"])), (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); + return res.status(200).json(data); }) .catch((error) => { diff --git a/pages/dns/[developmentName].js b/pages/dns/[developmentName].js index bc5cd698..fcf1fb82 100644 --- a/pages/dns/[developmentName].js +++ b/pages/dns/[developmentName].js @@ -79,6 +79,10 @@ const CaseHome = (props) => { props.awaitingSubmission.awaitingSubmission } caseReference={ + props.searchResultsObj.searchResultsObj.value[0] + .caseReference + } + ticketnumber={ props.searchResultsObj.searchResultsObj.value[0] .ticketnumber } diff --git a/pages/dnsapplications.js b/pages/dnsapplications.js index b3315c4e..eb859939 100644 --- a/pages/dnsapplications.js +++ b/pages/dnsapplications.js @@ -20,7 +20,7 @@ import { wrapper } from "../store/store"; import ServiceBanner from "../components/servicebanner"; const Home = (props) => { - const { footerLinks, pages, showMap } = props; + const { footerLinks, pages, showMap, showLoginCheck } = props; let { t, lang } = useTranslation(); const router = useRouter(); @@ -105,6 +105,7 @@ const Home = (props) => { showMap={showMap} searchString="DNS" searchResultsObj={props.searchResultsObj} + showLoginCheck={showLoginCheck} />