@@ -1,3 +1,5 @@
|
||||
import { getAppealTypeFamily } from "../appeal-type-policy";
|
||||
|
||||
const APPEAL_TYPES = {
|
||||
SIPS: 846040002,
|
||||
DNS: 846040011,
|
||||
@@ -22,6 +24,11 @@ const REPRESENTATION_OPTIONS = {
|
||||
MARINE_IMPACT_REPORT: "Marine Impact Report"
|
||||
};
|
||||
|
||||
const APPEAL_TYPE_FAMILIES = {
|
||||
DNS: "DNS",
|
||||
SIPS: "SIP"
|
||||
};
|
||||
|
||||
const isValidDate = (date) =>
|
||||
date instanceof Date && !Number.isNaN(date.getTime());
|
||||
|
||||
@@ -34,15 +41,16 @@ const isWithinWindow = (now, start, end) => {
|
||||
};
|
||||
|
||||
const addQuestionnaire = (options, ctx) => {
|
||||
const appealTypeFamily = getAppealTypeFamily(ctx.appealType);
|
||||
const excludedTypes = [
|
||||
APPEAL_TYPES.EXCLUDE_QUESTIONNAIRE_1,
|
||||
APPEAL_TYPES.DNS,
|
||||
APPEAL_TYPES.EXCLUDE_QUESTIONNAIRE_2,
|
||||
APPEAL_TYPES.EXCLUDE_QUESTIONNAIRE_3
|
||||
];
|
||||
|
||||
const canAdd =
|
||||
ctx.isLPA &&
|
||||
appealTypeFamily !== APPEAL_TYPE_FAMILIES.DNS &&
|
||||
!excludedTypes.includes(ctx.appealType) &&
|
||||
isWithinWindow(ctx.now, ctx.startDate, ctx.finalCommentsDueDate);
|
||||
|
||||
@@ -52,6 +60,9 @@ const addQuestionnaire = (options, ctx) => {
|
||||
};
|
||||
|
||||
const addStatements = (options, ctx) => {
|
||||
const appealTypeFamily = getAppealTypeFamily(ctx.appealType);
|
||||
const isDnsAppeal = appealTypeFamily === APPEAL_TYPE_FAMILIES.DNS;
|
||||
|
||||
const isLpaAdvertPart3NoStatement =
|
||||
ctx.isLPA &&
|
||||
ctx.appealType === APPEAL_TYPES.ADVERT &&
|
||||
@@ -59,7 +70,7 @@ const addStatements = (options, ctx) => {
|
||||
|
||||
const canAddDnsLpaDocs =
|
||||
ctx.isLPA &&
|
||||
ctx.isDNS &&
|
||||
isDnsAppeal &&
|
||||
ctx.appealType !== APPEAL_TYPES.EXCLUDE_QUESTIONNAIRE_1 &&
|
||||
!ctx.isCaseOwner &&
|
||||
isWithinWindow(ctx.now, ctx.startDate, ctx.finalCommentsDueDate);
|
||||
@@ -70,7 +81,7 @@ const addStatements = (options, ctx) => {
|
||||
}
|
||||
|
||||
const canAddStatementForNonDns =
|
||||
!ctx.isDNS &&
|
||||
!isDnsAppeal &&
|
||||
ctx.appealType !== APPEAL_TYPES.HOUSEHOLDER &&
|
||||
!isLpaAdvertPart3NoStatement &&
|
||||
!ctx.isCaseOwner &&
|
||||
@@ -81,7 +92,7 @@ const addStatements = (options, ctx) => {
|
||||
}
|
||||
|
||||
const canAddStatementForDnsNonLpa =
|
||||
ctx.isDNS &&
|
||||
isDnsAppeal &&
|
||||
!ctx.isLPA &&
|
||||
!ctx.isCaseOwner &&
|
||||
isWithinWindow(ctx.now, ctx.startDate, ctx.statementDueDate);
|
||||
@@ -92,20 +103,23 @@ const addStatements = (options, ctx) => {
|
||||
};
|
||||
|
||||
const addFinalComments = (options, ctx) => {
|
||||
const appealTypeFamily = getAppealTypeFamily(ctx.appealType);
|
||||
const isDnsAppeal = appealTypeFamily === APPEAL_TYPE_FAMILIES.DNS;
|
||||
|
||||
const canSubmitFinalCommentsDefault =
|
||||
ctx.isSelectedAppellant ||
|
||||
ctx.isSelectedAgent ||
|
||||
ctx.isSelectedInterestedParty ||
|
||||
ctx.isLPA;
|
||||
|
||||
const canSubmitFinalComments = ctx.isDNS
|
||||
const canSubmitFinalComments = isDnsAppeal
|
||||
? ctx.isLPA
|
||||
: canSubmitFinalCommentsDefault;
|
||||
|
||||
const isSpecialistNonHearing =
|
||||
ctx.specialistProcess !== SPECIALIST_PROCESS.HEARING;
|
||||
|
||||
const finalCommentsWindowStart = ctx.isDNS
|
||||
const finalCommentsWindowStart = isDnsAppeal
|
||||
? ctx.startDate
|
||||
: ctx.statementDueDate;
|
||||
|
||||
@@ -124,7 +138,9 @@ const addFinalComments = (options, ctx) => {
|
||||
};
|
||||
|
||||
const addConsultation = (options, ctx) => {
|
||||
if (!ctx.isSIPS) return;
|
||||
const appealTypeFamily = getAppealTypeFamily(ctx.appealType);
|
||||
|
||||
if (appealTypeFamily !== APPEAL_TYPE_FAMILIES.SIPS) return;
|
||||
|
||||
options.add(REPRESENTATION_OPTIONS.CONSULTATION_RESPONSE);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user