reps defects

This commit is contained in:
2024-06-03 11:57:11 +01:00
parent c63ea33c64
commit c947995e7b
19 changed files with 392 additions and 167 deletions
+11 -23
View File
@@ -5,12 +5,12 @@ import _ from "lodash";
let BASE_URL;
const port = parseInt(process.env.PORT, 10) || 3000;
if (process.browser) {
if (typeof window !== "undefined") {
BASE_URL = window.apiRoot;
} else {
BASE_URL = process.env.API_ROOT || `http://localhost:${port}`;
}
BASE_URL = process.env.API_ROOT;
//BASE_URL = process.env.API_ROOT;
const WORDKEY = process.env.HASHKEY;
@@ -62,25 +62,12 @@ export const consoleLogger = (err) => {
(_.has(err, "response.headers.date")
? "\nRequest Time: " + err.response.headers.date + "\n"
: "") +
// (
// err.hasOwnProperty("response")
// ? err.response.hasOwnProperty("status")
// ? err.response.status +
// " : " +
// err.response.statusText +
// "\nRequest IP: " +
// err.response.request.hasOwnProperty("socket")
// ? err.response.request.hasOwnProperty("remoteAddress")
// ? err.response.request.socket.remoteAddress
// : ""
// : "" +
// "\nRequest URL: " +
// err.response.config.url +
// "\nRequest Time: " +
// err.response.headers.date
// : err
// : err.response
// ) +
(_.has(err, "config.url")
? "\nAxios config url: " + err.config.url + "\n"
: "") +
(_.has(err, "config.url")
? "\nAxios message url: " + err.message + "\n"
: "") +
"\n/////////////////////////////////////////////////\n\n";
return errStr;
};
@@ -699,6 +686,7 @@ export const getPersonalAccount = (contactid) => {
return res.data;
})
.catch((error) => {
consoleLogger(error);
//console.log("returned:", error);
// let ErrResponse = {
// value: [],
@@ -1789,7 +1777,7 @@ export const getNotice = () => {
});
};
export const getPortalLogin = (emailAddress) => {
export const getPortalLogin = async (emailAddress) => {
var queryUrl =
"/api/endpoint/getportallogin_api?emailAddress=" + emailAddress;
@@ -1797,7 +1785,7 @@ export const getPortalLogin = (emailAddress) => {
.get(BASE_URL + queryUrl)
.then((res) => res.data)
.catch((error) => {
//console.log(consoleLogger(error));
console.log(consoleLogger(error));
console.log("thiserror", error);
return JSON.stringify(error);
});
+9 -1
View File
@@ -216,7 +216,6 @@ let MakeRepresentation = (props) => {
capacityOptionsArr.push(
t("myrepresentations:capacity-options-arr-interested")
);
console.log(props.props.currentView);
let setCaseDetailsObj = router.query.hasOwnProperty("state")
? router.query.state == "edit"
@@ -300,6 +299,7 @@ let MakeRepresentation = (props) => {
isLPA &&
currentView.caseReference.appealType != 846040019 &&
currentView.caseReference.appealType != 846040011 &&
currentView.caseReference.appealType != 846040015 &&
todaysDate >= startDate &&
todaysDate <= questionnaireDate &&
buildArr.push("Questionnaire");
@@ -323,6 +323,8 @@ let MakeRepresentation = (props) => {
buildArr.push("Statement");
currentView.caseReference.appealType != 846040004 &&
currentView.caseReference.appealType == 846040015 &&
currentView.caseReference.specialistProcess != 846040001 &&
todaysDate >= statementDueDate &&
todaysDate <= finalCommentsDate &&
buildArr.push("Final comments");
@@ -333,6 +335,12 @@ let MakeRepresentation = (props) => {
todaysDate <= finalCommentsDate &&
buildArr.push("Final comments");
//is LPA Advert part 3 no statement
isLPA &&
currentView.caseReference.appealType == 846040018 &&
currentView.caseReference.specialistProcess == 846040000 &&
buildArr.pop("Statements");
return buildArr;
};
@@ -225,15 +225,13 @@ const RepAgent = (props) => {
);
};
const mapStateToProps = (state, props) => {};
const mapDispatchToProps = (dispatch) => ({
updateField: (form, field, newValue) =>
dispatch(change(form, field, newValue)),
});
export default connect(
mapStateToProps,
null,
mapDispatchToProps
)(
reduxForm({
@@ -209,7 +209,7 @@ const RepAppellant = (props) => {
);
};
const mapStateToProps = (state, props) => {};
//const mapStateToProps = (state, props) => {};
const mapDispatchToProps = (dispatch) => ({
updateField: (form, field, newValue) =>
@@ -217,7 +217,7 @@ const mapDispatchToProps = (dispatch) => ({
});
export default connect(
mapStateToProps,
null,
mapDispatchToProps
)(
reduxForm({
@@ -2,6 +2,7 @@ import useTranslation from "next-translate/useTranslation";
import Link from "next/link";
import { useRouter } from "next/router";
import { useEffect } from "react";
import { connect } from "react-redux";
import { useDropzone } from "react-dropzone";
import {
@@ -68,8 +69,13 @@ const RepComplete = (props) => {
props.props.currentView.caseReference.appealType,
"pinswg_representationsubmitted": new Date(Date.now()),
"pinswg_representationtype":
props.props.currentView.caseReference.repDetails
.representationType,
props.props.currentView.caseReference.hasOwnProperty(
"repDetails"
)
? props.props.currentView.caseReference.repDetails
.representationType
: props.props.currentView.caseReference
.representationType,
}),
setRepresentationMessageSent(true));
});
@@ -102,4 +108,22 @@ const RepComplete = (props) => {
);
};
export default RepComplete;
const mapStateToProps = (state) => {
return {
search: state.search,
searchResultsObj: state.searchResultsObj,
formData: state.formData,
appealType: state.appealType,
currentView: state.currentView,
myRepresentations: state.myRepresentations,
initialValues: state.currentView.caseReference.repDetails,
accountDetails: state.accountDetails,
//form: state.form,
};
};
const mapDispatchToProps = (dispatch) => {
return {};
};
export default connect(mapStateToProps, mapDispatchToProps)(RepComplete);
@@ -6,6 +6,7 @@ import RepComplete from "./representationComplete";
import RepLPAQuestionnaireCheck_s78 from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_s78";
import RepLPAQuestionnaireCheck_enforcement from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_enforcement";
import { useState, useEffect } from "react";
import { connect } from "react-redux";
import {
getFormCollectionByID,
@@ -450,4 +451,22 @@ const RepCompleteSubmit = (props) => {
);
};
export default RepCompleteSubmit;
const mapStateToProps = (state) => {
return {
search: state.search,
searchResultsObj: state.searchResultsObj,
formData: state.formData,
appealType: state.appealType,
currentView: state.currentView,
myRepresentations: state.myRepresentations,
initialValues: state.currentView.caseReference.repDetails,
accountDetails: state.accountDetails,
//form: state.form,
};
};
const mapDispatchToProps = (dispatch) => {
return {};
};
export default connect(mapStateToProps, mapDispatchToProps)(RepCompleteSubmit);
@@ -1007,7 +1007,16 @@ export const RenderFileUpload = (field) => {
return (
<>
<Dropzone
accept="application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,image/tiff,image/jpeg,application/zip"
accept={{
"application/pdf": [".pdf"],
"application/msword": [".doc"],
"application/vnd.openxmlformats-officedocument.wordprocessingml.document":
[".docx"],
"image/tiff": [".tif", ".tiff"],
"image/jpeg": [".jpg", ".jpeg"],
"application/zip": [".zip"],
"image/png": [".png"],
}}
onDrop={(filesToUpload, e) => {
const renamedAcceptedFiles = filesToUpload.map(
(file) =>
@@ -191,7 +191,7 @@ const RepInterestedPartyPerson = (props) => {
);
};
const mapStateToProps = (state, props) => {};
//const mapStateToProps = (state, props) => {};
const mapDispatchToProps = (dispatch) => ({
updateField: (form, field, newValue) =>
@@ -199,7 +199,7 @@ const mapDispatchToProps = (dispatch) => ({
});
export default connect(
mapStateToProps,
null,
mapDispatchToProps
)(
reduxForm({
+84 -50
View File
@@ -171,8 +171,14 @@ const CaseSummary = (props) => {
const noRepresentationLink = ["/dnsdetails", "/dns/[developmentName]"];
let setCaseQueryObj = props[currentType];
let setCaseDetailsObj = props[currentType + "Details"];
let setCaseQueryObj =
currentType == "directResultsObj"
? props.searchResultsObj.searchResultsObj
: props[currentType];
let setCaseDetailsObj =
currentType == "directResultsObj"
? props.searchResultsObj.searchDetailsObj
: props[currentType + "Details"];
var casesObj = {};
@@ -192,7 +198,10 @@ const CaseSummary = (props) => {
setCaseQueryObj
))
: currentType == "directResultsObj"
? (casesObj = directSearchResultsObj.value)
? (casesObj = jsonpath(
'$..[?(@.ticketnumber=="' + caseReference + '")]',
setCaseQueryObj
))
: (casesObj = jsonpath(
'$..[?(@.reference=="' + caseReference + '")]',
setCaseQueryObj
@@ -207,8 +216,6 @@ const CaseSummary = (props) => {
'$..[?(@.pinswg_name=="' + caseReference + '")]',
searchDetailsObj
))
: currentType == "directResultsObj"
? (detailsObj = searchDetailsObj[0].value)
: (detailsObj = jsonpath(
'$..[?(@.pinswg_name=="' + caseReference + '")]',
setCaseDetailsObj
@@ -436,52 +443,44 @@ const CaseSummary = (props) => {
.caseReference
.appealType
) ? (
props.currentView
.caseReference
.appealType ==
846040018 &&
props.currentView
.caseReference
.specialistProcess ==
846040000 ? (
""
) : (
<>
<Link
href={{
pathname:
"/myportal/representation",
query: {
case:
currentType ==
"searchResultsObj"
? detailsObj.pinswg_name
: currentType ==
"watchedCases"
? casesObj.pinswg_title
: casesObj.reference,
},
}}
className="govuk-button"
>
{t(
"case:summary-make-representation-label"
)}
</Link>
<>
<Link
href={{
pathname:
"/myportal/representation",
query: {
case:
currentType ==
"searchResultsObj"
? detailsObj.pinswg_name
: currentType ==
"watchedCases"
? casesObj.pinswg_title
: currentType ==
"directResultsObj"
? detailsObj.pinswg_name
: casesObj.reference,
},
}}
className="govuk-button"
>
{t(
"case:summary-make-representation-label"
)}
</Link>
<a
onClick={() => {
//spinnerState();
router.back();
}}
className="govuk-button govuk-button--secondary"
>
{t(
"case:summary-back-button-label"
)}
</a>
</>
)
<a
onClick={() => {
//spinnerState();
router.back();
}}
className="govuk-button govuk-button--secondary"
>
{t(
"case:summary-back-button-label"
)}
</a>
</>
) : !isLPA &&
props.currentView
.caseReference
@@ -1129,6 +1128,41 @@ const CaseSummary = (props) => {
return false;
case 846040004:
return isLPA ? true : false;
case 846040015:
return props.searchResultsObj.searchDetailsObj[0].value[0]
.pinswg_specialistcaseprocess == 846040001
? showReps(
props.searchResultsObj.searchDetailsObj[0].value[0]
.pinswg_startdate,
props.searchResultsObj.searchDetailsObj[0].value[0]
.pinswg_statementduedate
)
: true;
case 846040018:
console.log(
props.searchResultsObj.searchDetailsObj[0].value[0]
.pinswg_speacialistcaseprocess,
props.searchResultsObj.searchDetailsObj[0].value[0][
"pinswg_speacialistcaseprocess@OData.Community.Display.V1.FormattedValue"
],
isLPA
);
return props.searchResultsObj.searchDetailsObj[0].value[0]
.pinswg_speacialistcaseprocess == 846040000 && isLPA
? true
: false;
case 846040019:
return showReps(
props.searchResultsObj.searchDetailsObj[0].value[0]
.pinswg_startdate,
props.searchResultsObj.searchDetailsObj[0].value[0]
.pinswg_statementduedate
);
default:
return true;
}
+9 -7
View File
@@ -198,19 +198,21 @@ const TopThree = (props) => {
"&inid=" +
showTopThreeArr[key].incidentid
: router.locale == "cy"
? "/fymhorth/achos"
: "/myportal/case"
? "/fymhorth/achos/" +
showTopThreeArr[key].pinswg_title
: "/myportal/case/" +
showTopThreeArr[key].pinswg_title
}
className="govuk-link--no-underline"
data-id={index}
onClick={() => {
setSearchResults(
props.props.watchedCases.watchedCases
),
setSearchDetails(
props.props.watchedCases
.watchedCasesDetails
);
);
setSearchDetails(
props.props.watchedCases
.watchedCasesDetails
);
setCurrentReference({
"ticketnumber":
showTopThreeArr[key].ticketnumber,
+9 -1
View File
@@ -190,6 +190,14 @@ const ViewAllResults = (props) => {
resultsArr[key].ticketnumber
}
onClick={() => {
currentView.viewKey == "watchedCases" &&
setSearchResults(
props.watchedCases.watchedCases
),
setSearchDetails(
props.watchedCases
.watchedCasesDetails
);
setCurrentReference({
"ticketnumber":
resultsArr[key].ticketnumber,
@@ -1016,7 +1024,7 @@ const ViewAllResults = (props) => {
const mapStateToProps = (state) => {
return {
// currentView: state.currentView,
//currentView: state.currentView,
accountDetails: state.accountDetails,
// search: state.search,
// searchResultsObj: state.searchResultsObj,
@@ -9,12 +9,6 @@ import { connect } from "react-redux";
import { JSONPath as jsonpath } from "jsonpath-plus";
import _, { result } from "lodash";
import transLookup from "../../data/lookuptranslations.json";
import {
getBasicSearchPaged,
getSearchDocumentDetails,
getBasicSearchDetailsPaged,
getAdvancedSearchPaged,
} from "../../actions";
import data from "../../data/collections.json";
import { useCallback, useState } from "react";
+5 -8
View File
@@ -10,12 +10,7 @@ import { connect } from "react-redux";
import { JSONPath as jsonpath } from "jsonpath-plus";
import _ from "lodash";
import transLookup from "../../data/lookuptranslations.json";
import {
getBasicSearchPaged,
getSearchDocumentDetails,
getBasicSearchDetailsPaged,
getAdvancedSearchPaged,
} from "../../actions";
import { getBasicSearchPaged, getAdvancedSearchPaged } from "../../actions";
import data from "../../data/collections.json";
import { useCallback, useState } from "react";
@@ -294,8 +289,10 @@ const SearchResults = (props) => {
? "/fymhorth/achos"
: "/achos"
: myportal == true
? "/myportal/case"
: "/case"
? "/myportal/case/" +
item.ticketnumber
: "/case/" +
item.ticketnumber
}
className="govuk-link--no-underline"
onClick={() => {
@@ -0,0 +1,69 @@
/**
* @swagger
* /api/endpoint/getportallogin_api:
* get:
* tags: [Login]
* description: Returns portal login
* summary: Phase 2
* parameters:
* - name: emailaddress
* in: query
* required: true
* schema:
* type: string
* responses:
* 200:
* description: hello world
*/
import axios from "axios";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
process.env.RELAY_ROOT ||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
const hashAPIPath = (queryPath) => {
var hashlink = CryptoJS.HmacSHA256(
queryPath,
CryptoJS.enc.Hex.parse(WORDKEY)
);
hashlink = hashlink.toString(CryptoJS.enc.Hex);
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var emailAddress = req.query.emailAddress;
var token = await getToken();
var queryUrl =
"contacts?$filter=emailaddress1 eq '" +
emailAddress +
"'&$count=true&$select=emailaddress1,contactid,yomifullname,firstname,lastname";
//console.log(req.query);
var apiResponse = _.isEmpty(req.query)
? res.status(400).json()
: typeof emailAddress != "undefined" && emailAddress.length > 0
? axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
//console.log(data);
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
res.status(400).json(err);
})
: res.status(400).json();
return apiResponse;
}
+4 -2
View File
@@ -36,7 +36,7 @@ import {
import _ from "lodash";
import nextConnect from "next-connect";
import middleware from "../middleware/middleware";
import { hashAPIPath } from "../../../actions";
import { consoleLogger, hashAPIPath } from "../../../actions";
const ApiProxy = nextConnect();
ApiProxy.use(middleware);
@@ -80,7 +80,9 @@ ApiProxy.get(async (req, res) => {
error +
"\n///////////////////////\n"
);
console.log("API call error", error);
//console.log("API call error", error);
console.log(consoleLogger(error));
});
} else {
return res.status(400).json({ msg: "error" });
+34 -9
View File
@@ -29,7 +29,13 @@ import {
} from "../../store/accountDetails/action";
const CaseHome = (props) => {
const { footerLinks, pages } = props;
const {
footerLinks,
pages,
setSearchResults,
setSearchDetails,
searchResultsObj,
} = props;
let { t, lang } = useTranslation();
const router = useRouter();
@@ -54,9 +60,9 @@ const CaseHome = (props) => {
props={props}
myCases={props.myCases.myCases}
myCasesDetails={props.myCases.myCasesDetails}
directSearchResultsObj={
props.searchResultsObj.searchResultsObj
}
// directSearchResultsObj={
// props.searchResultsObj.searchResultsObj
// }
searchDetailsObj={
props.searchResultsObj.searchDetailsObj
}
@@ -172,6 +178,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
},
};
} else {
store.dispatch(setSearchResults(searchResultsObj));
store.dispatch(setSearchDetails(searchDetailsObj));
store.dispatch(
setCurrentReference({
"ticketnumber": searchResultsObj.value[0].ticketnumber,
@@ -180,6 +188,17 @@ export const getServerSideProps = wrapper.getServerSideProps(
"incidentid": searchResultsObj.value[0].incidentid,
"appealType":
searchResultsObj.value[0].pinswg_appealcasetype,
"showLoginCheck": true,
"specialistProcess":
searchDetailsObj[0].value[0]
.pinswg_speacialistcaseprocess != null ||
searchDetailsObj[0].value[0]
.pinswg_specialistcaseprocess != null
? searchDetailsObj[0].value[0]
.pinswg_speacialistcaseprocess ||
searchDetailsObj[0].value[0]
.pinswg_specialistcaseprocess
: "",
})
);
}
@@ -187,10 +206,10 @@ export const getServerSideProps = wrapper.getServerSideProps(
// console.log(searchResultsObj);
return {
props: {
searchResultsObj: {
searchResultsObj: searchResultsObj,
searchDetailsObj: searchDetailsObj,
},
// searchResultsObj: {
// searchResultsObj: searchResultsObj,
// searchDetailsObj: searchDetailsObj,
// },
currentType: "directResultsObj",
},
};
@@ -202,7 +221,7 @@ const mapStateToProps = (state) => {
accountDetails: state.accountDetails,
currentView: state.currentView,
search: state.search,
//searchResultsObj: state.searchResultsObj,
searchResultsObj: state.searchResultsObj,
documentDetailsObj: state.searchResultsObj.documentDetailsObj,
formData: state.formData,
appealType: state.appealType,
@@ -219,6 +238,12 @@ const mapDispatchToProps = (dispatch) => {
setCurrentReference: (currentReference) => {
dispatch(setCurrentReference(refno));
},
setSearchResults: (searchResults) => {
dispatch(setSearchResults(searchResults));
},
setSearchDetails: (searchDetails) => {
dispatch(setSearchDetails(searchDetails));
},
};
};
+41 -22
View File
@@ -29,7 +29,7 @@ import {
} from "../../../store/accountDetails/action";
const CaseHome = (props) => {
const { footerLinks, pages } = props;
const { footerLinks, pages, setSearchResults, setSearchDetails } = props;
let { t, lang } = useTranslation();
const router = useRouter();
@@ -54,12 +54,10 @@ const CaseHome = (props) => {
props={props}
myCases={props.myCases.myCases}
myCasesDetails={props.myCases.myCasesDetails}
directSearchResultsObj={
props.searchResultsObj.searchResultsObj
}
searchDetailsObj={
props.searchResultsObj.searchDetailsObj
}
// directSearchResultsObj={
// props.searchResultsObj.searchResultsObj
// }
searchDetailsObj={props.searchDetailsObj}
documentDetailsObj={props.documentDetailsObj}
myRepresentations={
props.myRepresentations.myRepresentations
@@ -72,18 +70,13 @@ const CaseHome = (props) => {
props.awaitingSubmission.awaitingSubmission
}
caseReference={
props.searchResultsObj.searchResultsObj.value[0]
.ticketnumber
props.currentView.caseReference.currentReference
}
currentType={props.currentType}
appealTypeID={
props.searchResultsObj.searchResultsObj.value[0]
.pinswg_appealcasetype
}
incidentid={
props.searchResultsObj.searchResultsObj.value[0]
.incidentid
props.currentView.caseReference.appealType
}
incidentid={props.currentView.caseReference.incidentid}
representationsObj={
props.searchResultsObj.representationsObj
}
@@ -94,8 +87,7 @@ const CaseHome = (props) => {
footerLinks={footerLinks}
props={props}
ticketnumber={
props.searchResultsObj.searchResultsObj.value[0]
.ticketnumber
props.currentView.caseReference.currentReference
}
/>
</div>
@@ -112,6 +104,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
console.log(cookies);
console.log("the query :", query.ticketnumber);
const showLoginCheck = process.env.SHOWLOGIN || false;
let thisSession = await getSession(ctx);
let loggedInUser = {};
@@ -124,7 +117,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
loggedInUser = loggedInUser.value[0].contactid;
const accountDetails = await getPersonalAccount(loggedInUser);
store.dispatch(setContainerID(thisSession.user.id));
store.dispatch(setAccountDetails(accountDetails));
store.dispatch(setLoggedInUserId(loggedInUser));
} else {
console.log("not has sesssion.......");
}
@@ -172,6 +167,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
},
};
} else {
store.dispatch(setSearchResults(searchResultsObj));
store.dispatch(setSearchDetails(searchDetailsObj));
store.dispatch(
setCurrentReference({
"ticketnumber": searchResultsObj.value[0].ticketnumber,
@@ -180,17 +177,30 @@ export const getServerSideProps = wrapper.getServerSideProps(
"incidentid": searchResultsObj.value[0].incidentid,
"appealType":
searchResultsObj.value[0].pinswg_appealcasetype,
"showLoginCheck": showLoginCheck,
"specialistProcess":
searchDetailsObj[0].value[0]
.pinswg_speacialistcaseprocess != null ||
searchDetailsObj[0].value[0]
.pinswg_specialistcaseprocess != null
? searchDetailsObj[0].value[0]
.pinswg_speacialistcaseprocess ||
searchDetailsObj[0].value[0]
.pinswg_specialistcaseprocess
: "",
})
);
}
}
// console.log(searchResultsObj);
console.log(loggedInUser);
return {
props: {
searchResultsObj: {
searchResultsObj: searchResultsObj,
searchDetailsObj: searchDetailsObj,
},
// searchResultsObj: {
// searchResultsObj: searchResultsObj,
// searchDetailsObj: searchDetailsObj,
// },
currentType: "directResultsObj",
},
};
@@ -202,7 +212,7 @@ const mapStateToProps = (state) => {
accountDetails: state.accountDetails,
currentView: state.currentView,
search: state.search,
//searchResultsObj: state.searchResultsObj,
searchResultsObj: state.searchResultsObj,
documentDetailsObj: state.searchResultsObj.documentDetailsObj,
formData: state.formData,
appealType: state.appealType,
@@ -219,6 +229,15 @@ const mapDispatchToProps = (dispatch) => {
setCurrentReference: (currentReference) => {
dispatch(setCurrentReference(refno));
},
setSearchResults: (searchResults) => {
dispatch(setSearchResults(searchResults));
},
setSearchDetails: (searchDetails) => {
dispatch(setSearchDetails(searchDetails));
},
setLoggedInUserId: (loggedInUser) => {
dispatch(setLoggedInUserId(loggedInUser));
},
};
};
+54 -25
View File
@@ -30,8 +30,8 @@ import {
import NoSessionWarning from "../../components/nosession";
const Home = (props) => {
const { footerLinks, pages } = props;
const RepresentationF = (props) => {
const { footerLinks, pages, accountDetails } = props;
let { t, lang } = useTranslation();
const router = useRouter();
@@ -40,26 +40,26 @@ const Home = (props) => {
const dispatch = useDispatch();
// useEffect(() => {
// const updateAccountStore = async () => {
// const thisSession = await getSession();
useEffect(() => {
const updateAccountStore = async () => {
const thisSession = await getSession();
// if (thisSession) {
// let loggedInUser = await getPortalLogin(thisSession.user.email);
// dispatch(
// setAccountDetails(
// await getPersonalAccount(
// loggedInUser.value[0].contactid
// )
// )
// );
// dispatch(setContainerID(thisSession.user.id));
// //dispatch(setRepresentationSubmit(true));
// }
// };
// updateAccountStore();
// }, [dispatch]);
if (thisSession) {
let loggedInUser = await getPortalLogin(thisSession.user.email);
dispatch(
setAccountDetails(
await getPersonalAccount(
loggedInUser.value[0].contactid
)
)
);
dispatch(setContainerID(thisSession.user.id));
dispatch(setLoggedInUserId(loggedInUser.value[0].contactid));
//dispatch(setRepresentationSubmit(true));
}
};
updateAccountStore();
}, [dispatch]);
const { data: session, status } = useSession();
@@ -158,6 +158,13 @@ const Home = (props) => {
currentType={
props.currentView.caseReference.currentType
}
appealTypeID={
props.currentView.caseReference.appealType
}
incidentid={props.currentView.caseReference.incidentid}
representationsObj={
props.searchResultsObj.representationsObj
}
props={props}
/>
</div>
@@ -174,15 +181,37 @@ const Home = (props) => {
// const { cookies } = req;
// let loggedInUser = cookies.pinsUser;
// let loggedInUserCookie = cookies.pinsUser;
// let thisSession = await getSession(ctx);
// let loggedInUser = {};
// console.log(loggedInUser, thisSession);
// if (!thisSession) {
// console.log("not has sesssion.......");
// return {
// redirect: {
// destination: "/auth/signin",
// permanent: false,
// },
// };
// } else {
// [loggedInUser] = await Promise.all([
// await getPortalLogin(thisSession.user.email),
// ]);
// console.log(
// "=====//////////=====",
// thisSession,
// thisSession.user.email,
// loggedInUser
// );
// loggedInUser = loggedInUser.value[0].contactid;
// }
// const accountDetails = await getPersonalAccount(loggedInUser);
// store.dispatch(setAccountDetails(accountDetails));
// console.log(accountDetails);
// store.dispatch(setAccountDetails(accountDetails));
// return {
// props: {
// containerID: thisSession.user.id,
@@ -217,4 +246,4 @@ const mapStateToProps = (state) => {
};
};
export default connect(mapStateToProps, mapDispatchToProps)(Home);
export default connect(mapStateToProps, mapDispatchToProps)(RepresentationF);
+1 -1
View File
@@ -130,7 +130,7 @@ const makeStore = ({ isServer }) => {
"searchResultsObj",
//"appealType",
"LPAData",
//"accountDetails",
"accountDetails",
"awaitingSubmission",
"myCases",
"myRepresentations",