135 lines
5.9 KiB
JavaScript
135 lines
5.9 KiB
JavaScript
import { signOut } from "next-auth/react";
|
|
import useTranslation from "next-translate/useTranslation";
|
|
import Link from "next/link";
|
|
import { useRouter } from "next/router";
|
|
import TimeOut from "../components/timeout";
|
|
import AwaitingSubmissionFromBlob from "./myportal/awaitingsubmissionfromblob";
|
|
import { hasOwn } from "./utils";
|
|
import Dns from "./myportal/dns";
|
|
import MakeNewAppeal from "./myportal/makenewappeal";
|
|
import MyCases from "./myportal/mycases";
|
|
import MyRepresentations from "./myportal/myrepresentations";
|
|
import SearchCases from "./myportal/searchcases";
|
|
import WatchedCases from "./myportal/watchedcases";
|
|
import MySubmittedReps from "./myportal/mysubmittedrepresentations";
|
|
import ServiceBanner from "./myportal/servicebanner";
|
|
import transLookup from "../data/lookuptranslations.json";
|
|
import { performPortalSignOut } from "../lib/auth/sessionClient";
|
|
import resolveCrmDisplayValue from "../lib/i18n/crmDisplay/resolveCrmDisplayValue";
|
|
import _ from "lodash";
|
|
|
|
const MyPortal = (props) => {
|
|
const { showFileUpload, showLoginCheck, docsOffline } = props;
|
|
let { t } = useTranslation();
|
|
|
|
const router = useRouter();
|
|
const { locale } = router;
|
|
|
|
const handleLogout = () => {
|
|
performPortalSignOut({ locale, signOutFn: signOut });
|
|
};
|
|
|
|
const isLPA =
|
|
props.accountDetails.accountDetails[
|
|
"pinswg_typeofinvolvement@OData.Community.Display.V1.FormattedValue"
|
|
] == "LPA"
|
|
? true
|
|
: false;
|
|
|
|
return (
|
|
<>
|
|
<main className="" id="main-content" role="main">
|
|
<ServiceBanner props={props} />
|
|
{isLPA && (
|
|
<div>
|
|
<h2 className="heading-small card-heading">
|
|
{resolveCrmDisplayValue({
|
|
value: props.accountDetails.accountDetails[
|
|
"pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
|
|
],
|
|
locale,
|
|
translations: transLookup
|
|
})}{" "}
|
|
{t("myportal:lpa-portal-heading")}
|
|
</h2>
|
|
</div>
|
|
)}
|
|
<div className="govuk-grid-row">
|
|
<div className="govuk-grid-column-full">
|
|
<div className="flex-container grid-row govuk-body ">
|
|
<SearchCases />
|
|
{!isLPA && (
|
|
<MakeNewAppeal docsOffline={docsOffline} />
|
|
)}
|
|
|
|
{!isLPA &&
|
|
_.has(props.awaitingSubmission, [
|
|
"awaitingSubmissionFromBlob",
|
|
"@odata.count"
|
|
]) &&
|
|
props.awaitingSubmission
|
|
.awaitingSubmissionFromBlob.case.length >
|
|
0 && (
|
|
<AwaitingSubmissionFromBlob
|
|
containerID={props.containerID}
|
|
awaitingSubmissionFromBlob={
|
|
props.awaitingSubmission
|
|
.awaitingSubmissionFromBlob
|
|
}
|
|
/>
|
|
)}
|
|
{props.myCases.myCases["@odata.count"] > 0 && (
|
|
<MyCases
|
|
myCases={props.myCases}
|
|
isLPA={isLPA}
|
|
/>
|
|
)}
|
|
{props.watchedCases.watchedCases["@odata.count"] >
|
|
0 && (
|
|
<WatchedCases
|
|
currentView={props.currentView}
|
|
watchedCases={props.watchedCases}
|
|
isLPA={isLPA}
|
|
myReps={false}
|
|
accountDetails={props.accountDetails}
|
|
/>
|
|
)}
|
|
{props.myRepresentations.hasOwnProperty(
|
|
"myRepresentations"
|
|
) &&
|
|
typeof props.myRepresentations
|
|
.myRepresentations != "undefined" &&
|
|
props.myRepresentations.myRepresentations[
|
|
"@odata.count"
|
|
] > 0 && (
|
|
<MyRepresentations
|
|
myRepresentations={
|
|
props.myRepresentations
|
|
}
|
|
isLPA={isLPA}
|
|
/>
|
|
)}
|
|
{props.myRepresentations.mySubmittedReps
|
|
.mySubmittedReps.length > 0 && (
|
|
<MySubmittedReps
|
|
currentView={props.currentView}
|
|
mySubmittedReps={
|
|
props.myRepresentations.mySubmittedReps
|
|
}
|
|
isLPA={isLPA}
|
|
myReps={true}
|
|
/>
|
|
)}
|
|
{!isLPA && <Dns />}
|
|
{/* <YourAccount /> */}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
<TimeOut />
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default MyPortal;
|