Merged PR 767: Added service stage status and delete functions
Added service stage status and delete functions Related work items: #7319
This commit is contained in:
+58
-6
@@ -464,7 +464,7 @@ export const createCase = (appealTypeId, lpaID, contactid) => {
|
||||
contactid;
|
||||
|
||||
var config = {
|
||||
method: "post",
|
||||
method: "get",
|
||||
url: BASE_URL + queryUrl,
|
||||
};
|
||||
|
||||
@@ -566,17 +566,34 @@ export const getWatchedCasesProxy = (loggedInUserId) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const getAwaitingSubmission = () => {
|
||||
export const getAwaitingSubmissionProxy = (loggedInUserId) => {
|
||||
return axios
|
||||
.get(BASE_URL + "/api/lookups/awaitingSubmission", {
|
||||
httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||
})
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getawaitingsubmissionproxy_api?loggedInUserId=" +
|
||||
loggedInUserId
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getAwaitingSubmission = (loggedInUserId) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getawaitingsubmission_api?loggedInUserId=" +
|
||||
loggedInUserId
|
||||
)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPortalModuleDetails = (appealType, caseReference) => {
|
||||
return axios
|
||||
.get(
|
||||
@@ -699,7 +716,7 @@ export const updateCase = async (
|
||||
|
||||
var config = {
|
||||
method: "post",
|
||||
url: queryUrl + hashAPIPath(queryUrl),
|
||||
url: queryUrl,
|
||||
data: data,
|
||||
};
|
||||
|
||||
@@ -712,6 +729,22 @@ export const updateCase = async (
|
||||
});
|
||||
};
|
||||
|
||||
export const patchCase = async (incidentid) => {
|
||||
var queryUrl = "/api/endpoint/patchcase_api?incidentid=" + incidentid;
|
||||
var config = {
|
||||
method: "get",
|
||||
url: queryUrl,
|
||||
};
|
||||
|
||||
return axios(config)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("this error:", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteMyRepresentations = (myRepresentationsID) => {
|
||||
var queryUrl =
|
||||
"/api/endpoint/deletemyrepresentations_api?myRepresentationsID=" +
|
||||
@@ -739,6 +772,25 @@ export const deleteMyRepresentations = (myRepresentationsID) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteAwaitingSubmissions = (incidentID) => {
|
||||
var queryUrl =
|
||||
"/api/endpoint/deleteawaitingsubmissions_api?incidentID=" + incidentID;
|
||||
|
||||
var config = {
|
||||
method: "delete",
|
||||
url: queryUrl,
|
||||
};
|
||||
// console.log(config);
|
||||
return axios(config)
|
||||
.then((res) => {
|
||||
//console.log("deleted ", res.data);
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("this serror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteWatchedCases = (watchedCaseID) => {
|
||||
var queryUrl =
|
||||
"/api/endpoint/deletewatchedcases_api?watchedCaseID=" + watchedCaseID;
|
||||
|
||||
@@ -75,6 +75,16 @@ const CaseSummary = (props) => {
|
||||
searchResultsObj,
|
||||
'$..[?(@.title=="' + caseReference + '")]'
|
||||
))
|
||||
: currentType == "watchedCases"
|
||||
? (casesObj = jsonpath.query(
|
||||
setCaseQueryObj,
|
||||
'$..[?(@.pinswg_title=="' + caseReference + '")]'
|
||||
))
|
||||
: currentType == "myCases"
|
||||
? (casesObj = jsonpath.query(
|
||||
setCaseQueryObj,
|
||||
'$..[?(@.pinswg_title=="' + caseReference + '")]'
|
||||
))
|
||||
: (casesObj = jsonpath.query(
|
||||
setCaseQueryObj,
|
||||
'$..[?(@.reference=="' + caseReference + '")]'
|
||||
@@ -232,7 +242,6 @@ const CaseSummary = (props) => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{showSummary(casesObj, detailsObj)}
|
||||
</div>
|
||||
) : (
|
||||
|
||||
@@ -201,10 +201,14 @@ const Pinswg_miscellaneouscasewordid = (props) => {
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
'$..[?(@.value=="' +
|
||||
detailsObj.pinswg_relevantauthorityname +
|
||||
detailsObj[
|
||||
"pinswg_relevantauthorityname@OData.Community.Display.V1.FormattedValue"
|
||||
] +
|
||||
'")].value_cy'
|
||||
)
|
||||
: detailsObj.pinswg_relevantauthorityname ||
|
||||
: detailsObj[
|
||||
"pinswg_relevantauthorityname@OData.Community.Display.V1.FormattedValue"
|
||||
] ||
|
||||
t(
|
||||
"case:summary-no-date-entered-label"
|
||||
)}
|
||||
|
||||
@@ -20,11 +20,7 @@ export default function MakeNewAppeal() {
|
||||
{t("myportal:makenewappeal-card-paragraph-two")}
|
||||
</p>
|
||||
<div>
|
||||
<Link
|
||||
href={
|
||||
router.locale == "cy" ? "/apelnewydd" : "/newappeal"
|
||||
}
|
||||
>
|
||||
<Link href={"/newappeal"}>
|
||||
<a className="govuk-button">
|
||||
{t("myportal:makenewappeal-card-button-label")}
|
||||
</a>
|
||||
|
||||
@@ -9,12 +9,18 @@ import {
|
||||
getWatchedCasesProxy,
|
||||
getPortalModuleDetailsProxy,
|
||||
deleteWatchedCases,
|
||||
deleteAwaitingSubmissions,
|
||||
getAwaitingSubmissionProxy,
|
||||
} from "../../actions";
|
||||
|
||||
import {
|
||||
setWatchedCases,
|
||||
setWatchedCasesDetails,
|
||||
} from "../../store/watchedCases/action";
|
||||
import {
|
||||
setAwaitingSubmission,
|
||||
setAwaitingSubmissionDetails,
|
||||
} from "../../store/awaitingSubmission/action";
|
||||
import { getFormCollectionByID } from "../../components/utils";
|
||||
|
||||
const TopThree = (props) => {
|
||||
@@ -26,6 +32,8 @@ const TopThree = (props) => {
|
||||
topThreeType,
|
||||
setWatchedCases,
|
||||
setWatchedCasesDetails,
|
||||
setAwaitingSubmission,
|
||||
setAwaitingSubmissionDetails,
|
||||
} = props;
|
||||
|
||||
const router = useRouter();
|
||||
@@ -37,6 +45,7 @@ const TopThree = (props) => {
|
||||
|
||||
const deleteItem = (caseID, topThreeType) => {
|
||||
let cookies = parseCookies();
|
||||
//console.log("sssss", caseID, topThreeType);
|
||||
topThreeType == "watchedCases" &&
|
||||
deleteWatchedCases(caseID)
|
||||
.then((data) => data)
|
||||
@@ -48,6 +57,32 @@ const TopThree = (props) => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
topThreeType == "awaitingSubmission" &&
|
||||
deleteAwaitingSubmissions(caseID)
|
||||
.then((data) => {
|
||||
console.log("zzzzz");
|
||||
|
||||
return data;
|
||||
})
|
||||
.then(() => {
|
||||
console.log("qqqqqq");
|
||||
getAwaitingSubmissionProxy(cookies.pinsUser).then(
|
||||
(data) => {
|
||||
console.log("assss", data);
|
||||
setAwaitingSubmission(data),
|
||||
getDetails(data, "awaitingSubmission").then(
|
||||
(data) => {
|
||||
console.log(
|
||||
"submission get details:",
|
||||
data
|
||||
);
|
||||
setAwaitingSubmissionDetails(data);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
const getDetails = (resultsObj, detailsType) => {
|
||||
@@ -94,6 +129,7 @@ const TopThree = (props) => {
|
||||
return objArr.ticketnumber;
|
||||
break;
|
||||
case "awaitingSubmission":
|
||||
return objArr.ticketnumber;
|
||||
break;
|
||||
default:
|
||||
// code block
|
||||
@@ -183,14 +219,12 @@ const TopThree = (props) => {
|
||||
|
||||
{topThreeType == "awaitingSubmission" ? (
|
||||
<div className="carModuleAddress">
|
||||
Make Representation on Case Incomplete, not
|
||||
submitted
|
||||
Case Incomplete, not submitted
|
||||
</div>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</div>
|
||||
|
||||
{topThreeType == "watchedCases" && (
|
||||
<div className="">
|
||||
<a
|
||||
@@ -214,6 +248,27 @@ const TopThree = (props) => {
|
||||
</a>
|
||||
</div>
|
||||
)}
|
||||
{topThreeType == "awaitingSubmission" && (
|
||||
<div className="">
|
||||
<a
|
||||
href="#"
|
||||
className=" cardModuleRemoveCase govuk-link govuk-link--no-underline govuk-link--inverse "
|
||||
onClick={() => {
|
||||
event.preventDefault();
|
||||
deleteItem(
|
||||
showTopThreeArr[key].incidentid,
|
||||
"awaitingSubmission"
|
||||
);
|
||||
alert(
|
||||
"You have deleted case " +
|
||||
showTopThreeArr[key].ticketnumber
|
||||
);
|
||||
}}
|
||||
>
|
||||
—
|
||||
</a>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
});
|
||||
@@ -255,6 +310,12 @@ const mapDispatchToProps = (dispatch) => {
|
||||
setWatchedCasesDetails: (watchedCasesDetails) => {
|
||||
dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
||||
},
|
||||
setAwaitingSubmission: (awaitingSubmission) => {
|
||||
dispatch(setAwaitingSubmission(awaitingSubmission));
|
||||
},
|
||||
setAwaitingSubmissionDetails: (awaitingSubmissionDetails) => {
|
||||
dispatch(setAwaitingSubmissionDetails(awaitingSubmissionDetails));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
+110
-34
@@ -3,6 +3,8 @@ 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 transLookup from "../../data/lookuptranslations.json";
|
||||
|
||||
const ViewAllResults = (props) => {
|
||||
const {
|
||||
@@ -21,8 +23,16 @@ const ViewAllResults = (props) => {
|
||||
var resultsArr = props[currentView.viewKey][currentView.viewKey].value || [
|
||||
{},
|
||||
];
|
||||
var searchDetailsObj =
|
||||
props[currentView.viewKey][currentView.viewKey + "Details"] || {};
|
||||
let resultsRowArr = [];
|
||||
Object.keys(resultsArr).map((key, index) => {
|
||||
resultsArr.map((item, key) => {
|
||||
let detailsObj = jsonpath.query(
|
||||
searchDetailsObj,
|
||||
"$..value[?(@.pinswg_name=='" + item.pinswg_title + "')]"
|
||||
);
|
||||
detailsObj = detailsObj[0];
|
||||
|
||||
resultsRowArr.push(
|
||||
<div className="govuk-summary-list__row" key={key}>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 govuk-!-padding-left-2">
|
||||
@@ -42,21 +52,21 @@ const ViewAllResults = (props) => {
|
||||
setCurrentReference({
|
||||
"currentReference":
|
||||
currentView.viewKey != "watchedCases"
|
||||
? resultsArr[index].ticketnumber
|
||||
: resultsArr[index][
|
||||
? resultsArr[key].ticketnumber
|
||||
: resultsArr[key][
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
],
|
||||
|
||||
"currentType": currentView.viewKey,
|
||||
"incidentid":
|
||||
currentView.viewKey != "watchedCases"
|
||||
? resultsArr[index].incidentid
|
||||
: resultsArr[index][
|
||||
" _pinswg_watchedcase_value"
|
||||
? resultsArr[key].incidentid
|
||||
: resultsArr[key][
|
||||
"_pinswg_watchedcase_value"
|
||||
],
|
||||
|
||||
"appealType":
|
||||
resultsArr[index].pinswg_appealcasetype,
|
||||
resultsArr[key].pinswg_appealcasetype,
|
||||
});
|
||||
}}
|
||||
>
|
||||
@@ -65,8 +75,8 @@ const ViewAllResults = (props) => {
|
||||
</span>
|
||||
|
||||
{currentView.viewKey != "watchedCases"
|
||||
? resultsArr[index].ticketnumber
|
||||
: resultsArr[index][
|
||||
? resultsArr[key].ticketnumber
|
||||
: resultsArr[key][
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
]}
|
||||
</a>
|
||||
@@ -74,42 +84,108 @@ const ViewAllResults = (props) => {
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
Site Address:{" "}
|
||||
{t("search:searchresults-site-address-label")}:
|
||||
</span>
|
||||
{resultsArr[index].address1}
|
||||
<br /> {resultsArr[index].town}
|
||||
<br />
|
||||
{resultsArr[index].postcode}
|
||||
{_.has(detailsObj, "pinswg_siteaddressline1")
|
||||
? detailsObj.pinswg_siteaddressline1
|
||||
: ""}
|
||||
|
||||
{/* {detailsObj.pinswg_siteaddressline1 !=
|
||||
null && <br />} */}
|
||||
|
||||
{_.has(detailsObj, "pinswg_siteaddressline1") &&
|
||||
detailsObj.pinswg_siteaddressline1 != null && <br />}
|
||||
|
||||
{_.has(detailsObj, "pinswg_siteaddressline1")
|
||||
? detailsObj.pinswg_siteaddressline2
|
||||
: ""}
|
||||
|
||||
{_.has(detailsObj, "pinswg_siteaddressline2") &&
|
||||
detailsObj.pinswg_siteaddressline2 != null && <br />}
|
||||
{_.has(detailsObj, "pinswg_siteaddresstown")
|
||||
? detailsObj.pinswg_siteaddresstown
|
||||
: ""}
|
||||
{_.has(detailsObj, "pinswg_siteaddresstown") &&
|
||||
detailsObj.pinswg_siteaddresstown != null && <br />}
|
||||
|
||||
{_.has(detailsObj, "pinswg_siteaddresscounty")
|
||||
? detailsObj.pinswg_siteaddresscounty
|
||||
: ""}
|
||||
{_.has(detailsObj, "pinswg_siteaddresscounty") &&
|
||||
detailsObj.pinswg_siteaddresscounty != null && <br />}
|
||||
{_.has(detailsObj, "pinswg_siteaddresspostcode")
|
||||
? detailsObj.pinswg_siteaddresspostcode
|
||||
: ""}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
Appellant/Applicant:
|
||||
{t("search:searchresults-applicant-label")}:
|
||||
</span>
|
||||
Mr smith
|
||||
|
||||
{_.has(detailsObj, [
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue",
|
||||
])
|
||||
? detailsObj[
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: resultsArr[key][
|
||||
"_customerid_value@OData.Community.Display.V1.FormattedValue"
|
||||
]}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">Authority:</span>
|
||||
{
|
||||
resultsArr[index][
|
||||
"_customerid_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
}
|
||||
<span className="results-visually-hidden">
|
||||
{t("search:searchresults-authority-label")}:
|
||||
</span>
|
||||
{_.has(detailsObj, [
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue",
|
||||
])
|
||||
? router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
'$..[?(@.value=="' +
|
||||
item[
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
] +
|
||||
'")].value_cy'
|
||||
)
|
||||
: detailsObj[
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
] || "N/A"
|
||||
: ""}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">Case Type:</span>
|
||||
{
|
||||
resultsArr[index][
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
}
|
||||
<span className="results-visually-hidden">
|
||||
{t("search:searchresults-case-type-label")}:
|
||||
</span>
|
||||
{router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
'$..[?(@.value=="' +
|
||||
item[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
] +
|
||||
'")].value_cy'
|
||||
)
|
||||
: item[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
] || "N/A"}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">Status:</span>
|
||||
{
|
||||
resultsArr[index][
|
||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
}
|
||||
<span className="results-visually-hidden">
|
||||
{t("search:searchresults-status-label")}:
|
||||
</span>
|
||||
{router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
'$..[?(@.value=="' +
|
||||
item[
|
||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
] +
|
||||
'")].value_cy'
|
||||
)
|
||||
: item[
|
||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
] || "N/A"}
|
||||
</dd>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -6,6 +6,10 @@ import jsonpath from "jsonpath";
|
||||
import BuildCheckField from "./buildCheckfield";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import fieldLookup from "../../data/crmfieldlookuptranslations.json";
|
||||
import {
|
||||
getFormCollectionByID,
|
||||
getPickListLabel,
|
||||
} from "../../components/utils";
|
||||
|
||||
import {
|
||||
setCaseReference,
|
||||
@@ -105,6 +109,16 @@ let BuildCheckRow = (props) => {
|
||||
datafieldname[0].value
|
||||
]
|
||||
)
|
||||
: fieldtype[0].value ==
|
||||
"{3EF39988-22BB-4f0b-BBBE-64B5A3748AEE}"
|
||||
? getPickListLabel(
|
||||
props.props.formData.pickListData,
|
||||
datafieldname[0].value,
|
||||
props.props.form["appealForm"]
|
||||
.values[
|
||||
datafieldname[0].value
|
||||
]
|
||||
)
|
||||
: props.props.form["appealForm"].values[
|
||||
datafieldname[0].value
|
||||
]}
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
import jsonpath from "jsonpath";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { useState, useEffect } from "react";
|
||||
import { useEffect } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { formValueSelector } from "redux-form";
|
||||
import xpath from "xpath";
|
||||
import BuildRow from "./buildrow";
|
||||
import { reduxForm, formValueSelector } from "redux-form";
|
||||
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { updateCase, patchCase } from "../../actions";
|
||||
import data from "../../data/collections.json";
|
||||
import { setCurrentSection } from "../../store/appealType/action";
|
||||
import { updateCase } from "../../actions";
|
||||
import jsonpath from "jsonpath";
|
||||
import { getFormCollectionByID } from "../utils";
|
||||
|
||||
import data from "../../data/collections.json";
|
||||
|
||||
let CompleteAppeal = (props) => {
|
||||
// un comment to update incident with an appealtype id
|
||||
useEffect(() => {
|
||||
let incidentId = props.appealType.caseReference.incidentid;
|
||||
let updateBody = props.props.form.appealForm.values;
|
||||
@@ -51,6 +48,8 @@ let CompleteAppeal = (props) => {
|
||||
primaryAttribute,
|
||||
props.appealType.caseReference.ticketnumber
|
||||
);
|
||||
console.log("patching////////");
|
||||
patchCase(incidentId);
|
||||
}, [
|
||||
props.appealType.caseReference,
|
||||
props.props.form.appealForm.values,
|
||||
|
||||
@@ -1,23 +1,15 @@
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { useState, useEffect } from "react";
|
||||
import xpath from "xpath";
|
||||
import BuildRow from "./buildrow";
|
||||
import { reduxForm, formValueSelector, Field } from "redux-form";
|
||||
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
||||
import jsonpath from "jsonpath";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { Field, formValueSelector, reduxForm } from "redux-form";
|
||||
import transLookup from "../../data/lookuptranslations.json";
|
||||
import { getFormCollectionByID } from "../utils";
|
||||
|
||||
import data from "../../data/collections.json";
|
||||
import {
|
||||
setAppealType,
|
||||
setAppealTypeTitle,
|
||||
setAppealTypeID,
|
||||
setAppealLPA,
|
||||
getAppealTypeObj,
|
||||
setAppealTypeID,
|
||||
setAppealTypeTitle,
|
||||
} from "../../store/appealType/action";
|
||||
import { getFormCollectionByID } from "../utils";
|
||||
|
||||
let CreateCase = (props) => {
|
||||
// useEffect(() => {
|
||||
@@ -222,7 +214,7 @@ let CreateCase = (props) => {
|
||||
appTypeCollection = getFormCollectionByID(appTypeCollection);
|
||||
|
||||
router.replace(
|
||||
(router.locale = "cy" ? "/apelnewydd" : "/newappeal") +
|
||||
"/newappeal" +
|
||||
"/" +
|
||||
appTypeCollection.UrlName +
|
||||
"?lpa=" +
|
||||
|
||||
@@ -25,6 +25,19 @@ export const getFormCollectionByID = (appealTypeID) => {
|
||||
return collectionName[0];
|
||||
};
|
||||
|
||||
export const getPickListLabel = (data, picklistType, picklistID) => {
|
||||
const pickListData = jsonpath.query(
|
||||
data,
|
||||
"$..[?(@.LogicalName=='" + picklistType + "')]"
|
||||
);
|
||||
|
||||
const pickListLabel = jsonpath.query(
|
||||
pickListData,
|
||||
"$..[?(@.Value=='" + picklistID + "')].Label.LocalizedLabels..Label"
|
||||
);
|
||||
return pickListLabel[0];
|
||||
};
|
||||
|
||||
/*
|
||||
* Get the details of a case from the appeal type
|
||||
* @param object searchResultsObj
|
||||
|
||||
@@ -214,6 +214,16 @@
|
||||
}
|
||||
],
|
||||
"pinswg_decision": [
|
||||
{
|
||||
"value": "Allowed",
|
||||
"value_cy": "Caniateir",
|
||||
"pinswg_decision": 846040000
|
||||
},
|
||||
{
|
||||
"value": "Non Determination",
|
||||
"value_cy": "Amhenderfyniad",
|
||||
"pinswg_decision": 846040001
|
||||
},
|
||||
{
|
||||
"value": "Dismissed",
|
||||
"value_cy": "Gwrthodwyd",
|
||||
|
||||
@@ -31,11 +31,14 @@ export default async function ApiProxy(req, res) {
|
||||
var data = JSON.stringify({
|
||||
"title": "insertion test case",
|
||||
"caseorigincode": 3,
|
||||
"servicestage": 1,
|
||||
"customerid_contact@odata.bind": "/contacts(" + contactid + ")",
|
||||
"pinswg_appealcasetype": appealTypeId,
|
||||
"pinswg_AssociatedLPA@odata.bind": "/accounts(" + lpaID + ")",
|
||||
});
|
||||
|
||||
console.log(data);
|
||||
|
||||
var config = {
|
||||
method: "post",
|
||||
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const hashAPIPath = (queryPath) => {
|
||||
var hashlink = CryptoJS.HmacSHA256(
|
||||
queryPath,
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
|
||||
//return "&hash=" + hashlink;
|
||||
|
||||
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
};
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var incidentID = req.query.incidentID;
|
||||
var token = await getToken();
|
||||
var queryUrl = "incidents(" + incidentID + ")";
|
||||
|
||||
var config = {
|
||||
method: "delete",
|
||||
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*"',
|
||||
"Authorization": "Bearer " + token.access_token,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
};
|
||||
|
||||
return axios(config)
|
||||
.then(({ data }) => {
|
||||
console.log("deleted awaitingsubmission case - " + incidentID);
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeaders } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const hashAPIPath = (queryPath) => {
|
||||
var hashlink = CryptoJS.HmacSHA256(
|
||||
queryPath,
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
};
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var loggedInUserId = req.query.loggedInUserId;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=_customerid_value eq " +
|
||||
loggedInUserId +
|
||||
" and servicestage eq 1 and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true";
|
||||
|
||||
console.log(queryUrl);
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
data.value.forEach(function (element) {
|
||||
element.pinswg_title = element.title;
|
||||
});
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeaders } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const hashAPIPath = (queryPath) => {
|
||||
var hashlink = CryptoJS.HmacSHA256(
|
||||
queryPath,
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
};
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var loggedInUserId = req.query.loggedInUserId;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=_customerid_value eq " +
|
||||
loggedInUserId +
|
||||
" and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true";
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
data.value.forEach(function (element) {
|
||||
element.pinswg_title = element.title;
|
||||
});
|
||||
console.log(data);
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
}
|
||||
@@ -15,9 +15,6 @@ const hashAPIPath = (queryPath) => {
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
|
||||
//return "&hash=" + hashlink;
|
||||
|
||||
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
};
|
||||
|
||||
@@ -37,7 +34,7 @@ export default async function ApiProxy(req, res) {
|
||||
|
||||
queryUrl = queryUrl + getSelectQuery(appealTypeName);
|
||||
|
||||
console.log("query: ", queryUrl, "<<<<end query");
|
||||
//console.log("query: ", queryUrl, "<<<<end query");
|
||||
|
||||
return axios
|
||||
.get(
|
||||
|
||||
@@ -38,7 +38,7 @@ export default async function ApiProxy(req, res) {
|
||||
|
||||
queryUrl = queryUrl + getSelectQuery(appealTypeName);
|
||||
|
||||
console.log("query: ", queryUrl, "<<<<end query");
|
||||
//console.log("query: ", queryUrl, "<<<<end query");
|
||||
|
||||
return axios
|
||||
.get(
|
||||
|
||||
@@ -22,9 +22,11 @@ export default async function ApiProxy(req, res) {
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"incidents?$select=ticketnumber,casetypecode,createdon,_customerid_value,description,incidentid,pinswg_appealcasetype,_pinswg_assignedinspectrids_value,statecode,statuscode,title&$filter=_customerid_value eq " +
|
||||
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=_customerid_value eq " +
|
||||
loggedInUserId +
|
||||
" and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3";
|
||||
" and servicestage eq 0 and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3";
|
||||
|
||||
//console.log("Portal query: ", queryUrl, "<<<<end query");
|
||||
|
||||
return axios
|
||||
.get(
|
||||
@@ -32,6 +34,9 @@ export default async function ApiProxy(req, res) {
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
data.value.forEach(function (element) {
|
||||
element.pinswg_title = element.title;
|
||||
});
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
|
||||
@@ -26,6 +26,8 @@ export default async function ApiProxy(req, res) {
|
||||
whichForm +
|
||||
"')/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet,GlobalOptionSet&$count=true";
|
||||
|
||||
console.log("get pick list for " + whichForm + ": ", queryUrl);
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeaders } from "../../../actions";
|
||||
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
@@ -28,6 +29,8 @@ export default async function ApiProxy(req, res) {
|
||||
caseReference +
|
||||
"'&$count=true";
|
||||
|
||||
queryUrl = queryUrl + getSelectQuery(appealType);
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeaders } from "../../../actions";
|
||||
import {
|
||||
getToken,
|
||||
azureHeaders,
|
||||
getBasicSearchDetails,
|
||||
} from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
@@ -24,7 +28,7 @@ export default async function ApiProxy(req, res) {
|
||||
var queryUrl =
|
||||
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
|
||||
loggedInUserId +
|
||||
"&$count=true&$orderby=createdon desc";
|
||||
"&$select=pinswg_appealcasetype,pinswg_watchlistid,_pinswg_watchedcase_value,statuscode&$count=true&$orderby=createdon desc&$expand=pinswg_WatchedCase($select=pinswg_AssociatedLPA)";
|
||||
|
||||
return axios
|
||||
.get(
|
||||
@@ -32,6 +36,31 @@ export default async function ApiProxy(req, res) {
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
data.value.forEach(function (element) {
|
||||
element.pinswg_title =
|
||||
element[
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
|
||||
element[
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
] =
|
||||
element.pinswg_WatchedCase[
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
element._pinswg_associatedlpa_value =
|
||||
element.pinswg_WatchedCase._pinswg_associatedlpa_value;
|
||||
element[
|
||||
"_ownerid_value@OData.Community.Display.V1.FormattedValue"
|
||||
] =
|
||||
element.pinswg_WatchedCase[
|
||||
"_ownerid_value@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
element._ownerid_value =
|
||||
element.pinswg_WatchedCase._ownerid_value;
|
||||
|
||||
delete element.pinswg_WatchedCase;
|
||||
});
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
|
||||
@@ -24,7 +24,7 @@ export default async function ApiProxy(req, res) {
|
||||
var queryUrl =
|
||||
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
|
||||
loggedInUserId +
|
||||
"&$count=true&$orderby=createdon desc";
|
||||
"&$select=pinswg_appealcasetype,pinswg_watchlistid,_pinswg_watchedcase_value,statuscode&$count=true&$orderby=createdon desc&$expand=pinswg_WatchedCase($select=pinswg_AssociatedLPA)";
|
||||
|
||||
return axios
|
||||
.get(
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const hashAPIPath = (queryPath) => {
|
||||
var hashlink = CryptoJS.HmacSHA256(
|
||||
queryPath,
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
|
||||
//return "&hash=" + hashlink;
|
||||
|
||||
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
};
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var incidentID = req.query.incidentid;
|
||||
var queryUrl = "incidents(" + incidentID + ")";
|
||||
var token = await getToken();
|
||||
|
||||
var data = JSON.stringify({
|
||||
"servicestage": 0,
|
||||
});
|
||||
|
||||
//console.log(data, WEBAPI_URL + queryUrl);
|
||||
|
||||
var config = {
|
||||
method: "patch",
|
||||
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Authorization": "Bearer " + token.access_token,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
data: data,
|
||||
};
|
||||
|
||||
var apiResponse = _.isEmpty(req.query)
|
||||
? res.status(400).json()
|
||||
: axios(config)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
|
||||
return apiResponse;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken } from "../../../actions";
|
||||
import { getToken, patchCase } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
@@ -22,7 +22,9 @@ const hashAPIPath = (queryPath) => {
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var data = JSON.stringify(req.body);
|
||||
var appealObj = rea.query.appealObj;
|
||||
var appealObj = req.query.appealObj;
|
||||
var incidentID = req.query.incident;
|
||||
|
||||
var updateFormCollection = req.query.updateFormCollection;
|
||||
var queryUrl = updateFormCollection + "(" + appealObj + ")";
|
||||
|
||||
@@ -47,6 +49,7 @@ export default async function ApiProxy(req, res) {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
console.log(err);
|
||||
res.status(400).json(err);
|
||||
});
|
||||
}
|
||||
|
||||
+10
-14
@@ -1,19 +1,12 @@
|
||||
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 { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import Case from "../../components/case";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Footer from "../../components/footer";
|
||||
import Header from "../../components/header";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
@@ -57,6 +50,9 @@ const Home = (props) => {
|
||||
props.myRepresentations.myRepresentations
|
||||
}
|
||||
watchedCases={props.watchedCases.watchedCases}
|
||||
watchedCasesDetails={
|
||||
props.watchedCases.watchedCasesDetails
|
||||
}
|
||||
awaitingSubmission={
|
||||
props.awaitingSubmission.awaitingSubmission
|
||||
}
|
||||
|
||||
@@ -78,21 +78,6 @@ const Home = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
// export const getServerSideProps = wrapper.getServerSideProps(
|
||||
// (store) => async (ctx) => {
|
||||
// const { query, req, res } = ctx;
|
||||
|
||||
// const showRepresentationsCheck =
|
||||
// process.env.SHOWREPRESENTATIONS || false;
|
||||
|
||||
// console.log("Show representation module: ", showRepresentationsCheck);
|
||||
|
||||
// return {
|
||||
// props: { showRepresentations: showRepresentationsCheck },
|
||||
// };
|
||||
// }
|
||||
// );
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
//console.log(state);
|
||||
|
||||
|
||||
+10
-7
@@ -22,7 +22,10 @@ import {
|
||||
setAccountDetails,
|
||||
setLoggedInUserId,
|
||||
} from "../../store/accountDetails/action";
|
||||
import { setAwaitingSubmission } from "../../store/awaitingSubmission/action";
|
||||
import {
|
||||
setAwaitingSubmission,
|
||||
setAwaitingSubmissionDetails,
|
||||
} from "../../store/awaitingSubmission/action";
|
||||
import { getGovGatewayConfig } from "../../store/govgateway/action";
|
||||
import { setMyCases, setMyCasesDetails } from "../../store/myCases/action";
|
||||
import {
|
||||
@@ -172,7 +175,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
await getMyCases(loggedInUser),
|
||||
await getMyRepresentations(loggedInUser),
|
||||
await getWatchedCases(loggedInUser),
|
||||
await getAwaitingSubmission(),
|
||||
await getAwaitingSubmission(loggedInUser),
|
||||
]);
|
||||
|
||||
//const cookiesMaker = nookies.get(ctx)
|
||||
@@ -194,12 +197,12 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
myCasesDetails,
|
||||
myRepresentationsDetails,
|
||||
watchedCasesDetails,
|
||||
// awaitingSubmissionDetails,
|
||||
awaitingSubmissionDetails,
|
||||
] = await Promise.all([
|
||||
await getDetails(myCases, "myCases"),
|
||||
await getDetails(myRepresentations, "myRepresentations"),
|
||||
await getDetails(watchedCases, "myWatchedCases"),
|
||||
//await getDetails(awaitingSubmission),
|
||||
await getDetails(awaitingSubmission, "awaitingSubmission"),
|
||||
]);
|
||||
|
||||
store.dispatch(setAccountDetails(accountDetails));
|
||||
@@ -213,9 +216,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
store.dispatch(setWatchedCases(watchedCases));
|
||||
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
||||
store.dispatch(setAwaitingSubmission(awaitingSubmission));
|
||||
// store.dispatch(
|
||||
// setAwaitingSubmissionDetails(awaitingSubmissionDetails)
|
||||
// );
|
||||
store.dispatch(
|
||||
setAwaitingSubmissionDetails(awaitingSubmissionDetails)
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user