From 2cf0d78bf3a52abf72a5e6aa81392b02da646946 Mon Sep 17 00:00:00 2001 From: vhu-axelor <146069039+vhu-axelor@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:19:33 +0100 Subject: [PATCH] fix: filter issue with chips on CustomerParkScreen (#826) * RM#87640 --- changelogs/unreleased/87640.json | 5 ++++ .../intervention/src/api/equipment-api.js | 28 ++++++++++++++++--- .../screens/equipment/CustomerParkScreen.tsx | 2 +- 3 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 changelogs/unreleased/87640.json diff --git a/changelogs/unreleased/87640.json b/changelogs/unreleased/87640.json new file mode 100644 index 0000000000..41a692231d --- /dev/null +++ b/changelogs/unreleased/87640.json @@ -0,0 +1,5 @@ +{ + "title": "CustomerParkScreen: resolve filter issue with chips", + "type": "fix", + "packages": "intervention" +} diff --git a/packages/apps/intervention/src/api/equipment-api.js b/packages/apps/intervention/src/api/equipment-api.js index bb5bc7ab1a..cf3397582c 100644 --- a/packages/apps/intervention/src/api/equipment-api.js +++ b/packages/apps/intervention/src/api/equipment-api.js @@ -46,9 +46,29 @@ const createEquipmentsCriteria = ({ if (inService != null) { criteria.push({ - fieldName: 'inService', - operator: inService ? '=' : '!=', - value: true, + operator: 'or', + criteria: [ + { + operator: 'and', + criteria: [ + { + fieldName: 'typeSelect', + operator: '=', + value: Equipment?.typeSelect.Equipment, + }, + { + fieldName: 'inService', + operator: inService ? '=' : '!=', + value: true, + }, + ], + }, + { + fieldName: 'typeSelect', + operator: '=', + value: Equipment?.typeSelect.Place, + }, + ], }); } @@ -144,7 +164,7 @@ const createInterventionEquipmentToLinkCriteria = ({ export async function searchEquipment({ searchValue = null, page = 0, - inService, + inService = null, partnerId, parentPlaceId, noParent = false, diff --git a/packages/apps/intervention/src/screens/equipment/CustomerParkScreen.tsx b/packages/apps/intervention/src/screens/equipment/CustomerParkScreen.tsx index 9a262ff8d5..185f48d9fe 100644 --- a/packages/apps/intervention/src/screens/equipment/CustomerParkScreen.tsx +++ b/packages/apps/intervention/src/screens/equipment/CustomerParkScreen.tsx @@ -89,7 +89,7 @@ const CustomerParkScreen = ({}) => { sliceFunctionDataNoParentName="noParent" fetchBranchData={branchId => searchEquipmentApi({ - inService: selectedStatus[0]?.key, + inService: selectedStatus[0]?.value, partnerId: customer?.id, parentPlaceId: branchId, })