export function showRepsLocal(startDate, endDate) { let date = new Date(); date = new Date(date.toDateString()); const start = new Date(startDate); const end = new Date(endDate); return date >= start && date <= end ? true : false; } export function showRepsEndedLocal(startDate, endDate) { let date = new Date(); date = new Date(date.toDateString()); const start = new Date(startDate); const end = new Date(endDate); return date > start && date > end ? true : false; } export function isConsultationWindowOpen(detailsObj) { return showRepsLocal( detailsObj.pinswg_consultationopen, detailsObj.pinswg_consultationclose ); } export function isGeneralRepresentationWindowOpen(detailsObj) { return ( (Object.prototype.hasOwnProperty.call(detailsObj, "pinswg_startdate") || Object.prototype.hasOwnProperty.call( detailsObj, "pinswg_applicationacceptedasvalid" ) || Object.prototype.hasOwnProperty.call( detailsObj, "pinswg_startdates" )) && showRepsLocal( detailsObj.pinswg_startdate || detailsObj.pinswg_startdates || detailsObj.pinswg_applicationacceptedasvalid, detailsObj.pinswg_finalcommentsduedate || detailsObj.pinswg_endofrepresentationperiod ) ); } export function canShowRepButtonForAppealType({ appealType, isLPA, searchDetailsObj }) { switch (appealType) { case 846040012: case 846040013: case 846040014: //for ROW case 846040015: case 846040020: case 846040021: case 846040023: case 846040024: return false; case 846040004: return isLPA ? true : false; case 846040015: return searchDetailsObj[0].value[0].pinswg_specialistcaseprocess == 846040001 ? showRepsLocal( searchDetailsObj[0].value[0].pinswg_startdate, searchDetailsObj[0].value[0].pinswg_finalcommentsduedate ) : true; case 846040018: let shouldShow = searchDetailsObj[0].value[0].pinswg_speacialistcaseprocess == 846040000 && isLPA ? true : searchDetailsObj[0].value[0] .pinswg_speacialistcaseprocess == 846040001 ? true : false; return shouldShow; case 846040019: return showRepsLocal( searchDetailsObj[0].value[0].pinswg_startdate, searchDetailsObj[0].value[0].pinswg_statementduedate ); 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 }) { 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 ); }