create incident record in new appeal
This commit is contained in:
+81
-92
@@ -13,13 +13,17 @@ if (process.browser) {
|
||||
BASE_URL = process.env.API_ROOT || `http://localhost:${port}`;
|
||||
}
|
||||
|
||||
const WEBAPI_URL = "https://devcrm2016.llcdt.gov.wales/DVPINS";
|
||||
|
||||
const API_PATH = "/api/data/v8.2/";
|
||||
|
||||
const WEBAPI_URL = "https://devcrm2016.llcdt.gov.wales/DVPINS" + API_PATH;
|
||||
|
||||
const agent = new https.Agent({
|
||||
rejectUnauthorized: false,
|
||||
});
|
||||
|
||||
const accessToken =
|
||||
"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IlVXelVaa0U3OEx0NVBGRkJ0LV9seVdoMjdjTSIsImtpZCI6IlVXelVaa0U3OEx0NVBGRkJ0LV9seVdoMjdjTSJ9.eyJhdWQiOiJodHRwczovL2RldmNybTIwMTYubGxjZHQuZ292LndhbGVzLyIsImlzcyI6Imh0dHA6Ly9mcy50ZXN0Lmdvdi53YWxlcy9hZGZzL3NlcnZpY2VzL3RydXN0IiwiaWF0IjoxNjMxMTcwMjI1LCJuYmYiOjE2MzExNzAyMjUsImV4cCI6MTYzMTE5OTAyNSwidXBuIjpbIlJvYmVydC5Cb25kQHRlc3QuZ292LndhbGVzIiwicm9iZXJ0LmJvbmRAdGVzdC5nb3Yud2FsZXMiXSwicHJpbWFyeXNpZCI6IlMtMS01LTIxLTE4MDA4NDIwNzYtMjQ1NTYwNjU5LTQyMTU3NzU0NjktMTY2MjgiLCJ1bmlxdWVfbmFtZSI6IlhNXFxCb25kUiIsImFwcHR5cGUiOiJQdWJsaWMiLCJhcHBpZCI6IjQyN2ZhNzljLWI1ZmMtNDJhZC04M2Q0LTQxMGIwMzk0OGFiNiIsImF1dGhtZXRob2QiOiJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL3dzLzIwMDgvMDYvaWRlbnRpdHkvYXV0aGVudGljYXRpb25tZXRob2Qvd2luZG93cyIsImF1dGhfdGltZSI6IjIwMjEtMDktMDlUMDY6NTA6MjIuMTgzWiIsInZlciI6IjEuMCJ9.jds1ILVmVonh1g_KDDzFHZV7_iFpR4GZ6m_uw7YDQpQLXQlFXkPLf-Fan1h61Jl78ZmsBnhPKREvqALQ13tcMPPDg4SK5i6BYI7Jw8eKnqCjNb_mFAnnSCL0NeqZY4JV-HYzgY5tpvuCWgpjL2v_5BKOtU9mRL_700D7Fjt_R6nlI89dOKy3iT88lUxPostTVEC1nBxvh1AjjACG6103ymtRBtRy2ONowk4PClhCO3ZWwnVg1kb4GmXqhKNsXBvEscuZQuAzvawwTIXMvjwUBFSu4fsGdxxjfdsXVGACPdcUn7FekJIzaDtS2I_DvzrWLn9B1BDyBEctUqoVWOWqBw";
|
||||
|
||||
const crmHeaders = {
|
||||
withCredentials: true,
|
||||
headers: {
|
||||
@@ -28,8 +32,22 @@ const crmHeaders = {
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*"',
|
||||
"Authorization":
|
||||
"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IlVXelVaa0U3OEx0NVBGRkJ0LV9seVdoMjdjTSIsImtpZCI6IlVXelVaa0U3OEx0NVBGRkJ0LV9seVdoMjdjTSJ9.eyJhdWQiOiJodHRwczovL2RldmNybTIwMTYubGxjZHQuZ292LndhbGVzLyIsImlzcyI6Imh0dHA6Ly9mcy50ZXN0Lmdvdi53YWxlcy9hZGZzL3NlcnZpY2VzL3RydXN0IiwiaWF0IjoxNjMxMDgwNTk3LCJuYmYiOjE2MzEwODA1OTcsImV4cCI6MTYzMTEwOTM5NywidXBuIjpbIlJvYmVydC5Cb25kQHRlc3QuZ292LndhbGVzIiwicm9iZXJ0LmJvbmRAdGVzdC5nb3Yud2FsZXMiXSwicHJpbWFyeXNpZCI6IlMtMS01LTIxLTE4MDA4NDIwNzYtMjQ1NTYwNjU5LTQyMTU3NzU0NjktMTY2MjgiLCJ1bmlxdWVfbmFtZSI6IlhNXFxCb25kUiIsImFwcHR5cGUiOiJQdWJsaWMiLCJhcHBpZCI6IjQyN2ZhNzljLWI1ZmMtNDJhZC04M2Q0LTQxMGIwMzk0OGFiNiIsImF1dGhtZXRob2QiOiJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL3dzLzIwMDgvMDYvaWRlbnRpdHkvYXV0aGVudGljYXRpb25tZXRob2Qvd2luZG93cyIsImF1dGhfdGltZSI6IjIwMjEtMDktMDhUMDU6NTY6MzcuMjg1WiIsInZlciI6IjEuMCJ9.bsZhsbeQtJpLxxe70nePUnT-vokKDVUZh3s17w34TAWlWERAj4KxxcAJvhTACz9BJqz7YXTBsqPu2Kq10f_g9FibIgqQZEMiFM4nKFbgALRXjdEtP6ptpqLBvbW2ECCHSnf_IpClhmr0d_a1nv-MQ62YmKyztcEvNBd7IC1NZsWrAf2jLYg_ROOxjtAlK3itfSqGazkvKdgYYtbC-Al6hjn5y-3E0lfq2H8ZZdVFa9XcDOss5rxSeJBkJK6Ezczov5FXHhN9oATTiA0khRpcnqfXbhW2H8w5PYqyZGa7_LMDAdmeCgBxAva874jadjIN2Fjfq9Bo6V1v6OvbXBgAAg",
|
||||
"Authorization": "Bearer " + accessToken,
|
||||
},
|
||||
};
|
||||
|
||||
const crmHeadersReturn = {
|
||||
withCredentials: true,
|
||||
headers: {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": "return=representation",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Access-Control-Allow-Credentials": "true",
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + accessToken,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -37,7 +55,6 @@ export const getBasicSearch = (searchString) => {
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
API_PATH +
|
||||
"incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=contains(title, '" +
|
||||
searchString +
|
||||
"') and pinswg_appealcasetype ne null &$count=true",
|
||||
@@ -53,7 +70,6 @@ export const getBasicSearchDetails = (appealType, caseReference) => {
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
API_PATH +
|
||||
appealType +
|
||||
"?$filter=pinswg_name eq '" +
|
||||
caseReference +
|
||||
@@ -69,40 +85,24 @@ export const getBasicSearchDetails = (appealType, caseReference) => {
|
||||
export const getFormData = (whichForm) => {
|
||||
console.log("got to axios", whichForm);
|
||||
console.log("api_root: ", BASE_URL);
|
||||
return (
|
||||
axios
|
||||
//.get("api/appealforms/pinswg_dns", {
|
||||
//.get("api/appealforms/pinswg_planningobligationappeals106", {
|
||||
//.get("api/appealforms/pinswg_planningconditionss73s79", {
|
||||
//.get("api/appealforms/pinswg_row", {
|
||||
//.get("api/appealforms/pinswg_transportandworkact", {
|
||||
//.get("api/appealforms/pinswg_harbourrevisionorder", {
|
||||
//.get("api/appealforms/pinswg_planningappeals78", {
|
||||
//.get(api/appealforms/pinswg_householderappealhas", {
|
||||
// .get(BASE_URL + "/api/appealforms/pinswg_" + whichForm, {
|
||||
// httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||
// })
|
||||
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
API_PATH +
|
||||
"systemforms?$select=formid,name,formxml,type,objecttypecode&$filter=(objecttypecode%20eq%20%27pinswg_" +
|
||||
whichForm +
|
||||
"%27and%20type%20eq%202)&$count=true",
|
||||
crmHeaders
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thiserror", error);
|
||||
})
|
||||
);
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
"systemforms?$select=formid,name,formxml,type,objecttypecode&$filter=(objecttypecode%20eq%20%27pinswg_" +
|
||||
whichForm +
|
||||
"%27and%20type%20eq%202)&$count=true",
|
||||
crmHeaders
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thiserror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getMandatoryFields = (whichForm) => {
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
API_PATH +
|
||||
"EntityDefinitions(LogicalName='pinswg_" +
|
||||
whichForm +
|
||||
"')/Attributes?$count=true&$select=LogicalName,RequiredLevel",
|
||||
@@ -118,7 +118,6 @@ export const getPickLists = (whichForm) => {
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
API_PATH +
|
||||
"EntityDefinitions(LogicalName='pinswg_" +
|
||||
whichForm +
|
||||
"')/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet,GlobalOptionSet&$count=true",
|
||||
@@ -131,24 +130,16 @@ export const getPickLists = (whichForm) => {
|
||||
};
|
||||
|
||||
export const getAppealsTypes = () => {
|
||||
console.log("got to axios: appeal types");
|
||||
console.log("api_root: ", BASE_URL);
|
||||
return (
|
||||
axios
|
||||
// .get(BASE_URL + "/api/lookups/pinswg_appealcasetype", {
|
||||
// httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||
// })
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
API_PATH +
|
||||
"stringmaps?$filter=attributename%20eq%20%27pinswg_appealcasetype%27&$count=true&$select=value,stringmapid,organizationid,attributevalue",
|
||||
crmHeaders
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thiserror", error);
|
||||
})
|
||||
);
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
"stringmaps?$filter=attributename%20eq%20%27pinswg_appealcasetype%27&$count=true&$select=value,stringmapid,organizationid,attributevalue",
|
||||
crmHeaders
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thiserror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getBasicSearch2 = (searchString) => {
|
||||
@@ -255,23 +246,12 @@ export const getAppealTypeDetail = (caseReference, appealcasetype) => {
|
||||
|
||||
export const getLPA = () => {
|
||||
console.log("api_root: ", BASE_URL);
|
||||
return (
|
||||
axios
|
||||
|
||||
// .get(
|
||||
// BASE_URL + "/api/lookups/pinswg_lpa",
|
||||
// //.get("https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/accounts?$select=name",
|
||||
// { httpsAgent: new https.Agent({ rejectUnauthorized: false }) }
|
||||
// )
|
||||
.get(
|
||||
WEBAPI_URL + API_PATH + "accounts?$count=true&$select=name",
|
||||
crmHeaders
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thi serror", error);
|
||||
})
|
||||
);
|
||||
return axios
|
||||
.get(WEBAPI_URL + "accounts?$count=true&$select=name", crmHeaders)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thi serror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getPersonalAccount = () => {
|
||||
@@ -289,27 +269,39 @@ export const getPersonalAccount = () => {
|
||||
});
|
||||
};
|
||||
|
||||
function makeid(length) {
|
||||
var result = "";
|
||||
var characters =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
var charactersLength = characters.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
result += characters.charAt(
|
||||
Math.floor(Math.random() * charactersLength)
|
||||
);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export const createCase = (lpaType, appealType) => {
|
||||
console.log();
|
||||
return axios
|
||||
.post(
|
||||
WEBAPI_URL + "incidents",
|
||||
{
|
||||
"title": "insertion test case",
|
||||
"customerid_contact@odata.bind":
|
||||
"/contacts(f8b454ed-eded-eb11-aac7-00224800be9c)",
|
||||
},
|
||||
crmHeadersReturn
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thi serror", error);
|
||||
});
|
||||
};
|
||||
|
||||
const lastPart = makeid(6);
|
||||
|
||||
const middlePart = Math.floor(100000 + Math.random() * 900000);
|
||||
|
||||
return "CAS-" + middlePart + "-" + lastPart.toUpperCase();
|
||||
export const updateCase = (incidentID, appealTypeId) => {
|
||||
return axios
|
||||
.patch(
|
||||
WEBAPI_URL + "incidents(" + incidentID + ")",
|
||||
{
|
||||
"pinswg_appealtype": appealTypeId,
|
||||
},
|
||||
crmHeadersReturn
|
||||
)
|
||||
.then((res) => {
|
||||
console.log("patched ", res.data);
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("thi serror", error);
|
||||
});
|
||||
};
|
||||
|
||||
// var req = new XMLHttpRequest();
|
||||
@@ -378,7 +370,6 @@ export const createCase = (lpaType, appealType) => {
|
||||
|
||||
export const getMyCases = () => {
|
||||
return axios
|
||||
|
||||
.get(BASE_URL + "/api/lookups/myCases", {
|
||||
httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||
})
|
||||
@@ -390,7 +381,6 @@ export const getMyCases = () => {
|
||||
|
||||
export const getMyRepresentations = () => {
|
||||
return axios
|
||||
|
||||
.get(BASE_URL + "/api/lookups/myRepresentations", {
|
||||
httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||
})
|
||||
@@ -415,7 +405,6 @@ export const getWatchedCases = () => {
|
||||
|
||||
export const getAwaitingSubmission = () => {
|
||||
return axios
|
||||
|
||||
.get(BASE_URL + "/api/lookups/awaitingSubmission", {
|
||||
httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
||||
})
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import axios from "axios";
|
||||
|
||||
const API_PATH = "/api/data/v8.2/";
|
||||
|
||||
const WEBAPI_URL = "https://devcrm2016.llcdt.gov.wales/DVPINS" + API_PATH;
|
||||
|
||||
const accessToken =
|
||||
"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IlVXelVaa0U3OEx0NVBGRkJ0LV9seVdoMjdjTSIsImtpZCI6IlVXelVaa0U3OEx0NVBGRkJ0LV9seVdoMjdjTSJ9.eyJhdWQiOiJodHRwczovL2RldmNybTIwMTYubGxjZHQuZ292LndhbGVzLyIsImlzcyI6Imh0dHA6Ly9mcy50ZXN0Lmdvdi53YWxlcy9hZGZzL3NlcnZpY2VzL3RydXN0IiwiaWF0IjoxNjMxMTcwMjI1LCJuYmYiOjE2MzExNzAyMjUsImV4cCI6MTYzMTE5OTAyNSwidXBuIjpbIlJvYmVydC5Cb25kQHRlc3QuZ292LndhbGVzIiwicm9iZXJ0LmJvbmRAdGVzdC5nb3Yud2FsZXMiXSwicHJpbWFyeXNpZCI6IlMtMS01LTIxLTE4MDA4NDIwNzYtMjQ1NTYwNjU5LTQyMTU3NzU0NjktMTY2MjgiLCJ1bmlxdWVfbmFtZSI6IlhNXFxCb25kUiIsImFwcHR5cGUiOiJQdWJsaWMiLCJhcHBpZCI6IjQyN2ZhNzljLWI1ZmMtNDJhZC04M2Q0LTQxMGIwMzk0OGFiNiIsImF1dGhtZXRob2QiOiJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL3dzLzIwMDgvMDYvaWRlbnRpdHkvYXV0aGVudGljYXRpb25tZXRob2Qvd2luZG93cyIsImF1dGhfdGltZSI6IjIwMjEtMDktMDlUMDY6NTA6MjIuMTgzWiIsInZlciI6IjEuMCJ9.jds1ILVmVonh1g_KDDzFHZV7_iFpR4GZ6m_uw7YDQpQLXQlFXkPLf-Fan1h61Jl78ZmsBnhPKREvqALQ13tcMPPDg4SK5i6BYI7Jw8eKnqCjNb_mFAnnSCL0NeqZY4JV-HYzgY5tpvuCWgpjL2v_5BKOtU9mRL_700D7Fjt_R6nlI89dOKy3iT88lUxPostTVEC1nBxvh1AjjACG6103ymtRBtRy2ONowk4PClhCO3ZWwnVg1kb4GmXqhKNsXBvEscuZQuAzvawwTIXMvjwUBFSu4fsGdxxjfdsXVGACPdcUn7FekJIzaDtS2I_DvzrWLn9B1BDyBEctUqoVWOWqBw";
|
||||
|
||||
const crmHeadersReturn = {
|
||||
withCredentials: true,
|
||||
headers: {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": "return=representation",
|
||||
"Authorization": "Bearer " + accessToken,
|
||||
},
|
||||
};
|
||||
|
||||
export default async function (res, req) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.patch();
|
||||
});
|
||||
}
|
||||
@@ -374,12 +374,7 @@ const RenderPickList = ({
|
||||
<option>Select...</option>
|
||||
{Object.keys(dropdownObj).map((key, index) => {
|
||||
return (
|
||||
<option
|
||||
key={key}
|
||||
value={
|
||||
dropdownObj[key].Label.LocalizedLabels[0].Label
|
||||
}
|
||||
>
|
||||
<option key={key} value={dropdownObj[key].Value}>
|
||||
{dropdownObj[key].Label.LocalizedLabels[0].Label}
|
||||
</option>
|
||||
);
|
||||
|
||||
@@ -32,7 +32,10 @@ export default function BuildField(props) {
|
||||
<ReadOnlyfield
|
||||
name={props.datafieldname}
|
||||
label={props.label}
|
||||
value={props.props.props.appealType.caseReference}
|
||||
value={
|
||||
props.props.props.appealType.caseReference
|
||||
.ticketnumber
|
||||
}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -144,7 +144,6 @@ let BuildSection = (props) => {
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
|
||||
<BuildRow
|
||||
rowXML={rowXML}
|
||||
whichSection={props.whichSection}
|
||||
|
||||
@@ -7,11 +7,16 @@ import BuildRow from "./buildrow";
|
||||
import { reduxForm, formValueSelector } from "redux-form";
|
||||
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { setCurrentSection } from "../../store/appealType/action";
|
||||
import { updateCase } from "../../actions";
|
||||
|
||||
let CompleteAppeal = (props) => {
|
||||
// un comment to update incident with an appealtype id
|
||||
// useEffect(() => {
|
||||
// window.scrollTo(0, 0);
|
||||
// });
|
||||
// updateCase(
|
||||
// props.appealType.caseReference.incidentid,
|
||||
// props.appealType.appealTypeID
|
||||
// );
|
||||
// }, []);
|
||||
|
||||
let { t } = useTranslation();
|
||||
|
||||
@@ -62,7 +67,9 @@ let CompleteAppeal = (props) => {
|
||||
<div className="govuk-panel__body">
|
||||
Your reference number
|
||||
<br />
|
||||
<strong>{props.appealType.caseReference}</strong>
|
||||
<strong>
|
||||
{props.appealType.caseReference.ticketnumber}
|
||||
</strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -43,7 +43,9 @@ let CreateCase = (props) => {
|
||||
? [{}]
|
||||
: _.isEmpty(props.LPAData.LPAData)
|
||||
? [{}]
|
||||
: jsonpath.query(props.LPAData.LPAData, "$..name");
|
||||
: _.isEmpty(props.LPAData.LPAData)
|
||||
? [{}]
|
||||
: props.LPAData.LPAData.value;
|
||||
|
||||
const RenderLPAList = ({
|
||||
name,
|
||||
@@ -94,9 +96,9 @@ let CreateCase = (props) => {
|
||||
return (
|
||||
<option
|
||||
key={key}
|
||||
value={optionsObj[key]}
|
||||
value={optionsObj[key].accountid}
|
||||
>
|
||||
{optionsObj[key]}
|
||||
{optionsObj[key].name}
|
||||
</option>
|
||||
);
|
||||
})}
|
||||
@@ -167,7 +169,10 @@ let CreateCase = (props) => {
|
||||
.value
|
||||
)
|
||||
? ""
|
||||
: optionsObj[key].value
|
||||
: optionsObj[key]
|
||||
.attributevalue +
|
||||
"," +
|
||||
optionsObj[key].value
|
||||
.replace(
|
||||
/[\s\-\+\(\)\,]/g,
|
||||
""
|
||||
@@ -198,9 +203,18 @@ let CreateCase = (props) => {
|
||||
|
||||
const onHandleSubmit = (values) => {
|
||||
event.preventDefault();
|
||||
router.replace("/newappeal/" + values.appealTypes, null, {
|
||||
shallow: true,
|
||||
});
|
||||
router.replace(
|
||||
"/newappeal/" +
|
||||
values.appealTypes.split(",")[1] +
|
||||
"?lpa=" +
|
||||
values.lpaTypes +
|
||||
"&apt=" +
|
||||
values.appealTypes.split(",")[0],
|
||||
null,
|
||||
{
|
||||
shallow: true,
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -254,8 +268,8 @@ const mapDispatchToProps = (dispatch) => {
|
||||
);
|
||||
dispatch(setAppealTypeID(event.target.value));
|
||||
},
|
||||
onChangeSelectLPA: (event) => {
|
||||
dispatch(setAppealLPA(event.target.value));
|
||||
onChangeSelectLPA: (lpaId) => {
|
||||
dispatch(setAppealLPA(lpaId));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
setAppealTypeTitle,
|
||||
setAppealTypeID,
|
||||
getAppealTypeObj,
|
||||
setAppealLPA,
|
||||
setCaseReference,
|
||||
} from "../../store/appealType/action";
|
||||
import { setForm, getFormObj } from "../../store/formData/action";
|
||||
@@ -28,6 +29,7 @@ import {
|
||||
getMandatoryFields,
|
||||
createCase,
|
||||
getPickLists,
|
||||
updateCase,
|
||||
} from "../../actions";
|
||||
|
||||
import xpath from "xpath";
|
||||
@@ -163,24 +165,34 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
//console.log("the query", query);
|
||||
|
||||
const [
|
||||
updateCaseData,
|
||||
caseReferenceData,
|
||||
appealTypeData,
|
||||
mandatoryFieldsData,
|
||||
pickListData,
|
||||
formdata,
|
||||
] = await Promise.all([
|
||||
// await updateCase(
|
||||
// "3ffcf47c-5811-ec11-aac9-00224800be9c",
|
||||
// "846040004"
|
||||
// ),
|
||||
await createCase(),
|
||||
await getAppealsTypes(),
|
||||
await getMandatoryFields(query.appealtypes),
|
||||
await getPickLists(query.appealtypes),
|
||||
await getFormData(query.appealtypes),
|
||||
]);
|
||||
|
||||
const caseReference = createCase("asasa", "asasa");
|
||||
|
||||
let caseReference = caseReferenceData;
|
||||
let xmlStr = formdata;
|
||||
xmlStr = formdata.value[0].formxml;
|
||||
xmlStr = xmlStr.replace(/\\"/g, "");
|
||||
store.dispatch(setAppealTypeID(query.appealtypes));
|
||||
|
||||
//console.log(caseReference, query.appealtypes, formdata);
|
||||
store.dispatch(setAppealLPA(query.lpa));
|
||||
store.dispatch(setAppealTypeID(query.apt));
|
||||
store.dispatch(setCaseReference(caseReference));
|
||||
store.dispatch(setForm(xmlStr, mandatoryFieldsData, pickListData));
|
||||
store.dispatch(setAppealType(appealTypeData));
|
||||
|
||||
@@ -6,7 +6,7 @@ const appealTypeDataInitialState = {
|
||||
appealTypeID: {},
|
||||
currentSection: 1,
|
||||
appealLPA: "",
|
||||
caseReference: "",
|
||||
caseReference: {},
|
||||
formComplete: "false",
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user