reps trigger for logged out & upload storage acc

This commit is contained in:
2023-01-05 14:26:08 +00:00
parent 98aefdd867
commit ee4d00a500
16 changed files with 251 additions and 465 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ RELAYPATH = "dev-pedw-hc"
GOOGLE_TAG_MANAGER = GTM-T78CBC3 GOOGLE_TAG_MANAGER = GTM-T78CBC3
SHOWLOGIN = "true" SHOWLOGIN = "true"
SHOWREPRESENTATIONS = "true" SHOWREPRESENTATIONS = true
SHOWFILEUPLOAD = "false" SHOWFILEUPLOAD = "false"
SHOWMAPS = "false" SHOWMAPS = "false"
//BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2 //BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2
+1 -1
View File
@@ -45,7 +45,7 @@ const Case = (props) => {
searchDetailsObj={props.searchDetailsObj} searchDetailsObj={props.searchDetailsObj}
documentDetailsObj={props.documentDetailsObj} documentDetailsObj={props.documentDetailsObj}
/> />
{showRepresentations == "true" && ( {showRepresentations == true && (
<RepresentationList <RepresentationList
incidentid={props.incidentid} incidentid={props.incidentid}
caseReference={props.caseReference} caseReference={props.caseReference}
+17 -35
View File
@@ -67,7 +67,7 @@ let MakeRepresentation = (props) => {
setRepresentationSubmitConfirmation, setRepresentationSubmitConfirmation,
} = props; } = props;
const formObj = props.props.form; const formObj = props.props.form;
let setCaseQueryObj = props[currentType]; let setCaseQueryObj = props[currentType] || {};
var casesObj = {}; var casesObj = {};
currentType == "searchResultsObj" currentType == "searchResultsObj"
@@ -84,16 +84,6 @@ let MakeRepresentation = (props) => {
var detailsObj = {}; var detailsObj = {};
currentType == "searchResultsObj"
? (casesObj = jsonpath.query(
setCaseQueryObj,
'$..[?(@.title=="' + caseReference + '")]'
))
: (casesObj = jsonpath.query(
setCaseQueryObj,
'$..[?(@.reference=="' + caseReference + '")]'
));
const capacityOptionsArr = [ const capacityOptionsArr = [
"Appellant", "Appellant",
"Agent", "Agent",
@@ -213,6 +203,7 @@ let MakeRepresentation = (props) => {
setRepresentationSubmit={setRepresentationSubmit} setRepresentationSubmit={setRepresentationSubmit}
currentView={currentView} currentView={currentView}
setSubmitBack={setSubmitBack} setSubmitBack={setSubmitBack}
props={props}
/> />
); );
break; break;
@@ -248,6 +239,7 @@ let MakeRepresentation = (props) => {
let day = repDate.getDate(); let day = repDate.getDate();
let month = repDate.getMonth() + 1; let month = repDate.getMonth() + 1;
let year = repDate.getFullYear(); let year = repDate.getFullYear();
let time = repDate.getTime();
const repType = ""; const repType = "";
switch (values.representationCapacity) { switch (values.representationCapacity) {
@@ -276,6 +268,8 @@ let MakeRepresentation = (props) => {
"-" + "-" +
day + day +
"-" + "-" +
time +
"-" +
repType + repType +
"-REP" + "-REP" +
"_" + "_" +
@@ -299,7 +293,7 @@ let MakeRepresentation = (props) => {
//console.log(updateBody); //console.log(updateBody);
window.alert(`form is :\n\n${JSON.stringify(updateBody, null, 2)}`); //window.alert(`form is :\n\n${JSON.stringify(updateBody, null, 2)}`);
const reference = "PEDW-PARTIAL-REP"; const reference = "PEDW-PARTIAL-REP";
const templateId = "021b0a7b-df00-41f1-b94e-c269bee98c75"; const templateId = "021b0a7b-df00-41f1-b94e-c269bee98c75";
@@ -323,35 +317,23 @@ let MakeRepresentation = (props) => {
const onHandleSubmit = (values) => { const onHandleSubmit = (values) => {
currentView.representationSubmit != true currentView.representationSubmit != true
? // console.log( ? _.isEmpty(currentView.representationCapacity)
// values,
// values.representationCapacity,
// currentView.representationCapacity
// );
// console.log(_.isEmpty(currentView.representationCapacity));
// console.log(
// values.representationCapacity
// .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
// .toLowerCase() == currentView.representationCapacity
// );
_.isEmpty(currentView.representationCapacity)
? setRepresentationCapacity( ? setRepresentationCapacity(
values.representationCapacity values.representationCapacity
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "") .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
.toLowerCase() .toLowerCase()
) )
: setRepresentationSubmit(true) : setRepresentationSubmit(true)
: currentView.representationSubmit == true && : currentView.representationSubmit == true
(console.log("capacity", currentView.representationCapacity), ? (console.log("capacity", currentView.representationCapacity),
console.log("has errors:", props.invalid), console.log("has errors:", props.invalid),
props.invalid == false && props.invalid == false &&
updateRepresentation(values, false, false), updateRepresentation(values, false, false),
uploadRepresentationFiles(values), uploadRepresentationFiles(values),
setRepresentationSubmitConfirmation(true)); setRepresentationSubmitConfirmation(true))
: console.log("nit updated");
window.alert(`You submitted:\n\n${JSON.stringify(values, null, 2)}`); //window.alert(`You submitted:\n\n${JSON.stringify(values, null, 2)}`);
}; };
const uploadRepresentationFiles = (values) => { const uploadRepresentationFiles = (values) => {
@@ -388,15 +370,15 @@ let MakeRepresentation = (props) => {
const repForm = props.props.form; const repForm = props.props.form;
// console.log( console.log(
// "waht is representationSubmit:", "waht is representationSubmit:",
// currentView.representationSubmit currentView.representationSubmit
// ); );
return ( return (
<div> <div>
<form onSubmit={handleSubmit(onHandleSubmit)}> <form onSubmit={handleSubmit(onHandleSubmit)}>
{currentView.representationSubmit == "true" ? ( {currentView.representationSubmit == true ? (
<RepCompleteSubmit <RepCompleteSubmit
formObj={formObj} formObj={formObj}
capacityOptionsArr={capacityOptionsArr} capacityOptionsArr={capacityOptionsArr}
@@ -8,6 +8,7 @@ import {
RenderRadioList, RenderRadioList,
RenderMultiline, RenderMultiline,
RenderCondtionalRadioList, RenderCondtionalRadioList,
FileUploadField,
} from "./representationElements"; } from "./representationElements";
import { import {
setRepresentationCapacity, setRepresentationCapacity,
@@ -90,6 +91,7 @@ const RepAgent = (props) => {
/> />
</div> </div>
</div> </div>
<div className="govuk-grid-row"> <div className="govuk-grid-row">
<div className="govuk-form-group"> <div className="govuk-form-group">
<p className="govuk-body"> <p className="govuk-body">
@@ -101,50 +103,8 @@ const RepAgent = (props) => {
aria-describedby="commentBox-hint" aria-describedby="commentBox-hint"
> >
<div id="commentBox-hint" className="govuk-hint"> <div id="commentBox-hint" className="govuk-hint">
My comments are set out in:* My comments are set out in:
</div> </div>
<div
className="govuk-checkboxes"
data-module="govuk-checkboxes"
>
<div className="govuk-checkboxes__item">
<Field
className="govuk-checkboxes__input"
id="commentBox"
name="commentBox"
value="email"
data-aria-controls="commentBox"
type="checkbox"
component={RenderTextfield}
/>
<label
className="govuk-label govuk-checkboxes__label"
htmlFor="commentBox"
>
the box below{" "}
</label>
</div>
<div
className={
_.isEmpty(formObj["representationForm"])
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden rr"
: _.isEmpty(
formObj["representationForm"]
.values
)
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden q11 "
: _.isEmpty(
formObj["representationForm"]
.values.commentBox
)
? formObj["representationForm"]
.values.commentBox == false
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden www"
: "govuk-checkboxes__conditional"
: "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden wwwaqqqq"
}
id="conditional-commentBox"
>
<div className="govuk-form-group"> <div className="govuk-form-group">
<Field <Field
name="representationComments" name="representationComments"
@@ -153,70 +113,23 @@ const RepAgent = (props) => {
type="text" type="text"
rows="5" rows="5"
className="govuk-textarea govuk-input--width-30" className="govuk-textarea govuk-input--width-30"
aria-describedby={ aria-describedby={props.name + "-hint"}
props.name + "-hint"
}
/> />
</div> </div>
</div>
<div className="govuk-checkboxes__item"> <div className="govuk-form-group govuk-!-margin-bottom-9">
<Field <FileUploadField
className="govuk-checkboxes__input" name={"representationDocuments"}
id="documentBox" label={"Add your files"}
name="documentBox" ticketnumber={props.props.caseReference}
value="email" hint={"sdsd"}
data-aria-controls="documentBox" fileList={[]}
type="checkbox" setFilesForRepresentation={[]}
component={RenderTextfield} containerID={
/> props.props.props.accountDetails
<label .containerID
className="govuk-label govuk-checkboxes__label"
htmlFor="documentBox"
>
separate documents
</label>
</div>
<div
className={
_.isEmpty(formObj["representationForm"])
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden rr"
: _.isEmpty(
formObj["representationForm"]
.values
)
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden www"
: _.isEmpty(
formObj["representationForm"]
.values.documentBox
)
? formObj["representationForm"]
.values.documentBox == false
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden www"
: "govuk-checkboxes__conditional"
: "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden"
} }
id="conditional-documentBox" />
>
<div className="govuk-form-group">
<section className="container">
<div
{...getRootProps({
className: "dropzone",
})}
>
<input {...getInputProps()} />
<p>
Drag and drop files here or
click to select files
</p>
</div>
<aside>
<h4>Files</h4>
<ul>{files}</ul>
</aside>
</section>
</div>
</div>
</div> </div>
</fieldset> </fieldset>
</div>{" "} </div>{" "}
@@ -11,6 +11,7 @@ import {
RenderRadioList, RenderRadioList,
RenderMultiline, RenderMultiline,
RenderFileUpload, RenderFileUpload,
FileUploadField,
} from "./representationElements"; } from "./representationElements";
import { useDropzone } from "react-dropzone"; import { useDropzone } from "react-dropzone";
// import { // import {
@@ -70,6 +71,7 @@ const RepAppellant = (props) => {
/> />
</div> </div>
</div> */} </div> */}
<div className="govuk-grid-row"> <div className="govuk-grid-row">
<div className="govuk-form-group"> <div className="govuk-form-group">
<p className="govuk-body"> <p className="govuk-body">
@@ -81,50 +83,8 @@ const RepAppellant = (props) => {
aria-describedby="commentBox-hint" aria-describedby="commentBox-hint"
> >
<div id="commentBox-hint" className="govuk-hint"> <div id="commentBox-hint" className="govuk-hint">
My comments are set out in:* My comments are set out in:
</div> </div>
<div
className="govuk-checkboxes"
data-module="govuk-checkboxes"
>
<div className="govuk-checkboxes__item">
<Field
className="govuk-checkboxes__input"
id="commentBox"
name="commentBox"
value="email"
data-aria-controls="commentBox"
type="checkbox"
component={RenderTextfield}
/>
<label
className="govuk-label govuk-checkboxes__label"
htmlFor="commentBox"
>
the box below{" "}
</label>
</div>
<div
className={
_.isEmpty(formObj["representationForm"])
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden rr"
: _.isEmpty(
formObj["representationForm"]
.values
)
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden q11 "
: _.isEmpty(
formObj["representationForm"]
.values.commentBox
)
? formObj["representationForm"]
.values.commentBox == false
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden www"
: "govuk-checkboxes__conditional"
: "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden wwwaqqqq"
}
id="conditional-commentBox"
>
<div className="govuk-form-group"> <div className="govuk-form-group">
<Field <Field
name="representationComments" name="representationComments"
@@ -133,72 +93,23 @@ const RepAppellant = (props) => {
type="text" type="text"
rows="5" rows="5"
className="govuk-textarea govuk-input--width-30" className="govuk-textarea govuk-input--width-30"
aria-describedby={ aria-describedby={props.name + "-hint"}
props.name + "-hint"
}
/> />
</div> </div>
</div>
<div className="govuk-checkboxes__item"> <div className="govuk-form-group govuk-!-margin-bottom-9">
<Field <FileUploadField
className="govuk-checkboxes__input" name={"representationDocuments"}
id="documentBox" label={"Add your files"}
name="documentBox" ticketnumber={props.props.caseReference}
data-aria-controls="documentBox" hint={"sdsd"}
type="checkbox" fileList={[]}
component={RenderTextfield} setFilesForRepresentation={[]}
containerID={
props.props.props.accountDetails
.containerID
}
/> />
<label
className="govuk-label govuk-checkboxes__label"
htmlFor="documentBox"
>
separate documents
</label>
</div>
<div
className={
_.isEmpty(formObj["representationForm"])
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden rr"
: _.isEmpty(
formObj["representationForm"]
.values
)
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden www"
: _.isEmpty(
formObj["representationForm"]
.values.documentBox
)
? formObj["representationForm"]
.values.documentBox == false
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden www"
: "govuk-checkboxes__conditional"
: "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden"
}
id="conditional-documentBox"
>
<h2 className="govuk-heading-s">
{props.label}{" "}
</h2>
<Field
name="repsFiles"
id="repsFiles"
component={RenderFileUpload}
className="govuk-input govuk-input--width-20"
//validate={[required]}
label={props.label}
errorMsg="Is required"
ticketnumber={props.caseReference}
documentTypeCode={
props.documentTypeCode
}
hint={props.hint}
fileList={props.fileList}
setFilesForAppeal={
props.setFilesForAppeal
}
containerID={props.containerID}
/>
</div>
</div> </div>
</fieldset> </fieldset>
</div>{" "} </div>{" "}
@@ -77,7 +77,7 @@ let RepCapacitySelection = (props) => {
className="govuk-button" className="govuk-button"
data-module="govuk-button" data-module="govuk-button"
> >
Continue {t("common:continue-button")}
</button> </button>
</div> </div>
</div> </div>
@@ -166,6 +166,7 @@ const RepCompleteSubmit = (props) => {
<dd className="govuk-summary-list__value"> <dd className="govuk-summary-list__value">
<span <span
className="multiline-elipsis"
dangerouslySetInnerHTML={{ dangerouslySetInnerHTML={{
__html: repFormData.representationComments, __html: repFormData.representationComments,
}} }}
@@ -260,12 +261,12 @@ const RepCompleteSubmit = (props) => {
type="submit" type="submit"
className="govuk-button" className="govuk-button"
data-module="govuk-button" data-module="govuk-button"
onClick={() => // onClick={() => {
//setRepresentationSubmitConfirmation() // setRepresentationSubmitConfirmation();
setRepresentationSubmit(true) // setRepresentationSubmit(true);
} // }}
> >
Continue {t("common:continue-button")}
</button> </button>
{/* <a {/* <a
onClick={() => { onClick={() => {
@@ -280,7 +281,7 @@ const RepCompleteSubmit = (props) => {
onClick={() => setSubmitBack()} onClick={() => setSubmitBack()}
className="govuk-link" className="govuk-link"
> >
Back {t("case:summary-back-button-label")}
</a> </a>
</div> </div>
</div> </div>
@@ -117,15 +117,16 @@ const RepInterestedPartyPerson = (props) => {
</fieldset> </fieldset>
</div>{" "} </div>{" "}
</div> </div>
<div className="govuk-grid-row"> <div className="govuk-grid-row">
<div className="govuk-button-group"> <div className="govuk-button-group">
{/* <button <button
type="submit" type="submit"
className="govuk-button" className="govuk-button"
data-module="govuk-button" data-module="govuk-button"
> >
Continue {t("common:continue-button")}
</button> */} </button>
{/* <Link href="/representation"> {/* <Link href="/representation">
<a <a
onClick={() => { onClick={() => {
@@ -143,7 +144,7 @@ const RepInterestedPartyPerson = (props) => {
}} }}
className="govuk-link" className="govuk-link"
> >
Back {t("case:summary-back-button-label")}
</a> </a>
</div> </div>
</div> </div>
@@ -7,6 +7,7 @@ import {
RenderTextfield, RenderTextfield,
RenderRadioList, RenderRadioList,
RenderMultiline, RenderMultiline,
FileUploadField,
} from "./representationElements"; } from "./representationElements";
import { useDropzone } from "react-dropzone"; import { useDropzone } from "react-dropzone";
import { import {
@@ -69,6 +70,7 @@ const RepLandOwner = (props) => {
/> />
</div> </div>
</div> */} </div> */}
<div className="govuk-grid-row"> <div className="govuk-grid-row">
<div className="govuk-form-group"> <div className="govuk-form-group">
<p className="govuk-body"> <p className="govuk-body">
@@ -80,50 +82,8 @@ const RepLandOwner = (props) => {
aria-describedby="commentBox-hint" aria-describedby="commentBox-hint"
> >
<div id="commentBox-hint" className="govuk-hint"> <div id="commentBox-hint" className="govuk-hint">
My comments are set out in:* My comments are set out in:
</div> </div>
<div
className="govuk-checkboxes"
data-module="govuk-checkboxes"
>
<div className="govuk-checkboxes__item">
<Field
className="govuk-checkboxes__input"
id="commentBox"
name="commentBox"
value="email"
data-aria-controls="commentBox"
type="checkbox"
component={RenderTextfield}
/>
<label
className="govuk-label govuk-checkboxes__label"
htmlFor="commentBox"
>
the box below{" "}
</label>
</div>
<div
className={
_.isEmpty(formObj["representationForm"])
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden rr"
: _.isEmpty(
formObj["representationForm"]
.values
)
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden q11 "
: _.isEmpty(
formObj["representationForm"]
.values.commentBox
)
? formObj["representationForm"]
.values.commentBox == false
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden www"
: "govuk-checkboxes__conditional"
: "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden wwwaqqqq"
}
id="conditional-commentBox"
>
<div className="govuk-form-group"> <div className="govuk-form-group">
<Field <Field
name="representationComments" name="representationComments"
@@ -132,74 +92,28 @@ const RepLandOwner = (props) => {
type="text" type="text"
rows="5" rows="5"
className="govuk-textarea govuk-input--width-30" className="govuk-textarea govuk-input--width-30"
aria-describedby={ aria-describedby={props.name + "-hint"}
props.name + "-hint"
}
/> />
</div> </div>
</div>
<div className="govuk-checkboxes__item"> <div className="govuk-form-group govuk-!-margin-bottom-9">
<Field <FileUploadField
className="govuk-checkboxes__input" name={"representationDocuments"}
id="documentBox" label={"Add your files"}
name="documentBox" ticketnumber={props.props.caseReference}
value="email" hint={"sdsd"}
data-aria-controls="documentBox" fileList={[]}
type="checkbox" setFilesForRepresentation={[]}
component={RenderTextfield} containerID={
/> props.props.props.accountDetails
<label .containerID
className="govuk-label govuk-checkboxes__label"
htmlFor="documentBox"
>
separate documents
</label>
</div>
<div
className={
_.isEmpty(formObj["representationForm"])
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden rr"
: _.isEmpty(
formObj["representationForm"]
.values
)
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden www"
: _.isEmpty(
formObj["representationForm"]
.values.documentBox
)
? formObj["representationForm"]
.values.documentBox == false
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden www"
: "govuk-checkboxes__conditional"
: "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden"
} }
id="conditional-documentBox" />
>
<div className="govuk-form-group">
<section className="container">
<div
{...getRootProps({
className: "dropzone",
})}
>
<input {...getInputProps()} />
<p>
Drag and drop files here or
click to select files
</p>
</div>
<aside>
<h4>Files</h4>
<ul>{files}</ul>
</aside>
</section>
</div>
</div>
</div> </div>
</fieldset> </fieldset>
</div>{" "}
</div> </div>
</div>
<div className="govuk-grid-row"> <div className="govuk-grid-row">
<div className="govuk-button-group"> <div className="govuk-button-group">
<button <button
+7 -5
View File
@@ -289,7 +289,8 @@ const CaseSummary = (props) => {
</div> </div>
</div> </div>
{props.currentView.showReps == "true" && {props.currentView.showReps == true ||
(props.currentView.showReps == "true" &&
_.has(detailsObj, "pinswg_startdate") && _.has(detailsObj, "pinswg_startdate") &&
hasEndDate && hasEndDate &&
showReps( showReps(
@@ -326,13 +327,15 @@ const CaseSummary = (props) => {
}} }}
className="govuk-button govuk-button--secondary" className="govuk-button govuk-button--secondary"
> >
{t("case:summary-back-button-label")} {t(
"case:summary-back-button-label"
)}
</a> </a>
</div> </div>
</div> </div>
</div> </div>
)} ))}
{props.currentView.showReps == "true" && {props.currentView.showReps == true &&
_.has(detailsObj, "pinswg_startdate") && _.has(detailsObj, "pinswg_startdate") &&
hasEndDate && hasEndDate &&
showRepsEnded( showRepsEnded(
@@ -352,7 +355,6 @@ const CaseSummary = (props) => {
</div> </div>
</div> </div>
)} )}
{/* 1{" "} {/* 1{" "}
{_.has(detailsObj, "pinswg_startdatetimeiftheevent") && {_.has(detailsObj, "pinswg_startdatetimeiftheevent") &&
detailsObj.pinswg_startdatetimeiftheevent} detailsObj.pinswg_startdatetimeiftheevent}
+1 -1
View File
@@ -133,7 +133,7 @@ const TopThree = (props) => {
} }
}; };
let topThreeOnlyArr = showTopThreeArr.slice(0, 3); let topThreeOnlyArr = showTopThreeArr; //.slice(0, 3);
Object.keys(topThreeOnlyArr).map((key, index) => { Object.keys(topThreeOnlyArr).map((key, index) => {
topthreeRow.push( topthreeRow.push(
<div className="cardModuleItem" key={index}> <div className="cardModuleItem" key={index}>
+12 -10
View File
@@ -162,23 +162,25 @@ export const getServerSideProps = wrapper.getServerSideProps(
let loggedInUserCookie = cookies.pinsUser; let loggedInUserCookie = cookies.pinsUser;
let thisSession = await getSession(ctx); let thisSession = await getSession(ctx);
let loggedInUser = {};
let [loggedInUser] = await Promise.all([ if (!thisSession) {
console.log("not has sesssion.......");
return {
redirect: {
destination: "/auth/signin",
permanent: false,
},
};
} else {
console.log(" has sesssion.......");
[loggedInUser] = await Promise.all([
await getPortalLogin(thisSession.user.email), await getPortalLogin(thisSession.user.email),
]); ]);
loggedInUser = loggedInUser.value[0].contactid; loggedInUser = loggedInUser.value[0].contactid;
console.log("nextAuth Session:", thisSession); console.log("nextAuth Session:", thisSession);
if (_.has(thisSession, "user") == false) {
return {
redirect: {
destination: "/error",
permanent: false,
},
};
} }
//Create Storage container for logged in user //Create Storage container for logged in user
await createContainer(thisSession.user.id); await createContainer(thisSession.user.id);
+44 -3
View File
@@ -1,7 +1,9 @@
import useTranslation from "next-translate/useTranslation"; import useTranslation from "next-translate/useTranslation";
import Head from "next/head"; import Head from "next/head";
import { useEffect } from "react";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { connect } from "react-redux"; import { connect, useDispatch } from "react-redux";
import Breadcrumbs from "../../components/breadcrumbs"; import Breadcrumbs from "../../components/breadcrumbs";
import CookieBanner from "../../components/cookieBanner"; import CookieBanner from "../../components/cookieBanner";
import Footer from "../../components/footer"; import Footer from "../../components/footer";
@@ -9,7 +11,17 @@ import Header from "../../components/header";
import Case from "../../components/representation"; import Case from "../../components/representation";
import { wrapper } from "../../store/store"; import { wrapper } from "../../store/store";
import { getSession, useSession } from "next-auth/react"; import { getSession, useSession } from "next-auth/react";
import { getPersonalAccount } from "../../actions"; import {
consoleLogger,
getPersonalAccount,
getPortalLogin,
} from "../../actions";
import {
setRepresentationCapacity,
setRepresentationSubmit,
setSubmitBack,
setRepresentationSubmitConfirmation,
} from "../../store/currentView/action";
import { import {
setAccountDetails, setAccountDetails,
setContainerID, setContainerID,
@@ -24,6 +36,27 @@ const Home = (props) => {
const { locale } = router; const { locale } = router;
const { appealtypes } = router.query; const { appealtypes } = router.query;
const dispatch = useDispatch();
useEffect(async () => {
const thisSession = await getSession();
if (thisSession) {
let [loggedInUser] = await Promise.all([
await getPortalLogin(thisSession.user.email),
]);
dispatch(
setAccountDetails(
await getPersonalAccount(loggedInUser.value[0].contactid)
)
);
dispatch(setContainerID(thisSession.user.id));
//dispatch(setRepresentationSubmit(true));
}
}, [dispatch]);
return ( return (
<div> <div>
<Head> <Head>
@@ -148,6 +181,14 @@ const Home = (props) => {
// } // }
// ); // );
const mapDispatchToProps = (dispatch) => {
return {
setAccountDetails: (loggedInUser) => {
dispatch(setAccountDetails(loggedInUser));
},
};
};
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
//console.log(state); //console.log(state);
@@ -166,4 +207,4 @@ const mapStateToProps = (state) => {
}; };
}; };
export default connect(mapStateToProps)(Home); export default connect(mapStateToProps, mapDispatchToProps)(Home);
+7
View File
@@ -29,6 +29,8 @@ import {
setWatchedCases, setWatchedCases,
setWatchedCasesDetails, setWatchedCasesDetails,
} from "../../store/watchedCases/action"; } from "../../store/watchedCases/action";
import { setShowReps } from "../../store/currentView/action";
import TimeOut from "../../components/timeout"; import TimeOut from "../../components/timeout";
import { getSession, useSession } from "next-auth/react"; import { getSession, useSession } from "next-auth/react";
import { import {
@@ -87,6 +89,11 @@ export const getServerSideProps = wrapper.getServerSideProps(
await getPortalLogin(thisSession.user.email), await getPortalLogin(thisSession.user.email),
]); ]);
const showReps = process.env.SHOWREPRESENTATIONS || false;
console.log("env var ", process.env.SHOWREPRESENTATIONS);
store.dispatch(setShowReps(showReps));
searchResultsObj = searchResultsObj =
searchResultsObj.status == 502 searchResultsObj.status == 502
? { ? {
+1
View File
@@ -8,6 +8,7 @@ const currentViewInitialState = {
representationSubmitConfirmation: {}, representationSubmitConfirmation: {},
linkedCaseReferences: {}, linkedCaseReferences: {},
currentPage: 1, currentPage: 1,
showReps: false,
}; };
export default function reducer(state = currentViewInitialState, action) { export default function reducer(state = currentViewInitialState, action) {
+11
View File
@@ -998,6 +998,17 @@ textarea,
} }
.govuk-summary-list__value {
.multiline-elipsis {
-webkit-box-orient: vertical;
display: -webkit-box;
-webkit-line-clamp: 10;
overflow: hidden;
text-overflow: ellipsis;
white-space: normal;
}
}
.documentList { .documentList {
.govuk-summary-list__key:first-of-type { .govuk-summary-list__key:first-of-type {
width: 40%; width: 40%;