Skip to content

Commit

Permalink
Merge pull request Expensify#45866 from rushatgabhane/upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
dangrous authored Jul 30, 2024
2 parents d6dda64 + 0836ad5 commit 49f0958
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 9 deletions.
8 changes: 8 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5410,6 +5410,14 @@ const CONST = {
description: 'workspace.upgrade.glAndPayrollCodes.description' as const,
icon: 'FolderOpen',
},
taxCodes: {
id: 'taxCodes' as const,
alias: 'tax-codes',
name: 'Tax codes',
title: 'workspace.upgrade.taxCodes.title' as const,
description: 'workspace.upgrade.taxCodes.description' as const,
icon: 'Coins',
},
};
},
REPORT_FIELD_TYPES: {
Expand Down
5 changes: 5 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3438,6 +3438,11 @@ export default {
description: `Add GL & Payroll codes to your categories for easy export of expenses to your accounting and payroll systems.`,
onlyAvailableOnPlan: 'GL & Payroll codes are only available on the Control plan, starting at ',
},
taxCodes: {
title: 'Tax codes',
description: `Add tax codes to your taxes for easy export of expenses to your accounting and payroll systems.`,
onlyAvailableOnPlan: 'Tax codes are only available on the Control plan, starting at ',
},
pricing: {
amount: '$9 ',
perActiveMember: 'per active member per month.',
Expand Down
5 changes: 5 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3494,6 +3494,11 @@ export default {
description: `Añada códigos de libro mayor y nómina a sus categorías para exportar fácilmente los gastos a sus sistemas de contabilidad y nómina.`,
onlyAvailableOnPlan: 'Los códigos de libro mayor y nómina solo están disponibles en el plan Control, a partir de ',
},
taxCodes: {
title: 'Código de impuesto',
description: `Añada código de impuesto mayor a sus categorías para exportar fácilmente los gastos a sus sistemas de contabilidad y nómina.`,
onlyAvailableOnPlan: 'Los código de impuesto mayor solo están disponibles en el plan Control, a partir de ',
},
note: {
upgradeWorkspace: 'Mejore su espacio de trabajo para acceder a esta función, o',
learnMore: 'más información',
Expand Down
4 changes: 1 addition & 3 deletions src/pages/workspace/categories/CategorySettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ function CategorySettingsPage({route, policyCategories, navigation}: CategorySet
const [deleteCategoryConfirmModalVisible, setDeleteCategoryConfirmModalVisible] = useState(false);
const backTo = route.params?.backTo;
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${route.params.policyID}`);
const shouldDisablePayrollCode = !isControlPolicy(policy);

const policyCategory =
policyCategories?.[route.params.categoryName] ?? Object.values(policyCategories ?? {}).find((category) => category.previousCategoryName === route.params.categoryName);
Expand Down Expand Up @@ -131,7 +130,7 @@ function CategorySettingsPage({route, policyCategories, navigation}: CategorySet
<OfflineWithFeedback pendingAction={policyCategory.pendingFields?.name}>
<MenuItemWithTopDescription
title={policyCategory.name}
description={translate(`workspace.categories.categoryName`)}
description={translate(`common.name`)}
onPress={navigateToEditCategory}
shouldShowRightIcon
/>
Expand Down Expand Up @@ -162,7 +161,6 @@ function CategorySettingsPage({route, policyCategories, navigation}: CategorySet
Navigation.navigate(ROUTES.WORKSPACE_CATEGORY_PAYROLL_CODE.getRoute(route.params.policyID, policyCategory.name));
}}
shouldShowRightIcon
disabled={shouldDisablePayrollCode}
/>
</OfflineWithFeedback>
{!isThereAnyAccountingConnection && (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/tags/TagSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function TagSettingsPage({route, policyTags, navigation}: TagSettingsPageProps)
<OfflineWithFeedback pendingAction={currentPolicyTag.pendingFields?.name}>
<MenuItemWithTopDescription
title={PolicyUtils.getCleanedTagName(currentPolicyTag.name)}
description={translate(`workspace.tags.tagName`)}
description={translate(`common.name`)}
onPress={navigateToEditTag}
shouldShowRightIcon
/>
Expand Down
13 changes: 9 additions & 4 deletions src/pages/workspace/taxes/WorkspaceEditTaxPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ function WorkspaceEditTaxPage({
const [isDeleteModalVisible, setIsDeleteModalVisible] = useState(false);
const canEditTaxRate = policy && PolicyUtils.canEditTaxRate(policy, taxID);
const hasAccountingConnections = PolicyUtils.hasAccountingConnections(policy);
const canEditTaxCode = PolicyUtils.isControlPolicy(policy);

const shouldShowDeleteMenuItem = canEditTaxRate && !hasAccountingConnections;

Expand Down Expand Up @@ -70,6 +69,7 @@ function WorkspaceEditTaxPage({
if (!currentTaxRate) {
return <NotFoundPage />;
}
const taxCodeToShow = PolicyUtils.isControlPolicy(policy) ? taxID : '';

return (
<AccessOrNotFoundWrapper
Expand Down Expand Up @@ -139,12 +139,17 @@ function WorkspaceEditTaxPage({
>
<MenuItemWithTopDescription
shouldShowRightIcon
title={taxID}
title={taxCodeToShow}
description={translate('workspace.taxes.taxCode')}
style={[styles.moneyRequestMenuItem]}
titleStyle={styles.flex1}
disabled={!canEditTaxCode}
onPress={() => Navigation.navigate(ROUTES.WORKSPACE_TAX_CODE.getRoute(`${policyID}`, taxID))}
onPress={() => {
if (!PolicyUtils.isControlPolicy(policy)) {
Navigation.navigate(ROUTES.WORKSPACE_UPGRADE.getRoute(policyID, CONST.UPGRADE_FEATURE_INTRO_MAPPING.taxCodes.alias));
return;
}
Navigation.navigate(ROUTES.WORKSPACE_TAX_CODE.getRoute(`${policyID}`, taxID));
}}
/>
</OfflineWithFeedback>
{shouldShowDeleteMenuItem && (
Expand Down
7 changes: 6 additions & 1 deletion src/pages/workspace/taxes/WorkspaceTaxCodePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,14 @@ function WorkspaceTaxCodePage({route}: WorkspaceTaxCodePageProps) {
if (!policy) {
return {};
}
const newTaxCode = values.taxCode.trim();
if (newTaxCode === currentTaxCode) {
return {};
}

return validateTaxCode(policy, values);
},
[policy],
[currentTaxCode, policy],
);

return (
Expand Down

0 comments on commit 49f0958

Please sign in to comment.