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