diff --git a/src/CONST.ts b/src/CONST.ts index d78629e95001..9d3042b64f80 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1266,6 +1266,10 @@ const CONST = { COLLECTION_ACCOUNT_ID: 'collectionAccountID', }, + XERO_CONFIG: { + IMPORT_TAX_RATES: 'importTaxRates', + }, + QUICKBOOKS_EXPORT_ENTITY: { VENDOR_BILL: 'vendorBill', CHECK: 'check', diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 9d279b952078..801914fc1515 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -774,6 +774,10 @@ const ROUTES = { route: 'settings/workspaces/:policyID/accounting/xero/organization/:currentOrganizationID', getRoute: (policyID: string, currentOrganizationID: string) => `settings/workspaces/${policyID}/accounting/xero/organization/${currentOrganizationID}` as const, }, + POLICY_ACCOUNTING_XERO_TAXES: { + route: 'settings/workspaces/:policyID/accounting/xero/import/taxes', + getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/import/taxes` as const, + }, POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_IMPORT: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/import', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/import` as const, diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 8cafd441fdb3..56363b09c980 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -236,6 +236,7 @@ const SCREENS = { QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECTOR: 'Policy_Accounting_Quickbooks_Online_Invoice_Account_Selector', XERO_IMPORT: 'Policy_Accounting_Xero_Import', XERO_ORGANIZATION: 'Policy_Accounting_Xero_Customers', + XERO_TAXES: 'Policy_Accounting_Xero_Taxes', }, INITIAL: 'Workspace_Initial', PROFILE: 'Workspace_Profile', diff --git a/src/languages/en.ts b/src/languages/en.ts index 53735624d14f..5188c884810c 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1994,6 +1994,7 @@ export default { importDescription: 'Choose which coding configurations are imported from Xero to Expensify.', trackingCategories: 'Tracking categories', customers: 'Re-bill customers', + taxesDescription: 'Choose whether to import tax rates and tax defaults from your accounting integration.', }, type: { free: 'Free', diff --git a/src/languages/es.ts b/src/languages/es.ts index e916772ef984..2363340666cf 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -2021,6 +2021,7 @@ export default { importDescription: 'Elija qué configuraciones de codificación se importan de Xero a Expensify.', trackingCategories: 'Categorías de seguimiento', customers: 'Volver a facturar a los clientes', + taxesDescription: 'Elige si quires importar las tasas de impuestos y los impuestos por defecto de tu integración de contaduría.', }, type: { free: 'Gratis', diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index f9918647f84a..79fe3628a782 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -295,6 +295,7 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/workspace/accounting/xero/XeroImportPage').default as React.ComponentType, [SCREENS.WORKSPACE.ACCOUNTING.XERO_ORGANIZATION]: () => require('../../../../pages/workspace/accounting/xero/XeroOrganizationConfigurationPage').default as React.ComponentType, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_TAXES]: () => require('../../../../pages/workspace/accounting/xero/XeroTaxesConfigurationPage').default as React.ComponentType, [SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_FREQUENCY]: () => require('../../../../pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage').default as React.ComponentType, [SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_MONTHLY_OFFSET]: () => require('../../../../pages/workspace/workflows/WorkspaceAutoReportingMonthlyOffsetPage').default as React.ComponentType, diff --git a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts index 5ac899f34559..7712d1fc56a8 100755 --- a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts +++ b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts @@ -41,6 +41,7 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial> = { SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECTOR, SCREENS.WORKSPACE.ACCOUNTING.XERO_IMPORT, SCREENS.WORKSPACE.ACCOUNTING.XERO_ORGANIZATION, + SCREENS.WORKSPACE.ACCOUNTING.XERO_TAXES, ], [SCREENS.WORKSPACE.TAXES]: [ SCREENS.WORKSPACE.TAXES_SETTINGS, diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index c5a4463ac967..fb27b9b63447 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -326,6 +326,7 @@ const config: LinkingOptions['config'] = { }, [SCREENS.WORKSPACE.ACCOUNTING.XERO_IMPORT]: {path: ROUTES.POLICY_ACCOUNTING_XERO_IMPORT.route}, [SCREENS.WORKSPACE.ACCOUNTING.XERO_ORGANIZATION]: {path: ROUTES.POLICY_ACCOUNTING_XERO_ORGANIZATION.route}, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_TAXES]: {path: ROUTES.POLICY_ACCOUNTING_XERO_TAXES.route}, [SCREENS.WORKSPACE.DESCRIPTION]: { path: ROUTES.WORKSPACE_PROFILE_DESCRIPTION.route, }, diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 04442ffab5ce..7722de72645f 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -315,6 +315,9 @@ type SettingsNavigatorParamList = { policyID: string; organizationID: string; }; + [SCREENS.WORKSPACE.ACCOUNTING.XERO_TAXES]: { + policyID: string; + }; [SCREENS.GET_ASSISTANCE]: { backTo: Routes; }; diff --git a/src/pages/workspace/accounting/xero/XeroImportPage.tsx b/src/pages/workspace/accounting/xero/XeroImportPage.tsx index 3c1455e9ee65..4c83f8dea501 100644 --- a/src/pages/workspace/accounting/xero/XeroImportPage.tsx +++ b/src/pages/workspace/accounting/xero/XeroImportPage.tsx @@ -7,10 +7,12 @@ import ScrollView from '@components/ScrollView'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import Navigation from '@libs/Navigation/Navigation'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; import CONST from '@src/CONST'; +import ROUTES from '@src/ROUTES'; import type {Tenant} from '@src/types/onyx/Policy'; function XeroImportPage({policy}: WithPolicyProps) { @@ -48,7 +50,7 @@ function XeroImportPage({policy}: WithPolicyProps) { }, { description: translate('workspace.accounting.taxes'), - action: () => {}, + action: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_XERO_TAXES.getRoute(policyID)), hasError: !!policy?.errors?.importTaxes, title: importTaxRates ? translate('workspace.accounting.imported') : '', pendingAction: pendingFields?.importTaxRates, @@ -67,6 +69,7 @@ function XeroImportPage({policy}: WithPolicyProps) { policy?.errors?.importCustomers, policy?.errors?.importTaxes, translate, + policyID, ], ); diff --git a/src/pages/workspace/accounting/xero/XeroTaxesConfigurationPage.tsx b/src/pages/workspace/accounting/xero/XeroTaxesConfigurationPage.tsx new file mode 100644 index 000000000000..47910760eb40 --- /dev/null +++ b/src/pages/workspace/accounting/xero/XeroTaxesConfigurationPage.tsx @@ -0,0 +1,62 @@ +import React from 'react'; +import {View} from 'react-native'; +import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import OfflineWithFeedback from '@components/OfflineWithFeedback'; +import ScreenWrapper from '@components/ScreenWrapper'; +import ScrollView from '@components/ScrollView'; +import Switch from '@components/Switch'; +import Text from '@components/Text'; +import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; +import * as Connections from '@libs/actions/connections'; +import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; +import type {WithPolicyProps} from '@pages/workspace/withPolicy'; +import withPolicyConnections from '@pages/workspace/withPolicyConnections'; +import variables from '@styles/variables'; +import CONST from '@src/CONST'; + +function XeroTaxesConfigurationPage({policy}: WithPolicyProps) { + const {translate} = useLocalize(); + const styles = useThemeStyles(); + const policyID = policy?.id ?? ''; + const {importTaxRates, pendingFields} = policy?.connections?.xero?.config ?? {}; + const isSwitchOn = Boolean(importTaxRates); + return ( + + + + + {translate('workspace.xero.taxesDescription')} + + + {translate('workspace.accounting.import')} + + + + + Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.XERO, CONST.XERO_CONFIG.IMPORT_TAX_RATES, !importTaxRates) + } + /> + + + + + + + ); +} + +XeroTaxesConfigurationPage.displayName = 'XeroTaxesConfigurationPage'; + +export default withPolicyConnections(XeroTaxesConfigurationPage);