Merged PR 2178: removed app if not an app in capacity
removed app if not an app in capacity Related work items: #22095
This commit is contained in:
@@ -225,10 +225,16 @@ let MakeRepresentation = (props) => {
|
||||
|
||||
var detailsObj = {};
|
||||
|
||||
const capacityOptionsArr = [
|
||||
t("myrepresentations:capacity-options-arr-appellant"),
|
||||
t("myrepresentations:capacity-options-arr-agent")
|
||||
];
|
||||
const isAppellant =
|
||||
props.props.accountDetails.accountDetails.pinswg_typeofinvolvement ===
|
||||
846040001;
|
||||
|
||||
const capacityOptionsArr = [];
|
||||
|
||||
isAppellant &&
|
||||
capacityOptionsArr.push(
|
||||
t("myrepresentations:capacity-options-arr-appellant")
|
||||
);
|
||||
|
||||
const shouldIncludeInterested =
|
||||
appealType !== 846040017 ||
|
||||
@@ -236,7 +242,8 @@ let MakeRepresentation = (props) => {
|
||||
|
||||
if (shouldIncludeInterested) {
|
||||
capacityOptionsArr.push(
|
||||
t("myrepresentations:capacity-options-arr-interested")
|
||||
t("myrepresentations:capacity-options-arr-interested"),
|
||||
t("myrepresentations:capacity-options-arr-agent")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -293,28 +300,153 @@ let MakeRepresentation = (props) => {
|
||||
const safeDetailsObj = detailsObj || {};
|
||||
const safeResultsObj = resultsObj || {};
|
||||
|
||||
// blocked out build reps arr for refactoring
|
||||
// const buildRepsArr = (detailsObj) => {
|
||||
// const buildArr = [];
|
||||
// const todaysDate = new Date();
|
||||
|
||||
// const isDNS = appealType === 846040011;
|
||||
// const isSIPS = appealType === 846040002;
|
||||
// const isIP = true;
|
||||
|
||||
// const isAppellant =
|
||||
// props.props.accountDetails.accountDetails
|
||||
// .pinswg_typeofinvolvement === 846040001;
|
||||
|
||||
// // Determine key dates based on appeal type
|
||||
// const startDate = new Date(
|
||||
// isDNS
|
||||
// ? detailsObj.pinswg_applicationacceptedasvalid
|
||||
// : detailsObj.pinswg_startdate || detailsObj.pinswg_startdates
|
||||
// );
|
||||
|
||||
// const questionnaireDate = new Date(
|
||||
// isDNS
|
||||
// ? detailsObj.pinswg_endofrepresentationperiod
|
||||
// : detailsObj.pinswg_questionnaireduedate
|
||||
// );
|
||||
// questionnaireDate.setHours(23, 59, 59, 999);
|
||||
|
||||
// const finalCommentsDate = new Date(
|
||||
// isDNS
|
||||
// ? detailsObj.pinswg_endofrepresentationperiod
|
||||
// : detailsObj.pinswg_finalcommentsduedate
|
||||
// );
|
||||
// finalCommentsDate.setHours(23, 59, 59, 999);
|
||||
|
||||
// const statementDueDate = new Date(
|
||||
// isDNS
|
||||
// ? detailsObj.pinswg_endofrepresentationperiod
|
||||
// : detailsObj.pinswg_statementduedate ||
|
||||
// detailsObj.pinswg_statementsduedate
|
||||
// );
|
||||
// statementDueDate.setHours(23, 59, 59, 999);
|
||||
|
||||
// // Shared condition
|
||||
// const isWithin = (start, end) =>
|
||||
// todaysDate >= start && todaysDate <= end;
|
||||
// const notAppeal = (...types) => !types.includes(appealType);
|
||||
|
||||
// // Questionnaire
|
||||
// if (
|
||||
// isLPA &&
|
||||
// notAppeal(846040019, 846040011, 846040015, 846040016) &&
|
||||
// isWithin(startDate, finalCommentsDate)
|
||||
// ) {
|
||||
// buildArr.push("Questionnaire");
|
||||
// }
|
||||
|
||||
// // DNS LPA Documents
|
||||
// if (
|
||||
// isLPA &&
|
||||
// isDNS &&
|
||||
// appealType !== 846040019 &&
|
||||
// isWithin(startDate, finalCommentsDate)
|
||||
// ) {
|
||||
// buildArr.push("Local Impact Report", "Statement");
|
||||
// }
|
||||
|
||||
// // Non-DNS Statement
|
||||
// if (
|
||||
// !isDNS &&
|
||||
// appealType !== 846040004 &&
|
||||
// isWithin(startDate, statementDueDate)
|
||||
// ) {
|
||||
// buildArr.push("Statement");
|
||||
// }
|
||||
|
||||
// // DNS Non-LPA Statement
|
||||
// if (isDNS && !isLPA && isWithin(startDate, statementDueDate)) {
|
||||
// buildArr.push("Statement");
|
||||
// }
|
||||
|
||||
// // Final Comments
|
||||
// const isSpecialistNonHearing =
|
||||
// currentView.caseReference.specialistProcess !== 846040001;
|
||||
|
||||
// if (
|
||||
// (appealType !== 846040004 ||
|
||||
// (appealType === 846040015 && isSpecialistNonHearing)) &&
|
||||
// isWithin(statementDueDate, finalCommentsDate)
|
||||
// ) {
|
||||
// buildArr.push("Final comments");
|
||||
// }
|
||||
|
||||
// if (
|
||||
// appealType === 846040004 &&
|
||||
// isSpecialistNonHearing &&
|
||||
// isWithin(statementDueDate, finalCommentsDate)
|
||||
// ) {
|
||||
// buildArr.push("Final comments");
|
||||
// }
|
||||
|
||||
// // Remove "Statement" for LPA Advert Part 3 (no statement)
|
||||
// if (
|
||||
// isLPA &&
|
||||
// appealType === 846040018 &&
|
||||
// currentView.caseReference.specialistProcess === 846040000
|
||||
// ) {
|
||||
// const index = buildArr.indexOf("Statement");
|
||||
// if (index !== -1) buildArr.splice(index, 1);
|
||||
// }
|
||||
|
||||
// // SIPS-related documents
|
||||
// if (isSIPS) {
|
||||
// const capacity = repCapacityType();
|
||||
// if (capacity === "appellant") {
|
||||
// buildArr.push("Consultation Response");
|
||||
// } else {
|
||||
// buildArr.push("Consultation Response", "Local Impact Report");
|
||||
// }
|
||||
|
||||
// if (isNRW) {
|
||||
// buildArr.push("Marine Impact Report");
|
||||
// }
|
||||
// }
|
||||
|
||||
// return buildArr;
|
||||
// };
|
||||
|
||||
const buildRepsArr = (detailsObj) => {
|
||||
const buildArr = [];
|
||||
const todaysDate = new Date();
|
||||
|
||||
const isDNS = appealType === 846040011;
|
||||
const isSIPS = appealType === 846040002;
|
||||
const isIP = true;
|
||||
const specialistProcess = currentView.caseReference.specialistProcess;
|
||||
|
||||
const isSpecialistNonHearing = specialistProcess !== 846040001;
|
||||
|
||||
const isAppellant =
|
||||
props.props?.accountDetails?.accountDetails
|
||||
?.pinswg_typeofinvolvement === 846040001;
|
||||
|
||||
// Determine key dates based on appeal type
|
||||
const startDate = new Date(
|
||||
isDNS
|
||||
? detailsObj.pinswg_applicationacceptedasvalid
|
||||
: detailsObj.pinswg_startdate || detailsObj.pinswg_startdates
|
||||
);
|
||||
|
||||
const questionnaireDate = new Date(
|
||||
isDNS
|
||||
? detailsObj.pinswg_endofrepresentationperiod
|
||||
: detailsObj.pinswg_questionnaireduedate
|
||||
);
|
||||
questionnaireDate.setHours(23, 59, 59, 999);
|
||||
|
||||
const finalCommentsDate = new Date(
|
||||
isDNS
|
||||
? detailsObj.pinswg_endofrepresentationperiod
|
||||
@@ -330,85 +462,84 @@ let MakeRepresentation = (props) => {
|
||||
);
|
||||
statementDueDate.setHours(23, 59, 59, 999);
|
||||
|
||||
// Shared condition
|
||||
const isWithin = (start, end) =>
|
||||
todaysDate >= start && todaysDate <= end;
|
||||
const notAppeal = (...types) => !types.includes(appealType);
|
||||
|
||||
// Questionnaire
|
||||
if (
|
||||
const addRep = (value) => {
|
||||
if (!buildArr.includes(value)) {
|
||||
buildArr.push(value);
|
||||
}
|
||||
};
|
||||
|
||||
const canAddQuestionnaire =
|
||||
isLPA &&
|
||||
notAppeal(846040019, 846040011, 846040015, 846040016) &&
|
||||
isWithin(startDate, finalCommentsDate)
|
||||
) {
|
||||
buildArr.push("Questionnaire");
|
||||
![846040019, 846040011, 846040015, 846040016].includes(
|
||||
appealType
|
||||
) &&
|
||||
isWithin(startDate, finalCommentsDate);
|
||||
|
||||
if (canAddQuestionnaire) {
|
||||
addRep("Questionnaire");
|
||||
}
|
||||
|
||||
// DNS LPA Documents
|
||||
if (
|
||||
const isLpaAdvertPart3NoStatement =
|
||||
isLPA &&
|
||||
appealType === 846040018 &&
|
||||
specialistProcess === 846040000;
|
||||
|
||||
const canAddDnsLpaDocs =
|
||||
isLPA &&
|
||||
isDNS &&
|
||||
appealType !== 846040019 &&
|
||||
isWithin(startDate, finalCommentsDate)
|
||||
) {
|
||||
buildArr.push("Local Impact Report", "Statement");
|
||||
!isAppellant &&
|
||||
isWithin(startDate, finalCommentsDate);
|
||||
|
||||
if (canAddDnsLpaDocs) {
|
||||
addRep("Local Impact Report");
|
||||
addRep("Statement");
|
||||
}
|
||||
|
||||
// Non-DNS Statement
|
||||
if (
|
||||
const canAddStatementForNonDns =
|
||||
!isDNS &&
|
||||
appealType !== 846040004 &&
|
||||
isWithin(startDate, statementDueDate)
|
||||
) {
|
||||
buildArr.push("Statement");
|
||||
!isLpaAdvertPart3NoStatement &&
|
||||
!isAppellant &&
|
||||
isWithin(startDate, statementDueDate);
|
||||
|
||||
if (canAddStatementForNonDns) {
|
||||
addRep("Statement");
|
||||
}
|
||||
|
||||
// DNS Non-LPA Statement
|
||||
if (isDNS && !isLPA && isWithin(startDate, statementDueDate)) {
|
||||
buildArr.push("Statement");
|
||||
const canAddStatementForDnsNonLpa =
|
||||
isDNS &&
|
||||
!isLPA &&
|
||||
!isAppellant &&
|
||||
isWithin(startDate, statementDueDate);
|
||||
|
||||
if (canAddStatementForDnsNonLpa) {
|
||||
addRep("Statement");
|
||||
}
|
||||
|
||||
// Final Comments
|
||||
const isSpecialistNonHearing =
|
||||
currentView.caseReference.specialistProcess !== 846040001;
|
||||
const canAddFinalComments =
|
||||
isAppellant &&
|
||||
isWithin(statementDueDate, finalCommentsDate) &&
|
||||
(appealType !== 846040004 || isSpecialistNonHearing);
|
||||
|
||||
if (
|
||||
(appealType !== 846040004 ||
|
||||
(appealType === 846040015 && isSpecialistNonHearing)) &&
|
||||
isWithin(statementDueDate, finalCommentsDate)
|
||||
) {
|
||||
buildArr.push("Final comments");
|
||||
if (canAddFinalComments) {
|
||||
addRep("Final comments");
|
||||
}
|
||||
|
||||
if (
|
||||
appealType === 846040004 &&
|
||||
isSpecialistNonHearing &&
|
||||
isWithin(statementDueDate, finalCommentsDate)
|
||||
) {
|
||||
buildArr.push("Final comments");
|
||||
}
|
||||
|
||||
// Remove "Statement" for LPA Advert Part 3 (no statement)
|
||||
if (
|
||||
isLPA &&
|
||||
appealType === 846040018 &&
|
||||
currentView.caseReference.specialistProcess === 846040000
|
||||
) {
|
||||
const index = buildArr.indexOf("Statement");
|
||||
if (index !== -1) buildArr.splice(index, 1);
|
||||
}
|
||||
|
||||
// SIPS-related documents
|
||||
if (isSIPS) {
|
||||
const capacity = repCapacityType();
|
||||
if (capacity === "appellant") {
|
||||
buildArr.push("Consultation Response");
|
||||
} else {
|
||||
buildArr.push("Consultation Response", "Local Impact Report");
|
||||
|
||||
addRep("Consultation Response");
|
||||
|
||||
if (capacity !== "appellant") {
|
||||
addRep("Local Impact Report");
|
||||
}
|
||||
|
||||
if (isNRW) {
|
||||
buildArr.push("Marine Impact Report");
|
||||
addRep("Marine Impact Report");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ let RepCapacitySelection = (props) => {
|
||||
casesObj,
|
||||
validate,
|
||||
handleSubmit,
|
||||
setCurrentReference,
|
||||
setCurrentReference
|
||||
} = props;
|
||||
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
|
||||
const files = acceptedFiles.map((file) => (
|
||||
@@ -52,7 +52,7 @@ let RepCapacitySelection = (props) => {
|
||||
{t(
|
||||
"myrepresentations:capacity-select-your-details"
|
||||
)}{" "}
|
||||
- {props.firstValue}
|
||||
- {props.firstValue}{" "}
|
||||
</h2>
|
||||
<Field
|
||||
name="representationCapacity"
|
||||
|
||||
@@ -326,7 +326,6 @@ const CaseSummary = (props) => {
|
||||
|
||||
const buildSearchHref = (router, session) => {
|
||||
const { va, adv, ads, key } = router.query;
|
||||
console.log(router);
|
||||
|
||||
const isDnsRoute =
|
||||
router.pathname === "/dns" ||
|
||||
|
||||
Reference in New Issue
Block a user