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,122 +103,33 @@ 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 <div className="govuk-form-group">
className="govuk-checkboxes" <Field
data-module="govuk-checkboxes" name="representationComments"
> id="representationComments"
<div className="govuk-checkboxes__item"> component={RenderMultiline}
<Field type="text"
className="govuk-checkboxes__input" rows="5"
id="commentBox" className="govuk-textarea govuk-input--width-30"
name="commentBox" aria-describedby={props.name + "-hint"}
value="email" />
data-aria-controls="commentBox" </div>
type="checkbox"
component={RenderTextfield} <div className="govuk-form-group govuk-!-margin-bottom-9">
/> <FileUploadField
<label name={"representationDocuments"}
className="govuk-label govuk-checkboxes__label" label={"Add your files"}
htmlFor="commentBox" ticketnumber={props.props.caseReference}
> hint={"sdsd"}
the box below{" "} fileList={[]}
</label> setFilesForRepresentation={[]}
</div> containerID={
<div props.props.props.accountDetails
className={ .containerID
_.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">
<Field
name="representationComments"
id="representationComments"
component={RenderMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={
props.name + "-hint"
}
/>
</div>
</div>
<div className="govuk-checkboxes__item">
<Field
className="govuk-checkboxes__input"
id="documentBox"
name="documentBox"
value="email"
data-aria-controls="documentBox"
type="checkbox"
component={RenderTextfield}
/>
<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"
>
<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,124 +83,33 @@ 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 <div className="govuk-form-group">
className="govuk-checkboxes" <Field
data-module="govuk-checkboxes" name="representationComments"
> id="representationComments"
<div className="govuk-checkboxes__item"> component={RenderMultiline}
<Field type="text"
className="govuk-checkboxes__input" rows="5"
id="commentBox" className="govuk-textarea govuk-input--width-30"
name="commentBox" aria-describedby={props.name + "-hint"}
value="email" />
data-aria-controls="commentBox" </div>
type="checkbox"
component={RenderTextfield} <div className="govuk-form-group govuk-!-margin-bottom-9">
/> <FileUploadField
<label name={"representationDocuments"}
className="govuk-label govuk-checkboxes__label" label={"Add your files"}
htmlFor="commentBox" ticketnumber={props.props.caseReference}
> hint={"sdsd"}
the box below{" "} fileList={[]}
</label> setFilesForRepresentation={[]}
</div> containerID={
<div props.props.props.accountDetails
className={ .containerID
_.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">
<Field
name="representationComments"
id="representationComments"
component={RenderMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={
props.name + "-hint"
}
/>
</div>
</div>
<div className="govuk-checkboxes__item">
<Field
className="govuk-checkboxes__input"
id="documentBox"
name="documentBox"
data-aria-controls="documentBox"
type="checkbox"
component={RenderTextfield}
/>
<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,25 +117,26 @@ 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={() => {
setRepresentationSubmit(true); setRepresentationSubmit(true);
}} }}
className="govuk-button" className="govuk-button"
> >
Continue Continue
</a> </a>
</Link> */} </Link> */}
<a <a
onClick={() => { onClick={() => {
setRepresentationCapacity(); setRepresentationCapacity();
@@ -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,126 +82,38 @@ 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 <div className="govuk-form-group">
className="govuk-checkboxes" <Field
data-module="govuk-checkboxes" name="representationComments"
> id="representationComments"
<div className="govuk-checkboxes__item"> component={RenderMultiline}
<Field type="text"
className="govuk-checkboxes__input" rows="5"
id="commentBox" className="govuk-textarea govuk-input--width-30"
name="commentBox" aria-describedby={props.name + "-hint"}
value="email" />
data-aria-controls="commentBox" </div>
type="checkbox"
component={RenderTextfield} <div className="govuk-form-group govuk-!-margin-bottom-9">
/> <FileUploadField
<label name={"representationDocuments"}
className="govuk-label govuk-checkboxes__label" label={"Add your files"}
htmlFor="commentBox" ticketnumber={props.props.caseReference}
> hint={"sdsd"}
the box below{" "} fileList={[]}
</label> setFilesForRepresentation={[]}
</div> containerID={
<div props.props.props.accountDetails
className={ .containerID
_.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">
<Field
name="representationComments"
id="representationComments"
component={RenderMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={
props.name + "-hint"
}
/>
</div>
</div>
<div className="govuk-checkboxes__item">
<Field
className="govuk-checkboxes__input"
id="documentBox"
name="documentBox"
value="email"
data-aria-controls="documentBox"
type="checkbox"
component={RenderTextfield}
/>
<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"
>
<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
+42 -40
View File
@@ -289,50 +289,53 @@ const CaseSummary = (props) => {
</div> </div>
</div> </div>
{props.currentView.showReps == "true" && {props.currentView.showReps == true ||
_.has(detailsObj, "pinswg_startdate") && (props.currentView.showReps == "true" &&
hasEndDate && _.has(detailsObj, "pinswg_startdate") &&
showReps( hasEndDate &&
detailsObj.pinswg_startdate, showReps(
detailsObj.pinswg_representation_period_end_date detailsObj.pinswg_startdate,
) && ( detailsObj.pinswg_representation_period_end_date
<div className="govuk-grid-row"> ) && (
<div className="govuk-grid-column-full"> <div className="govuk-grid-row">
<div className="govuk-button-group"> <div className="govuk-grid-column-full">
<Link <div className="govuk-button-group">
href={{ <Link
pathname: href={{
"/myportal/representation", pathname:
query: { "/myportal/representation",
case: query: {
currentType == case:
"searchResultsObj" currentType ==
? detailsObj.pinswg_name "searchResultsObj"
: casesObj.reference, ? detailsObj.pinswg_name
}, : casesObj.reference,
}} },
> }}
<a className="govuk-button"> >
<a className="govuk-button">
{t(
"case:summary-make-representation-label"
)}
</a>
</Link>
<a
onClick={() => {
//spinnerState();
router.back();
}}
className="govuk-button govuk-button--secondary"
>
{t( {t(
"case:summary-make-representation-label" "case:summary-back-button-label"
)} )}
</a> </a>
</Link> </div>
<a
onClick={() => {
//spinnerState();
router.back();
}}
className="govuk-button govuk-button--secondary"
>
{t("case:summary-back-button-label")}
</a>
</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) {
await getPortalLogin(thisSession.user.email), console.log("not has sesssion.......");
]);
loggedInUser = loggedInUser.value[0].contactid;
console.log("nextAuth Session:", thisSession);
if (_.has(thisSession, "user") == false) {
return { return {
redirect: { redirect: {
destination: "/error", destination: "/auth/signin",
permanent: false, permanent: false,
}, },
}; };
} } else {
console.log(" has sesssion.......");
[loggedInUser] = await Promise.all([
await getPortalLogin(thisSession.user.email),
]);
loggedInUser = loggedInUser.value[0].contactid;
console.log("nextAuth Session:", thisSession);
}
//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) {
+20 -9
View File
@@ -907,11 +907,11 @@ textarea,
.app-step-nav__step--active .app-step-nav__circle--number, .app-step-nav__step--active .app-step-nav__circle--number,
.app-step-nav__step--active:after, .app-step-nav__step--active:after,
.app-step-nav__step--active .app-step-nav__help:after { .app-step-nav__step--active .app-step-nav__help:after {
border-color: $lightgrey !important; border-color: $lightgrey !important;
} }
.app-step-nav__circle--number { .app-step-nav__circle--number {
border-color: $lightgrey !important; border-color: $lightgrey !important;
} }
.app-step-nav__circle-background { .app-step-nav__circle-background {
@@ -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%;
@@ -1039,12 +1050,12 @@ textarea,
padding: 10px 15px !important; padding: 10px 15px !important;
font-size: 16px; font-size: 16px;
float: right; float: right;
border-color: $midgrey !important; border-color: $midgrey !important;
color: $midgrey !important; color: $midgrey !important;
&:hover { &:hover {
background-color: $midgrey !important; background-color: $midgrey !important;
color: $white !important; color: $white !important;
} }
} }
@@ -1054,7 +1065,7 @@ textarea,
font-size: 16px; font-size: 16px;
float: right; float: right;
color: $midgrey !important; color: $midgrey !important;
@@ -1167,7 +1178,7 @@ textarea,
height: 2.5rem; height: 2.5rem;
margin-top: 0; margin-top: 0;
padding: 10px 15px; padding: 10px 15px;
border: 1px solid $darkgrey !important; border: 1px solid $darkgrey !important;
border-radius: 0; border-radius: 0;
-webkit-appearance: none; -webkit-appearance: none;
appearance: none; appearance: none;
@@ -2024,7 +2035,7 @@ ul#sharePageLinks.active {
} }
&.watched_link { &.watched_link {
color: $black !important; color: $black !important;
background-color: $white; background-color: $white;
width: 13px; width: 13px;
display: block; display: block;