Merged PR 2158: fixed breacrumb and label
fixed breacrumb and label Related work items: #18688, #21942, #21943
This commit is contained in:
+132
-206
@@ -1,5 +1,3 @@
|
||||
import { JSONPath as jsonpath } from "jsonpath-plus";
|
||||
import _ from "lodash";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
@@ -7,7 +5,7 @@ import { connect } from "react-redux";
|
||||
|
||||
import { useSession } from "next-auth/react";
|
||||
import { setCurrentView } from "../store/currentView/action";
|
||||
import { Field, change, reduxForm } from "redux-form";
|
||||
import { change } from "redux-form";
|
||||
|
||||
import { setCurrentSection } from "../store/appealType/action";
|
||||
import {
|
||||
@@ -15,35 +13,114 @@ import {
|
||||
setRepresentationSubmit
|
||||
} from "../store/currentView/action";
|
||||
const Breadcrumbs = (props) => {
|
||||
const {
|
||||
currentView,
|
||||
setCurrentView,
|
||||
setCurrentSection,
|
||||
setRepresentationCapacity,
|
||||
setRepresentationSubmit
|
||||
} = props;
|
||||
const { currentView, setCurrentSection, setRepresentationSubmit } = props;
|
||||
const router = useRouter();
|
||||
let { t } = useTranslation();
|
||||
|
||||
const { data: session, status } = useSession();
|
||||
const { data: session } = useSession();
|
||||
|
||||
const currentReference =
|
||||
props?.props?.currentView?.caseReference?.currentReference || "";
|
||||
const fallbackSearchTitle =
|
||||
props?.props?.searchResultsObj?.searchResultsObj?.value?.[0]?.title ||
|
||||
"";
|
||||
const caseReferenceDisplay = currentReference || fallbackSearchTitle;
|
||||
|
||||
const myPortalHref =
|
||||
router.locale != "en" ? "/" + router.locale + "/fymhorth" : "/myportal";
|
||||
const cyMyPortalHref =
|
||||
router.locale == "cy" ? "/" + router.locale + "/fymhorth" : "/myportal";
|
||||
const caseReference = currentView?.caseReference || {};
|
||||
const repDetails = caseReference?.repDetails;
|
||||
const hasRepDetails = Object.prototype.hasOwnProperty.call(
|
||||
caseReference,
|
||||
"repDetails"
|
||||
);
|
||||
|
||||
const qcount =
|
||||
currentView.caseReference.appealType == 846040000 ||
|
||||
currentView.caseReference.appealType == 846040001 ||
|
||||
currentView.caseReference.appealType == 846040025 ||
|
||||
currentView.caseReference.appealType == 846040004 ||
|
||||
currentView.caseReference.appealType == 846040018 ||
|
||||
currentView.caseReference.appealType == 846040003 ||
|
||||
currentView.caseReference.appealType == 846040009 ||
|
||||
currentView.caseReference.appealType == 846040008
|
||||
caseReference.appealType == 846040000 ||
|
||||
caseReference.appealType == 846040001 ||
|
||||
caseReference.appealType == 846040025 ||
|
||||
caseReference.appealType == 846040004 ||
|
||||
caseReference.appealType == 846040018 ||
|
||||
caseReference.appealType == 846040003 ||
|
||||
caseReference.appealType == 846040009 ||
|
||||
caseReference.appealType == 846040008
|
||||
? 7
|
||||
: currentView.caseReference.appealType == 846040005 ||
|
||||
currentView.caseReference.appealType == 846040006 ||
|
||||
currentView.caseReference.appealType == 846040007
|
||||
: caseReference.appealType == 846040005 ||
|
||||
caseReference.appealType == 846040006 ||
|
||||
caseReference.appealType == 846040007
|
||||
? 9
|
||||
: "";
|
||||
|
||||
var viewAllKey = currentView?.viewKey || router.query.viewKey;
|
||||
const { va, adv, ads, key } = router.query;
|
||||
|
||||
const breadcrumbHref = (() => {
|
||||
if (va === "true") {
|
||||
return {
|
||||
pathname: "/myportal/viewall",
|
||||
query: { key }
|
||||
};
|
||||
}
|
||||
|
||||
const base = session ? "/myportal" : "";
|
||||
|
||||
if (adv === "true") {
|
||||
return {
|
||||
pathname: `${base}/advancedsearchresults`,
|
||||
query: router.query
|
||||
};
|
||||
}
|
||||
|
||||
if (ads === "true") {
|
||||
return {
|
||||
pathname: `${base}/addresssearchresults`,
|
||||
query: router.query
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
pathname: `${base}/searchresults`,
|
||||
query: router.query
|
||||
};
|
||||
})();
|
||||
|
||||
const breadcrumbLabel = (() => {
|
||||
if (va === "true") {
|
||||
if (key === "awaitingSubmissionDetails")
|
||||
return t("myportal:awatitingsubmission-card-title");
|
||||
}
|
||||
if (key === "watchedCases")
|
||||
return t("myportal:watchedcases-card-title");
|
||||
|
||||
if (key === "myCases") return t("myportal:mycases-card-title");
|
||||
|
||||
if (key === "myRepresentations")
|
||||
return t("myportal:myrepresentations-card-title");
|
||||
|
||||
if (key === "awaitingSubmissionDetails")
|
||||
return t("myportal:awatitingsubmission-card-title");
|
||||
|
||||
if (key === "watchedCases")
|
||||
return t("myportal:watchedcases-card-title");
|
||||
|
||||
if (key === "myCases") return t("myportal:mycases-card-title");
|
||||
|
||||
if (key === "myRepresentations")
|
||||
return t("myportal:myrepresentations-card-title");
|
||||
|
||||
if (key === "mySubmittedReps") return "Submitted representations";
|
||||
|
||||
if (adv === "true") {
|
||||
return t("common:breadcrumb-advanced-search-results");
|
||||
}
|
||||
|
||||
if (ads === "true") {
|
||||
return t("common:breadcrumb-address-search-results");
|
||||
}
|
||||
|
||||
return t("common:breadcrumb-search-results");
|
||||
})();
|
||||
return (
|
||||
<>
|
||||
<nav
|
||||
@@ -76,13 +153,7 @@ const Breadcrumbs = (props) => {
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<a
|
||||
href={
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
href={myPortalHref}
|
||||
className="govuk-breadcrumbs__link"
|
||||
>
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
@@ -118,13 +189,7 @@ const Breadcrumbs = (props) => {
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
href={myPortalHref}
|
||||
className="govuk-breadcrumbs__link"
|
||||
>
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
@@ -139,13 +204,7 @@ const Breadcrumbs = (props) => {
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
href={myPortalHref}
|
||||
className="govuk-breadcrumbs__link"
|
||||
>
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
@@ -160,13 +219,7 @@ const Breadcrumbs = (props) => {
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
href={myPortalHref}
|
||||
className="govuk-breadcrumbs__link"
|
||||
>
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
@@ -228,13 +281,7 @@ const Breadcrumbs = (props) => {
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
href={myPortalHref}
|
||||
className="govuk-breadcrumbs__link"
|
||||
>
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
@@ -265,13 +312,7 @@ const Breadcrumbs = (props) => {
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
href={myPortalHref}
|
||||
className="govuk-breadcrumbs__link"
|
||||
>
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
@@ -428,13 +469,7 @@ const Breadcrumbs = (props) => {
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
href={myPortalHref}
|
||||
className="govuk-breadcrumbs__link"
|
||||
>
|
||||
{t("newappeal:parent-page-title")}
|
||||
@@ -442,13 +477,7 @@ const Breadcrumbs = (props) => {
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
href={myPortalHref}
|
||||
className="govuk-breadcrumbs__link"
|
||||
>
|
||||
{t("newappeal:page-title")}
|
||||
@@ -463,13 +492,7 @@ const Breadcrumbs = (props) => {
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
href={myPortalHref}
|
||||
className="govuk-breadcrumbs__link"
|
||||
>
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
@@ -484,13 +507,7 @@ const Breadcrumbs = (props) => {
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
href={myPortalHref}
|
||||
className="govuk-breadcrumbs__link"
|
||||
>
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
@@ -540,10 +557,7 @@ const Breadcrumbs = (props) => {
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-case-reference")}:{" "}
|
||||
{
|
||||
props.props.currentView.caseReference
|
||||
.currentReference
|
||||
}
|
||||
{currentReference}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
@@ -574,10 +588,7 @@ const Breadcrumbs = (props) => {
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-case-reference")}:{" "}
|
||||
{
|
||||
props.props.searchResultsObj
|
||||
.searchResultsObj.value[0].title
|
||||
}
|
||||
{fallbackSearchTitle}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
@@ -619,10 +630,7 @@ const Breadcrumbs = (props) => {
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-case-reference")}:{" "}
|
||||
{
|
||||
props.props.currentView.caseReference
|
||||
.currentReference
|
||||
}
|
||||
{currentReference}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
@@ -631,13 +639,7 @@ const Breadcrumbs = (props) => {
|
||||
{" "}
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
href={myPortalHref}
|
||||
className="govuk-breadcrumbs__link"
|
||||
>
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
@@ -683,10 +685,7 @@ const Breadcrumbs = (props) => {
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-case-reference")}:{" "}
|
||||
{
|
||||
props.props.currentView.caseReference
|
||||
.currentReference
|
||||
}
|
||||
{currentReference}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
@@ -694,13 +693,7 @@ const Breadcrumbs = (props) => {
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
href={myPortalHref}
|
||||
className="govuk-breadcrumbs__link"
|
||||
>
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
@@ -708,37 +701,15 @@ const Breadcrumbs = (props) => {
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={{
|
||||
pathname:
|
||||
(session ? "/myportal" : "") +
|
||||
(router.query.adv == "true"
|
||||
? "/advancedsearchresults"
|
||||
: router.query.ads == "true"
|
||||
? "/addresssearchresults"
|
||||
: "/searchresults"),
|
||||
query: router.query
|
||||
}}
|
||||
href={breadcrumbHref}
|
||||
className="govuk-breadcrumbs__link"
|
||||
>
|
||||
{router.query.adv == "true"
|
||||
? t(
|
||||
"common:breadcrumb-advanced-search-results"
|
||||
)
|
||||
: router.query.ads == "true"
|
||||
? t(
|
||||
"common:breadcrumb-address-search-results"
|
||||
)
|
||||
: t(
|
||||
"common:breadcrumb-search-results"
|
||||
)}
|
||||
{breadcrumbLabel}
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-case-reference")}:{" "}
|
||||
{props.props.currentView.caseReference
|
||||
.currentReference ||
|
||||
props.props.searchResultsObj
|
||||
.searchResultsObj.value[0].title}
|
||||
{caseReferenceDisplay}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
@@ -747,13 +718,7 @@ const Breadcrumbs = (props) => {
|
||||
{" "}
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
href={myPortalHref}
|
||||
className="govuk-breadcrumbs__link"
|
||||
>
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
@@ -768,13 +733,7 @@ const Breadcrumbs = (props) => {
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
href={myPortalHref}
|
||||
className="govuk-breadcrumbs__link"
|
||||
>
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
@@ -790,10 +749,7 @@ const Breadcrumbs = (props) => {
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-case-reference")}:{" "}
|
||||
{
|
||||
props.props.currentView.caseReference
|
||||
.currentReference
|
||||
}
|
||||
{currentReference}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
@@ -822,10 +778,7 @@ const Breadcrumbs = (props) => {
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-case-reference")}:{" "}
|
||||
{props.props.currentView.caseReference
|
||||
.currentReference ||
|
||||
props.props.searchResultsObj
|
||||
.searchResultsObj.value[0].title}
|
||||
{caseReferenceDisplay}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
@@ -856,10 +809,7 @@ const Breadcrumbs = (props) => {
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-case-reference")}:{" "}
|
||||
{
|
||||
props.props.currentView.caseReference
|
||||
.currentReference
|
||||
}
|
||||
{currentReference}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
@@ -934,11 +884,8 @@ const Breadcrumbs = (props) => {
|
||||
)}
|
||||
{props.currentView.representationSubmit !=
|
||||
true &&
|
||||
props.currentView.caseReference.hasOwnProperty(
|
||||
"repDetails"
|
||||
) &&
|
||||
props.currentView.caseReference.repDetails
|
||||
.representationType !=
|
||||
hasRepDetails &&
|
||||
repDetails?.representationType !=
|
||||
"Questionnaire" && (
|
||||
<li className="govuk-breadcrumbs__link-item backChevron">
|
||||
<a
|
||||
@@ -956,11 +903,8 @@ const Breadcrumbs = (props) => {
|
||||
)}
|
||||
{props.currentView.representationSubmit !=
|
||||
true &&
|
||||
props.currentView.caseReference.hasOwnProperty(
|
||||
"repDetails"
|
||||
) &&
|
||||
props.currentView.caseReference.repDetails
|
||||
.representationType ==
|
||||
hasRepDetails &&
|
||||
repDetails?.representationType ==
|
||||
"Questionnaire" &&
|
||||
props.showQuestionnaireSection > 1 && (
|
||||
<li className="govuk-breadcrumbs__link-item backChevron">
|
||||
@@ -987,13 +931,7 @@ const Breadcrumbs = (props) => {
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale == "cy"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
href={cyMyPortalHref}
|
||||
className="govuk-breadcrumbs__link"
|
||||
>
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
@@ -1015,13 +953,7 @@ const Breadcrumbs = (props) => {
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
<Link
|
||||
href={
|
||||
router.locale == "cy"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
href={cyMyPortalHref}
|
||||
className="govuk-breadcrumbs__link"
|
||||
>
|
||||
{t("common:breadcrumb-my-portal")}
|
||||
@@ -1064,10 +996,7 @@ const Breadcrumbs = (props) => {
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-case-reference")}:{" "}
|
||||
{
|
||||
props.props.currentView.caseReference
|
||||
.currentReference
|
||||
}
|
||||
{currentReference}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
@@ -1088,10 +1017,7 @@ const Breadcrumbs = (props) => {
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
{t("common:breadcrumb-case-reference")}:{" "}
|
||||
{props.props.currentView.caseReference
|
||||
.currentReference ||
|
||||
props.props.searchResultsObj
|
||||
.searchResultsObj.value[0].title}
|
||||
{caseReferenceDisplay}
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
|
||||
+35
-18
@@ -324,6 +324,35 @@ const CaseSummary = (props) => {
|
||||
|
||||
const zoom = isNaN(parseFloat(siteCoords.latitude)) ? 7 : 12;
|
||||
|
||||
const buildSearchHref = (router, session) => {
|
||||
const { va, adv, ads, key } = router.query;
|
||||
|
||||
if (va === "true") {
|
||||
return {
|
||||
pathname: "/myportal/viewall",
|
||||
query: { key }
|
||||
};
|
||||
}
|
||||
|
||||
const base = session ? "/myportal" : "";
|
||||
|
||||
if (adv === "true") {
|
||||
return {
|
||||
pathname: `${base}/advancedsearchresults`,
|
||||
query: router.query
|
||||
};
|
||||
}
|
||||
|
||||
if (ads === "true") {
|
||||
return {
|
||||
pathname: `${base}/addresssearchresults`,
|
||||
query: router.query
|
||||
};
|
||||
}
|
||||
|
||||
return { pathname: `${base}/searchresults`, query: router.query };
|
||||
};
|
||||
|
||||
let showDetailsBlock =
|
||||
showDetails == true ? (
|
||||
<>
|
||||
@@ -996,23 +1025,10 @@ const CaseSummary = (props) => {
|
||||
|
||||
<Link
|
||||
className="govuk-button govuk-button--secondary"
|
||||
href={{
|
||||
pathname:
|
||||
(session
|
||||
? "/myportal"
|
||||
: "") +
|
||||
(router.query
|
||||
.adv ==
|
||||
"true"
|
||||
? "/advancedsearchresults"
|
||||
: router
|
||||
.query
|
||||
.ads ==
|
||||
"true"
|
||||
? "/addresssearchresults"
|
||||
: "/searchresults"),
|
||||
query: router.query
|
||||
}}
|
||||
href={buildSearchHref(
|
||||
router,
|
||||
session
|
||||
)}
|
||||
>
|
||||
{" "}
|
||||
{t(
|
||||
@@ -2134,7 +2150,8 @@ const mapStateToProps = (state) => {
|
||||
myCases: state.myCases,
|
||||
watchedCases: state.watchedCases,
|
||||
myRepresentations: state.myRepresentations,
|
||||
awaitingSubmission: state.awaitingSubmission
|
||||
awaitingSubmission: state.awaitingSubmission,
|
||||
mySubmittedReps: state.myRepresentations.mySubmittedReps
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
+376
-507
File diff suppressed because it is too large
Load Diff
@@ -54,7 +54,7 @@ export default async function ApiProxy(req, res) {
|
||||
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
getPortalModuleDetails,
|
||||
getWatchedCases,
|
||||
getSIPSEvents,
|
||||
getSIPSMedia,
|
||||
getSIPSMedia
|
||||
} from "../../../actions";
|
||||
import { getFormCollectionByID } from "../../../components/utils";
|
||||
|
||||
@@ -27,28 +27,30 @@ import { getSearchDetails } from "../../../components/utils";
|
||||
import {
|
||||
setAccountDetails,
|
||||
setContainerID,
|
||||
setLoggedInUserId,
|
||||
setLoggedInUserId
|
||||
} from "../../../store/accountDetails/action";
|
||||
import {
|
||||
setCurrentReference,
|
||||
setCurrentView,
|
||||
setCurrentView
|
||||
} from "../../../store/currentView/action";
|
||||
import { setMyCases, setMyCasesDetails } from "../../../store/myCases/action";
|
||||
import {
|
||||
setMyRepresentations,
|
||||
setMyRepresentationsDetails,
|
||||
setMySubmittedReps,
|
||||
setMySubmittedRepsDetails
|
||||
} from "../../../store/myRepresentations/action";
|
||||
import { setSearch } from "../../../store/search/action";
|
||||
import {
|
||||
setSearchDetails,
|
||||
setSearchResults,
|
||||
setEventDetails,
|
||||
setMediaDetails,
|
||||
setMediaDetails
|
||||
} from "../../../store/searchOutput/action";
|
||||
import { wrapper } from "../../../store/store";
|
||||
import {
|
||||
setWatchedCases,
|
||||
setWatchedCasesDetails,
|
||||
setWatchedCasesDetails
|
||||
} from "../../../store/watchedCases/action";
|
||||
import ServiceBanner from "../../../components/myportal/servicebanner";
|
||||
import TimeOut from "../../../components/timeout";
|
||||
@@ -59,7 +61,7 @@ const CaseHome = (props) => {
|
||||
pages,
|
||||
setSearchResults,
|
||||
setSearchDetails,
|
||||
searchResultsObj,
|
||||
searchResultsObj
|
||||
} = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
@@ -159,7 +161,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
if (thisSession) {
|
||||
console.log(" has sesssion.......");
|
||||
[loggedInUser] = await Promise.all([
|
||||
await getPortalLogin(thisSession.user.email),
|
||||
await getPortalLogin(thisSession.user.email)
|
||||
]);
|
||||
|
||||
loggedInUser = loggedInUser.value[0].contactid;
|
||||
@@ -168,8 +170,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
return {
|
||||
redirect: {
|
||||
destination: "/auth/signin",
|
||||
permanent: false,
|
||||
},
|
||||
permanent: false
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -203,14 +205,14 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
if (searchResultsObj.value[0].pinswg_appealcasetype == 846040002) {
|
||||
eventsObj = await getSIPSEvents(
|
||||
searchDetailsObj[0].value[0].pinswg_sipsid,
|
||||
searchDetailsObj[0].value[0].pinswg_sipsid
|
||||
);
|
||||
store.dispatch(setEventDetails(eventsObj));
|
||||
}
|
||||
|
||||
if (searchResultsObj.value[0].pinswg_appealcasetype == 846040002) {
|
||||
mediaObj = await getSIPSMedia(
|
||||
searchDetailsObj[0].value[0].pinswg_sipsid,
|
||||
searchDetailsObj[0].value[0].pinswg_sipsid
|
||||
);
|
||||
store.dispatch(setMediaDetails(mediaObj));
|
||||
}
|
||||
@@ -236,8 +238,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
return {
|
||||
redirect: {
|
||||
destination: "/404",
|
||||
permanent: false,
|
||||
},
|
||||
permanent: false
|
||||
}
|
||||
};
|
||||
} else {
|
||||
if (searchResultsObj["@odata.count"] > 1) {
|
||||
@@ -245,8 +247,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
redirect: {
|
||||
//destination: "/dns-not-found",
|
||||
destination: "/404",
|
||||
permanent: false,
|
||||
},
|
||||
permanent: false
|
||||
}
|
||||
};
|
||||
} else {
|
||||
if (query.hasOwnProperty("key")) {
|
||||
@@ -257,8 +259,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
store.dispatch(
|
||||
setCurrentView({
|
||||
"viewName": "Awaiting Submission",
|
||||
"viewKey": "awaitingSubmissionDetails",
|
||||
}),
|
||||
"viewKey": "awaitingSubmissionDetails"
|
||||
})
|
||||
);
|
||||
break;
|
||||
case "watchedCases":
|
||||
@@ -301,8 +303,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
store.dispatch(
|
||||
setCurrentView({
|
||||
"viewName": "Watched Cases",
|
||||
"viewKey": "watchedCases",
|
||||
}),
|
||||
"viewKey": "watchedCases"
|
||||
})
|
||||
);
|
||||
break;
|
||||
case "myCases":
|
||||
@@ -314,41 +316,42 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
const myCasesDetails = await getDetails(
|
||||
myCases,
|
||||
"myCases",
|
||||
"myCases"
|
||||
);
|
||||
store.dispatch(setMyCases(myCases));
|
||||
store.dispatch(setMyCasesDetails(myCasesDetails));
|
||||
store.dispatch(
|
||||
setCurrentView({
|
||||
"viewName": "My Cases",
|
||||
"viewKey": "myCases",
|
||||
}),
|
||||
"viewKey": "myCases"
|
||||
})
|
||||
);
|
||||
break;
|
||||
case "myRepresentations":
|
||||
const myRepresentations = await getRepsFromBlob(
|
||||
thisSession.user.id,
|
||||
thisSession.user.id
|
||||
);
|
||||
|
||||
const myRepresentationsDetails = await getDetails(
|
||||
myRepresentations,
|
||||
"myRepresentations",
|
||||
"myRepresentations"
|
||||
);
|
||||
|
||||
store.dispatch(
|
||||
setMyRepresentations(myRepresentations),
|
||||
setMyRepresentations(myRepresentations)
|
||||
);
|
||||
store.dispatch(
|
||||
setMyRepresentationsDetails(
|
||||
myRepresentationsDetails,
|
||||
),
|
||||
myRepresentationsDetails
|
||||
)
|
||||
);
|
||||
store.dispatch(
|
||||
setCurrentView({
|
||||
"viewName": "My Representations",
|
||||
"viewKey": "myRepresentations",
|
||||
}),
|
||||
"viewKey": "myRepresentations"
|
||||
})
|
||||
);
|
||||
|
||||
default:
|
||||
// code block
|
||||
}
|
||||
@@ -363,7 +366,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
let newObj = {};
|
||||
return Object.assign(newObj, {
|
||||
"@odata.count": required.length,
|
||||
"value": required,
|
||||
"value": required
|
||||
});
|
||||
};
|
||||
|
||||
@@ -371,7 +374,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
const watchedCasesDetails = await getDetails(
|
||||
filteredWatchedCases,
|
||||
"myWatchedCases",
|
||||
"myWatchedCases"
|
||||
);
|
||||
|
||||
store.dispatch(setWatchedCases(filteredWatchedCases));
|
||||
@@ -396,8 +399,21 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
.pinswg_speacialistcaseprocess ||
|
||||
searchDetailsObj[0].value[0]
|
||||
.pinswg_specialistcaseprocess
|
||||
: "",
|
||||
}),
|
||||
: ""
|
||||
})
|
||||
);
|
||||
|
||||
const mySubmittedReps = watchedCases.value.filter(
|
||||
(el) => el.pinswg_representationsubmitted != null
|
||||
);
|
||||
|
||||
const [mySubmittedRepsDetails] = await Promise.all([
|
||||
getDetails(mySubmittedReps, "mySubmittedReps")
|
||||
]);
|
||||
|
||||
store.dispatch(setMySubmittedReps(mySubmittedReps));
|
||||
store.dispatch(
|
||||
setMySubmittedRepsDetails(mySubmittedRepsDetails)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -410,18 +426,18 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
searchResultsObj: searchResultsObj,
|
||||
searchDetailsObj: searchDetailsObj,
|
||||
eventsObj: eventsObj,
|
||||
mediaObj: mediaObj,
|
||||
mediaObj: mediaObj
|
||||
},
|
||||
currentType: "directResultsObj",
|
||||
docsOffline: process.env.DOCAPI_OFFLINE || false,
|
||||
messagesObj: await getCaseMessage(
|
||||
searchResultsObj.value[0].incidentid,
|
||||
searchResultsObj.value[0].incidentid
|
||||
),
|
||||
showFilteredDocs: process.env.SHOWFILTERDOCS || false,
|
||||
showMaps: process.env.SHOWMAPS,
|
||||
},
|
||||
showMaps: process.env.SHOWMAPS
|
||||
}
|
||||
};
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const getDetails = (resultsObj, detailsType) => {
|
||||
@@ -457,9 +473,9 @@ const getDetails = (resultsObj, detailsType) => {
|
||||
return getPortalModuleDetails(
|
||||
getFormCollectionByID(data.pinswg_appealcasetype)
|
||||
.LogicalCollectionName,
|
||||
caseID,
|
||||
caseID
|
||||
);
|
||||
}),
|
||||
})
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -495,13 +511,13 @@ const getDetails = (resultsObj, detailsType) => {
|
||||
getPortalModuleDetails(
|
||||
getFormCollectionByID(searchDetail.pinswg_appealcasetype)
|
||||
.LogicalCollectionName,
|
||||
caseID,
|
||||
caseID
|
||||
// detailsType != "myWatchedCases"
|
||||
// ? searchDetail.ticketnumber
|
||||
// : searchDetail[
|
||||
// "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
// ]
|
||||
),
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
@@ -524,6 +540,7 @@ const mapStateToProps = (state) => {
|
||||
watchedCases: state.watchedCases,
|
||||
myRepresentations: state.myRepresentations,
|
||||
awaitingSubmission: state.awaitingSubmission,
|
||||
mySubmittedReps: state.myRepresentations.mySubmittedReps
|
||||
};
|
||||
};
|
||||
|
||||
@@ -540,7 +557,7 @@ const mapDispatchToProps = (dispatch) => {
|
||||
// },
|
||||
setLoggedInUserId: (loggedInUser) => {
|
||||
dispatch(setLoggedInUserId(loggedInUser));
|
||||
},
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user