diff --git a/components/utils/index.js b/components/utils/index.js index 041b12c4..ba9b616c 100644 --- a/components/utils/index.js +++ b/components/utils/index.js @@ -115,17 +115,19 @@ export const getSearchDetails = async (searchResultsObj) => { } ); } else { - detailsArr.push( - getBasicSearchDetails( - formMeta.LogicalCollectionName, - searchDetail.title, - formMeta.PrimaryIdAttribute, - searchDetail.incidentid - ) || { - "@odata.count": 1, - "value": [{ "title": searchDetail.title }], - } - ); + formMeta?.LogicalCollectionName && + formMeta?.LogicalCollectionName != "pinswg_sipses" && + detailsArr.push( + getBasicSearchDetails( + formMeta.LogicalCollectionName, + searchDetail.title, + formMeta.PrimaryIdAttribute, + searchDetail.incidentid + ) || { + "@odata.count": 1, + "value": [{ "title": searchDetail.title }], + } + ); } }); // Promise.all(detailsArr).then((data) => { @@ -150,7 +152,7 @@ export const getPartSavedDetails = (searchResultsObj) => { let formMeta = getFormCollectionByID( searchDetail.pinswg_appealcasetype ); - console.log(formMeta); + // console.log(formMeta); detailsArr.push( getBasicPartSavedDetails( formMeta.LogicalCollectionName, @@ -178,15 +180,16 @@ export const getSearchDetailsPaged = (searchResultsObj) => { let formMeta = getFormCollectionByID( searchDetail.pinswg_appealcasetype ); - - detailsArr.push( - getBasicSearchDetailsPaged( - formMeta.LogicalCollectionName, - searchDetail.title, - formMeta.PrimaryIdAttribute, - searchDetail.incidentid - ) - ); + formMeta?.LogicalCollectionName && + formMeta?.LogicalCollectionName != "pinswg_sipses" && + detailsArr.push( + getBasicSearchDetailsPaged( + formMeta.LogicalCollectionName, + searchDetail.title, + formMeta.PrimaryIdAttribute, + searchDetail.incidentid + ) + ); } }); return Promise.all(detailsArr); diff --git a/data/collections.json b/data/collections.json index 3240e7c1..64358d07 100644 --- a/data/collections.json +++ b/data/collections.json @@ -370,6 +370,16 @@ "appealTypeID": "846040012", "NavigationProperty": "pinswg_ElectricityActIds", "value": "Electricity Act" + }, + { + "LogicalCollectionName": "pinswg_sipses", + "LogicalName": "pinswg_sips", + "PrimaryIdAttribute": "pinswg_sipscase", + "UrlName": "sips", + "MetadataId": "8d31911b-b8ea-ef11-ab08-00224800be9c", + "appealTypeID": "846040002", + "NavigationProperty": "pinswg_SIPSIds", + "value": "SIP" } ] } \ No newline at end of file diff --git a/pages/api/endpoint/getappealtypes_api.js b/pages/api/endpoint/getappealtypes_api.js index 23dfd07f..a206cb59 100644 --- a/pages/api/endpoint/getappealtypes_api.js +++ b/pages/api/endpoint/getappealtypes_api.js @@ -35,7 +35,15 @@ export default async function ApiProxy(req, res) { var token = await getToken(); var queryUrl = - "stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc"; + "stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' " + + (process.env.SHOWSIPS !== "true" + ? "and pinswg_appealcasetype ne 846040002" + : "") + + "&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc"; + + // for sips + // "stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc"; + // "stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc"; //"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'Developments of National Significance' and value ne 'LDP' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc"; diff --git a/pages/api/endpoint/getbasicsearch_api.js b/pages/api/endpoint/getbasicsearch_api.js index 0c5567a5..3b785c04 100644 --- a/pages/api/endpoint/getbasicsearch_api.js +++ b/pages/api/endpoint/getbasicsearch_api.js @@ -49,7 +49,11 @@ export default async function ApiProxy(req, res) { searchString + "') or contains(ticketnumber, '" + searchString + - "')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true"; + "')) and pinswg_appealcasetype ne null " + + (process.env.SHOWSIPS !== "true" + ? "and pinswg_appealcasetype ne 846040002" + : "") + + "and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true"; console.log( "\n==========================================\n", diff --git a/pages/api/endpoint/getbasicsearchpaged_api.js b/pages/api/endpoint/getbasicsearchpaged_api.js index 55c2266a..800a1b2f 100644 --- a/pages/api/endpoint/getbasicsearchpaged_api.js +++ b/pages/api/endpoint/getbasicsearchpaged_api.js @@ -83,7 +83,11 @@ export default async function ApiProxy(req, res) { searchString + "') or contains(ticketnumber, '" + searchString + - "')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=" + + "')) and pinswg_appealcasetype ne null " + + (process.env.SHOWSIPS !== "true" + ? "and pinswg_appealcasetype ne 846040002" + : "") + + "and pinswg_publishtoweb eq true&$orderby=" + orderby + " " + fieldSort +