Merged PR 490: logic to let child cases be shown in case details
logic to let child cases be shown in case details Related work items: #6270
This commit is contained in:
+24
-10
@@ -143,7 +143,7 @@ export const getBasicSearch = (token, searchString) => {
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
"incidents?$select=_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=contains(title, '" +
|
||||
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=contains(title, '" +
|
||||
searchString +
|
||||
"') and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true&$top=201",
|
||||
azureHeaders(token)
|
||||
@@ -166,7 +166,7 @@ export const getBasicDNSSearch = (token, searchString) => {
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
"incidents?$select=_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype eq 846040011 and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true",
|
||||
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype eq 846040011 and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true",
|
||||
azureHeaders(token)
|
||||
)
|
||||
.then((res) => res.data)
|
||||
@@ -204,7 +204,7 @@ export const getAdvancedSearch = (token, searchString) => {
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
"incidents?$select=_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=" +
|
||||
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=" +
|
||||
queryString +
|
||||
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true&$top=201",
|
||||
|
||||
@@ -269,13 +269,8 @@ export const getSearchDocumentHistory = (token, documentID) => {
|
||||
};
|
||||
|
||||
export const getSearchDocumentDetails1 = (incidentID) => {
|
||||
console.log(incidentID);
|
||||
//console.log(incidentID);
|
||||
var token = getSASToken();
|
||||
console.log(
|
||||
"/api/proxy/pinswg_documents?$count=true&$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " +
|
||||
incidentID +
|
||||
"&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference"
|
||||
);
|
||||
return axios
|
||||
.get(
|
||||
"/api/proxy/pinswg_documents?$count=true&$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " +
|
||||
@@ -289,7 +284,7 @@ export const getSearchDocumentDetails1 = (incidentID) => {
|
||||
};
|
||||
|
||||
export const getSearchDocumentHistory1 = (documentID) => {
|
||||
console.log(documentID);
|
||||
// console.log(documentID);
|
||||
var token = getSASToken();
|
||||
return axios
|
||||
.get(
|
||||
@@ -318,6 +313,25 @@ export const getBasicDNSSearchDetails = (token, appealType, caseReference) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const getLinkedCases = (parentIncidentid) => {
|
||||
console.log(parentIncidentid);
|
||||
var token = getSASToken();
|
||||
|
||||
return axios
|
||||
.get(
|
||||
"/api/proxy/incidents?$count=true&$filter=_parentcaseid_value eq " +
|
||||
parentIncidentid +
|
||||
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true &$select=title, incidentid,"
|
||||
)
|
||||
.then((res) => {
|
||||
console.log(" linked date", res.data);
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("thiserror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getFormData = (token, whichForm) => {
|
||||
//console.log("got to axios", whichForm);
|
||||
//console.log("api_root: ", BASE_URL);
|
||||
|
||||
@@ -30,6 +30,7 @@ const CaseSummary = (props) => {
|
||||
searchResultsObj={props.searchResultsObj}
|
||||
searchDetailsObj={props.searchDetailsObj}
|
||||
searchString={props.searchString}
|
||||
incidentid={props.incidentid}
|
||||
/>
|
||||
<Documents
|
||||
incidentid={props.incidentid}
|
||||
|
||||
@@ -42,7 +42,7 @@ const DocumentDetails = (props) => {
|
||||
var documentDetailsArr = documentDetailsObj || [];
|
||||
|
||||
const DocumentView = (documentDetailsArr) => {
|
||||
console.log(documentDetailsArr);
|
||||
//console.log(documentDetailsArr);
|
||||
|
||||
documentDetailsArr = documentDetailsArr.value;
|
||||
|
||||
@@ -173,7 +173,7 @@ const DocumentDetails = (props) => {
|
||||
const docDetailsObj = async () => {
|
||||
let docObj = await getSearchDocumentDetails1(incidentid)
|
||||
.then((data) => {
|
||||
console.log(data);
|
||||
//console.log(data);
|
||||
setDocumentDetails(data);
|
||||
return data;
|
||||
})
|
||||
|
||||
+112
-18
@@ -1,18 +1,26 @@
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import { useState } from "react";
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import jsonpath from "jsonpath";
|
||||
import _ from "lodash";
|
||||
import transLookup from "../../data/lookuptranslations.json";
|
||||
import LoadingOverlay from "react-loading-overlay";
|
||||
|
||||
import { getLinkedCases } from "../../actions";
|
||||
import {
|
||||
setCurrentLinkedCases,
|
||||
setCurrentReference,
|
||||
} from "../../store/currentView/action";
|
||||
|
||||
const CaseSummary = (props) => {
|
||||
let { t } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
const {
|
||||
incidentid,
|
||||
caseReference,
|
||||
myCases,
|
||||
myRepresentations,
|
||||
@@ -21,6 +29,9 @@ const CaseSummary = (props) => {
|
||||
searchResultsObj,
|
||||
searchDetailsObj,
|
||||
currentType,
|
||||
setCurrentLinkedCases,
|
||||
linkedCasesReference,
|
||||
setCurrentReference,
|
||||
} = props;
|
||||
|
||||
const noRepresentationLink = ["/case", "/dnsdetails"];
|
||||
@@ -322,28 +333,39 @@ const CaseSummary = (props) => {
|
||||
)}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{_.has(detailsObj, [
|
||||
"pinswg_linkedstatus@OData.Community.Display.V1.FormattedValue",
|
||||
{_.has(casesObj, [
|
||||
"numberofchildincidents",
|
||||
])
|
||||
? detailsObj[
|
||||
"pinswg_linkedstatus@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
? casesObj.numberofchildincidents >
|
||||
0
|
||||
? t(
|
||||
"case:summary-case-link-status-linked"
|
||||
)
|
||||
: t(
|
||||
"case:summary-case-link-status-not-linked"
|
||||
)
|
||||
: t(
|
||||
"case:summary-case-link-status-not-linked"
|
||||
)}
|
||||
</dd>
|
||||
</div>
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
{t(
|
||||
"case:summary-linked-cases-label"
|
||||
)}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{/* {casesObj.caseDetails.linkedCases ||
|
||||
""} */}
|
||||
</dd>
|
||||
</div>
|
||||
{casesObj.numberofchildincidents > 0 ? (
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
{t(
|
||||
"case:summary-linked-cases-label"
|
||||
)}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{linkedCasesList(
|
||||
props.currentView
|
||||
.linkedCaseReferences
|
||||
)}
|
||||
</dd>
|
||||
</div>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
@@ -582,6 +604,20 @@ const CaseSummary = (props) => {
|
||||
</>
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const linkCaseObj = async () => {
|
||||
let docObj = await getLinkedCases(incidentid).then((data) => {
|
||||
console.log(data);
|
||||
setCurrentLinkedCases(data);
|
||||
return data;
|
||||
});
|
||||
|
||||
return linkCaseObj;
|
||||
};
|
||||
|
||||
const linkedCases = linkCaseObj();
|
||||
}, [incidentid, setCurrentLinkedCases]);
|
||||
|
||||
const [showSpinnerState, setShowSpinnerState] = useState(false);
|
||||
|
||||
let spinnerState = () => {
|
||||
@@ -599,6 +635,47 @@ const CaseSummary = (props) => {
|
||||
return dd + "/" + mm + "/" + yyyy;
|
||||
}
|
||||
|
||||
function linkedCasesList(linkedCasesReference) {
|
||||
console.log(linkedCasesReference);
|
||||
|
||||
linkedCasesReference = linkedCasesReference.value || [];
|
||||
|
||||
return (
|
||||
<>
|
||||
<ul className="govuk-list govuk-!-font-size-14">
|
||||
{linkedCasesReference.map((item, key) => {
|
||||
return (
|
||||
<li key={key}>
|
||||
<Link
|
||||
href={
|
||||
router.locale == "cy"
|
||||
? "/achos"
|
||||
: "/case"
|
||||
}
|
||||
>
|
||||
<a
|
||||
onClick={() => {
|
||||
setCurrentReference({
|
||||
"currentReference": item.title,
|
||||
"currentType":
|
||||
"searchResultsObj",
|
||||
"incidentid": item.incidentid,
|
||||
});
|
||||
}}
|
||||
className=""
|
||||
>
|
||||
{item.title}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
);
|
||||
// console.log(item.incidentid, item.title);
|
||||
})}
|
||||
</ul>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{showDetailsBlock}
|
||||
@@ -611,4 +688,21 @@ const CaseSummary = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default CaseSummary;
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
...state,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
setCurrentLinkedCases: (parentIncidentid) => {
|
||||
dispatch(setCurrentLinkedCases(parentIncidentid));
|
||||
},
|
||||
setCurrentReference: (currentReference) => {
|
||||
dispatch(setCurrentReference(currentReference));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(CaseSummary);
|
||||
|
||||
@@ -15,7 +15,7 @@ const CRMError = (props) => {
|
||||
? "LPAData"
|
||||
: "searchResultsObj";
|
||||
|
||||
console.log(errorSwitch);
|
||||
//console.log(errorSwitch);
|
||||
|
||||
return (
|
||||
<div className="govuk-grid-row">
|
||||
|
||||
@@ -17,7 +17,7 @@ export default function Search(props) {
|
||||
? true
|
||||
: false;
|
||||
|
||||
console.log("has an error", hasError);
|
||||
//console.log("has an error", hasError);
|
||||
|
||||
return (
|
||||
<main
|
||||
|
||||
@@ -243,7 +243,7 @@ let AdvancedSearch = (props) => {
|
||||
event.preventDefault();
|
||||
spinnerState();
|
||||
|
||||
console.log(values);
|
||||
//console.log(values);
|
||||
// var appTypeCollection = values.appealTypes.split(",")[1];
|
||||
|
||||
// appTypeCollection = getFormCollection(
|
||||
|
||||
@@ -17,7 +17,7 @@ export default function Search(props) {
|
||||
? true
|
||||
: false;
|
||||
|
||||
console.log("has an error", hasError);
|
||||
//console.log("has an error", hasError);
|
||||
|
||||
return (
|
||||
<main
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"summary-decision-label": "Penderfyniad a chanlyniad",
|
||||
"summary-case-link-status-label": "Statws cysylltiad yr Achos",
|
||||
"summary-case-link-status-not-linked": "Heb ei Gysylltu",
|
||||
"summary-case-link-status-linked": "Cysylltiedig",
|
||||
"summary-linked-cases-label": "Achosion cysylltiedig",
|
||||
"summary-dates-label": "Dyddiadau",
|
||||
"summary-no-date-entered-label": "dim dyddiad wedi'i nodi",
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"summary-decision-label": "Decision and Outcome",
|
||||
"summary-case-link-status-label": "Case Link Status",
|
||||
"summary-case-link-status-not-linked": "Not linked",
|
||||
"summary-case-link-status-linked": "Linked",
|
||||
"summary-linked-cases-label": "Linked Cases",
|
||||
"summary-dates-label": "Dates",
|
||||
"summary-no-date-entered-label": "no date entered",
|
||||
|
||||
+11
-6
@@ -33,6 +33,7 @@ import {
|
||||
setAwaitingSubmissionDetails,
|
||||
} from "../../store/awaitingSubmission/action";
|
||||
import {
|
||||
getSASToken,
|
||||
getMyCases,
|
||||
getMyRepresentations,
|
||||
getWatchedCases,
|
||||
@@ -85,16 +86,19 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
//console.log("the query", query);
|
||||
|
||||
const token = await getSASToken();
|
||||
|
||||
const [
|
||||
myCases,
|
||||
myRepresentations,
|
||||
watchedCases,
|
||||
awaitingSubmission,
|
||||
] = await Promise.all([
|
||||
await getMyCases("f8b454ed-eded-eb11-aac7-00224800be9c"),
|
||||
await getMyRepresentations(),
|
||||
await getWatchedCases(),
|
||||
await getAwaitingSubmission(),
|
||||
await getMyCases(token, "f8b454ed-eded-eb11-aac7-00224800be9c"),
|
||||
await getMyRepresentations(token),
|
||||
await getWatchedCases(token),
|
||||
await getAwaitingSubmission(token),
|
||||
]);
|
||||
|
||||
const cookies = new Cookies(req, res);
|
||||
@@ -109,7 +113,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
// watchedCasesDetails,
|
||||
// awaitingSubmissionDetails,
|
||||
] = await Promise.all([
|
||||
await getDetails(myCases),
|
||||
await getDetails(token, myCases),
|
||||
// await getDetails(myRepresentations),
|
||||
// await getDetails(watchedCases),
|
||||
// await getDetails(awaitingSubmission),
|
||||
@@ -142,7 +146,7 @@ const getFormCollection = (formtype) => {
|
||||
return collectionName[0];
|
||||
};
|
||||
|
||||
const getDetails = (resultsObj) => {
|
||||
const getDetails = (token, resultsObj) => {
|
||||
//console.log(resultsObj);
|
||||
let detailsArr = [];
|
||||
resultsObj = resultsObj.value;
|
||||
@@ -152,6 +156,7 @@ const getDetails = (resultsObj) => {
|
||||
} else {
|
||||
detailsArr.push(
|
||||
getPortalModuelDetails(
|
||||
token,
|
||||
getFormCollection(
|
||||
"pinswg_" +
|
||||
searchDetail[
|
||||
|
||||
@@ -5,6 +5,7 @@ export const currentViewActionTypes = {
|
||||
SETREPRESENTATIONCAPACITY: "SETREPRESENTATIONCAPACITY",
|
||||
SETREPRESENTATIONSUBMIT: "SETREPRESENTATIONSUBMIT",
|
||||
SETREPRESENTATIONSUBMITCONFIRMATION: "SETREPRESENTATIONSUBMITCONFIRMATION",
|
||||
SETCURRENTLINKEDCASES: "SETCURRENTLINKEDCASES",
|
||||
};
|
||||
|
||||
export const getCurrentViewObj = () => (dispatch) => {
|
||||
@@ -56,3 +57,10 @@ export const setRepresentationSubmitConfirmation =
|
||||
representationSubmitConfirmation: representationSubmitConfirmation,
|
||||
});
|
||||
};
|
||||
|
||||
export const setCurrentLinkedCases = (linkedCaseReferences) => (dispatch) => {
|
||||
return dispatch({
|
||||
type: currentViewActionTypes.SETCURRENTLINKEDCASES,
|
||||
linkedCaseReferences: linkedCaseReferences,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -6,6 +6,7 @@ const currentViewInitialState = {
|
||||
representationCapacity: {},
|
||||
representationSubmit: null,
|
||||
representationSubmitConfirmation: {},
|
||||
linkedCaseReferences: {},
|
||||
};
|
||||
|
||||
export default function reducer(state = currentViewInitialState, action) {
|
||||
@@ -20,6 +21,12 @@ export default function reducer(state = currentViewInitialState, action) {
|
||||
...state,
|
||||
caseReference: action.caseReference,
|
||||
};
|
||||
|
||||
case currentViewActionTypes.SETCURRENTLINKEDCASES:
|
||||
return {
|
||||
...state,
|
||||
linkedCaseReferences: action.linkedCaseReferences,
|
||||
};
|
||||
case currentViewActionTypes.SETREPRESENTATIONCAPACITY:
|
||||
return {
|
||||
...state,
|
||||
|
||||
Reference in New Issue
Block a user