Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable/disable option shows rates text in plural instead rate #52465

Merged
merged 4 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3569,10 +3569,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 @@ -3612,10 +3612,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',
disableTaxRates: () => ({
twilight2294 marked this conversation as resolved.
Show resolved Hide resolved
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
Loading