removed app if not an app in capacity
This commit is contained in:
@@ -225,10 +225,16 @@ let MakeRepresentation = (props) => {
|
|||||||
|
|
||||||
var detailsObj = {};
|
var detailsObj = {};
|
||||||
|
|
||||||
const capacityOptionsArr = [
|
const isAppellant =
|
||||||
t("myrepresentations:capacity-options-arr-appellant"),
|
props.props.accountDetails.accountDetails.pinswg_typeofinvolvement ===
|
||||||
t("myrepresentations:capacity-options-arr-agent")
|
846040001;
|
||||||
];
|
|
||||||
|
const capacityOptionsArr = [];
|
||||||
|
|
||||||
|
isAppellant &&
|
||||||
|
capacityOptionsArr.push(
|
||||||
|
t("myrepresentations:capacity-options-arr-appellant")
|
||||||
|
);
|
||||||
|
|
||||||
const shouldIncludeInterested =
|
const shouldIncludeInterested =
|
||||||
appealType !== 846040017 ||
|
appealType !== 846040017 ||
|
||||||
@@ -236,7 +242,8 @@ let MakeRepresentation = (props) => {
|
|||||||
|
|
||||||
if (shouldIncludeInterested) {
|
if (shouldIncludeInterested) {
|
||||||
capacityOptionsArr.push(
|
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 safeDetailsObj = detailsObj || {};
|
||||||
const safeResultsObj = resultsObj || {};
|
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 buildRepsArr = (detailsObj) => {
|
||||||
const buildArr = [];
|
const buildArr = [];
|
||||||
const todaysDate = new Date();
|
const todaysDate = new Date();
|
||||||
|
|
||||||
const isDNS = appealType === 846040011;
|
const isDNS = appealType === 846040011;
|
||||||
const isSIPS = appealType === 846040002;
|
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(
|
const startDate = new Date(
|
||||||
isDNS
|
isDNS
|
||||||
? detailsObj.pinswg_applicationacceptedasvalid
|
? 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
|
|
||||||
);
|
|
||||||
questionnaireDate.setHours(23, 59, 59, 999);
|
|
||||||
|
|
||||||
const finalCommentsDate = new Date(
|
const finalCommentsDate = new Date(
|
||||||
isDNS
|
isDNS
|
||||||
? detailsObj.pinswg_endofrepresentationperiod
|
? detailsObj.pinswg_endofrepresentationperiod
|
||||||
@@ -330,85 +462,84 @@ let MakeRepresentation = (props) => {
|
|||||||
);
|
);
|
||||||
statementDueDate.setHours(23, 59, 59, 999);
|
statementDueDate.setHours(23, 59, 59, 999);
|
||||||
|
|
||||||
// Shared condition
|
|
||||||
const isWithin = (start, end) =>
|
const isWithin = (start, end) =>
|
||||||
todaysDate >= start && todaysDate <= end;
|
todaysDate >= start && todaysDate <= end;
|
||||||
const notAppeal = (...types) => !types.includes(appealType);
|
|
||||||
|
|
||||||
// Questionnaire
|
const addRep = (value) => {
|
||||||
if (
|
if (!buildArr.includes(value)) {
|
||||||
|
buildArr.push(value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const canAddQuestionnaire =
|
||||||
isLPA &&
|
isLPA &&
|
||||||
notAppeal(846040019, 846040011, 846040015, 846040016) &&
|
![846040019, 846040011, 846040015, 846040016].includes(
|
||||||
isWithin(startDate, finalCommentsDate)
|
appealType
|
||||||
) {
|
) &&
|
||||||
buildArr.push("Questionnaire");
|
isWithin(startDate, finalCommentsDate);
|
||||||
|
|
||||||
|
if (canAddQuestionnaire) {
|
||||||
|
addRep("Questionnaire");
|
||||||
}
|
}
|
||||||
|
|
||||||
// DNS LPA Documents
|
const isLpaAdvertPart3NoStatement =
|
||||||
if (
|
isLPA &&
|
||||||
|
appealType === 846040018 &&
|
||||||
|
specialistProcess === 846040000;
|
||||||
|
|
||||||
|
const canAddDnsLpaDocs =
|
||||||
isLPA &&
|
isLPA &&
|
||||||
isDNS &&
|
isDNS &&
|
||||||
appealType !== 846040019 &&
|
appealType !== 846040019 &&
|
||||||
isWithin(startDate, finalCommentsDate)
|
!isAppellant &&
|
||||||
) {
|
isWithin(startDate, finalCommentsDate);
|
||||||
buildArr.push("Local Impact Report", "Statement");
|
|
||||||
|
if (canAddDnsLpaDocs) {
|
||||||
|
addRep("Local Impact Report");
|
||||||
|
addRep("Statement");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Non-DNS Statement
|
const canAddStatementForNonDns =
|
||||||
if (
|
|
||||||
!isDNS &&
|
!isDNS &&
|
||||||
appealType !== 846040004 &&
|
appealType !== 846040004 &&
|
||||||
isWithin(startDate, statementDueDate)
|
!isLpaAdvertPart3NoStatement &&
|
||||||
) {
|
!isAppellant &&
|
||||||
buildArr.push("Statement");
|
isWithin(startDate, statementDueDate);
|
||||||
|
|
||||||
|
if (canAddStatementForNonDns) {
|
||||||
|
addRep("Statement");
|
||||||
}
|
}
|
||||||
|
|
||||||
// DNS Non-LPA Statement
|
const canAddStatementForDnsNonLpa =
|
||||||
if (isDNS && !isLPA && isWithin(startDate, statementDueDate)) {
|
isDNS &&
|
||||||
buildArr.push("Statement");
|
!isLPA &&
|
||||||
|
!isAppellant &&
|
||||||
|
isWithin(startDate, statementDueDate);
|
||||||
|
|
||||||
|
if (canAddStatementForDnsNonLpa) {
|
||||||
|
addRep("Statement");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Final Comments
|
const canAddFinalComments =
|
||||||
const isSpecialistNonHearing =
|
isAppellant &&
|
||||||
currentView.caseReference.specialistProcess !== 846040001;
|
isWithin(statementDueDate, finalCommentsDate) &&
|
||||||
|
(appealType !== 846040004 || isSpecialistNonHearing);
|
||||||
|
|
||||||
if (
|
if (canAddFinalComments) {
|
||||||
(appealType !== 846040004 ||
|
addRep("Final comments");
|
||||||
(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) {
|
if (isSIPS) {
|
||||||
const capacity = repCapacityType();
|
const capacity = repCapacityType();
|
||||||
if (capacity === "appellant") {
|
|
||||||
buildArr.push("Consultation Response");
|
addRep("Consultation Response");
|
||||||
} else {
|
|
||||||
buildArr.push("Consultation Response", "Local Impact Report");
|
if (capacity !== "appellant") {
|
||||||
|
addRep("Local Impact Report");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNRW) {
|
if (isNRW) {
|
||||||
buildArr.push("Marine Impact Report");
|
addRep("Marine Impact Report");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ let RepCapacitySelection = (props) => {
|
|||||||
casesObj,
|
casesObj,
|
||||||
validate,
|
validate,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
setCurrentReference,
|
setCurrentReference
|
||||||
} = props;
|
} = props;
|
||||||
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
|
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
|
||||||
const files = acceptedFiles.map((file) => (
|
const files = acceptedFiles.map((file) => (
|
||||||
@@ -52,7 +52,7 @@ let RepCapacitySelection = (props) => {
|
|||||||
{t(
|
{t(
|
||||||
"myrepresentations:capacity-select-your-details"
|
"myrepresentations:capacity-select-your-details"
|
||||||
)}{" "}
|
)}{" "}
|
||||||
- {props.firstValue}
|
- {props.firstValue}{" "}
|
||||||
</h2>
|
</h2>
|
||||||
<Field
|
<Field
|
||||||
name="representationCapacity"
|
name="representationCapacity"
|
||||||
|
|||||||
@@ -326,7 +326,6 @@ const CaseSummary = (props) => {
|
|||||||
|
|
||||||
const buildSearchHref = (router, session) => {
|
const buildSearchHref = (router, session) => {
|
||||||
const { va, adv, ads, key } = router.query;
|
const { va, adv, ads, key } = router.query;
|
||||||
console.log(router);
|
|
||||||
|
|
||||||
const isDnsRoute =
|
const isDnsRoute =
|
||||||
router.pathname === "/dns" ||
|
router.pathname === "/dns" ||
|
||||||
|
|||||||
Reference in New Issue
Block a user