Files
pedwfrontend/components/case/summary/utils/representationEntry.js
T
Robert Bond 7b6af58065 Merged PR 2441: electricity shouldnt be showing reps available
electricity shouldnt be showing reps available

Related work items: #24008
2026-06-29 08:39:39 +00:00

93 lines
2.5 KiB
JavaScript

import {
resolveRepresentationWindow,
isRepresentationWindowOpen,
isRepresentationWindowClosed,
canShowRepresentationButtonForAppealType,
canStartHouseholderRepresentation,
canStartCpoRepresentation,
canStartRowRepresentation,
canStartAdvertRepresentation
} from "../../../../lib/domain/representation-policy";
export function showRepsLocal(startDate, endDate) {
return isRepresentationWindowOpen(startDate, endDate);
}
export function showRepsEndedLocal(startDate, endDate) {
return isRepresentationWindowClosed(startDate, endDate);
}
export function isConsultationWindowOpen(detailsObj) {
return showRepsLocal(
detailsObj.pinswg_consultationopen,
detailsObj.pinswg_consultationclose
);
}
export function isGeneralRepresentationWindowOpen(detailsObj) {
return resolveRepresentationWindow(detailsObj).isOpen;
}
export function canShowRepButtonForAppealType({
appealType,
isLPA,
searchDetailsObj
}) {
if (!canShowRepresentationButtonForAppealType(appealType)) {
return false;
}
switch (appealType) {
case 846040004:
return canStartHouseholderRepresentation(appealType, isLPA);
case 846040015:
return canStartRowRepresentation(
appealType,
searchDetailsObj[0].value[0]
);
case 846040018:
return canStartAdvertRepresentation(
appealType,
searchDetailsObj[0].value[0],
isLPA
);
case 846040019:
return canStartCpoRepresentation(
appealType,
searchDetailsObj[0].value[0]
);
default:
return true;
}
}
export function getEntryCtaLabelKey(appealType) {
return appealType == 846040002
? "case:summary-make-consultation-label"
: "case:summary-make-representation-label";
}
export function shouldSuppressBlockedMessage({ appealType, isLPA }) {
if (!canShowRepresentationButtonForAppealType(appealType)) {
return true;
}
return !isLPA && appealType == 846040004;
}
export function getGeneralBlockedEndDate(detailsObj, appealType) {
return appealType == 846040019
? detailsObj.pinswg_statementduedate
: detailsObj.pinswg_finalcommentsduedate;
}
export function isRepresentationPeriodEnded(detailsObj) {
return showRepsEndedLocal(
detailsObj.pinswg_startdate,
detailsObj.pinswg_finalcommentsduedate
);
}