Merged PR 2407: Extract representation entry specialist rules to domain policy
Extract representation entry specialist rules to domain policy Related work items: #23754
This commit is contained in:
@@ -4,7 +4,9 @@ import {
|
|||||||
isRepresentationWindowClosed,
|
isRepresentationWindowClosed,
|
||||||
canShowRepresentationButtonForAppealType,
|
canShowRepresentationButtonForAppealType,
|
||||||
canStartHouseholderRepresentation,
|
canStartHouseholderRepresentation,
|
||||||
canStartCpoRepresentation
|
canStartCpoRepresentation,
|
||||||
|
canStartRowRepresentation,
|
||||||
|
canStartAdvertRepresentation
|
||||||
} from "../../../../lib/domain/representation-policy";
|
} from "../../../../lib/domain/representation-policy";
|
||||||
|
|
||||||
export function showRepsLocal(startDate, endDate) {
|
export function showRepsLocal(startDate, endDate) {
|
||||||
@@ -40,25 +42,17 @@ export function canShowRepButtonForAppealType({
|
|||||||
return canStartHouseholderRepresentation(appealType, isLPA);
|
return canStartHouseholderRepresentation(appealType, isLPA);
|
||||||
|
|
||||||
case 846040015:
|
case 846040015:
|
||||||
return searchDetailsObj[0].value[0].pinswg_specialistcaseprocess ==
|
return canStartRowRepresentation(
|
||||||
846040001
|
appealType,
|
||||||
? showRepsLocal(
|
searchDetailsObj[0].value[0]
|
||||||
searchDetailsObj[0].value[0].pinswg_startdate,
|
);
|
||||||
searchDetailsObj[0].value[0].pinswg_finalcommentsduedate
|
|
||||||
)
|
|
||||||
: true;
|
|
||||||
|
|
||||||
case 846040018:
|
case 846040018:
|
||||||
let shouldShow =
|
return canStartAdvertRepresentation(
|
||||||
searchDetailsObj[0].value[0].pinswg_speacialistcaseprocess ==
|
appealType,
|
||||||
846040000 && isLPA
|
searchDetailsObj[0].value[0],
|
||||||
? true
|
isLPA
|
||||||
: searchDetailsObj[0].value[0]
|
);
|
||||||
.pinswg_speacialistcaseprocess == 846040001
|
|
||||||
? true
|
|
||||||
: false;
|
|
||||||
|
|
||||||
return shouldShow;
|
|
||||||
|
|
||||||
case 846040019:
|
case 846040019:
|
||||||
return canStartCpoRepresentation(
|
return canStartCpoRepresentation(
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
const ADVERT_APPEAL_TYPE = 846040018;
|
||||||
|
const WRITTEN_REPS_SPECIALIST_PROCESS = 846040000;
|
||||||
|
const HEARING_SPECIALIST_PROCESS = 846040001;
|
||||||
|
|
||||||
|
export function canStartAdvertRepresentation(appealType, caseDetails, isLPA) {
|
||||||
|
if (Number(appealType) !== ADVERT_APPEAL_TYPE) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const specialistProcess = caseDetails?.pinswg_speacialistcaseprocess;
|
||||||
|
|
||||||
|
return specialistProcess == WRITTEN_REPS_SPECIALIST_PROCESS && isLPA
|
||||||
|
? true
|
||||||
|
: specialistProcess == HEARING_SPECIALIST_PROCESS
|
||||||
|
? true
|
||||||
|
: false;
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import { isRepresentationWindowOpen } from "./resolveRepresentationWindow";
|
||||||
|
|
||||||
|
const ROW_APPEAL_TYPE = 846040015;
|
||||||
|
const HEARING_SPECIALIST_PROCESS = 846040001;
|
||||||
|
|
||||||
|
export function canStartRowRepresentation(
|
||||||
|
appealType,
|
||||||
|
caseDetails,
|
||||||
|
DateCtor = Date
|
||||||
|
) {
|
||||||
|
if (Number(appealType) !== ROW_APPEAL_TYPE) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return caseDetails?.pinswg_specialistcaseprocess ==
|
||||||
|
HEARING_SPECIALIST_PROCESS
|
||||||
|
? isRepresentationWindowOpen(
|
||||||
|
caseDetails?.pinswg_startdate,
|
||||||
|
caseDetails?.pinswg_finalcommentsduedate,
|
||||||
|
DateCtor
|
||||||
|
)
|
||||||
|
: true;
|
||||||
|
}
|
||||||
@@ -7,3 +7,5 @@ export {
|
|||||||
export { canShowRepresentationButtonForAppealType } from "./canShowRepresentationButtonForAppealType";
|
export { canShowRepresentationButtonForAppealType } from "./canShowRepresentationButtonForAppealType";
|
||||||
export { canStartHouseholderRepresentation } from "./canStartHouseholderRepresentation";
|
export { canStartHouseholderRepresentation } from "./canStartHouseholderRepresentation";
|
||||||
export { canStartCpoRepresentation } from "./canStartCpoRepresentation";
|
export { canStartCpoRepresentation } from "./canStartCpoRepresentation";
|
||||||
|
export { canStartRowRepresentation } from "./canStartRowRepresentation";
|
||||||
|
export { canStartAdvertRepresentation } from "./canStartAdvertRepresentation";
|
||||||
|
|||||||
Reference in New Issue
Block a user