refactor(actions): complete priority-1 consumer import migration pass

This commit is contained in:
2026-03-12 13:26:48 +00:00
parent a0a633a9ea
commit c4ad9ab7a2
13 changed files with 232 additions and 220 deletions
@@ -7,7 +7,7 @@ import { connect } from "react-redux";
import {
deleteAwaitingSubmissionsFromBlob,
getAwaitingSubmissionFromBlobProxy
} from "../../actions";
} from "../../actions/services/documentService";
import { getFormCollectionByID } from "../../components/utils";
import transLookup from "../../data/lookuptranslations.json";
import {
+58 -52
View File
@@ -10,22 +10,22 @@ import {
deleteWatchedCases,
getAwaitingSubmissionProxy,
getPortalModuleDetailsProxy,
getWatchedCasesProxy,
} from "../../actions";
getWatchedCasesProxy
} from "../../actions/services/portalService";
import { getFormCollectionByID, getDetailsProxy } from "../../components/utils";
import transLookup from "../../data/lookuptranslations.json";
import {
setAwaitingSubmission,
setAwaitingSubmissionDetails,
setAwaitingSubmissionDetails
} from "../../store/awaitingSubmission/action";
import { setCurrentReference } from "../../store/currentView/action";
import {
setSearchDetails,
setSearchResults,
setSearchResults
} from "../../store/searchOutput/action";
import {
setWatchedCases,
setWatchedCasesDetails,
setWatchedCasesDetails
} from "../../store/watchedCases/action";
import { planningappeals78_pdf } from "../../components/pdftemplates/planningappeals78_pdf";
@@ -47,7 +47,7 @@ const TopThree = (props) => {
setAwaitingSubmissionDetails,
setSearchResults,
setSearchDetails,
showLoginCheck,
showLoginCheck
} = props;
const router = useRouter();
@@ -132,19 +132,19 @@ const TopThree = (props) => {
let newObj = {};
return Object.assign(newObj, {
"@odata.count": required.length,
"value": required,
"value": required
});
};
let filteredWatchedCases = showWatchedCases(data);
setWatchedCases(filteredWatchedCases),
(setWatchedCases(filteredWatchedCases),
getDetailsProxy(
filteredWatchedCases,
"myWatchedCases"
).then((data) => {
setWatchedCasesDetails(data);
});
}));
});
});
@@ -156,7 +156,7 @@ const TopThree = (props) => {
.then(() => {
getAwaitingSubmissionProxy(cookies.pinsUser).then(
(data) => {
setAwaitingSubmission(data),
(setAwaitingSubmission(data),
getDetailsProxy(
data,
"awaitingSubmission"
@@ -166,7 +166,7 @@ const TopThree = (props) => {
// data
// );
setAwaitingSubmissionDetails(data);
});
}));
}
);
});
@@ -196,7 +196,7 @@ const TopThree = (props) => {
const res = await fetch("/api/file/generateappealpdfcopy", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ docProps }),
body: JSON.stringify({ docProps })
});
if (!res.ok) throw new Error("PDF generation failed");
@@ -287,25 +287,25 @@ const TopThree = (props) => {
"&inid=" +
showTopThreeArr[key].incidentid
: router.locale == "cy"
? "/fymhorth/achos/" +
showTopThreeArr[key].ticketnumber +
"?key=" +
topThreeType +
"&appealType=" +
showTopThreeArr[key]
.pinswg_appealcasetype
: "/myportal/case/" +
showTopThreeArr[key].ticketnumber +
"?key=" +
topThreeType +
"&appealType=" +
showTopThreeArr[key]
.pinswg_appealcasetype
? "/fymhorth/achos/" +
showTopThreeArr[key].ticketnumber +
"?key=" +
topThreeType +
"&appealType=" +
showTopThreeArr[key]
.pinswg_appealcasetype
: "/myportal/case/" +
showTopThreeArr[key].ticketnumber +
"?key=" +
topThreeType +
"&appealType=" +
showTopThreeArr[key]
.pinswg_appealcasetype
}
className="govuk-link--no-underline"
data-id={index}
onClick={() => {
setSearchResults(
(setSearchResults(
props.props[topThreeType][topThreeType]
),
setSearchDetails(
@@ -337,8 +337,8 @@ const TopThree = (props) => {
"appealType":
showTopThreeArr[key]
.pinswg_appealcasetype,
});
.pinswg_appealcasetype
}));
}}
>
{showTopThreeArr[key].pinswg_title}
@@ -423,7 +423,7 @@ const TopThree = (props) => {
] +
'")].value_cy',
json: transLookup,
eval: true,
eval: true
})
: showTopThreeArr[key][
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
@@ -436,26 +436,32 @@ const TopThree = (props) => {
{_.isEmpty(showTopThreeArr[key])
? t("myportal:case-address-not-entered")
: _.isEmpty(showTopThreeArr[key])
? t("myportal:case-address-not-entered")
: _.isEmpty(showTopThreeArr[key])
? t("myportal:case-address-not-entered")
: _.isEmpty(
showTopThreeArr[key].pinswg_siteaddressline1
)
? t("myportal:case-address-not-entered")
: showTopThreeArr[key].pinswg_siteaddressline1 +
(!_.isEmpty(
showTopThreeArr[key].pinswg_siteaddressline2
)
? ", " +
showTopThreeArr[key].pinswg_siteaddressline2
: "") +
(!_.isEmpty(
showTopThreeArr[key].pinswg_siteaddresstown
)
? ", " +
showTopThreeArr[key].pinswg_siteaddresstown
: "")}
? t("myportal:case-address-not-entered")
: _.isEmpty(showTopThreeArr[key])
? t("myportal:case-address-not-entered")
: _.isEmpty(
showTopThreeArr[key]
.pinswg_siteaddressline1
)
? t("myportal:case-address-not-entered")
: showTopThreeArr[key]
.pinswg_siteaddressline1 +
(!_.isEmpty(
showTopThreeArr[key]
.pinswg_siteaddressline2
)
? ", " +
showTopThreeArr[key]
.pinswg_siteaddressline2
: "") +
(!_.isEmpty(
showTopThreeArr[key]
.pinswg_siteaddresstown
)
? ", " +
showTopThreeArr[key]
.pinswg_siteaddresstown
: "")}
</div>
{showTopThreeArr[key].pinswg_appellantagent != null && (
<div className="cardModuleReference">
@@ -495,7 +501,7 @@ const TopThree = (props) => {
] +
'")].value_cy',
json: transLookup,
eval: true,
eval: true
})
: showTopThreeArr[key][
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
@@ -591,7 +597,7 @@ const mapDispatchToProps = (dispatch) => {
},
setSearchDetails: (searchDetails) => {
dispatch(setSearchDetails(searchDetails));
},
}
};
};
+45 -43
View File
@@ -6,30 +6,32 @@ import { parseCookies } from "nookies";
import { connect } from "react-redux";
import {
deleteAwaitingSubmissions,
deleteMyRepresentationsFromBlob,
deleteWatchedCases,
getAwaitingSubmissionProxy,
getPortalModuleDetailsProxy,
getRepsFromBlobProxy,
getWatchedCasesProxy,
} from "../../actions";
getWatchedCasesProxy
} from "../../actions/services/portalService";
import {
deleteMyRepresentationsFromBlob,
getRepsFromBlobProxy
} from "../../actions/services/documentService";
import { consoleLogger } from "../../actions/core/logger";
import transLookup from "../../data/lookuptranslations.json";
import {
setAwaitingSubmission,
setAwaitingSubmissionDetails,
setAwaitingSubmissionDetails
} from "../../store/awaitingSubmission/action";
import {
setCurrentReference,
setCurrentView,
setRepresentationCapacity,
setRepresentationCapacity
} from "../../store/currentView/action";
import {
setMyRepresentations,
setMyRepresentationsDetails,
setMyRepresentationsDetails
} from "../../store/myRepresentations/action";
import {
setWatchedCases,
setWatchedCasesDetails,
setWatchedCasesDetails
} from "../../store/watchedCases/action";
import { getFormCollectionByID, getDetailsProxy } from "../utils";
@@ -46,7 +48,7 @@ const TopThree = (props) => {
setAwaitingSubmissionDetails,
setMyRepresentations,
setMyRepresentationsDetails,
setRepresentationCapacity,
setRepresentationCapacity
} = props;
const router = useRouter();
@@ -80,12 +82,12 @@ const TopThree = (props) => {
.then((data) => data)
.then(() => {
getWatchedCasesProxy(cookies.pinsUser).then((data) => {
setWatchedCases(data),
(setWatchedCases(data),
getDetailsProxy(data, "myWatchedCases").then(
(data) => {
setWatchedCasesDetails(data);
}
);
));
});
});
@@ -97,7 +99,7 @@ const TopThree = (props) => {
.then(() => {
getAwaitingSubmissionProxy(cookies.pinsUser).then(
(data) => {
setAwaitingSubmission(data),
(setAwaitingSubmission(data),
getDetailsProxy(
data,
"awaitingSubmission"
@@ -107,7 +109,7 @@ const TopThree = (props) => {
// data
// );
setAwaitingSubmissionDetails(data);
});
}));
}
);
});
@@ -136,12 +138,12 @@ const TopThree = (props) => {
})
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
return null;
})
.then(() => {
setCurrentView({
"viewName": "My Representations",
"viewKey": "myRepresentations",
"viewKey": "myRepresentations"
});
});
});
@@ -211,7 +213,7 @@ const TopThree = (props) => {
style={{
color: "#0360a6",
cursor: "pointer",
fontWeight: "bold",
fontWeight: "bold"
}}
data-id={index}
onClick={() => {
@@ -225,7 +227,7 @@ const TopThree = (props) => {
showTopThreeArr[key].incidentID,
"appealType":
showTopThreeArr[key].appealType,
"repDetails": showTopThreeArr[key],
"repDetails": showTopThreeArr[key]
});
isLPA && setRepresentationCapacity("LPA");
router.push({
@@ -239,8 +241,8 @@ const TopThree = (props) => {
state: "edit",
created:
showTopThreeArr[key]
.repfile_name,
},
.repfile_name
}
});
}}
>
@@ -294,7 +296,7 @@ const TopThree = (props) => {
showTopThreeArr[key].representationType +
'")].value_cy',
json: transLookup,
eval: true,
eval: true
})
: showTopThreeArr[key].representationType || ""}
</div>
@@ -312,27 +314,27 @@ const TopThree = (props) => {
.representationCapacity +
'" )].value_cy',
json: transLookup,
eval: true,
eval: true
})
: jsonpath({
path:
'$..[?(@ && @.value_cy=="' +
showTopThreeArr[key]
.representationCapacity +
'")].value',
json: transLookup,
eval: true,
}).length > 0
? jsonpath({
path:
'$..[?(@ && @.value_cy=="' +
showTopThreeArr[key]
.representationCapacity +
'")].value',
json: transLookup,
eval: true,
})
: showTopThreeArr[key].representationCapacity}
path:
'$..[?(@ && @.value_cy=="' +
showTopThreeArr[key]
.representationCapacity +
'")].value',
json: transLookup,
eval: true
}).length > 0
? jsonpath({
path:
'$..[?(@ && @.value_cy=="' +
showTopThreeArr[key]
.representationCapacity +
'")].value',
json: transLookup,
eval: true
})
: showTopThreeArr[key].representationCapacity}
</div>
<div className="cardModuleReference">
<b>{t("myportal:date-raised")}:</b>
@@ -352,7 +354,7 @@ const TopThree = (props) => {
] +
'")].value_cy',
json: transLookup,
eval: true,
eval: true
})
: showTopThreeArr[key][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
@@ -400,7 +402,7 @@ const TopThree = (props) => {
const mapStateToProps = (state) => {
return {
// currentView: state.currentView,
accountDetails: state.accountDetails,
accountDetails: state.accountDetails
// search: state.search,
// searchResultsObj: state.searchResultsObj,
};
@@ -431,7 +433,7 @@ const mapDispatchToProps = (dispatch) => {
},
setRepresentationCapacity: (representationCapacity) => {
dispatch(setRepresentationCapacity(representationCapacity));
},
}
};
};