updated restriction to disallow partial reps and appeals from being submitted when not docapi

This commit is contained in:
2026-01-15 13:20:07 +00:00
parent 94861846aa
commit 9241fe0b84
17 changed files with 956 additions and 743 deletions
+2 -32
View File
@@ -5,7 +5,7 @@ import { useRouter } from "next/router";
import { useCallback, useEffect, useRef, useState } from "react";
import { connect } from "react-redux";
import transLookup from "../../../data/lookuptranslations.json";
import { formatDates } from "../../utils";
import { formatDates, getDocLink } from "../../utils";
import PaginationControl from "../../../components/case/pagination";
import DocumentLink from "../../utils/downloads";
import { useDownloadQueue } from "../../utils/downloadmanager";
@@ -305,37 +305,7 @@ const DocumentsTab = (props) => {
setSelectedDocumentOrigin("all")
);
};
let ShowDocLinks = false;
let checkShowDocLinks = docsOffline != false ? true : false;
const getDocLink = (docsOffline) => {
var startTime = docsOffline.split(",")[0];
var endTime = docsOffline.split(",")[1];
// console.log(startTime);
// console.log(endTime);
var currentDate = new Date();
var startDate = new Date(currentDate.getTime());
startDate.setHours(startTime.split(":")[0]);
startDate.setMinutes(startTime.split(":")[1]);
startDate.setSeconds(startTime.split(":")[2]);
var endDate = new Date(currentDate.getTime());
endDate.setHours(endTime.split(":")[0]);
endDate.setMinutes(endTime.split(":")[1]);
endDate.setSeconds(endTime.split(":")[2]);
// console.log(startDate);
// console.log(endDate);
// console.log(currentDate);
var valid = startDate < currentDate && endDate > currentDate;
ShowDocLinks = valid;
};
checkShowDocLinks && getDocLink(docsOffline);
let ShowDocLinks = getDocLink(docsOffline);
const FilteredDocumentView = (documentDetailsArr) => {
documentDetailsArr = documentDetailsArr.value;
+2 -32
View File
@@ -5,7 +5,7 @@ import { useRouter } from "next/router";
import { useCallback, useEffect, useRef, useState } from "react";
import { connect } from "react-redux";
import transLookup from "../../data/lookuptranslations.json";
import { formatDates } from "../utils";
import { formatDates, getDocLink } from "../utils";
import PaginationControl from "./pagination";
import { sendGAEvent } from "@next/third-parties/google";
@@ -90,37 +90,7 @@ const DocumentDetails = (props) => {
setCurrentPage(1)
);
};
let ShowDocLinks = false;
let checkShowDocLinks = docsOffline != false ? true : false;
const getDocLink = (docsOffline) => {
var startTime = docsOffline.split(",")[0];
var endTime = docsOffline.split(",")[1];
// console.log(startTime);
// console.log(endTime);
var currentDate = new Date();
var startDate = new Date(currentDate.getTime());
startDate.setHours(startTime.split(":")[0]);
startDate.setMinutes(startTime.split(":")[1]);
startDate.setSeconds(startTime.split(":")[2]);
var endDate = new Date(currentDate.getTime());
endDate.setHours(endTime.split(":")[0]);
endDate.setMinutes(endTime.split(":")[1]);
endDate.setSeconds(endTime.split(":")[2]);
// console.log(startDate);
// console.log(endDate);
// console.log(currentDate);
var valid = startDate < currentDate && endDate > currentDate;
ShowDocLinks = valid;
};
checkShowDocLinks && getDocLink(docsOffline);
let ShowDocLinks = getDocLink(docsOffline);
const DocumentView = (documentDetailsArr) => {
documentDetailsArr = documentDetailsArr.value;
+2
View File
@@ -66,6 +66,7 @@ let MakeRepresentation = (props) => {
initialValues,
setCurrentReference,
ticketnumber,
docsOffline,
} = props;
const formObj = props.props.form;
let setCaseQueryObj = props[currentType] || {};
@@ -1105,6 +1106,7 @@ let MakeRepresentation = (props) => {
questionnaireCount={questionnaireCount}
finaliseAppealProcess={finaliseAppealProcess}
setFinaliseAppealProcess={setFinaliseAppealProcess}
docsOffline={docsOffline}
/>
) : (
<>
@@ -13,6 +13,7 @@ import {
getThumbnailIconByExtension,
formatDates,
updateLinks,
getDocLink,
} from "../../utils";
import {
@@ -41,7 +42,11 @@ const RepCompleteSubmit = (props) => {
questionnaireCount,
finaliseAppealProcess,
setCurrentReference,
docsOffline,
} = props;
let ShowDocLinks = getDocLink(docsOffline);
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
const files = acceptedFiles.map((file) => (
<li key={file.path}>
@@ -230,6 +235,7 @@ const RepCompleteSubmit = (props) => {
}
const checkRepDatePassed = () => {
return false;
if (repFormData.representationType == "Questionnaire") {
return false;
} else {
@@ -603,6 +609,7 @@ const RepCompleteSubmit = (props) => {
"myrepresentations:rep-check-tandc-para-three"
)}
</p>
{checkRepDatePassed() ? (
<div className="govuk-warning-text noticebanner">
<strong className="govuk-warning-text__text">
@@ -641,6 +648,32 @@ const RepCompleteSubmit = (props) => {
{t("myrepresentations:rep-wait-label")}
</p>
</div>
) : ShowDocLinks ? (
<>
{" "}
<div className="govuk-warning-text ">
<span
className="govuk-warning-text__icon"
aria-hidden="true"
>
!
</span>
<strong className="govuk-warning-text__text govuk-!-margin-top-2">
<span className="govuk-visually-hidden">
Notice
</span>
{t(
"myrepresentations:docsoffline-reps-label"
)}
{" "}
</strong>
</div>{" "}
<a className="govuk-link" href="/">
{t(
"myrepresentations:return-to-myportal-link"
)}
</a>
</>
) : (
<>
<div className="govuk-form-group">
-32
View File
@@ -104,38 +104,6 @@ const CaseSummary = (props) => {
? true
: false;
let ShowDocLinks = false;
let checkShowDocLinks = docsOffline != false ? true : false;
const getDocLink = (docsOffline) => {
var startTime = docsOffline.split(",")[0];
var endTime = docsOffline.split(",")[1];
// console.log(startTime);
// console.log(endTime);
var currentDate = new Date();
var startDate = new Date(currentDate.getTime());
startDate.setHours(startTime.split(":")[0]);
startDate.setMinutes(startTime.split(":")[1]);
startDate.setSeconds(startTime.split(":")[2]);
var endDate = new Date(currentDate.getTime());
endDate.setHours(endTime.split(":")[0]);
endDate.setMinutes(endTime.split(":")[1]);
endDate.setSeconds(endTime.split(":")[2]);
// console.log(startDate);
// console.log(endDate);
// console.log(currentDate);
var valid = startDate < currentDate && endDate > currentDate;
ShowDocLinks = valid;
};
checkShowDocLinks && getDocLink(docsOffline);
const selectWatchedCase = (loggedInUser, incidentID, appealType) => {
let updateBody = {
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
+2 -31
View File
@@ -1,6 +1,7 @@
import useTranslation from "next-translate/useTranslation";
import Link from "next/link";
import { useRouter } from "next/router";
import { getDocLink } from "../utils";
export default function MakeNewAppeal(props) {
let { t } = useTranslation();
@@ -10,37 +11,7 @@ export default function MakeNewAppeal(props) {
const router = useRouter();
const { locale } = router;
let ShowDocLinks = false;
let checkShowDocLinks = docsOffline != false ? true : false;
const getDocLink = (docsOffline) => {
var startTime = docsOffline.split(",")[0];
var endTime = docsOffline.split(",")[1];
// console.log(startTime);
// console.log(endTime);
var currentDate = new Date();
var startDate = new Date(currentDate.getTime());
startDate.setHours(startTime.split(":")[0]);
startDate.setMinutes(startTime.split(":")[1]);
startDate.setSeconds(startTime.split(":")[2]);
var endDate = new Date(currentDate.getTime());
endDate.setHours(endTime.split(":")[0]);
endDate.setMinutes(endTime.split(":")[1]);
endDate.setSeconds(endTime.split(":")[2]);
// console.log(startDate);
// console.log(endDate);
// console.log(currentDate);
var valid = startDate < currentDate && endDate > currentDate;
ShowDocLinks = valid;
};
console.log("docsOffline", docsOffline, getDocLink(docsOffline));
let ShowDocLinks = getDocLink(docsOffline);
return (
<div className="card" id="new-appeal-card">
+52 -17
View File
@@ -18,6 +18,7 @@ import {
bytesToSize,
getThumbnailIconByExtension,
updateLinks,
getDocLink,
} from "../utils";
let BuildCheckSection = (props) => {
@@ -39,6 +40,7 @@ let BuildCheckSection = (props) => {
setCurrentSection,
updateCurrentSection,
mandatoryFieldsData,
docsOffline,
} = props;
const parser = new DOMParser();
@@ -180,6 +182,8 @@ let BuildCheckSection = (props) => {
: setConfirmSections(false);
};
let ShowDocLinks = getDocLink(docsOffline);
return (
<div className="govuk-grid-row" key={1222}>
<div className="govuk-grid-column-full">
@@ -327,23 +331,54 @@ let BuildCheckSection = (props) => {
</div>
<div className="govuk-button-group">
<a
disabled={confirmSections ? false : true}
className="govuk-button"
data-module="govuk-button"
onClick={() => {
finaliseAppeal();
}}
>
{t("newappeal:submit-appeal-button")}
</a>
<a
className="govuk-link"
href="#"
onClick={() => setCurrentSection(sectionCount)}
>
{t("common:back-link")}
</a>
{ShowDocLinks ? (
<>
<div className="govuk-warning-text ">
<span
className="govuk-warning-text__icon"
aria-hidden="true"
>
!
</span>
<strong className="govuk-warning-text__text govuk-!-margin-top-2">
<span className="govuk-visually-hidden">
Notice
</span>
{t(
"myportal:docsoffline-newappeal-label"
)}
{" "}
</strong>
</div>{" "}
<a className="govuk-link" href="/">
{t("newappeal:return-to-myportal-link")}
</a>
</>
) : (
<>
<a
disabled={
confirmSections ? false : true
}
className="govuk-button"
data-module="govuk-button"
onClick={() => {
finaliseAppeal();
}}
>
{t("newappeal:submit-appeal-button")}
</a>
<a
className="govuk-link"
href="#"
onClick={() =>
setCurrentSection(sectionCount)
}
>
{t("common:back-link")}
</a>
</>
)}
</div>
</>
)}
+1
View File
@@ -35,6 +35,7 @@ const CaseRepresentation = (props) => {
props.setShowQuestionnaireSection
}
setCurrentReference={props.setCurrentReference}
docsOffline={props.docsOffline}
/>
</div>
</div>
+27
View File
@@ -797,3 +797,30 @@ export const whichRepType = (props) => {
return repType;
};
export const getDocLink = (docsOffline) => {
var startTime = docsOffline.split(",")[0];
var endTime = docsOffline.split(",")[1];
// console.log(startTime);
// console.log(endTime);
var currentDate = new Date();
var startDate = new Date(currentDate.getTime());
startDate.setHours(startTime.split(":")[0]);
startDate.setMinutes(startTime.split(":")[1]);
startDate.setSeconds(startTime.split(":")[2]);
var endDate = new Date(currentDate.getTime());
endDate.setHours(endTime.split(":")[0]);
endDate.setMinutes(endTime.split(":")[1]);
endDate.setSeconds(endTime.split(":")[2]);
// console.log(startDate);
// console.log(endDate);
// console.log(currentDate);
var valid = startDate < currentDate && endDate > currentDate;
return valid;
};