added create contact flow for registration

This commit is contained in:
2021-10-13 07:40:36 +01:00
parent 7238a79895
commit b34c56145d
22 changed files with 663 additions and 307 deletions
+7 -1
View File
@@ -56,7 +56,13 @@ const Home = (props) => {
<h1>Create a new account</h1>
) : (
<h1>
Your account has been created
{props.accountDetails.accCr !=
"false"
? props.accountDetails
.accCr == "exists"
? "Your account has not created"
: "Your account has been created"
: "Checking for account.."}
</h1>
)}
<RegisterForm
+7 -14
View File
@@ -9,18 +9,6 @@ const PROXY_RELAY_URL =
"/" +
(process.env.RELAYPATH || "dev-pedw-hc") +
"/";
//"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
// const azureHeaders = {
// headers: {
// "OData-MaxVersion": "4.0",
// "OData-Version": "4.0",
// "Accept": "application/json",
// "Prefer": 'odata.include-annotations="*",return=representation',
// "Content-Type": "application/json",
// "ServiceBusAuthorization": SASToken,
// },
// };
const getSASToken = () => {
var m_ResourceURI =
@@ -82,7 +70,6 @@ export default async function ApiProxy(req, res) {
var config = {
method: req.method,
//url: PROXY_RELAY_URL + updateFormCollection + "(" + incidentId + ")",
url: PROXY_RELAY_URL + req.query.route[0],
headers: {
"OData-MaxVersion": "4.0",
@@ -112,7 +99,13 @@ export default async function ApiProxy(req, res) {
return new Promise((resolve, reject) => {
let apiPath = req.url.split("/api/proxy/")[1];
let hasDocument = apiPath.indexOf("/download") > 0 ? true : false;
console.log(
"//////////////",
req.url.split("/api/proxy/")[1],
PROXY_RELAY_URL + req.query.route[0],
req.method,
hasDocument
);
axios(
req.method == "GET"
? hasDocument
+5 -1
View File
@@ -10,6 +10,7 @@ import { useSelector, shallowEqual, connect } from "react-redux";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import { setLogout } from "../store/accountDetails/action";
import { useEffect } from "react";
const LogOut = (props) => {
const { footerLinks, pages, setLogout } = props;
@@ -17,7 +18,10 @@ const LogOut = (props) => {
const router = useRouter();
const { locale } = router;
setLogout();
useEffect(() => {
setLogout();
});
return (
<div>
<Head>
+50 -45
View File
@@ -82,58 +82,63 @@ const Home = (props) => {
};
export const getServerSideProps = wrapper.getServerSideProps(
(store) =>
async ({ query, req, res }) => {
//console.log("the query", query);
(store) => async (ctx) => {
const { query, req, res } = ctx;
console.log("the query", query);
const token = await getSASToken();
const { cookies } = req;
const [
myCases,
myRepresentations,
watchedCases,
awaitingSubmission,
] = await Promise.all([
await getMyCases(token, "f8b454ed-eded-eb11-aac7-00224800be9c"),
await getMyRepresentations(token),
await getWatchedCases(token),
console.log(cookies);
const token = await getSASToken();
let loggedInUser =
typeof query.q == undefined ? cookies.pinsUser : query.q;
console.log("qweqe ", loggedInUser);
const [myCases, myRepresentations, watchedCases, awaitingSubmission] =
await Promise.all([
await getMyCases(token, loggedInUser),
await getMyRepresentations(token, loggedInUser),
await getWatchedCases(token, loggedInUser),
await getAwaitingSubmission(token),
]);
const cookies = new Cookies(req, res);
const cookiesMaker = new Cookies(req, res);
cookies.set("pinsUser", "f8b454ed-eded-eb11-aac7-00224800be9c", {
httpOnly: true, // true by default
});
//console.log("my cases ", myCases);
const [
myCasesDetails,
// myRepresentationsDetails,
// watchedCasesDetails,
// awaitingSubmissionDetails,
] = await Promise.all([
await getDetails(token, myCases),
// await getDetails(myRepresentations),
// await getDetails(watchedCases),
// await getDetails(awaitingSubmission),
]);
cookiesMaker.set("pinsUser", query.q, {
httpOnly: true, // true by default
});
store.dispatch(
setLoggedInUserId("f8b454ed-eded-eb11-aac7-00224800be9c")
);
store.dispatch(setMyCases(myCases));
store.dispatch(setMyCasesDetails(myCasesDetails));
store.dispatch(setMyRepresentations(myRepresentations));
// store.dispatch(
// setMyRepresentationsDetails(myRepresentationsDetails)
// );
store.dispatch(setWatchedCases(watchedCases));
//store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
store.dispatch(setAwaitingSubmission(awaitingSubmission));
// store.dispatch(
// setAwaitingSubmissionDetails(awaitingSubmissionDetails)
// );
}
console.log(" from cookie ", cookiesMaker.get("pinsUser"));
console.log(myCases);
const [
myCasesDetails,
myRepresentationsDetails,
watchedCasesDetails,
// awaitingSubmissionDetails,
] = await Promise.all([
await getDetails(token, myCases),
await getDetails(token, myRepresentations),
await getDetails(token, watchedCases),
// await getDetails(awaitingSubmission),
]);
console.log(myCasesDetails);
store.dispatch(setLoggedInUserId(loggedInUser));
store.dispatch(setMyCases(myCases));
store.dispatch(setMyCasesDetails(myCasesDetails));
store.dispatch(setMyRepresentations(myRepresentations));
store.dispatch(setMyRepresentationsDetails(myRepresentationsDetails));
store.dispatch(setWatchedCases(watchedCases));
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
store.dispatch(setAwaitingSubmission(awaitingSubmission));
// store.dispatch(
// setAwaitingSubmissionDetails(awaitingSubmissionDetails)
// );
}
);
const getFormCollection = (formtype) => {
+45 -9
View File
@@ -20,9 +20,17 @@ import { setSearch, getSearchObj } from "../../store/search/action";
import {
setSearchResults,
setSearchDetails,
setDocumentDetails,
setDocumentHistory,
getSearchResultsObj,
} from "../../store/searchOutput/action";
import { getBasicSearch, getBasicSearchDetails } from "../../actions";
import {
getBasicSearch,
getBasicSearchDetails,
getSearchDocumentDetails,
getSearchDocumentHistory,
getSASToken,
} from "../../actions";
const Home = (props) => {
const { footerLinks, pages } = props;
@@ -47,6 +55,7 @@ const Home = (props) => {
<SearchResults
searchString={props.search.searchString}
searchResultsObj={props.searchResultsObj}
myportal="true"
/>
</div>
<Footer footerLinks={footerLinks} />
@@ -59,14 +68,38 @@ export const getServerSideProps = wrapper.getServerSideProps(
(store) =>
async ({ query, req, res }) => {
console.log("query-", query);
// const [searchResultsObj, searchDetailsObj] = await Promise.all(
// await getBasicSearch(query.q),
// await getBasicSearchDetails(query.d)
const token = await getSASToken();
let searchResultsObj = await getBasicSearch(token, query.q);
searchResultsObj =
searchResultsObj.status == 502
? {
value: [],
errorCode: searchResultsObj.status,
errorMsg: searchResultsObj.statusText,
}
: searchResultsObj;
//console.log("sssss", searchResultsObj);
const searchDetailsObj = await getSearchDetails(
token,
searchResultsObj
);
// const searchDocumentResultsObj = await getDocumentDetails(
// token,
// searchResultsObj
// );
const searchResultsObj = await getBasicSearch(query.q);
const searchDetailsObj = await getSearchDetails(searchResultsObj);
// console.log(searchDetailsObj);
// const searchDocumentHistoryObj = await getDocumentHistory(
// token,
// searchDocumentResultsObj
// );
// console.log(searchDocumentHistoryObj);
store.dispatch(setSearchResults(searchResultsObj));
store.dispatch(setSearchDetails(searchDetailsObj));
store.dispatch(setSearch(query.q));
@@ -82,7 +115,7 @@ const getFormCollection = (formtype) => {
return collectionName[0];
};
const getSearchDetails = (searchResultsObj) => {
const getSearchDetails = (token, searchResultsObj) => {
//console.log(searchResultsObj);
let detailsArr = [];
@@ -93,13 +126,15 @@ const getSearchDetails = (searchResultsObj) => {
} else {
detailsArr.push(
getBasicSearchDetails(
token,
getFormCollection(
"pinswg_" +
searchDetail[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
]
.replace(/[\s\-\+\(\)\,\&\.]/g, "")
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
.toLowerCase()
.slice(0, 39)
),
searchDetail.ticketnumber
)
@@ -122,6 +157,7 @@ const mapStateToProps = (state) => {
watchedCases: state.watchedCases,
myRepresentations: state.myRepresentations,
awaitingSubmission: state.awaitingSubmission,
accountDetails: state.accountDetails,
};
};
+32 -39
View File
@@ -258,49 +258,42 @@ let Home = (props) => {
};
export const getServerSideProps = wrapper.getServerSideProps(
(store) =>
async ({ query, req, res }) => {
console.log("the query", query);
const token = await getSASToken();
const [
caseReferenceData,
appealTypeData,
mandatoryFieldsData,
pickListData,
formdata,
] = await Promise.all([
await createCase(token, query.apt),
await getAppealsTypes(token),
await getMandatoryFields(token, query.appealtypes),
await getPickLists(token, query.appealtypes),
await getFormData(token, query.appealtypes),
]);
(store) => async (ctx) => {
const { query, req, res } = ctx;
const { cookies } = req;
// let updateCaseReferenceData = await updateCase(
// caseReferenceData.incidentid,
// query.apt
// );
console.log(cookies);
console.log("the query", query);
let loggedInUser = cookies.pinsUser;
const cookies = new Cookies(req, res);
// Get a cookie
const token = await getSASToken();
const [
caseReferenceData,
appealTypeData,
mandatoryFieldsData,
pickListData,
formdata,
] = await Promise.all([
await createCase(token, query.apt, loggedInUser),
await getAppealsTypes(token),
await getMandatoryFields(token, query.appealtypes),
await getPickLists(token, query.appealtypes),
await getFormData(token, query.appealtypes),
]);
console.log(cookies.get("pipinsUser"));
let caseReference = caseReferenceData;
let xmlStr = formdata;
xmlStr = formdata.value[0].formxml;
xmlStr = xmlStr.replace(/\\"/g, "");
let caseReference = caseReferenceData;
let xmlStr = formdata;
xmlStr = formdata.value[0].formxml;
xmlStr = xmlStr.replace(/\\"/g, "");
//console.log(caseReference, query.appealtypes, formdata);
store.dispatch(
setLoggedInUserId("f8b454ed-eded-eb11-aac7-00224800be9c")
);
store.dispatch(setAppealLPA(query.lpa));
store.dispatch(setAppealTypeID(query.apt));
store.dispatch(setCaseReference(caseReference));
store.dispatch(setForm(xmlStr, mandatoryFieldsData, pickListData));
store.dispatch(setAppealType(appealTypeData));
}
//console.log(caseReference, query.appealtypes, formdata);
store.dispatch(setLoggedInUserId(loggedInUser));
store.dispatch(setAppealLPA(query.lpa));
store.dispatch(setAppealTypeID(query.apt));
store.dispatch(setCaseReference(caseReference));
store.dispatch(setForm(xmlStr, mandatoryFieldsData, pickListData));
store.dispatch(setAppealType(appealTypeData));
}
);
const mapStateToProps = (state) => {
+21 -10
View File
@@ -19,6 +19,10 @@ import { reduxForm, formValueSelector } from "redux-form";
import CreateCase from "../../components/newappeal/createCase";
import xpath from "xpath";
import {
setLoggedInUserId,
setAccountDetails,
} from "../../store/accountDetails/action";
import {
setAppealType,
setAppealTypeTitle,
@@ -78,18 +82,25 @@ const Home = (props) => {
};
export const getServerSideProps = wrapper.getServerSideProps(
(store) =>
async ({ query, req, res }) => {
const token = await getSASToken();
(store) => async (ctx) => {
const { req, res } = ctx;
const { cookies } = req;
const [appealTypeData, lpaData, caseData] = await Promise.all([
await getAppealsTypes(token),
await getLPA(token),
]);
console.log(cookies);
store.dispatch(setAppealType(appealTypeData));
store.dispatch(setLPA(lpaData));
}
let loggedInUser = cookies.pinsUser;
const token = await getSASToken();
const [appealTypeData, lpaData, caseData] = await Promise.all([
await getAppealsTypes(token),
await getLPA(token),
]);
store.dispatch(setAppealType(appealTypeData));
store.dispatch(setLPA(lpaData));
store.dispatch(setLoggedInUserId(loggedInUser));
}
);
const mapStateToProps = (state) => {