Merged PR 1987: docoffline dependant appeals and reps
docoffline dependant appeals and reps Related work items: #20166
This commit is contained in:
+102
-33
@@ -111,6 +111,38 @@ 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 + ")",
|
||||
@@ -468,31 +500,51 @@ const CaseSummary = (props) => {
|
||||
.appealType
|
||||
) ? (
|
||||
<>
|
||||
<Link
|
||||
href={{
|
||||
pathname:
|
||||
"/myportal/representation",
|
||||
query: {
|
||||
case:
|
||||
currentType ==
|
||||
"searchResultsObj"
|
||||
? detailsObj.ticketnumber
|
||||
: currentType ==
|
||||
"watchedCases"
|
||||
? casesObj.pinswg_title
|
||||
: currentType ==
|
||||
"directResultsObj"
|
||||
? detailsObj.ticketnumber
|
||||
: casesObj.reference,
|
||||
},
|
||||
}}
|
||||
className="govuk-button"
|
||||
>
|
||||
{t(
|
||||
"case:summary-make-representation-label"
|
||||
)}
|
||||
</Link>
|
||||
|
||||
{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(
|
||||
"case:docsoffline-reps-label"
|
||||
)}
|
||||
</strong>
|
||||
</div>
|
||||
) : (
|
||||
<div>
|
||||
<Link
|
||||
href={{
|
||||
pathname:
|
||||
"/myportal/representation",
|
||||
query: {
|
||||
case:
|
||||
currentType ==
|
||||
"searchResultsObj"
|
||||
? detailsObj.ticketnumber
|
||||
: currentType ==
|
||||
"watchedCases"
|
||||
? casesObj.pinswg_title
|
||||
: currentType ==
|
||||
"directResultsObj"
|
||||
? detailsObj.ticketnumber
|
||||
: casesObj.reference,
|
||||
},
|
||||
}}
|
||||
className="govuk-button"
|
||||
>
|
||||
{t(
|
||||
"case:summary-make-representation-label"
|
||||
)}
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
<a
|
||||
onClick={() => {
|
||||
//spinnerState();
|
||||
@@ -802,15 +854,32 @@ const CaseSummary = (props) => {
|
||||
router.pathname
|
||||
) == true ? (
|
||||
""
|
||||
) : 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("case:docsoffline-reps-label")}
|
||||
</strong>
|
||||
</div>
|
||||
) : (
|
||||
<Link
|
||||
href="/representation"
|
||||
className="govuk-button"
|
||||
>
|
||||
{t(
|
||||
"case:summary-make-representation-label"
|
||||
)}
|
||||
</Link>
|
||||
<div>
|
||||
<Link
|
||||
href="/representation"
|
||||
className="govuk-button"
|
||||
>
|
||||
{t(
|
||||
"case:summary-make-representation-label"
|
||||
)}
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<a
|
||||
|
||||
@@ -19,7 +19,7 @@ import { JSONPath as jsonpath } from "jsonpath-plus";
|
||||
import transLookup from "../data/lookuptranslations.json";
|
||||
|
||||
const MyPortal = (props) => {
|
||||
const { showFileUpload, showLoginCheck } = props;
|
||||
const { showFileUpload, showLoginCheck, docsOffline } = props;
|
||||
let { t } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
@@ -126,7 +126,9 @@ const MyPortal = (props) => {
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full">
|
||||
<div className="flex-container grid-row govuk-body ">
|
||||
{!isLPA && <MakeNewAppeal />}
|
||||
{!isLPA && (
|
||||
<MakeNewAppeal docsOffline={docsOffline} />
|
||||
)}
|
||||
<SearchCases />
|
||||
{/* {props.awaitingSubmission.awaitingSubmission[
|
||||
"@odata.count"
|
||||
|
||||
@@ -2,11 +2,46 @@ import useTranslation from "next-translate/useTranslation";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
export default function MakeNewAppeal() {
|
||||
export default function MakeNewAppeal(props) {
|
||||
let { t } = useTranslation();
|
||||
|
||||
const { docsOffline } = 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));
|
||||
|
||||
return (
|
||||
<div className="card" id="new-appeal-card">
|
||||
<div className="card-body">
|
||||
@@ -22,11 +57,29 @@ export default function MakeNewAppeal() {
|
||||
<p className="govuk-body-s">
|
||||
{t("myportal:makenewappeal-card-paragraph-two")}
|
||||
</p>
|
||||
<div>
|
||||
<Link href={"/newappeal"} className="govuk-button">
|
||||
{t("myportal:makenewappeal-card-button-label")}
|
||||
</Link>
|
||||
</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("case:docsoffline-reps-label")}
|
||||
</strong>
|
||||
</div>
|
||||
) : (
|
||||
<div>
|
||||
<Link href={"/newappeal"} className="govuk-button">
|
||||
{t("myportal:makenewappeal-card-button-label")}
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<p className="govuk-body-s govuk govuk-!-margin-top-5">
|
||||
{t("myportal:makenewappeal-card-paragraph-three")}
|
||||
</p>
|
||||
|
||||
@@ -147,7 +147,7 @@ const DNSSearchResults = (props) => {
|
||||
};
|
||||
|
||||
const [orderByState, setOrderbyState] = useState("createdon");
|
||||
const [fieldSortState, setfieldSortState] = useState("asc");
|
||||
const [fieldSortState, setfieldSortState] = useState("desc");
|
||||
const [selectedOption, setSelectedOption] = useState(10);
|
||||
|
||||
const cookies = parseCookies();
|
||||
|
||||
@@ -66,7 +66,7 @@ const SearchResults = (props) => {
|
||||
const [showSpinnerState, setShowSpinnerState] = useState(false);
|
||||
const [selectedOption, setSelectedOption] = useState(10);
|
||||
const [orderByState, setOrderbyState] = useState("createdon");
|
||||
const [fieldSortState, setfieldSortState] = useState("asc");
|
||||
const [fieldSortState, setfieldSortState] = useState("desc");
|
||||
const [loginToWatch, setLoginToWatch] = useState("true");
|
||||
|
||||
let spinnerState = () => {
|
||||
|
||||
@@ -104,5 +104,6 @@
|
||||
"download-complete-label": "Lawrlwytho wedi'i gwblhau!",
|
||||
"downloading-label": "Wrthi'n llwytho i lawr",
|
||||
"download-failed-label": "Methodd y lawrlwythiad",
|
||||
"download-queued-label": "Wedi'i giwio"
|
||||
"download-queued-label": "Wedi'i giwio",
|
||||
"docsoffline-reps-label": "Oherwydd cynnal a chadw'r system, ni allwn dderbyn sylwadau ar hyn o bryd. Rhowch gynnig arall arni yn nes ymlaen."
|
||||
}
|
||||
@@ -51,5 +51,6 @@
|
||||
"date-raised": "Dyddiad codi",
|
||||
"representation-submitted": "Cyflwynwyd y sylw",
|
||||
"submission-processing-label": "Prosesu cyflwyniad",
|
||||
"appeal-pending-label": "Yn yr arfaeth"
|
||||
"appeal-pending-label": "Yn yr arfaeth",
|
||||
"docsoffline-newappeal-label": "Oherwydd gwaith cynnal a chadw'r system, ni allwn dderbyn apeliadau newydd ar hyn o bryd. Rhowch gynnig arall arni yn nes ymlaen."
|
||||
}
|
||||
@@ -104,5 +104,6 @@
|
||||
"download-complete-label": "Download complete!",
|
||||
"downloading-label": "Downloading",
|
||||
"download-failed-label": "Download failed",
|
||||
"download-queued-label": "Queued"
|
||||
"download-queued-label": "Queued",
|
||||
"docsoffline-reps-label": "Due to system maintenance, we are unable to accept representations at this time. Please try again later."
|
||||
}
|
||||
@@ -51,5 +51,6 @@
|
||||
"date-raised": "Date raised",
|
||||
"representation-submitted": "Representation submitted",
|
||||
"submission-processing-label": "Submission processing",
|
||||
"appeal-pending-label": "Pending"
|
||||
"appeal-pending-label": "Pending",
|
||||
"docsoffline-newappeal-label": "Due to system maintenance, we are unable to accept new appeals at this time. Please try again later."
|
||||
}
|
||||
@@ -66,6 +66,7 @@ const Home = (props) => {
|
||||
showLoginCheck,
|
||||
currentView,
|
||||
mySubmittedReps,
|
||||
docsOffline,
|
||||
} = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
@@ -161,6 +162,7 @@ const Home = (props) => {
|
||||
containerID={accountDetails.containerID}
|
||||
showLoginCheck={showLoginCheck}
|
||||
currentView={currentView}
|
||||
docsOffline={docsOffline}
|
||||
/>
|
||||
</div>
|
||||
<Footer footerLinks={footerLinks} ticketnumber={props} />
|
||||
@@ -366,6 +368,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
showFileUpload: process.env.SHOWFILEUPLOAD,
|
||||
containerID: thisSession.user.id,
|
||||
showLoginCheck: process.env.SHOWLOGIN,
|
||||
docsOffline: process.env.DOCAPI_OFFLINE || false,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user