added in documents for case and onlu published

This commit is contained in:
2021-09-24 15:31:08 +01:00
parent a8df1d1746
commit 287da16b8a
11 changed files with 905 additions and 548 deletions
+56 -85
View File
@@ -145,15 +145,15 @@ export const getBasicSearch = (token, searchString) => {
WEBAPI_URL +
"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 &$orderby=createdon desc&$count=true&$top=201",
"') and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true&$top=201",
azureHeaders(token)
)
.then((res) => {
console.log(" ");
console.log("/////////////////////");
console.log("data:" + res.data.value);
console.log("/////////////////////");
console.log(" ");
// console.log(" ");
// console.log("/////////////////////");
// console.log("data:" + res.data.value);
// console.log("/////////////////////");
// console.log(" ");
return res.data;
})
.catch((error) => {
@@ -165,7 +165,7 @@ export const getBasicDNSSearch = (token, searchString) => {
return axios
.get(
WEBAPI_URL +
"incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype eq 846040011&$orderby=createdon desc&$count=true",
"incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype eq 846040011 and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true",
azureHeaders(token)
)
.then((res) => res.data)
@@ -210,7 +210,7 @@ export const getAdvancedSearch = (token, searchString) => {
WEBAPI_URL +
"incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title&$filter=" +
queryString +
" and pinswg_appealcasetype ne null &$orderby=createdon desc&$count=true&$top=201",
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true&$top=201",
azureHeaders(token)
)
@@ -236,6 +236,35 @@ export const getBasicSearchDetails = (token, appealType, caseReference) => {
});
};
export const getSearchDocumentDetails = (token, incidentID) => {
return axios
.get(
WEBAPI_URL +
"pinswg_documents?$count=true&$filter=_pinswg_documentids_value eq " +
incidentID +
" and pinswg_publishtoweb eq true&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference",
azureHeaders(token)
)
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
});
};
export const getSearchDocumentHistory = (token, documentID) => {
return axios
.get(
WEBAPI_URL +
"pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " +
documentID,
azureHeaders(token)
)
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
});
};
export const getBasicDNSSearchDetails = (token, appealType, caseReference) => {
return axios
.get(
@@ -311,64 +340,6 @@ export const getAppealsTypes = (token) => {
});
};
export const getBasicSearch2 = (searchString) => {
var req = new XMLHttpRequest();
req.open(
"GET",
"https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title&$filter=contains(title, '" +
searchString +
"')&$count=true",
true
);
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("Prefer", 'odata.include-annotations="*"');
req.onreadystatechange = function () {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 200) {
var results = JSON.parse(this.response);
var recordCount = results["@odata.count"];
for (var i = 0; i < results.value.length; i++) {
var _accountid_value = results.value[i]["_accountid_value"];
var _accountid_value_formatted =
results.value[i][
"_accountid_value@OData.Community.Display.V1.FormattedValue"
];
var _accountid_value_lookuplogicalname =
results.value[i][
"_accountid_value@Microsoft.Dynamics.CRM.lookuplogicalname"
];
var _customerid_value =
results.value[i]["_customerid_value"];
var _customerid_value_formatted =
results.value[i][
"_customerid_value@OData.Community.Display.V1.FormattedValue"
];
var _customerid_value_lookuplogicalname =
results.value[i][
"_customerid_value@Microsoft.Dynamics.CRM.lookuplogicalname"
];
var pinswg_appealcasetype =
results.value[i]["pinswg_appealcasetype"];
var pinswg_appealcasetype_formatted =
results.value[i][
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
];
var statuscode = results.value[i]["statuscode"];
var ticketnumber = results.value[i]["ticketnumber"];
var title = results.value[i]["title"];
}
} else {
console.log(this.statusText);
}
}
};
return req.send();
};
//get list of entitydefinitions
//https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/EntityDefinitions?$select=LogicalName
@@ -393,25 +364,24 @@ export const getBasicSearch2 = (searchString) => {
// // 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);
});
};
//https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/pinswg_planningappeals78s?$filter=pinswg_name eq 'CAS-00015-L7J9H1'
// 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);
@@ -472,6 +442,7 @@ export const createCase = (appealTypeId) => {
appealTypeId = parseInt(appealTypeId);
var data = JSON.stringify({
"title": "insertion test case",
"caseorigincode": 3,
"customerid_contact@odata.bind":
"/contacts(f8b454ed-eded-eb11-aac7-00224800be9c)",
"pinswg_appealcasetype": appealTypeId,