From d2d3d844ca5c6f03bc2d643ccadd0a796ad111e2 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 6 Aug 2024 17:18:34 +0800 Subject: [PATCH 1/2] disable selecting foreign tax default --- src/libs/PolicyUtils.ts | 2 +- src/pages/workspace/taxes/WorkspaceTaxesPage.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index a867a8b99cda..9c8632c78ae3 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -415,7 +415,7 @@ function getTaxByID(policy: OnyxEntry, taxID: string): TaxRate | undefin * Whether the tax rate can be deleted and disabled */ function canEditTaxRate(policy: Policy, taxID: string): boolean { - return policy.taxRates?.defaultExternalID !== taxID; + return policy.taxRates?.defaultExternalID !== taxID && policy.taxRates?.foreignTaxDefault !== taxID; } function isPolicyFeatureEnabled(policy: OnyxEntry, featureName: PolicyFeatureName): boolean { diff --git a/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx b/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx index 5e753f4f9c10..af096e4a08f3 100644 --- a/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx +++ b/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx @@ -138,7 +138,7 @@ function WorkspaceTaxesPage({ }; const toggleAllTaxes = () => { - const taxesToSelect = taxesList.filter((tax) => tax.keyForList !== defaultExternalID && tax.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE); + const taxesToSelect = taxesList.filter((tax) => tax.keyForList !== defaultExternalID && tax.keyForList !== foreignTaxDefault && tax.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE); setSelectedTaxesIDs((prev) => { if (prev.length === taxesToSelect.length) { return []; From 23bdb92e86b3e8acf1e4edd0e02559f89ca32a8d Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 6 Aug 2024 17:36:07 +0800 Subject: [PATCH 2/2] prettier --- src/pages/workspace/taxes/WorkspaceTaxesPage.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx b/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx index af096e4a08f3..95f74d3b3f37 100644 --- a/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx +++ b/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx @@ -138,7 +138,9 @@ function WorkspaceTaxesPage({ }; const toggleAllTaxes = () => { - const taxesToSelect = taxesList.filter((tax) => tax.keyForList !== defaultExternalID && tax.keyForList !== foreignTaxDefault && tax.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE); + const taxesToSelect = taxesList.filter( + (tax) => tax.keyForList !== defaultExternalID && tax.keyForList !== foreignTaxDefault && tax.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE, + ); setSelectedTaxesIDs((prev) => { if (prev.length === taxesToSelect.length) { return [];