21187 implement helper function on summary
This commit is contained in:
@@ -140,9 +140,9 @@ let MakeRepresentation = (props) => {
|
||||
const pad = (num) => String(num).padStart(2, "0");
|
||||
|
||||
const dateStr = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(
|
||||
now.getDate()
|
||||
now.getDate(),
|
||||
)}-${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(
|
||||
now.getSeconds()
|
||||
now.getSeconds(),
|
||||
)}`;
|
||||
|
||||
const repCap = repCapMap[values.representationCapacity] || "";
|
||||
@@ -154,7 +154,7 @@ let MakeRepresentation = (props) => {
|
||||
const namePart = isLPA
|
||||
? sanitize(values.onBehalfOfLPA || "")
|
||||
: `${sanitize(values.lastname || "")}_${sanitize(
|
||||
values.firstname || ""
|
||||
values.firstname || "",
|
||||
)}`;
|
||||
|
||||
values.repfile_name =
|
||||
@@ -203,7 +203,7 @@ let MakeRepresentation = (props) => {
|
||||
|
||||
if (shouldIncludeInterested) {
|
||||
capacityOptionsArr.push(
|
||||
t("myrepresentations:capacity-options-arr-interested")
|
||||
t("myrepresentations:capacity-options-arr-interested"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -263,25 +263,26 @@ let MakeRepresentation = (props) => {
|
||||
|
||||
const isDNS = appealType === 846040011;
|
||||
const isSIPS = appealType === 846040002;
|
||||
const isIP = true;
|
||||
|
||||
// Determine key dates based on appeal type
|
||||
const startDate = new Date(
|
||||
isDNS
|
||||
? detailsObj.pinswg_applicationacceptedasvalid
|
||||
: detailsObj.pinswg_startdate || detailsObj.pinswg_startdates
|
||||
: detailsObj.pinswg_startdate || detailsObj.pinswg_startdates,
|
||||
);
|
||||
|
||||
const questionnaireDate = new Date(
|
||||
isDNS
|
||||
? detailsObj.pinswg_endofrepresentationperiod
|
||||
: detailsObj.pinswg_questionnaireduedate
|
||||
: detailsObj.pinswg_questionnaireduedate,
|
||||
);
|
||||
questionnaireDate.setHours(23, 59, 59, 999);
|
||||
|
||||
const finalCommentsDate = new Date(
|
||||
isDNS
|
||||
? detailsObj.pinswg_endofrepresentationperiod
|
||||
: detailsObj.pinswg_finalcommentsduedate
|
||||
: detailsObj.pinswg_finalcommentsduedate,
|
||||
);
|
||||
finalCommentsDate.setHours(23, 59, 59, 999);
|
||||
|
||||
@@ -289,7 +290,7 @@ let MakeRepresentation = (props) => {
|
||||
isDNS
|
||||
? detailsObj.pinswg_endofrepresentationperiod
|
||||
: detailsObj.pinswg_statementduedate ||
|
||||
detailsObj.pinswg_statementsduedate
|
||||
detailsObj.pinswg_statementsduedate,
|
||||
);
|
||||
statementDueDate.setHours(23, 59, 59, 999);
|
||||
|
||||
@@ -446,7 +447,7 @@ let MakeRepresentation = (props) => {
|
||||
case "apelydd":
|
||||
case "apelydd":
|
||||
case t(
|
||||
"myrepresentations:capacity-options-arr-appellant"
|
||||
"myrepresentations:capacity-options-arr-appellant",
|
||||
).toLowerCase(): {
|
||||
const Component =
|
||||
appealType === 846040002
|
||||
@@ -456,7 +457,7 @@ let MakeRepresentation = (props) => {
|
||||
<Component
|
||||
{...commonProps}
|
||||
appellantApplicantRepresentationArr={buildRepsArr(
|
||||
detailsObj
|
||||
detailsObj,
|
||||
)}
|
||||
/>
|
||||
);
|
||||
@@ -468,7 +469,7 @@ let MakeRepresentation = (props) => {
|
||||
<RepLPA
|
||||
{...commonProps}
|
||||
appellantApplicantRepresentationArr={buildRepsArr(
|
||||
detailsObj
|
||||
detailsObj,
|
||||
)}
|
||||
setShowQuestionnaireSection={
|
||||
setShowQuestionnaireSection
|
||||
@@ -483,7 +484,7 @@ let MakeRepresentation = (props) => {
|
||||
case "asiant":
|
||||
case "asiant":
|
||||
case t(
|
||||
"myrepresentations:capacity-options-arr-agent"
|
||||
"myrepresentations:capacity-options-arr-agent",
|
||||
).toLowerCase(): {
|
||||
const Component =
|
||||
appealType === 846040002 ? ConsultationAgent : RepAgent;
|
||||
@@ -491,7 +492,7 @@ let MakeRepresentation = (props) => {
|
||||
<Component
|
||||
{...commonProps}
|
||||
appellantApplicantRepresentationArr={buildRepsArr(
|
||||
detailsObj
|
||||
detailsObj,
|
||||
)}
|
||||
/>
|
||||
);
|
||||
@@ -499,7 +500,7 @@ let MakeRepresentation = (props) => {
|
||||
|
||||
case "interestedparty":
|
||||
case t(
|
||||
"myrepresentations:capacity-options-arr-interested"
|
||||
"myrepresentations:capacity-options-arr-interested",
|
||||
).toLowerCase(): {
|
||||
const Component =
|
||||
appealType === 846040002
|
||||
@@ -509,7 +510,7 @@ let MakeRepresentation = (props) => {
|
||||
<Component
|
||||
{...commonProps}
|
||||
interestedPersonRepresentationArr={buildRepsArr(
|
||||
detailsObj
|
||||
detailsObj,
|
||||
)}
|
||||
/>
|
||||
);
|
||||
@@ -621,7 +622,7 @@ let MakeRepresentation = (props) => {
|
||||
const updateRepresentation = async (
|
||||
values,
|
||||
sendSavedEmail,
|
||||
useSaveStatus
|
||||
useSaveStatus,
|
||||
) => {
|
||||
const {
|
||||
appealType: appealTypeProp,
|
||||
@@ -724,7 +725,7 @@ let MakeRepresentation = (props) => {
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{}
|
||||
{},
|
||||
);
|
||||
|
||||
// Normalize "Yes"/"No" to booleans
|
||||
@@ -747,7 +748,7 @@ let MakeRepresentation = (props) => {
|
||||
templateId,
|
||||
loggedinUserEmail,
|
||||
personalisation,
|
||||
reference
|
||||
reference,
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -838,8 +839,8 @@ let MakeRepresentation = (props) => {
|
||||
router.query?.state === "edit"
|
||||
? props.props.currentView.representationCapacity
|
||||
: isLPA
|
||||
? "LPA"
|
||||
: values.representationCapacity;
|
||||
? "LPA"
|
||||
: values.representationCapacity;
|
||||
|
||||
Object.assign(values, {
|
||||
...formValues,
|
||||
@@ -915,7 +916,7 @@ let MakeRepresentation = (props) => {
|
||||
showQuestionnaireSection < questionnaireCount
|
||||
) {
|
||||
setShowQuestionnaireSection(
|
||||
showQuestionnaireSection + 1
|
||||
showQuestionnaireSection + 1,
|
||||
);
|
||||
updateRepresentation(values, false, false);
|
||||
} else {
|
||||
@@ -948,7 +949,7 @@ let MakeRepresentation = (props) => {
|
||||
generateRepPDF(
|
||||
values,
|
||||
props.props.accountDetails.containerID,
|
||||
currentView.caseReference.currentReference
|
||||
currentView.caseReference.currentReference,
|
||||
).then((data) => {
|
||||
if (data.status === "success") {
|
||||
values = updateLinks(values);
|
||||
@@ -967,7 +968,7 @@ let MakeRepresentation = (props) => {
|
||||
(file) =>
|
||||
file &&
|
||||
typeof file === "object" &&
|
||||
Object.keys(file).length > 0
|
||||
Object.keys(file).length > 0,
|
||||
)
|
||||
.filter((file) => file.name !== undefined);
|
||||
|
||||
@@ -1002,7 +1003,7 @@ let MakeRepresentation = (props) => {
|
||||
dataObj,
|
||||
[{}],
|
||||
updatedValues.containerID,
|
||||
`${props.caseReference}/${dataObj.repfile_name}`
|
||||
`${props.caseReference}/${dataObj.repfile_name}`,
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1026,7 +1027,7 @@ let MakeRepresentation = (props) => {
|
||||
return formatDates(
|
||||
detailsObj.pinswg_questionnaireduedate ||
|
||||
detailsObj.pinswg_endofrepresentationperiod ||
|
||||
detailsObj.pinswg_consultationclose
|
||||
detailsObj.pinswg_consultationclose,
|
||||
);
|
||||
}
|
||||
return "N/A";
|
||||
@@ -1039,7 +1040,7 @@ let MakeRepresentation = (props) => {
|
||||
{formatDates(
|
||||
detailsObj.pinswg_statementduedate ||
|
||||
detailsObj.pinswg_statementsduedate ||
|
||||
detailsObj.pinswg_endofrepresentationperiod
|
||||
detailsObj.pinswg_endofrepresentationperiod,
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
@@ -1113,10 +1114,10 @@ let MakeRepresentation = (props) => {
|
||||
<h1 className="govuk-heading-l">
|
||||
{appealIsConsultation
|
||||
? t(
|
||||
"myrepresentations:make-a-consultation-on-label"
|
||||
"myrepresentations:make-a-consultation-on-label",
|
||||
)
|
||||
: t(
|
||||
"myrepresentations:make-a-representation-on-label"
|
||||
"myrepresentations:make-a-representation-on-label",
|
||||
)}{" "}
|
||||
{currentView.caseReference.currentReference}{" "}
|
||||
</h1>
|
||||
@@ -1130,17 +1131,17 @@ let MakeRepresentation = (props) => {
|
||||
<div className="card-body">
|
||||
<h2 className="govuk-heading-s">
|
||||
{t(
|
||||
"myrepresentations:timetable-title"
|
||||
"myrepresentations:timetable-title",
|
||||
)}
|
||||
</h2>
|
||||
<div className="govuk-summary-list">
|
||||
<div className="govuk-body-s">
|
||||
{appealIsLocalImpact
|
||||
? t(
|
||||
"myrepresentations:local-impact-report"
|
||||
"myrepresentations:local-impact-report",
|
||||
)
|
||||
: t(
|
||||
"myrepresentations:questionnaire-due-label"
|
||||
"myrepresentations:questionnaire-due-label",
|
||||
)}
|
||||
:{" "}
|
||||
<span className="govuk-body-s">
|
||||
@@ -1210,11 +1211,11 @@ const selector = formValueSelector("representationForm");
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
mapDispatchToProps,
|
||||
)(
|
||||
reduxForm({
|
||||
form: "representationForm",
|
||||
destroyOnUnmount: false,
|
||||
enableReinitialize: true,
|
||||
})(MakeRepresentation)
|
||||
})(MakeRepresentation),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user