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; let BASE_URL;
const port = parseInt(process.env.PORT, 10) || 3000; const port = parseInt(process.env.PORT, 10) || 3000;
if (process.browser) { if (typeof window !== "undefined") {
BASE_URL = window.apiRoot; BASE_URL = window.apiRoot;
} else { } else {
BASE_URL = process.env.API_ROOT || `http://localhost:${port}`; 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; const WORDKEY = process.env.HASHKEY;
@@ -62,25 +62,12 @@ export const consoleLogger = (err) => {
(_.has(err, "response.headers.date") (_.has(err, "response.headers.date")
? "\nRequest Time: " + err.response.headers.date + "\n" ? "\nRequest Time: " + err.response.headers.date + "\n"
: "") + : "") +
// ( (_.has(err, "config.url")
// err.hasOwnProperty("response") ? "\nAxios config url: " + err.config.url + "\n"
// ? err.response.hasOwnProperty("status") : "") +
// ? err.response.status + (_.has(err, "config.url")
// " : " + ? "\nAxios message url: " + err.message + "\n"
// 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
// ) +
"\n/////////////////////////////////////////////////\n\n"; "\n/////////////////////////////////////////////////\n\n";
return errStr; return errStr;
}; };
@@ -699,6 +686,7 @@ export const getPersonalAccount = (contactid) => {
return res.data; return res.data;
}) })
.catch((error) => { .catch((error) => {
consoleLogger(error);
//console.log("returned:", error); //console.log("returned:", error);
// let ErrResponse = { // let ErrResponse = {
// value: [], // value: [],
@@ -1789,7 +1777,7 @@ export const getNotice = () => {
}); });
}; };
export const getPortalLogin = (emailAddress) => { export const getPortalLogin = async (emailAddress) => {
var queryUrl = var queryUrl =
"/api/endpoint/getportallogin_api?emailAddress=" + emailAddress; "/api/endpoint/getportallogin_api?emailAddress=" + emailAddress;
@@ -1797,7 +1785,7 @@ export const getPortalLogin = (emailAddress) => {
.get(BASE_URL + queryUrl) .get(BASE_URL + queryUrl)
.then((res) => res.data) .then((res) => res.data)
.catch((error) => { .catch((error) => {
//console.log(consoleLogger(error)); console.log(consoleLogger(error));
console.log("thiserror", error); console.log("thiserror", error);
return JSON.stringify(error); return JSON.stringify(error);
}); });
+9 -1
View File
@@ -216,7 +216,6 @@ let MakeRepresentation = (props) => {
capacityOptionsArr.push( capacityOptionsArr.push(
t("myrepresentations:capacity-options-arr-interested") t("myrepresentations:capacity-options-arr-interested")
); );
console.log(props.props.currentView);
let setCaseDetailsObj = router.query.hasOwnProperty("state") let setCaseDetailsObj = router.query.hasOwnProperty("state")
? router.query.state == "edit" ? router.query.state == "edit"
@@ -300,6 +299,7 @@ let MakeRepresentation = (props) => {
isLPA && isLPA &&
currentView.caseReference.appealType != 846040019 && currentView.caseReference.appealType != 846040019 &&
currentView.caseReference.appealType != 846040011 && currentView.caseReference.appealType != 846040011 &&
currentView.caseReference.appealType != 846040015 &&
todaysDate >= startDate && todaysDate >= startDate &&
todaysDate <= questionnaireDate && todaysDate <= questionnaireDate &&
buildArr.push("Questionnaire"); buildArr.push("Questionnaire");
@@ -323,6 +323,8 @@ let MakeRepresentation = (props) => {
buildArr.push("Statement"); buildArr.push("Statement");
currentView.caseReference.appealType != 846040004 && currentView.caseReference.appealType != 846040004 &&
currentView.caseReference.appealType == 846040015 &&
currentView.caseReference.specialistProcess != 846040001 &&
todaysDate >= statementDueDate && todaysDate >= statementDueDate &&
todaysDate <= finalCommentsDate && todaysDate <= finalCommentsDate &&
buildArr.push("Final comments"); buildArr.push("Final comments");
@@ -333,6 +335,12 @@ let MakeRepresentation = (props) => {
todaysDate <= finalCommentsDate && todaysDate <= finalCommentsDate &&
buildArr.push("Final comments"); 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; return buildArr;
}; };
@@ -225,15 +225,13 @@ const RepAgent = (props) => {
); );
}; };
const mapStateToProps = (state, props) => {};
const mapDispatchToProps = (dispatch) => ({ const mapDispatchToProps = (dispatch) => ({
updateField: (form, field, newValue) => updateField: (form, field, newValue) =>
dispatch(change(form, field, newValue)), dispatch(change(form, field, newValue)),
}); });
export default connect( export default connect(
mapStateToProps, null,
mapDispatchToProps mapDispatchToProps
)( )(
reduxForm({ reduxForm({
@@ -209,7 +209,7 @@ const RepAppellant = (props) => {
); );
}; };
const mapStateToProps = (state, props) => {}; //const mapStateToProps = (state, props) => {};
const mapDispatchToProps = (dispatch) => ({ const mapDispatchToProps = (dispatch) => ({
updateField: (form, field, newValue) => updateField: (form, field, newValue) =>
@@ -217,7 +217,7 @@ const mapDispatchToProps = (dispatch) => ({
}); });
export default connect( export default connect(
mapStateToProps, null,
mapDispatchToProps mapDispatchToProps
)( )(
reduxForm({ reduxForm({
@@ -2,6 +2,7 @@ import useTranslation from "next-translate/useTranslation";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { useEffect } from "react"; import { useEffect } from "react";
import { connect } from "react-redux";
import { useDropzone } from "react-dropzone"; import { useDropzone } from "react-dropzone";
import { import {
@@ -68,8 +69,13 @@ const RepComplete = (props) => {
props.props.currentView.caseReference.appealType, props.props.currentView.caseReference.appealType,
"pinswg_representationsubmitted": new Date(Date.now()), "pinswg_representationsubmitted": new Date(Date.now()),
"pinswg_representationtype": "pinswg_representationtype":
props.props.currentView.caseReference.repDetails props.props.currentView.caseReference.hasOwnProperty(
.representationType, "repDetails"
)
? props.props.currentView.caseReference.repDetails
.representationType
: props.props.currentView.caseReference
.representationType,
}), }),
setRepresentationMessageSent(true)); 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_s78 from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_s78";
import RepLPAQuestionnaireCheck_enforcement from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_enforcement"; import RepLPAQuestionnaireCheck_enforcement from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_enforcement";
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import { connect } from "react-redux";
import { import {
getFormCollectionByID, 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 ( return (
<> <>
<Dropzone <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) => { onDrop={(filesToUpload, e) => {
const renamedAcceptedFiles = filesToUpload.map( const renamedAcceptedFiles = filesToUpload.map(
(file) => (file) =>
@@ -191,7 +191,7 @@ const RepInterestedPartyPerson = (props) => {
); );
}; };
const mapStateToProps = (state, props) => {}; //const mapStateToProps = (state, props) => {};
const mapDispatchToProps = (dispatch) => ({ const mapDispatchToProps = (dispatch) => ({
updateField: (form, field, newValue) => updateField: (form, field, newValue) =>
@@ -199,7 +199,7 @@ const mapDispatchToProps = (dispatch) => ({
}); });
export default connect( export default connect(
mapStateToProps, null,
mapDispatchToProps mapDispatchToProps
)( )(
reduxForm({ reduxForm({
+84 -50
View File
@@ -171,8 +171,14 @@ const CaseSummary = (props) => {
const noRepresentationLink = ["/dnsdetails", "/dns/[developmentName]"]; const noRepresentationLink = ["/dnsdetails", "/dns/[developmentName]"];
let setCaseQueryObj = props[currentType]; let setCaseQueryObj =
let setCaseDetailsObj = props[currentType + "Details"]; currentType == "directResultsObj"
? props.searchResultsObj.searchResultsObj
: props[currentType];
let setCaseDetailsObj =
currentType == "directResultsObj"
? props.searchResultsObj.searchDetailsObj
: props[currentType + "Details"];
var casesObj = {}; var casesObj = {};
@@ -192,7 +198,10 @@ const CaseSummary = (props) => {
setCaseQueryObj setCaseQueryObj
)) ))
: currentType == "directResultsObj" : currentType == "directResultsObj"
? (casesObj = directSearchResultsObj.value) ? (casesObj = jsonpath(
'$..[?(@.ticketnumber=="' + caseReference + '")]',
setCaseQueryObj
))
: (casesObj = jsonpath( : (casesObj = jsonpath(
'$..[?(@.reference=="' + caseReference + '")]', '$..[?(@.reference=="' + caseReference + '")]',
setCaseQueryObj setCaseQueryObj
@@ -207,8 +216,6 @@ const CaseSummary = (props) => {
'$..[?(@.pinswg_name=="' + caseReference + '")]', '$..[?(@.pinswg_name=="' + caseReference + '")]',
searchDetailsObj searchDetailsObj
)) ))
: currentType == "directResultsObj"
? (detailsObj = searchDetailsObj[0].value)
: (detailsObj = jsonpath( : (detailsObj = jsonpath(
'$..[?(@.pinswg_name=="' + caseReference + '")]', '$..[?(@.pinswg_name=="' + caseReference + '")]',
setCaseDetailsObj setCaseDetailsObj
@@ -436,52 +443,44 @@ const CaseSummary = (props) => {
.caseReference .caseReference
.appealType .appealType
) ? ( ) ? (
props.currentView <>
.caseReference <Link
.appealType == href={{
846040018 && pathname:
props.currentView "/myportal/representation",
.caseReference query: {
.specialistProcess == case:
846040000 ? ( currentType ==
"" "searchResultsObj"
) : ( ? detailsObj.pinswg_name
<> : currentType ==
<Link "watchedCases"
href={{ ? casesObj.pinswg_title
pathname: : currentType ==
"/myportal/representation", "directResultsObj"
query: { ? detailsObj.pinswg_name
case: : casesObj.reference,
currentType == },
"searchResultsObj" }}
? detailsObj.pinswg_name className="govuk-button"
: currentType == >
"watchedCases" {t(
? casesObj.pinswg_title "case:summary-make-representation-label"
: casesObj.reference, )}
}, </Link>
}}
className="govuk-button"
>
{t(
"case:summary-make-representation-label"
)}
</Link>
<a <a
onClick={() => { onClick={() => {
//spinnerState(); //spinnerState();
router.back(); router.back();
}} }}
className="govuk-button govuk-button--secondary" className="govuk-button govuk-button--secondary"
> >
{t( {t(
"case:summary-back-button-label" "case:summary-back-button-label"
)} )}
</a> </a>
</> </>
)
) : !isLPA && ) : !isLPA &&
props.currentView props.currentView
.caseReference .caseReference
@@ -1129,6 +1128,41 @@ const CaseSummary = (props) => {
return false; return false;
case 846040004: case 846040004:
return isLPA ? true : false; 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: default:
return true; return true;
} }
+9 -7
View File
@@ -198,19 +198,21 @@ const TopThree = (props) => {
"&inid=" + "&inid=" +
showTopThreeArr[key].incidentid showTopThreeArr[key].incidentid
: router.locale == "cy" : router.locale == "cy"
? "/fymhorth/achos" ? "/fymhorth/achos/" +
: "/myportal/case" showTopThreeArr[key].pinswg_title
: "/myportal/case/" +
showTopThreeArr[key].pinswg_title
} }
className="govuk-link--no-underline" className="govuk-link--no-underline"
data-id={index} data-id={index}
onClick={() => { onClick={() => {
setSearchResults( setSearchResults(
props.props.watchedCases.watchedCases props.props.watchedCases.watchedCases
), );
setSearchDetails( setSearchDetails(
props.props.watchedCases props.props.watchedCases
.watchedCasesDetails .watchedCasesDetails
); );
setCurrentReference({ setCurrentReference({
"ticketnumber": "ticketnumber":
showTopThreeArr[key].ticketnumber, showTopThreeArr[key].ticketnumber,
+9 -1
View File
@@ -190,6 +190,14 @@ const ViewAllResults = (props) => {
resultsArr[key].ticketnumber resultsArr[key].ticketnumber
} }
onClick={() => { onClick={() => {
currentView.viewKey == "watchedCases" &&
setSearchResults(
props.watchedCases.watchedCases
),
setSearchDetails(
props.watchedCases
.watchedCasesDetails
);
setCurrentReference({ setCurrentReference({
"ticketnumber": "ticketnumber":
resultsArr[key].ticketnumber, resultsArr[key].ticketnumber,
@@ -1016,7 +1024,7 @@ const ViewAllResults = (props) => {
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
// currentView: state.currentView, //currentView: state.currentView,
accountDetails: state.accountDetails, accountDetails: state.accountDetails,
// search: state.search, // search: state.search,
// searchResultsObj: state.searchResultsObj, // searchResultsObj: state.searchResultsObj,
@@ -9,12 +9,6 @@ import { connect } from "react-redux";
import { JSONPath as jsonpath } from "jsonpath-plus"; import { JSONPath as jsonpath } from "jsonpath-plus";
import _, { result } from "lodash"; import _, { result } from "lodash";
import transLookup from "../../data/lookuptranslations.json"; import transLookup from "../../data/lookuptranslations.json";
import {
getBasicSearchPaged,
getSearchDocumentDetails,
getBasicSearchDetailsPaged,
getAdvancedSearchPaged,
} from "../../actions";
import data from "../../data/collections.json"; import data from "../../data/collections.json";
import { useCallback, useState } from "react"; 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 { JSONPath as jsonpath } from "jsonpath-plus";
import _ from "lodash"; import _ from "lodash";
import transLookup from "../../data/lookuptranslations.json"; import transLookup from "../../data/lookuptranslations.json";
import { import { getBasicSearchPaged, getAdvancedSearchPaged } from "../../actions";
getBasicSearchPaged,
getSearchDocumentDetails,
getBasicSearchDetailsPaged,
getAdvancedSearchPaged,
} from "../../actions";
import data from "../../data/collections.json"; import data from "../../data/collections.json";
import { useCallback, useState } from "react"; import { useCallback, useState } from "react";
@@ -294,8 +289,10 @@ const SearchResults = (props) => {
? "/fymhorth/achos" ? "/fymhorth/achos"
: "/achos" : "/achos"
: myportal == true : myportal == true
? "/myportal/case" ? "/myportal/case/" +
: "/case" item.ticketnumber
: "/case/" +
item.ticketnumber
} }
className="govuk-link--no-underline" className="govuk-link--no-underline"
onClick={() => { 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 _ from "lodash";
import nextConnect from "next-connect"; import nextConnect from "next-connect";
import middleware from "../middleware/middleware"; import middleware from "../middleware/middleware";
import { hashAPIPath } from "../../../actions"; import { consoleLogger, hashAPIPath } from "../../../actions";
const ApiProxy = nextConnect(); const ApiProxy = nextConnect();
ApiProxy.use(middleware); ApiProxy.use(middleware);
@@ -80,7 +80,9 @@ ApiProxy.get(async (req, res) => {
error + error +
"\n///////////////////////\n" "\n///////////////////////\n"
); );
console.log("API call error", error); //console.log("API call error", error);
console.log(consoleLogger(error));
}); });
} else { } else {
return res.status(400).json({ msg: "error" }); return res.status(400).json({ msg: "error" });
+34 -9
View File
@@ -29,7 +29,13 @@ import {
} from "../../store/accountDetails/action"; } from "../../store/accountDetails/action";
const CaseHome = (props) => { const CaseHome = (props) => {
const { footerLinks, pages } = props; const {
footerLinks,
pages,
setSearchResults,
setSearchDetails,
searchResultsObj,
} = props;
let { t, lang } = useTranslation(); let { t, lang } = useTranslation();
const router = useRouter(); const router = useRouter();
@@ -54,9 +60,9 @@ const CaseHome = (props) => {
props={props} props={props}
myCases={props.myCases.myCases} myCases={props.myCases.myCases}
myCasesDetails={props.myCases.myCasesDetails} myCasesDetails={props.myCases.myCasesDetails}
directSearchResultsObj={ // directSearchResultsObj={
props.searchResultsObj.searchResultsObj // props.searchResultsObj.searchResultsObj
} // }
searchDetailsObj={ searchDetailsObj={
props.searchResultsObj.searchDetailsObj props.searchResultsObj.searchDetailsObj
} }
@@ -172,6 +178,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
}, },
}; };
} else { } else {
store.dispatch(setSearchResults(searchResultsObj));
store.dispatch(setSearchDetails(searchDetailsObj));
store.dispatch( store.dispatch(
setCurrentReference({ setCurrentReference({
"ticketnumber": searchResultsObj.value[0].ticketnumber, "ticketnumber": searchResultsObj.value[0].ticketnumber,
@@ -180,6 +188,17 @@ export const getServerSideProps = wrapper.getServerSideProps(
"incidentid": searchResultsObj.value[0].incidentid, "incidentid": searchResultsObj.value[0].incidentid,
"appealType": "appealType":
searchResultsObj.value[0].pinswg_appealcasetype, 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); // console.log(searchResultsObj);
return { return {
props: { props: {
searchResultsObj: { // searchResultsObj: {
searchResultsObj: searchResultsObj, // searchResultsObj: searchResultsObj,
searchDetailsObj: searchDetailsObj, // searchDetailsObj: searchDetailsObj,
}, // },
currentType: "directResultsObj", currentType: "directResultsObj",
}, },
}; };
@@ -202,7 +221,7 @@ const mapStateToProps = (state) => {
accountDetails: state.accountDetails, accountDetails: state.accountDetails,
currentView: state.currentView, currentView: state.currentView,
search: state.search, search: state.search,
//searchResultsObj: state.searchResultsObj, searchResultsObj: state.searchResultsObj,
documentDetailsObj: state.searchResultsObj.documentDetailsObj, documentDetailsObj: state.searchResultsObj.documentDetailsObj,
formData: state.formData, formData: state.formData,
appealType: state.appealType, appealType: state.appealType,
@@ -219,6 +238,12 @@ const mapDispatchToProps = (dispatch) => {
setCurrentReference: (currentReference) => { setCurrentReference: (currentReference) => {
dispatch(setCurrentReference(refno)); 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"; } from "../../../store/accountDetails/action";
const CaseHome = (props) => { const CaseHome = (props) => {
const { footerLinks, pages } = props; const { footerLinks, pages, setSearchResults, setSearchDetails } = props;
let { t, lang } = useTranslation(); let { t, lang } = useTranslation();
const router = useRouter(); const router = useRouter();
@@ -54,12 +54,10 @@ const CaseHome = (props) => {
props={props} props={props}
myCases={props.myCases.myCases} myCases={props.myCases.myCases}
myCasesDetails={props.myCases.myCasesDetails} myCasesDetails={props.myCases.myCasesDetails}
directSearchResultsObj={ // directSearchResultsObj={
props.searchResultsObj.searchResultsObj // props.searchResultsObj.searchResultsObj
} // }
searchDetailsObj={ searchDetailsObj={props.searchDetailsObj}
props.searchResultsObj.searchDetailsObj
}
documentDetailsObj={props.documentDetailsObj} documentDetailsObj={props.documentDetailsObj}
myRepresentations={ myRepresentations={
props.myRepresentations.myRepresentations props.myRepresentations.myRepresentations
@@ -72,18 +70,13 @@ const CaseHome = (props) => {
props.awaitingSubmission.awaitingSubmission props.awaitingSubmission.awaitingSubmission
} }
caseReference={ caseReference={
props.searchResultsObj.searchResultsObj.value[0] props.currentView.caseReference.currentReference
.ticketnumber
} }
currentType={props.currentType} currentType={props.currentType}
appealTypeID={ appealTypeID={
props.searchResultsObj.searchResultsObj.value[0] props.currentView.caseReference.appealType
.pinswg_appealcasetype
}
incidentid={
props.searchResultsObj.searchResultsObj.value[0]
.incidentid
} }
incidentid={props.currentView.caseReference.incidentid}
representationsObj={ representationsObj={
props.searchResultsObj.representationsObj props.searchResultsObj.representationsObj
} }
@@ -94,8 +87,7 @@ const CaseHome = (props) => {
footerLinks={footerLinks} footerLinks={footerLinks}
props={props} props={props}
ticketnumber={ ticketnumber={
props.searchResultsObj.searchResultsObj.value[0] props.currentView.caseReference.currentReference
.ticketnumber
} }
/> />
</div> </div>
@@ -112,6 +104,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
console.log(cookies); console.log(cookies);
console.log("the query :", query.ticketnumber); console.log("the query :", query.ticketnumber);
const showLoginCheck = process.env.SHOWLOGIN || false;
let thisSession = await getSession(ctx); let thisSession = await getSession(ctx);
let loggedInUser = {}; let loggedInUser = {};
@@ -124,7 +117,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
loggedInUser = loggedInUser.value[0].contactid; loggedInUser = loggedInUser.value[0].contactid;
const accountDetails = await getPersonalAccount(loggedInUser); const accountDetails = await getPersonalAccount(loggedInUser);
store.dispatch(setContainerID(thisSession.user.id));
store.dispatch(setAccountDetails(accountDetails)); store.dispatch(setAccountDetails(accountDetails));
store.dispatch(setLoggedInUserId(loggedInUser));
} else { } else {
console.log("not has sesssion......."); console.log("not has sesssion.......");
} }
@@ -172,6 +167,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
}, },
}; };
} else { } else {
store.dispatch(setSearchResults(searchResultsObj));
store.dispatch(setSearchDetails(searchDetailsObj));
store.dispatch( store.dispatch(
setCurrentReference({ setCurrentReference({
"ticketnumber": searchResultsObj.value[0].ticketnumber, "ticketnumber": searchResultsObj.value[0].ticketnumber,
@@ -180,17 +177,30 @@ export const getServerSideProps = wrapper.getServerSideProps(
"incidentid": searchResultsObj.value[0].incidentid, "incidentid": searchResultsObj.value[0].incidentid,
"appealType": "appealType":
searchResultsObj.value[0].pinswg_appealcasetype, 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(searchResultsObj);
console.log(loggedInUser);
return { return {
props: { props: {
searchResultsObj: { // searchResultsObj: {
searchResultsObj: searchResultsObj, // searchResultsObj: searchResultsObj,
searchDetailsObj: searchDetailsObj, // searchDetailsObj: searchDetailsObj,
}, // },
currentType: "directResultsObj", currentType: "directResultsObj",
}, },
}; };
@@ -202,7 +212,7 @@ const mapStateToProps = (state) => {
accountDetails: state.accountDetails, accountDetails: state.accountDetails,
currentView: state.currentView, currentView: state.currentView,
search: state.search, search: state.search,
//searchResultsObj: state.searchResultsObj, searchResultsObj: state.searchResultsObj,
documentDetailsObj: state.searchResultsObj.documentDetailsObj, documentDetailsObj: state.searchResultsObj.documentDetailsObj,
formData: state.formData, formData: state.formData,
appealType: state.appealType, appealType: state.appealType,
@@ -219,6 +229,15 @@ const mapDispatchToProps = (dispatch) => {
setCurrentReference: (currentReference) => { setCurrentReference: (currentReference) => {
dispatch(setCurrentReference(refno)); 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"; import NoSessionWarning from "../../components/nosession";
const Home = (props) => { const RepresentationF = (props) => {
const { footerLinks, pages } = props; const { footerLinks, pages, accountDetails } = props;
let { t, lang } = useTranslation(); let { t, lang } = useTranslation();
const router = useRouter(); const router = useRouter();
@@ -40,26 +40,26 @@ const Home = (props) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
// useEffect(() => { useEffect(() => {
// const updateAccountStore = async () => { const updateAccountStore = async () => {
// const thisSession = await getSession(); const thisSession = await getSession();
// if (thisSession) { if (thisSession) {
// let loggedInUser = await getPortalLogin(thisSession.user.email); let loggedInUser = await getPortalLogin(thisSession.user.email);
// dispatch( dispatch(
// setAccountDetails( setAccountDetails(
// await getPersonalAccount( await getPersonalAccount(
// loggedInUser.value[0].contactid loggedInUser.value[0].contactid
// ) )
// ) )
// ); );
// dispatch(setContainerID(thisSession.user.id)); dispatch(setContainerID(thisSession.user.id));
dispatch(setLoggedInUserId(loggedInUser.value[0].contactid));
// //dispatch(setRepresentationSubmit(true)); //dispatch(setRepresentationSubmit(true));
// } }
// }; };
// updateAccountStore(); updateAccountStore();
// }, [dispatch]); }, [dispatch]);
const { data: session, status } = useSession(); const { data: session, status } = useSession();
@@ -158,6 +158,13 @@ const Home = (props) => {
currentType={ currentType={
props.currentView.caseReference.currentType props.currentView.caseReference.currentType
} }
appealTypeID={
props.currentView.caseReference.appealType
}
incidentid={props.currentView.caseReference.incidentid}
representationsObj={
props.searchResultsObj.representationsObj
}
props={props} props={props}
/> />
</div> </div>
@@ -174,15 +181,37 @@ const Home = (props) => {
// const { cookies } = req; // const { cookies } = req;
// let loggedInUser = cookies.pinsUser; // let loggedInUserCookie = cookies.pinsUser;
// let thisSession = await getSession(ctx); // 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); // const accountDetails = await getPersonalAccount(loggedInUser);
// store.dispatch(setAccountDetails(accountDetails));
// console.log(accountDetails);
// store.dispatch(setAccountDetails(accountDetails));
// return { // return {
// props: { // props: {
// containerID: thisSession.user.id, // 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", "searchResultsObj",
//"appealType", //"appealType",
"LPAData", "LPAData",
//"accountDetails", "accountDetails",
"awaitingSubmission", "awaitingSubmission",
"myCases", "myCases",
"myRepresentations", "myRepresentations",