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
+71 -51
View File
@@ -299,6 +299,7 @@ export const getSearchDocumentHistory1 = (documentID) => {
console.log("thiserror", error);
});
};
export const getBasicDNSSearchDetails = (token, appealType, caseReference) => {
return axios
.get(
@@ -400,49 +401,6 @@ export const getAppealsTypes = (token) => {
});
};
//get list of entitydefinitions
//https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/EntityDefinitions?$select=LogicalName
// get list of appealtypes
//https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/stringmaps?$filter=attributename%20eq%20%27pinswg_appealcasetype%27&$count=true
//get crm xml form for appealtype
//https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/systemforms?$select=formid,name,formxml&$filter=(objecttypecode%20eq%20%27pinswg_dns%27and%20type%20eq%202)&$count=true
// then use regex to remove the escape
// convert xml to json and return
// promise example
// var xml2js = require('xml2js');
// var xml = '<foo></foo>';
// // With parser
// var parser = new xml2js.Parser(/* options */);
// parser.parseStringPromise(data).then(function (result) {
// console.dir(result);
// console.log('Done');
// })
// .catch(function (err) {
// // Failed
// });
// export const getAppealTypeDetail = (caseReference, appealcasetype) => {
// console.log("got to axios", searchString);
// console.log("api_root: ", BASE_URL);
// // example appealcasetype type pinswg_householderappealhases
// return axios
// .get(
// "https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/" +
// appealcasetype +
// "?$filter=pinswg_name eq '" +
// caseReference +
// "'",
// { httpsAgent: new https.Agent({ rejectUnauthorized: false }) }
// )
// .then((res) => res.data)
// .catch((error) => {
// console.log("thi serror", error);
// });
// };
export const getLPA = (token) => {
// console.log("api_root: ", BASE_URL);
return axios
@@ -508,13 +466,27 @@ export const getAppealID = (
});
};
export const createCase = (token, appealTypeId) => {
export const getLogin = (emailAddress, pwd) => {
return axios
.get(
"/api/proxy/contacts?$filter=emailaddress1 eq '" +
emailAddress +
"' and pinswg_custom_password eq '" +
pwd +
"'&$count=true&$select=emailaddress1,%20contactid,pinswg_custom_password, yomifullname, firstname, lastname"
)
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
});
};
export const createCase = (token, appealTypeId, contactid) => {
appealTypeId = parseInt(appealTypeId);
var data = JSON.stringify({
"title": "insertion test case",
"caseorigincode": 3,
"customerid_contact@odata.bind":
"/contacts(f8b454ed-eded-eb11-aac7-00224800be9c)",
"customerid_contact@odata.bind": "/contacts(" + contactid + ")",
"pinswg_appealcasetype": appealTypeId,
});
@@ -587,6 +559,7 @@ export const updateCase = async (
};
export const getMyCases = (token, loggedInUserId) => {
console.log("in action ", loggedInUserId);
return axios
.get(
WEBAPI_URL +
@@ -595,13 +568,15 @@ export const getMyCases = (token, loggedInUserId) => {
" and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3",
azureHeaders(token)
)
.then((res) => res.data)
.then((res) => {
return res.data;
})
.catch((error) => {
console.log("thi serror", error);
});
};
export const getMyRepresentations = (token) => {
export const getMyRepresentations = (token, loggedInUserId) => {
return (
axios
// .get(BASE_URL + "/api/lookups/myRepresentations", {
@@ -609,7 +584,9 @@ export const getMyRepresentations = (token) => {
// })
.get(
WEBAPI_URL +
"incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype ne null &$count=true&$top=3",
"incidents?$select=ticketnumber,casetypecode,createdon,_customerid_value,description,incidentid,pinswg_appealcasetype,_pinswg_assignedinspectrids_value,statecode,statuscode,title&$filter=_customerid_value eq " +
loggedInUserId +
" and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3",
azureHeaders(token)
)
.then((res) => res.data)
@@ -619,7 +596,7 @@ export const getMyRepresentations = (token) => {
);
};
export const getWatchedCases = (token) => {
export const getWatchedCases = (token, loggedInUserId) => {
return (
axios
@@ -628,7 +605,9 @@ export const getWatchedCases = (token) => {
// })
.get(
WEBAPI_URL +
"incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype ne null &$count=true&$top=3",
"incidents?$select=ticketnumber,casetypecode,createdon,_customerid_value,description,incidentid,pinswg_appealcasetype,_pinswg_assignedinspectrids_value,statecode,statuscode,title&$filter=_customerid_value eq " +
loggedInUserId +
" and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3",
azureHeaders(token)
)
.then((res) => res.data)
@@ -664,3 +643,44 @@ export const getPortalModuelDetails = (token, appealType, caseReference) => {
console.log("thiserror", error);
});
};
export const getEmailAccountCheck = (emailAddress) => {
let token = getSASToken();
return axios
.get(
"/api/proxy/contacts?$filter=emailaddress1 eq '" +
emailAddress +
"'&$count=true&$select=emailaddress1, contactid"
)
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
});
};
export const createAccount = (formValues) => {
var data = JSON.stringify(formValues);
var config = {
method: "post",
url: "/api/proxy/contacts",
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"Prefer": 'odata.include-annotations="*",return=representation',
"Content-Type": "application/json",
"ServiceBusAuthorization": getSASToken(),
},
data: data,
};
// console.log(config);
return axios(config)
.then((res) => {
// console.log("posted ", res.data);
return res.data;
})
.catch((error) => {
console.log("this serror", error);
});
};