Skip to content

Commit

Permalink
Merge pull request Expensify#52465 from twilight2294/enableDisableTax…
Browse files Browse the repository at this point in the history
…rate

Enable/disable option shows rates text in plural instead rate
  • Loading branch information
techievivek authored Nov 19, 2024
2 parents 68f661d + f9d1a5b commit cc53f0e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
12 changes: 9 additions & 3 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3616,10 +3616,16 @@ const translations = {
actions: {
delete: 'Delete rate',
deleteMultiple: 'Delete rates',
disable: 'Disable rate',
disableMultiple: 'Disable rates',
enable: 'Enable rate',
enableMultiple: 'Enable rates',
disable: 'Disable rate',
enableTaxRates: () => ({
one: 'Enable rate',
other: 'Enable rates',
}),
disableTaxRates: () => ({
one: 'Disable rate',
other: 'Disable rates',
}),
},
importedFromAccountingSoftware: 'The taxes below are imported from your',
taxCode: 'Tax code',
Expand Down
12 changes: 9 additions & 3 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3661,10 +3661,16 @@ const translations = {
actions: {
delete: 'Eliminar tasa',
deleteMultiple: 'Eliminar tasas',
disable: 'Desactivar tasa',
disableMultiple: 'Desactivar tasas',
enable: 'Activar tasa',
enableMultiple: 'Activar tasas',
disable: 'Desactivar tasa',
enableTaxRates: () => ({
one: 'Activar tasa',
other: 'Activar tasas',
}),
disableTaxRates: () => ({
one: 'Desactivar tasa',
other: 'Desactivar tasas',
}),
},
importedFromAccountingSoftware: 'Impuestos importadas desde',
taxCode: 'Código de impuesto',
Expand Down
9 changes: 6 additions & 3 deletions src/pages/workspace/taxes/WorkspaceTaxesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ function WorkspaceTaxesPage({
const currentConnectionName = PolicyUtils.getCurrentConnectionName(policy);
const canSelectMultiple = shouldUseNarrowLayout ? selectionMode?.isEnabled : true;

const enabledRatesCount = selectedTaxesIDs.filter((taxID) => !policy?.taxRates?.taxes[taxID]?.isDisabled).length;
const disabledRatesCount = selectedTaxesIDs.length - enabledRatesCount;

const fetchTaxes = useCallback(() => {
openPolicyTaxesPage(policyID);
}, [policyID]);
Expand Down Expand Up @@ -208,7 +211,7 @@ function WorkspaceTaxesPage({
if (selectedTaxesIDs.some((taxID) => !policy?.taxRates?.taxes[taxID]?.isDisabled)) {
options.push({
icon: Expensicons.Close,
text: isMultiple ? translate('workspace.taxes.actions.disableMultiple') : translate('workspace.taxes.actions.disable'),
text: translate('workspace.taxes.actions.disableTaxRates', {count: enabledRatesCount}),
value: CONST.POLICY.BULK_ACTION_TYPES.DISABLE,
onSelected: () => toggleTaxes(false),
});
Expand All @@ -218,13 +221,13 @@ function WorkspaceTaxesPage({
if (selectedTaxesIDs.some((taxID) => policy?.taxRates?.taxes[taxID]?.isDisabled)) {
options.push({
icon: Expensicons.Checkmark,
text: isMultiple ? translate('workspace.taxes.actions.enableMultiple') : translate('workspace.taxes.actions.enable'),
text: translate('workspace.taxes.actions.enableTaxRates', {count: disabledRatesCount}),
value: CONST.POLICY.BULK_ACTION_TYPES.ENABLE,
onSelected: () => toggleTaxes(true),
});
}
return options;
}, [hasAccountingConnections, policy?.taxRates?.taxes, selectedTaxesIDs, toggleTaxes, translate]);
}, [hasAccountingConnections, policy?.taxRates?.taxes, selectedTaxesIDs, toggleTaxes, translate, enabledRatesCount, disabledRatesCount]);

const shouldShowBulkActionsButton = shouldUseNarrowLayout ? selectionMode?.isEnabled : selectedTaxesIDs.length > 0;
const headerButtons = !shouldShowBulkActionsButton ? (
Expand Down

0 comments on commit cc53f0e

Please sign in to comment.