show submitted reps on dashboard
This commit is contained in:
@@ -37,6 +37,8 @@ export default async function ApiProxy(req, res) {
|
||||
var token = await getToken();
|
||||
var queryUrl = "pinswg_watchlists(" + watchedCaseID + ")";
|
||||
|
||||
console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
|
||||
|
||||
var config = {
|
||||
method: "delete",
|
||||
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
|
||||
@@ -48,7 +48,7 @@ export default async function ApiProxy(req, res) {
|
||||
var queryUrl =
|
||||
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
|
||||
loggedInUserId +
|
||||
"&$select=modifiedon,pinswg_appealcasetype,pinswg_watchlistid,_pinswg_watchedcase_value,statuscode&$count=true&$orderby=createdon desc&$expand=pinswg_WatchedCase($select=pinswg_AssociatedLPA)";
|
||||
"&$select=modifiedon,pinswg_appealcasetype,pinswg_watchlistid,_pinswg_watchedcase_value,statuscode,pinswg_representationsubmitted,pinswg_representationtype&$count=true&$orderby=createdon desc&$expand=pinswg_WatchedCase($select=pinswg_AssociatedLPA)";
|
||||
|
||||
return axios
|
||||
.get(
|
||||
|
||||
+43
-3
@@ -40,6 +40,8 @@ import { setMyCases, setMyCasesDetails } from "../../store/myCases/action";
|
||||
import {
|
||||
setMyRepresentations,
|
||||
setMyRepresentationsDetails,
|
||||
setMySubmittedReps,
|
||||
setMySubmittedRepsDetails,
|
||||
} from "../../store/myRepresentations/action";
|
||||
import { setShowReps } from "../../store/currentView/action";
|
||||
import { wrapper } from "../../store/store";
|
||||
@@ -54,6 +56,7 @@ const Home = (props) => {
|
||||
pages,
|
||||
myCases,
|
||||
myRepresentations,
|
||||
mySubmittedReps,
|
||||
watchedCases,
|
||||
awaitingSubmission,
|
||||
accountDetails,
|
||||
@@ -145,6 +148,7 @@ const Home = (props) => {
|
||||
<MyPortal
|
||||
myCases={myCases}
|
||||
myRepresentations={myRepresentations}
|
||||
mySubmittedReps={mySubmittedReps}
|
||||
watchedCases={watchedCases}
|
||||
awaitingSubmission={awaitingSubmission}
|
||||
accountDetails={accountDetails}
|
||||
@@ -247,6 +251,34 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
const showReps = process.env.SHOWREPRESENTATIONS || false;
|
||||
store.dispatch(setShowReps(showReps, showLoginCheck));
|
||||
|
||||
let showWatchedCases = (submittedArr) => {
|
||||
const required = submittedArr.value.filter((el) => {
|
||||
return el.pinswg_representationsubmitted == null;
|
||||
});
|
||||
|
||||
let newObj = {};
|
||||
return Object.assign(newObj, {
|
||||
"@odata.count": required.length,
|
||||
"value": required,
|
||||
});
|
||||
};
|
||||
|
||||
let filteredWatchedCases = showWatchedCases(watchedCases);
|
||||
|
||||
let showSubmittedReps = (submittedArr) => {
|
||||
submittedArr = submittedArr.value;
|
||||
const required = submittedArr.filter((el) => {
|
||||
let IsSubmittedRep = _.has(el, "pinswg_representationsubmitted")
|
||||
? el.pinswg_representationsubmitted != null &&
|
||||
el.pinswg_representationsubmitted
|
||||
: "";
|
||||
return IsSubmittedRep;
|
||||
});
|
||||
return required;
|
||||
};
|
||||
|
||||
const mySubmittedReps = showSubmittedReps(watchedCases);
|
||||
|
||||
// if (preferredLocale != ctx.locale) {
|
||||
// return {
|
||||
// redirect: {
|
||||
@@ -266,11 +298,13 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
const [
|
||||
myCasesDetails,
|
||||
watchedCasesDetails,
|
||||
mySubmittedRepsDetails,
|
||||
//awaitingSubmissionDetails,
|
||||
myRepresentationsDetails,
|
||||
] = await Promise.all([
|
||||
await getDetails(myCases, "myCases"),
|
||||
await getDetails(watchedCases, "myWatchedCases"),
|
||||
await getDetails(filteredWatchedCases, "myWatchedCases"),
|
||||
await getDetails(mySubmittedReps, "mySubmittedReps"),
|
||||
//await getDetails(awaitingSubmission, "awaitingSubmission"),
|
||||
await getDetails(myRepresentations, "myRepresentations"),
|
||||
]);
|
||||
@@ -284,8 +318,10 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
setMyRepresentationsDetails(myRepresentationsDetails)
|
||||
);
|
||||
|
||||
store.dispatch(setWatchedCases(watchedCases));
|
||||
store.dispatch(setWatchedCases(filteredWatchedCases));
|
||||
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
||||
store.dispatch(setMySubmittedReps(mySubmittedReps));
|
||||
store.dispatch(setMySubmittedRepsDetails(mySubmittedRepsDetails));
|
||||
store.dispatch(setAwaitingSubmission(awaitingSubmission));
|
||||
store.dispatch(
|
||||
setAwaitingSubmissionFromBlob(awaitingSubmissionFromBlob)
|
||||
@@ -318,7 +354,8 @@ const getDetails = (resultsObj, detailsType) => {
|
||||
// "\n//////////////////////////////////\n"
|
||||
// );
|
||||
|
||||
resultsObj = resultsObj.value;
|
||||
resultsObj =
|
||||
detailsType == "mySubmittedReps" ? resultsObj : resultsObj.value;
|
||||
|
||||
// console.log(
|
||||
// "////////////////////////////////// resultsobj\n",
|
||||
@@ -339,6 +376,7 @@ const getDetails = (resultsObj, detailsType) => {
|
||||
caseID = data.pinswg_title;
|
||||
break;
|
||||
case "myWatchedCases":
|
||||
case "mySubmittedReps":
|
||||
caseID =
|
||||
data[
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
@@ -371,6 +409,7 @@ const getDetails = (resultsObj, detailsType) => {
|
||||
caseID = searchDetail.pinswg_title;
|
||||
break;
|
||||
case "myWatchedCases":
|
||||
case "mySubmittedReps":
|
||||
caseID =
|
||||
searchDetail[
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
@@ -422,6 +461,7 @@ const mapStateToProps = (state) => {
|
||||
myCases: state.myCases,
|
||||
watchedCases: state.watchedCases,
|
||||
myRepresentations: state.myRepresentations,
|
||||
mySubmittedReps: state.mySubmittedReps,
|
||||
awaitingSubmission: state.awaitingSubmission,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user