From c2a0b77e400f1f66e391359a315577e7d05dfc71 Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Thu, 28 Mar 2024 18:25:12 +0200 Subject: [PATCH 01/39] Export main page - initial --- src/CONST.ts | 1 + src/ROUTES.ts | 8 ++ src/SCREENS.ts | 2 + src/languages/en.ts | 12 ++ src/languages/es.ts | 12 ++ .../ModalStackNavigators/index.tsx | 2 + .../FULL_SCREEN_TO_RHP_MAPPING.ts | 3 + src/libs/Navigation/linkingConfig/config.ts | 4 + src/libs/Navigation/types.ts | 9 ++ .../accounting/WorkspaceAccountingPage.tsx | 21 ++++ .../accounting/qbo/QuickbooksExportPage.tsx | 104 ++++++++++++++++++ 11 files changed, 178 insertions(+) create mode 100644 src/pages/workspace/accounting/WorkspaceAccountingPage.tsx create mode 100644 src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx diff --git a/src/CONST.ts b/src/CONST.ts index c57ac575f7e6..1b8b8cc0b30d 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -534,6 +534,7 @@ const CONST = { CONCIERGE_ICON_URL_2021: `${CLOUDFRONT_URL}/images/icons/concierge_2021.png`, CONCIERGE_ICON_URL: `${CLOUDFRONT_URL}/images/icons/concierge_2022.png`, UPWORK_URL: 'https://github.com/Expensify/App/issues?q=is%3Aopen+is%3Aissue+label%3A%22Help+Wanted%22', + DEEP_DIVE_EXPENSIFY_CARD: 'https://community.expensify.com/discussion/4848/deep-dive-expensify-card-and-quickbooks-online-auto-reconciliation-how-it-works', GITHUB_URL: 'https://github.com/Expensify/App', TERMS_URL: `${USE_EXPENSIFY_URL}/terms`, PRIVACY_URL: `${USE_EXPENSIFY_URL}/privacy`, diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 23bb2ee845ad..8d59c00d9dff 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -452,10 +452,18 @@ const ROUTES = { route: 'settings/workspaces/:policyID/profile', getRoute: (policyID: string) => `settings/workspaces/${policyID}/profile` as const, }, + WORKSPACE_ACCOUNTING: { + route: 'settings/workspaces/:policyID/accounting', + getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting` as const, + }, WORKSPACE_PROFILE_CURRENCY: { route: 'settings/workspaces/:policyID/profile/currency', getRoute: (policyID: string) => `settings/workspaces/${policyID}/profile/currency` as const, }, + WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT: { + route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export', + getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export` as const, + }, WORKSPACE_PROFILE_NAME: { route: 'settings/workspaces/:policyID/profile/name', getRoute: (policyID: string) => `settings/workspaces/${policyID}/profile/name` as const, diff --git a/src/SCREENS.ts b/src/SCREENS.ts index ffb18391c980..fd1732fce921 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -208,6 +208,7 @@ const SCREENS = { INVOICES: 'Workspace_Invoices', TRAVEL: 'Workspace_Travel', MEMBERS: 'Workspace_Members', + ACCOUNTING: 'Workspace_Accounting', INVITE: 'Workspace_Invite', INVITE_MESSAGE: 'Workspace_Invite_Message', CATEGORIES: 'Workspace_Categories', @@ -249,6 +250,7 @@ const SCREENS = { CREATE_DISTANCE_RATE: 'Create_Distance_Rate', DISTANCE_RATES_SETTINGS: 'Distance_Rates_Settings', DISTANCE_RATE_DETAILS: 'Distance_Rate_Details', + QUICKBOOKSONLINE_EXPORT: 'Workspace_Accounting_QuickbooksOnline_Export', DISTANCE_RATE_EDIT: 'Distance_Rate_Edit', }, diff --git a/src/languages/en.ts b/src/languages/en.ts index 4badcddbc03d..f2e51b8e3116 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1805,6 +1805,18 @@ export default { control: 'Control', collect: 'Collect', }, + qbo: { + export: 'Export', + exportDescription: 'Configure how data in Expensify gets exported to QuickBooks Online.', + preferredExporter: 'Preferred exporter', + date: 'Date', + exportExpenses: 'Export out-of-pocket expenses as', + exportInvoices: 'Export invoices to', + exportCompany: 'Export company cards as', + exportExpensifyCard: 'Export Expensify Card transactions as', + deepDiveExpensifyCard: 'Expensify Card transactions automatically export to a “Expensify Card Liability Account” created with', + deepDiveExpensifyCardIntegration: 'our integration.', + }, categories: { deleteCategories: 'Delete categories', deleteCategoriesPrompt: 'Are you sure you want to delete these categories?', diff --git a/src/languages/es.ts b/src/languages/es.ts index 8167633c2d64..4e30b0c06e7b 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1827,6 +1827,18 @@ export default { welcomeNote: ({workspaceName}: WelcomeNoteParams) => `¡Has sido invitado a ${workspaceName}! Descargue la aplicación móvil Expensify en use.expensify.com/download para comenzar a rastrear sus gastos.`, }, + qbo: { + export: 'Exportar', + exportDescription: 'Configure cómo se exportan los datos de Expensify a QuickBooks Online.', + preferredExporter: 'Exportador preferido', + date: 'Fecha', + exportExpenses: 'Exportar gastos de bolsillo como', + exportInvoices: 'Exportar facturas a', + exportCompany: 'Exportar tarjetas de empresa como', + exportExpensifyCard: 'Exportar transacciones de la tarjeta Expensify como', + deepDiveExpensifyCard: 'Las transacciones de la Tarjeta Expensify se exportan automáticamente a una "Cuenta de Responsabilidad de la Tarjeta Expensify" creada con', + deepDiveExpensifyCardIntegration: 'nuestra integración.', + }, type: { free: 'Gratis', control: 'Control', diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index ef1fc3c2dfb0..de53174ec375 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -194,6 +194,7 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/settings/Profile/Contacts/ContactMethodDetailsPage').default as React.ComponentType, [SCREENS.SETTINGS.PROFILE.NEW_CONTACT_METHOD]: () => require('../../../../pages/settings/Profile/Contacts/NewContactMethodPage').default as React.ComponentType, [SCREENS.SETTINGS.PREFERENCES.PRIORITY_MODE]: () => require('../../../../pages/settings/Preferences/PriorityModePage').default as React.ComponentType, + [SCREENS.WORKSPACE.ACCOUNTING]: () => require('@pages/workspace/accounting/WorkspaceAccountingPage').default as React.ComponentType, [SCREENS.SETTINGS.PREFERENCES.LANGUAGE]: () => require('../../../../pages/settings/Preferences/LanguagePage').default as React.ComponentType, [SCREENS.SETTINGS.PREFERENCES.THEME]: () => require('../../../../pages/settings/Preferences/ThemePage').default as React.ComponentType, [SCREENS.SETTINGS.CLOSE]: () => require('../../../../pages/settings/Security/CloseAccountPage').default as React.ComponentType, @@ -251,6 +252,7 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName').default as React.ComponentType, [SCREENS.WORKSPACE.TAXES_SETTINGS_FOREIGN_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsForeignCurrency').default as React.ComponentType, [SCREENS.WORKSPACE.TAXES_SETTINGS_WORKSPACE_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsWorkspaceCurrency').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportPage').default as React.ComponentType, [SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default as React.ComponentType, [SCREENS.GET_ASSISTANCE]: () => require('../../../../pages/GetAssistancePage').default as React.ComponentType, [SCREENS.SETTINGS.TWO_FACTOR_AUTH]: () => require('../../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').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 1247933701a8..15bc0e88fb44 100755 --- a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts +++ b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts @@ -19,6 +19,9 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial> = { SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_MONTHLY_OFFSET, SCREENS.WORKSPACE.WORKFLOWS_PAYER, ], + [SCREENS.WORKSPACE.ACCOUNTING]: [ + SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT, + ], [SCREENS.WORKSPACE.TAXES]: [ SCREENS.WORKSPACE.TAXES_SETTINGS, SCREENS.WORKSPACE.TAX_CREATE, diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index c9c5d47a2df3..74d61e20404a 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -232,6 +232,7 @@ const config: LinkingOptions['config'] = { [SCREENS.WORKSPACE.CURRENCY]: { path: ROUTES.WORKSPACE_PROFILE_CURRENCY.route, }, + [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT.route}, [SCREENS.WORKSPACE.DESCRIPTION]: { path: ROUTES.WORKSPACE_PROFILE_DESCRIPTION.route, }, @@ -617,6 +618,9 @@ const config: LinkingOptions['config'] = { [SCREENS.WORKSPACE.MEMBERS]: { path: ROUTES.WORKSPACE_MEMBERS.route, }, + [SCREENS.WORKSPACE.ACCOUNTING]: { + path: ROUTES.WORKSPACE_ACCOUNTING.route, + }, [SCREENS.WORKSPACE.CATEGORIES]: { path: ROUTES.WORKSPACE_CATEGORIES.route, }, diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 60b2ed63ab49..88f4571c0965 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -246,6 +246,9 @@ type SettingsNavigatorParamList = { [SCREENS.WORKSPACE.DISTANCE_RATES_SETTINGS]: { policyID: string; }; + [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT]: { + policyID: string; + }; [SCREENS.GET_ASSISTANCE]: { backTo: Routes; }; @@ -612,9 +615,15 @@ type WorkspacesCentralPaneNavigatorParamList = { [SCREENS.WORKSPACE.TAXES]: { policyID: string; }; + [SCREENS.WORKSPACE.ACCOUNTING]: { + policyID: string; + }; [SCREENS.WORKSPACE.DISTANCE_RATES]: { policyID: string; }; + [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT]: { + policyID: string; + }; }; type FullScreenNavigatorParamList = { diff --git a/src/pages/workspace/accounting/WorkspaceAccountingPage.tsx b/src/pages/workspace/accounting/WorkspaceAccountingPage.tsx new file mode 100644 index 000000000000..7c2245514839 --- /dev/null +++ b/src/pages/workspace/accounting/WorkspaceAccountingPage.tsx @@ -0,0 +1,21 @@ +import React from 'react'; +import {View} from 'react-native'; +import ScreenWrapper from '@components/ScreenWrapper'; +import withPolicy from '@pages/workspace/withPolicy'; + +// Fake page will be removed after normal on will be merged +function WorkspaceAccountingPage() { + return ( + + + + ); +} + +WorkspaceAccountingPage.displayName = 'WorkspaceAccountingPage'; + +export default withPolicy(WorkspaceAccountingPage); diff --git a/src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx new file mode 100644 index 000000000000..4722ac1143d1 --- /dev/null +++ b/src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx @@ -0,0 +1,104 @@ +import React from 'react'; +import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; +import OfflineWithFeedback from '@components/OfflineWithFeedback'; +import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback'; +import ScreenWrapper from '@components/ScreenWrapper'; +import ScrollView from '@components/ScrollView'; +import Text from '@components/Text'; +import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; +import Navigation from '@navigation/Navigation'; +import withPolicy from '@pages/workspace/withPolicy'; +import type {WithPolicyProps} from '@pages/workspace/withPolicy'; +import * as Link from '@userActions/Link'; +import CONST from '@src/CONST'; +import ROUTES from '@src/ROUTES'; + +function QuickbooksExportPage({policy}: WithPolicyProps) { + const {translate} = useLocalize(); + const styles = useThemeStyles(); + const policyID = policy?.id ?? ''; + + const sections = [ + { + description: translate('workspace.qbo.preferredExporter'), + action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT.getRoute(policyID)), + hasError: Boolean(policy?.errors?.enableNewCategories), + title: 'zany@cathyscroissants.com', + }, + { + description: translate('workspace.qbo.date'), + action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT.getRoute(policyID)), + hasError: Boolean(policy?.errors?.syncClasses), + title: 'Date of last expense', + }, + { + description: translate('workspace.qbo.exportExpenses'), + action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT.getRoute(policyID)), + hasError: Boolean(policy?.errors?.syncCustomers), + title: 'Vendor bill', + }, + { + description: translate('workspace.qbo.exportInvoices'), + action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT.getRoute(policyID)), + hasError: Boolean(policy?.errors?.syncLocations), + title: 'Accounts Receivable (A/R)', + }, + { + description: translate('workspace.qbo.exportCompany'), + action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT.getRoute(policyID)), + hasError: Boolean(policy?.errors?.syncTaxes), + title: 'Debit card', + }, + { + description: translate('workspace.qbo.exportExpensifyCard'), + action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT.getRoute(policyID)), + hasError: Boolean(policy?.errors?.syncTaxes), + title: 'Credit card', + interactive: false, + }, + ]; + + return ( + + + + {translate('workspace.qbo.exportDescription')} + {sections.map((section) => ( + + + + ))} + { + Link.openExternalLink(CONST.DEEP_DIVE_EXPENSIFY_CARD); + }} + style={[styles.ph5, styles.pb5]} + accessibilityLabel={translate('workspace.qbo.deepDiveExpensifyCard')} + role={CONST.ROLE.LINK} + > + + {`${translate('workspace.qbo.deepDiveExpensifyCard')} `} + {translate('workspace.qbo.deepDiveExpensifyCardIntegration')} + + + + + ); +} + +QuickbooksExportPage.displayName = 'QuickbooksExportPage'; + +export default withPolicy(QuickbooksExportPage); From 1dfc676edec029d2daf270aef4310705cfecb3ef Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Thu, 28 Mar 2024 18:46:02 +0200 Subject: [PATCH 02/39] prettier --- .../Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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 15bc0e88fb44..69da09eb8d23 100755 --- a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts +++ b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts @@ -19,9 +19,7 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial> = { SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_MONTHLY_OFFSET, SCREENS.WORKSPACE.WORKFLOWS_PAYER, ], - [SCREENS.WORKSPACE.ACCOUNTING]: [ - SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT, - ], + [SCREENS.WORKSPACE.ACCOUNTING]: [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT], [SCREENS.WORKSPACE.TAXES]: [ SCREENS.WORKSPACE.TAXES_SETTINGS, SCREENS.WORKSPACE.TAX_CREATE, From 274343407df3684bd0ed10cdd3e7369947ffc33d Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Fri, 29 Mar 2024 17:23:29 +0200 Subject: [PATCH 03/39] Export date page - initial --- src/CONST.ts | 6 ++ src/ROUTES.ts | 4 ++ src/SCREENS.ts | 1 + src/languages/en.ts | 5 ++ src/languages/es.ts | 5 ++ .../ModalStackNavigators/index.tsx | 1 + .../FULL_SCREEN_TO_RHP_MAPPING.ts | 2 +- src/libs/Navigation/linkingConfig/config.ts | 1 + src/libs/Navigation/types.ts | 3 + .../qbo/QuickbooksExportDatePage.tsx | 61 +++++++++++++++++++ .../accounting/qbo/QuickbooksExportPage.tsx | 2 +- src/types/onyx/Policy.ts | 2 +- 12 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 src/pages/workspace/accounting/qbo/QuickbooksExportDatePage.tsx diff --git a/src/CONST.ts b/src/CONST.ts index 1b8b8cc0b30d..4ca3884e117d 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -4134,6 +4134,12 @@ const CONST = { }, }, + QUICKBOOKS_EXPORT_DATE: { + LAST_EXPENSE: 'lastExpense', + EXPORTED_DATE: 'exportedDate', + SUBMITTED_DATA: 'submittedData', + }, + SESSION_STORAGE_KEYS: { INITIAL_URL: 'INITIAL_URL', }, diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 8d59c00d9dff..e5e9ec63d648 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -669,6 +669,10 @@ const ROUTES = { route: 'settings/workspaces/:policyID/distance-rates/:rateID/edit', getRoute: (policyID: string, rateID: string) => `settings/workspaces/${policyID}/distance-rates/${rateID}/edit` as const, }, + WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT_DATE: { + route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/date', + getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/date` as const, + }, // Referral program promotion REFERRAL_DETAILS_MODAL: { route: 'referral/:contentType', diff --git a/src/SCREENS.ts b/src/SCREENS.ts index fd1732fce921..664acfbfad66 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -251,6 +251,7 @@ const SCREENS = { DISTANCE_RATES_SETTINGS: 'Distance_Rates_Settings', DISTANCE_RATE_DETAILS: 'Distance_Rate_Details', QUICKBOOKSONLINE_EXPORT: 'Workspace_Accounting_QuickbooksOnline_Export', + QUICKBOOKSONLINE_EXPORT_DATE: 'Workspace_Accounting_QuickbooksOnline_Export_Date', DISTANCE_RATE_EDIT: 'Distance_Rate_Edit', }, diff --git a/src/languages/en.ts b/src/languages/en.ts index f2e51b8e3116..234e76c4ea69 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1816,6 +1816,11 @@ export default { exportExpensifyCard: 'Export Expensify Card transactions as', deepDiveExpensifyCard: 'Expensify Card transactions automatically export to a “Expensify Card Liability Account” created with', deepDiveExpensifyCardIntegration: 'our integration.', + exportDate: 'Export Date', + exportDateDescription: 'Use this date when exporting reports to QuickBooks Online.', + lastExpense: {label: 'Date of last expense', description: 'The date of the most recent expense on the report'}, + exportedDate: {label: 'Export date', description: 'The date the report was exported to QuickBooksOnline'}, + submittedData: {label: 'Submitted data', description: 'The date the report was submitted for approval'}, }, categories: { deleteCategories: 'Delete categories', diff --git a/src/languages/es.ts b/src/languages/es.ts index 4e30b0c06e7b..63968ee7b6f3 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1838,6 +1838,11 @@ export default { exportExpensifyCard: 'Exportar transacciones de la tarjeta Expensify como', deepDiveExpensifyCard: 'Las transacciones de la Tarjeta Expensify se exportan automáticamente a una "Cuenta de Responsabilidad de la Tarjeta Expensify" creada con', deepDiveExpensifyCardIntegration: 'nuestra integración.', + exportDate: 'Fecha de exportación', + exportDateDescription: 'Utilice esta fecha al exportar informes a QuickBooks Online.', + lastExpense: {label: 'Fecha del último gasto', description: 'La fecha del gasto más reciente en el informe.'}, + exportedDate: {label: 'Fecha de exportación', description: 'La fecha en que se exportó el informe a QuickBooks Online'}, + submittedData: {label: 'Datos enviados', description: 'La fecha en que se presentó el informe para su aprobación.'}, }, type: { free: 'Gratis', diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index de53174ec375..8425667a39e8 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -253,6 +253,7 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsForeignCurrency').default as React.ComponentType, [SCREENS.WORKSPACE.TAXES_SETTINGS_WORKSPACE_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsWorkspaceCurrency').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportPage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_DATE]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportDatePage').default as React.ComponentType, [SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default as React.ComponentType, [SCREENS.GET_ASSISTANCE]: () => require('../../../../pages/GetAssistancePage').default as React.ComponentType, [SCREENS.SETTINGS.TWO_FACTOR_AUTH]: () => require('../../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').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 69da09eb8d23..cb7cd0492f9a 100755 --- a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts +++ b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts @@ -19,7 +19,7 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial> = { SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_MONTHLY_OFFSET, SCREENS.WORKSPACE.WORKFLOWS_PAYER, ], - [SCREENS.WORKSPACE.ACCOUNTING]: [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT], + [SCREENS.WORKSPACE.ACCOUNTING]: [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT, SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_DATE], [SCREENS.WORKSPACE.TAXES]: [ SCREENS.WORKSPACE.TAXES_SETTINGS, SCREENS.WORKSPACE.TAX_CREATE, diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index 74d61e20404a..69287f0ee0b7 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -233,6 +233,7 @@ const config: LinkingOptions['config'] = { path: ROUTES.WORKSPACE_PROFILE_CURRENCY.route, }, [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT.route}, + [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_DATE]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT_DATE.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 88f4571c0965..9628c7f27680 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -249,6 +249,9 @@ type SettingsNavigatorParamList = { [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT]: { policyID: string; }; + [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_DATE]: { + policyID: string; + }; [SCREENS.GET_ASSISTANCE]: { backTo: Routes; }; diff --git a/src/pages/workspace/accounting/qbo/QuickbooksExportDatePage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksExportDatePage.tsx new file mode 100644 index 000000000000..93f26155fb77 --- /dev/null +++ b/src/pages/workspace/accounting/qbo/QuickbooksExportDatePage.tsx @@ -0,0 +1,61 @@ +import React, {useCallback} from 'react'; +import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import ScreenWrapper from '@components/ScreenWrapper'; +import ScrollView from '@components/ScrollView'; +import SelectionList from '@components/SelectionList'; +import RadioListItem from '@components/SelectionList/RadioListItem'; +import Text from '@components/Text'; +import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; +import Navigation from '@navigation/Navigation'; +import withPolicy from '@pages/workspace/withPolicy'; +import type {WithPolicyProps} from '@pages/workspace/withPolicy'; +import CONST from '@src/CONST'; + +function QuickbooksExportDatePage({policy}: WithPolicyProps) { + const {translate} = useLocalize(); + const styles = useThemeStyles(); + // const policyID = policy?.id ?? ''; + const {exportDate} = policy?.connections?.quickbooksOnline?.config ?? {}; + const data = Object.values(CONST.QUICKBOOKS_EXPORT_DATE).map((dateType) => ({ + value: dateType, + text: translate(`workspace.qbo.${dateType}.label`), + alternateText: translate(`workspace.qbo.${dateType}.description`), + keyForList: dateType, + isSelected: exportDate ? CONST.QUICKBOOKS_EXPORT_DATE[exportDate] === dateType : false, + })); + + const updateMode = useCallback( + (mode: {value: string}) => { + if (exportDate && mode.value === CONST.QUICKBOOKS_EXPORT_DATE[exportDate]) { + Navigation.goBack(); + return; + } + // TODO add API call for change + }, + [exportDate], + ); + + return ( + + + + {translate('workspace.qbo.exportDateDescription')} + mode.isSelected)?.keyForList} + /> + + + ); +} + +QuickbooksExportDatePage.displayName = 'QuickbooksExportDatePage'; + +export default withPolicy(QuickbooksExportDatePage); diff --git a/src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx index 4722ac1143d1..371da807e3ac 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx @@ -29,7 +29,7 @@ function QuickbooksExportPage({policy}: WithPolicyProps) { }, { description: translate('workspace.qbo.date'), - action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT.getRoute(policyID)), + action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT_DATE.getRoute(policyID)), hasError: Boolean(policy?.errors?.syncClasses), title: 'Date of last expense', }, diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index 398a0fe0dd28..c3554cad8403 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -165,7 +165,7 @@ type QBOConnectionConfig = { syncClasses: IntegrationEntityMap; syncCustomers: IntegrationEntityMap; syncLocations: IntegrationEntityMap; - exportDate: string; + exportDate: keyof typeof CONST.QUICKBOOKS_EXPORT_DATE; lastConfigurationTime: number; syncTax: boolean; enableNewCategories: boolean; From b07c19501f71998ec45784b3172f3d9a31537abf Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Tue, 2 Apr 2024 17:21:17 +0300 Subject: [PATCH 04/39] Export invoice page --- src/ROUTES.ts | 4 ++ src/SCREENS.ts | 1 + src/languages/en.ts | 3 + src/languages/es.ts | 3 + .../WorkspaceSettingsModalStackNavigator.tsx | 5 ++ .../ModalStackNavigators/index.tsx | 1 + .../FULL_SCREEN_TO_RHP_MAPPING.ts | 2 +- src/libs/Navigation/linkingConfig/config.ts | 1 + src/libs/Navigation/types.ts | 3 + .../qbo/QuickbooksExportInvoicesPage.tsx | 58 +++++++++++++++++++ .../accounting/qbo/QuickbooksExportPage.tsx | 2 +- 11 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 src/pages/workspace/accounting/qbo/QuickbooksExportInvoicesPage.tsx diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 2bd7a47be2aa..27b3cfb04c71 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -458,6 +458,10 @@ const ROUTES = { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export` as const, }, + WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_INVOICES: { + route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/invoices', + getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/invoices` as const, + }, WORKSPACE_PROFILE_NAME: { route: 'settings/workspaces/:policyID/profile/name', getRoute: (policyID: string) => `settings/workspaces/${policyID}/profile/name` as const, diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 7543378fb8b5..4bebfbbc5075 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -250,6 +250,7 @@ const SCREENS = { DISTANCE_RATE_DETAILS: 'Distance_Rate_Details', QUICKBOOKSONLINE_EXPORT: 'Workspace_Accounting_QuickbooksOnline_Export', QUICKBOOKSONLINE_EXPORT_DATE: 'Workspace_Accounting_QuickbooksOnline_Export_Date', + QUICKBOOKSONLINE_EXPORT_INVOICES: 'Workspace_Accounting_QuickbooksOnline_Export_Invoices', DISTANCE_RATE_EDIT: 'Distance_Rate_Edit', }, diff --git a/src/languages/en.ts b/src/languages/en.ts index 7a5db95b4a01..2ab722c73340 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1834,6 +1834,9 @@ export default { lastExpense: {label: 'Date of last expense', description: 'The date of the most recent expense on the report'}, exportedDate: {label: 'Export date', description: 'The date the report was exported to QuickBooksOnline'}, submittedData: {label: 'Submitted data', description: 'The date the report was submitted for approval'}, + receivable: 'Accounts receivable', + archive: 'Accounts receivable archive', + exportInvoicesDescription: 'Invoices will be exported to this account in QuickBooks Online.' }, categories: { deleteCategories: 'Delete categories', diff --git a/src/languages/es.ts b/src/languages/es.ts index fb505e1ccd3c..6b3e5260514d 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1856,6 +1856,9 @@ export default { lastExpense: {label: 'Fecha del último gasto', description: 'La fecha del gasto más reciente en el informe.'}, exportedDate: {label: 'Fecha de exportación', description: 'La fecha en que se exportó el informe a QuickBooks Online'}, submittedData: {label: 'Datos enviados', description: 'La fecha en que se presentó el informe para su aprobación.'}, + receivable: 'Cuentas por cobrar', + archive: 'Archivo de cuentas por cobrar', + exportInvoicesDescription: 'Las facturas se exportarán a esta cuenta en QuickBooks Online.' }, type: { free: 'Gratis', diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/WorkspaceSettingsModalStackNavigator.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/WorkspaceSettingsModalStackNavigator.tsx index 14153809bc86..38b2aec7672a 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/WorkspaceSettingsModalStackNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/WorkspaceSettingsModalStackNavigator.tsx @@ -75,6 +75,11 @@ function WorkspaceSettingsModalStackNavigator() { name={SCREENS.WORKSPACE.DISTANCE_RATES} getComponent={() => require('@pages/workspace/distanceRates/PolicyDistanceRatesPage').default as React.ComponentType} /> + require('@pages/workspace/distanceRates/PolicyDistanceRatesPage').default as React.ComponentType} + /> ); } diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index dce39bd30c45..4ffc09042a42 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -253,6 +253,7 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsWorkspaceCurrency').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportPage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_DATE]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportDatePage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_INVOICES]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportInvoicesPage').default as React.ComponentType, [SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default as React.ComponentType, [SCREENS.GET_ASSISTANCE]: () => require('../../../../pages/GetAssistancePage').default as React.ComponentType, [SCREENS.SETTINGS.TWO_FACTOR_AUTH]: () => require('../../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').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 cb7cd0492f9a..b228b3f9681c 100755 --- a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts +++ b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts @@ -19,7 +19,7 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial> = { SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_MONTHLY_OFFSET, SCREENS.WORKSPACE.WORKFLOWS_PAYER, ], - [SCREENS.WORKSPACE.ACCOUNTING]: [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT, SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_DATE], + [SCREENS.WORKSPACE.ACCOUNTING]: [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT, SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_DATE, SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_INVOICES], [SCREENS.WORKSPACE.TAXES]: [ SCREENS.WORKSPACE.TAXES_SETTINGS, SCREENS.WORKSPACE.TAX_CREATE, diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index d0d4a8336157..c6a0752fa53e 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -234,6 +234,7 @@ const config: LinkingOptions['config'] = { }, [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT.route}, [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_DATE]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT_DATE.route}, + [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_INVOICES]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_INVOICES.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 82eba60d3d6c..bc75acef5eeb 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -252,6 +252,9 @@ type SettingsNavigatorParamList = { [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_DATE]: { policyID: string; }; + [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_INVOICES]: { + policyID: string; + }; [SCREENS.GET_ASSISTANCE]: { backTo: Routes; }; diff --git a/src/pages/workspace/accounting/qbo/QuickbooksExportInvoicesPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksExportInvoicesPage.tsx new file mode 100644 index 000000000000..2fd407faa8c1 --- /dev/null +++ b/src/pages/workspace/accounting/qbo/QuickbooksExportInvoicesPage.tsx @@ -0,0 +1,58 @@ +import React, {useCallback} from 'react'; +import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import ScreenWrapper from '@components/ScreenWrapper'; +import ScrollView from '@components/ScrollView'; +import SelectionList from '@components/SelectionList'; +import RadioListItem from '@components/SelectionList/RadioListItem'; +import Text from '@components/Text'; +import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; +import withPolicy from '@pages/workspace/withPolicy'; +import type {WithPolicyProps} from '@pages/workspace/withPolicy'; + +function QuickbooksExportInvoicesPage({policy}: WithPolicyProps) { + const {translate} = useLocalize(); + const styles = useThemeStyles(); + // const policyID = policy?.id ?? ''; + const data = [ + { + value: 'receivable', + text: translate(`workspace.qbo.receivable`), + keyForList: 'receivable', + isSelected: false, + }, + { + value: 'archive', + text: translate(`workspace.qbo.archive`), + keyForList: 'archive', + isSelected: false, + }, + ]; + + const updateMode = useCallback((mode: {value: string}) => { + // TODO add API call for change + }, []); + + return ( + + + + {translate('workspace.qbo.exportInvoicesDescription')} + mode.isSelected)?.keyForList} + /> + + + ); +} + +QuickbooksExportInvoicesPage.displayName = 'QuickbooksExportInvoicesPage'; + +export default withPolicy(QuickbooksExportInvoicesPage); diff --git a/src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx index 371da807e3ac..c35c04445e67 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx @@ -41,7 +41,7 @@ function QuickbooksExportPage({policy}: WithPolicyProps) { }, { description: translate('workspace.qbo.exportInvoices'), - action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT.getRoute(policyID)), + action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_INVOICES.getRoute(policyID)), hasError: Boolean(policy?.errors?.syncLocations), title: 'Accounts Receivable (A/R)', }, From d0a4ccf4f38db2f5bf0681af7cedcf748f643221 Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Wed, 3 Apr 2024 17:36:44 +0300 Subject: [PATCH 05/39] Company card + company card selection screens --- src/ROUTES.ts | 8 +++ src/SCREENS.ts | 2 + src/languages/en.ts | 7 +- src/languages/es.ts | 7 +- .../ModalStackNavigators/index.tsx | 2 + .../FULL_SCREEN_TO_RHP_MAPPING.ts | 8 ++- src/libs/Navigation/linkingConfig/config.ts | 2 + src/libs/Navigation/types.ts | 6 ++ .../qbo/QuickbooksExportCompanyCardPage.tsx | 69 +++++++++++++++++++ .../qbo/QuickbooksExportCompanyCardsPage.tsx | 44 ++++++++++++ .../accounting/qbo/QuickbooksExportPage.tsx | 2 +- src/types/onyx/Policy.ts | 2 +- 12 files changed, 154 insertions(+), 5 deletions(-) create mode 100644 src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardPage.tsx create mode 100644 src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardsPage.tsx diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 27b3cfb04c71..35c9e41c34df 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -458,6 +458,14 @@ const ROUTES = { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export` as const, }, + WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_COMPANY_CARDS: { + route: 'settings/workspaces/:policyID/accounting/quickbooks-online/company-cards', + getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/company-cards` as const, + }, + WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_COMPANY_CARD: { + route: 'settings/workspaces/:policyID/accounting/quickbooks-online/company-card', + getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/company-card` as const, + }, WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_INVOICES: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/invoices', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/invoices` as const, diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 4bebfbbc5075..d02288833c4f 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -251,6 +251,8 @@ const SCREENS = { QUICKBOOKSONLINE_EXPORT: 'Workspace_Accounting_QuickbooksOnline_Export', QUICKBOOKSONLINE_EXPORT_DATE: 'Workspace_Accounting_QuickbooksOnline_Export_Date', QUICKBOOKSONLINE_EXPORT_INVOICES: 'Workspace_Accounting_QuickbooksOnline_Export_Invoices', + QUICKBOOKSONLINE_EXPORT_COMPANY_CARDS: 'Workspace_Accounting_QuickbooksOnline_Export_Company_Cards', + QUICKBOOKSONLINE_EXPORT_COMPANY_CARD: 'Workspace_Accounting_QuickbooksOnline_Export_Company_Card', DISTANCE_RATE_EDIT: 'Distance_Rate_Edit', }, diff --git a/src/languages/en.ts b/src/languages/en.ts index 2ab722c73340..c4a5b75105c5 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1820,6 +1820,7 @@ export default { }, qbo: { export: 'Export', + exportAs: 'Export as', exportDescription: 'Configure how data in Expensify gets exported to QuickBooks Online.', preferredExporter: 'Preferred exporter', date: 'Date', @@ -1836,7 +1837,11 @@ export default { submittedData: {label: 'Submitted data', description: 'The date the report was submitted for approval'}, receivable: 'Accounts receivable', archive: 'Accounts receivable archive', - exportInvoicesDescription: 'Invoices will be exported to this account in QuickBooks Online.' + exportInvoicesDescription: 'Invoices will be exported to this account in QuickBooks Online.', + exportCompanyCardsDescription: 'Set how company card purchases export to QuickBooks Online.', + creditCard: 'Credit Card', + debitCard: 'Debit Card', + vendorBill: 'Vendor Bill', }, categories: { deleteCategories: 'Delete categories', diff --git a/src/languages/es.ts b/src/languages/es.ts index 6b3e5260514d..d1104f8c48c1 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1842,6 +1842,7 @@ export default { }, qbo: { export: 'Exportar', + exportAs: 'Exportar cómo', exportDescription: 'Configure cómo se exportan los datos de Expensify a QuickBooks Online.', preferredExporter: 'Exportador preferido', date: 'Fecha', @@ -1858,7 +1859,11 @@ export default { submittedData: {label: 'Datos enviados', description: 'La fecha en que se presentó el informe para su aprobación.'}, receivable: 'Cuentas por cobrar', archive: 'Archivo de cuentas por cobrar', - exportInvoicesDescription: 'Las facturas se exportarán a esta cuenta en QuickBooks Online.' + exportInvoicesDescription: 'Las facturas se exportarán a esta cuenta en QuickBooks Online.', + exportCompanyCardsDescription: 'Establezca cómo se exportan las compras con tarjeta de empresa a QuickBooks Online.', + creditCard: 'Tarjeta de crédito', + debitCard: 'Tarjeta de débito', + vendorBill: 'Factura del proveedor', }, type: { free: 'Gratis', diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index 4ffc09042a42..8d9cef1eaaaa 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -254,6 +254,8 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/workspace/accounting/qbo/QuickbooksExportPage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_DATE]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportDatePage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_INVOICES]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportInvoicesPage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_COMPANY_CARDS]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportCompanyCardsPage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_COMPANY_CARD]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportCompanyCardPage').default as React.ComponentType, [SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default as React.ComponentType, [SCREENS.GET_ASSISTANCE]: () => require('../../../../pages/GetAssistancePage').default as React.ComponentType, [SCREENS.SETTINGS.TWO_FACTOR_AUTH]: () => require('../../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').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 b228b3f9681c..bf9b3b52c9c1 100755 --- a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts +++ b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts @@ -19,7 +19,13 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial> = { SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_MONTHLY_OFFSET, SCREENS.WORKSPACE.WORKFLOWS_PAYER, ], - [SCREENS.WORKSPACE.ACCOUNTING]: [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT, SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_DATE, SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_INVOICES], + [SCREENS.WORKSPACE.ACCOUNTING]: [ + SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT, + SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_DATE, + SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_INVOICES, + SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_COMPANY_CARDS, + SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_COMPANY_CARD, + ], [SCREENS.WORKSPACE.TAXES]: [ SCREENS.WORKSPACE.TAXES_SETTINGS, SCREENS.WORKSPACE.TAX_CREATE, diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index c6a0752fa53e..d2989bd45e5b 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -235,6 +235,8 @@ const config: LinkingOptions['config'] = { [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT.route}, [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_DATE]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT_DATE.route}, [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_INVOICES]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_INVOICES.route}, + [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_COMPANY_CARDS]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_COMPANY_CARDS.route}, + [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_COMPANY_CARD]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_COMPANY_CARD.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 bc75acef5eeb..947a17575640 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -255,6 +255,12 @@ type SettingsNavigatorParamList = { [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_INVOICES]: { policyID: string; }; + [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_COMPANY_CARDS]: { + policyID: string; + }; + [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_COMPANY_CARD]: { + policyID: string; + }; [SCREENS.GET_ASSISTANCE]: { backTo: Routes; }; diff --git a/src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardPage.tsx new file mode 100644 index 000000000000..eabdbed2e661 --- /dev/null +++ b/src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardPage.tsx @@ -0,0 +1,69 @@ +import React, {useCallback} from 'react'; +import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import ScreenWrapper from '@components/ScreenWrapper'; +import ScrollView from '@components/ScrollView'; +import SelectionList from '@components/SelectionList'; +import RadioListItem from '@components/SelectionList/RadioListItem'; +import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; +import withPolicy from '@pages/workspace/withPolicy'; +import type {WithPolicyProps} from '@pages/workspace/withPolicy'; + +const CARDS = { + CREDIT_CARD: 'credit_card', + DEBIT_CARD: 'debit_card', + VENDOR_BILL: 'vendor_bill', +}; + +function QuickbooksExportCompanyCardPage({policy}: WithPolicyProps) { + const {translate} = useLocalize(); + const styles = useThemeStyles(); + const {nonReimbursableExpensesExportDestination} = policy?.connections?.quickbooksOnline?.config ?? {}; + // const policyID = policy?.id ?? ''; + const data = [ + { + value: CARDS.CREDIT_CARD, + text: translate(`workspace.qbo.creditCard`), + keyForList: CARDS.CREDIT_CARD, + isSelected: nonReimbursableExpensesExportDestination === CARDS.CREDIT_CARD, + }, + { + value: CARDS.DEBIT_CARD, + text: translate(`workspace.qbo.debitCard`), + keyForList: CARDS.DEBIT_CARD, + isSelected: nonReimbursableExpensesExportDestination === CARDS.DEBIT_CARD, + }, + { + value: CARDS.VENDOR_BILL, + text: translate(`workspace.qbo.vendorBill`), + keyForList: CARDS.VENDOR_BILL, + isSelected: nonReimbursableExpensesExportDestination === CARDS.VENDOR_BILL, + }, + ]; + + const updateMode = useCallback((mode: {value: string}) => { + // TODO add API call for change + }, []); + + return ( + + + + mode.isSelected)?.keyForList} + /> + + + ); +} + +QuickbooksExportCompanyCardPage.displayName = 'QuickbooksExportCompanyCardPage'; + +export default withPolicy(QuickbooksExportCompanyCardPage); diff --git a/src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardsPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardsPage.tsx new file mode 100644 index 000000000000..318440ee570c --- /dev/null +++ b/src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardsPage.tsx @@ -0,0 +1,44 @@ +import React from 'react'; +import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; +import OfflineWithFeedback from '@components/OfflineWithFeedback'; +import ScreenWrapper from '@components/ScreenWrapper'; +import ScrollView from '@components/ScrollView'; +import Text from '@components/Text'; +import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; +import Navigation from '@navigation/Navigation'; +import withPolicy from '@pages/workspace/withPolicy'; +import type {WithPolicyProps} from '@pages/workspace/withPolicy'; +import ROUTES from '@src/ROUTES'; + +function QuickbooksExportCompanyCardsPage({policy}: WithPolicyProps) { + const {translate} = useLocalize(); + const styles = useThemeStyles(); + const policyID = policy?.id ?? ''; + + return ( + + + + {translate('workspace.qbo.exportCompanyCardsDescription')} + + Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_COMPANY_CARD.getRoute(policyID))} + brickRoadIndicator={undefined} + /> + + + + ); +} + +QuickbooksExportCompanyCardsPage.displayName = 'QuickbooksExportCompanyCardsPage'; + +export default withPolicy(QuickbooksExportCompanyCardsPage); diff --git a/src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx index c35c04445e67..b229c2b23467 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx @@ -47,7 +47,7 @@ function QuickbooksExportPage({policy}: WithPolicyProps) { }, { description: translate('workspace.qbo.exportCompany'), - action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT.getRoute(policyID)), + action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_COMPANY_CARDS.getRoute(policyID)), hasError: Boolean(policy?.errors?.syncTaxes), title: 'Debit card', }, diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index abfc88b2bad6..622a547637fb 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -157,7 +157,7 @@ type QBOConnectionConfig = { syncItems: boolean; markChecksToBePrinted: boolean; reimbursableExpensesExportDestination: IntegrationEntityMap; - nonReimbursableExpensesExportDestination: IntegrationEntityMap; + nonReimbursableExpensesExportDestination: string; reimbursableExpensesAccount?: string; nonReimbursableExpensesAccount?: string; From 11c23ffa19c2fbb364b7b1e9cf16e6a03f8eb87a Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Fri, 5 Apr 2024 16:57:09 +0300 Subject: [PATCH 06/39] Export Preferred Exporter screen + sub screen --- src/ROUTES.ts | 18 ++++-- src/SCREENS.ts | 12 ++-- src/languages/en.ts | 2 + src/languages/es.ts | 2 + .../ModalStackNavigators/index.tsx | 12 ++-- .../FULL_SCREEN_TO_RHP_MAPPING.ts | 12 ++-- src/libs/Navigation/linkingConfig/config.ts | 12 ++-- src/libs/Navigation/types.ts | 18 ++++-- .../qbo/QuickBooksExportPreferredExporter.tsx | 47 ++++++++++++++ .../QuickBooksExportPreferredExporterList.tsx | 61 +++++++++++++++++++ .../qbo/QuickbooksExportCompanyCardsPage.tsx | 2 +- .../accounting/qbo/QuickbooksExportPage.tsx | 16 ++--- 12 files changed, 175 insertions(+), 39 deletions(-) create mode 100644 src/pages/workspace/accounting/qbo/QuickBooksExportPreferredExporter.tsx create mode 100644 src/pages/workspace/accounting/qbo/QuickBooksExportPreferredExporterList.tsx diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 35c9e41c34df..dd4d63b0de03 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -454,22 +454,30 @@ const ROUTES = { route: 'settings/workspaces/:policyID/profile/currency', getRoute: (policyID: string) => `settings/workspaces/${policyID}/profile/currency` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT: { + WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_COMPANY_CARDS: { + WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARDS: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/company-cards', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/company-cards` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_COMPANY_CARD: { + WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/company-card', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/company-card` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_INVOICES: { + WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICES: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/invoices', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/invoices` as const, }, + WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER: { + route: 'settings/workspaces/:policyID/accounting/quickbooks-online/preferred-exporter', + getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/preferred-exporter` as const, + }, + WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER_LIST: { + route: 'settings/workspaces/:policyID/accounting/quickbooks-online/preferred-exporter-list', + getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/preferred-exporter-list` as const, + }, WORKSPACE_PROFILE_NAME: { route: 'settings/workspaces/:policyID/profile/name', getRoute: (policyID: string) => `settings/workspaces/${policyID}/profile/name` as const, @@ -675,7 +683,7 @@ const ROUTES = { route: 'settings/workspaces/:policyID/distance-rates/:rateID/edit', getRoute: (policyID: string, rateID: string) => `settings/workspaces/${policyID}/distance-rates/${rateID}/edit` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT_DATE: { + WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/date', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/date` as const, }, diff --git a/src/SCREENS.ts b/src/SCREENS.ts index d02288833c4f..59a9a431008a 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -248,11 +248,13 @@ const SCREENS = { CREATE_DISTANCE_RATE: 'Create_Distance_Rate', DISTANCE_RATES_SETTINGS: 'Distance_Rates_Settings', DISTANCE_RATE_DETAILS: 'Distance_Rate_Details', - QUICKBOOKSONLINE_EXPORT: 'Workspace_Accounting_QuickbooksOnline_Export', - QUICKBOOKSONLINE_EXPORT_DATE: 'Workspace_Accounting_QuickbooksOnline_Export_Date', - QUICKBOOKSONLINE_EXPORT_INVOICES: 'Workspace_Accounting_QuickbooksOnline_Export_Invoices', - QUICKBOOKSONLINE_EXPORT_COMPANY_CARDS: 'Workspace_Accounting_QuickbooksOnline_Export_Company_Cards', - QUICKBOOKSONLINE_EXPORT_COMPANY_CARD: 'Workspace_Accounting_QuickbooksOnline_Export_Company_Card', + QUICKBOOKS_ONLINE_EXPORT: 'Workspace_Accounting_Quickbooks_Online_Export', + QUICKBOOKS_ONLINE_EXPORT_DATE: 'Workspace_Accounting_Quickbooks_Online_Export_Date', + QUICKBOOKS_ONLINE_EXPORT_INVOICES: 'Workspace_Accounting_Quickbooks_Online_Export_Invoices', + QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARDS: 'Workspace_Accounting_Quickbooks_Online_Export_Company_Cards', + QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD: 'Workspace_Accounting_Quickbooks_Online_Export_Company_Card', + QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER: 'Workspace_Accounting_Quickbooks_Online_Export_Preferred_Exporter', + QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_LIST: 'Workspace_Accounting_Quickbooks_Online_Export_Preferred_Exporter_List', DISTANCE_RATE_EDIT: 'Distance_Rate_Edit', }, diff --git a/src/languages/en.ts b/src/languages/en.ts index c4a5b75105c5..d68efc4e5e7a 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1842,6 +1842,8 @@ export default { creditCard: 'Credit Card', debitCard: 'Debit Card', vendorBill: 'Vendor Bill', + exportPreferredExporterNote: 'This can be any workspace admin, but must be a Domain Admin if you set different export accounts for individual company cards in Domain Settings.', + exportPreferredExporterSubNote: 'Once set, the preferred exporter will see reports for export in their account.', }, categories: { deleteCategories: 'Delete categories', diff --git a/src/languages/es.ts b/src/languages/es.ts index d1104f8c48c1..5d9d58c2f2b4 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1864,6 +1864,8 @@ export default { creditCard: 'Tarjeta de crédito', debitCard: 'Tarjeta de débito', vendorBill: 'Factura del proveedor', + exportPreferredExporterNote: 'Puede ser cualquier administrador del espacio de trabajo, pero debe ser un administrador de dominio si configura diferentes cuentas de exportación para tarjetas de empresa individuales en la configuración del dominio.', + exportPreferredExporterSubNote: 'Una vez configurado, el exportador preferido verá los informes para exportar en su cuenta.', }, type: { free: 'Gratis', diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index 8d9cef1eaaaa..0d4446b2a029 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -251,11 +251,13 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName').default as React.ComponentType, [SCREENS.WORKSPACE.TAXES_SETTINGS_FOREIGN_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsForeignCurrency').default as React.ComponentType, [SCREENS.WORKSPACE.TAXES_SETTINGS_WORKSPACE_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsWorkspaceCurrency').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportPage').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_DATE]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportDatePage').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_INVOICES]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportInvoicesPage').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_COMPANY_CARDS]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportCompanyCardsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_COMPANY_CARD]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportCompanyCardPage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportPage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportDatePage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICES]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportInvoicesPage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARDS]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportCompanyCardsPage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportCompanyCardPage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: () => require('../../../../pages/workspace/accounting/qbo/QuickBooksExportPreferredExporter').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_LIST]: () => require('../../../../pages/workspace/accounting/qbo/QuickBooksExportPreferredExporterList').default as React.ComponentType, [SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default as React.ComponentType, [SCREENS.GET_ASSISTANCE]: () => require('../../../../pages/GetAssistancePage').default as React.ComponentType, [SCREENS.SETTINGS.TWO_FACTOR_AUTH]: () => require('../../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').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 bf9b3b52c9c1..ba4a1cb7cb38 100755 --- a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts +++ b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts @@ -20,11 +20,13 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial> = { SCREENS.WORKSPACE.WORKFLOWS_PAYER, ], [SCREENS.WORKSPACE.ACCOUNTING]: [ - SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT, - SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_DATE, - SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_INVOICES, - SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_COMPANY_CARDS, - SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_COMPANY_CARD, + SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT, + SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE, + SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICES, + SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARDS, + SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD, + SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER, + SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_LIST, ], [SCREENS.WORKSPACE.TAXES]: [ SCREENS.WORKSPACE.TAXES_SETTINGS, diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index d2989bd45e5b..9e700d7f66ca 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -232,11 +232,13 @@ const config: LinkingOptions['config'] = { [SCREENS.WORKSPACE.CURRENCY]: { path: ROUTES.WORKSPACE_PROFILE_CURRENCY.route, }, - [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT.route}, - [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_DATE]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT_DATE.route}, - [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_INVOICES]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_INVOICES.route}, - [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_COMPANY_CARDS]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_COMPANY_CARDS.route}, - [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_COMPANY_CARD]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_COMPANY_CARD.route}, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT.route}, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE.route}, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICES]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICES.route}, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARDS]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARDS.route}, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD.route}, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.route}, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_LIST]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER_LIST.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 947a17575640..89ecb38b66e5 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -246,19 +246,25 @@ type SettingsNavigatorParamList = { [SCREENS.WORKSPACE.DISTANCE_RATES_SETTINGS]: { policyID: string; }; - [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT]: { + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT]: { policyID: string; }; - [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_DATE]: { + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE]: { policyID: string; }; - [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_INVOICES]: { + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICES]: { policyID: string; }; - [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_COMPANY_CARDS]: { + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARDS]: { policyID: string; }; - [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT_COMPANY_CARD]: { + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD]: { + policyID: string; + }; + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: { + policyID: string; + }; + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_LIST]: { policyID: string; }; [SCREENS.GET_ASSISTANCE]: { @@ -642,7 +648,7 @@ type WorkspacesCentralPaneNavigatorParamList = { [SCREENS.WORKSPACE.DISTANCE_RATES]: { policyID: string; }; - [SCREENS.WORKSPACE.QUICKBOOKSONLINE_EXPORT]: { + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT]: { policyID: string; }; }; diff --git a/src/pages/workspace/accounting/qbo/QuickBooksExportPreferredExporter.tsx b/src/pages/workspace/accounting/qbo/QuickBooksExportPreferredExporter.tsx new file mode 100644 index 000000000000..ffd593591fe2 --- /dev/null +++ b/src/pages/workspace/accounting/qbo/QuickBooksExportPreferredExporter.tsx @@ -0,0 +1,47 @@ +import React from 'react'; +import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; +import OfflineWithFeedback from '@components/OfflineWithFeedback'; +import ScreenWrapper from '@components/ScreenWrapper'; +import ScrollView from '@components/ScrollView'; +import Text from '@components/Text'; +import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; +import Navigation from '@navigation/Navigation'; +import withPolicy from '@pages/workspace/withPolicy'; +import type {WithPolicyProps} from '@pages/workspace/withPolicy'; +import ROUTES from '@src/ROUTES'; + +function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { + const {translate} = useLocalize(); + const styles = useThemeStyles(); + const policyID = policy?.id ?? ''; + const policyOwner = policy?.owner ?? ''; + const {exporter} = policy?.connections?.quickbooksOnline?.config?.export ?? {}; + + return ( + + + + {translate('workspace.qbo.exportPreferredExporterNote')} + {translate('workspace.qbo.exportPreferredExporterSubNote')} + + Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER_LIST.getRoute(policyID))} + brickRoadIndicator={undefined} + /> + + + + ); +} + +QuickBooksExportPreferredExporterPage.displayName = 'QuickBooksExportPreferredExporterPage'; + +export default withPolicy(QuickBooksExportPreferredExporterPage); diff --git a/src/pages/workspace/accounting/qbo/QuickBooksExportPreferredExporterList.tsx b/src/pages/workspace/accounting/qbo/QuickBooksExportPreferredExporterList.tsx new file mode 100644 index 000000000000..63f4efbe69c0 --- /dev/null +++ b/src/pages/workspace/accounting/qbo/QuickBooksExportPreferredExporterList.tsx @@ -0,0 +1,61 @@ +import React, {useCallback, useMemo} from 'react'; +import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import ScreenWrapper from '@components/ScreenWrapper'; +import ScrollView from '@components/ScrollView'; +import SelectionList from '@components/SelectionList'; +import RadioListItem from '@components/SelectionList/RadioListItem'; +import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; +import withPolicy from '@pages/workspace/withPolicy'; +import type {WithPolicyProps} from '@pages/workspace/withPolicy'; + +const draft = [ + {name: '+14153166423@expensify.sms', currency: 'USD', id: '94', email: '+14153166423@expensify.sms'}, + {name: 'Account Maintenance Fee', currency: 'USD', id: '141', email: 'alberto@expensify213.com'}, + {name: 'Admin Test', currency: 'USD', id: '119', email: 'admin@qbocard.com'}, + {name: 'Alberto Gonzalez-Cela', currency: 'USD', id: '104', email: 'alberto@expensify.com'}, + {name: 'Aldo test QBO2 QBO2 Last name', currency: 'USD', id: '140', email: 'admin@qbo.com'}, +]; + +function QuickBooksExportPreferredExporterListPage({policy}: WithPolicyProps) { + const {translate} = useLocalize(); + const styles = useThemeStyles(); + const {data, config} = policy?.connections?.quickbooksOnline ?? {}; + // const policyID = policy?.id ?? ''; + const sections = useMemo( + () => + (data?.vendors ?? draft)?.map((vendor) => ({ + value: vendor.email, + text: vendor.email, + keyForList: vendor.email, + isSelected: config?.export?.exporter === vendor.email, + })) ?? [], + [config?.export?.exporter, data?.vendors], + ); + + const updateMode = useCallback((mode: {value: string}) => { + // TODO add API call for change + }, []); + + return ( + + + + mode.isSelected)?.keyForList} + /> + + + ); +} + +QuickBooksExportPreferredExporterListPage.displayName = 'QuickBooksExportPreferredExporterListPage'; + +export default withPolicy(QuickBooksExportPreferredExporterListPage); diff --git a/src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardsPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardsPage.tsx index 318440ee570c..87c442629c4d 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardsPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardsPage.tsx @@ -30,7 +30,7 @@ function QuickbooksExportCompanyCardsPage({policy}: WithPolicyProps) { Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_COMPANY_CARD.getRoute(policyID))} + onPress={() => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD.getRoute(policyID))} brickRoadIndicator={undefined} /> diff --git a/src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx index b229c2b23467..eb95eb93b06a 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx @@ -19,41 +19,43 @@ function QuickbooksExportPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); const policyID = policy?.id ?? ''; + const policyOwner = policy?.owner ?? ''; + const {exporter} = policy?.connections?.quickbooksOnline?.config?.export ?? {}; const sections = [ { description: translate('workspace.qbo.preferredExporter'), - action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT.getRoute(policyID)), + action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.getRoute(policyID)), hasError: Boolean(policy?.errors?.enableNewCategories), - title: 'zany@cathyscroissants.com', + title: exporter ?? policyOwner, }, { description: translate('workspace.qbo.date'), - action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT_DATE.getRoute(policyID)), + action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE.getRoute(policyID)), hasError: Boolean(policy?.errors?.syncClasses), title: 'Date of last expense', }, { description: translate('workspace.qbo.exportExpenses'), - action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT.getRoute(policyID)), + action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT.getRoute(policyID)), hasError: Boolean(policy?.errors?.syncCustomers), title: 'Vendor bill', }, { description: translate('workspace.qbo.exportInvoices'), - action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_INVOICES.getRoute(policyID)), + action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICES.getRoute(policyID)), hasError: Boolean(policy?.errors?.syncLocations), title: 'Accounts Receivable (A/R)', }, { description: translate('workspace.qbo.exportCompany'), - action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_COMPANY_CARDS.getRoute(policyID)), + action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARDS.getRoute(policyID)), hasError: Boolean(policy?.errors?.syncTaxes), title: 'Debit card', }, { description: translate('workspace.qbo.exportExpensifyCard'), - action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKSONLINE_EXPORT.getRoute(policyID)), + action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT.getRoute(policyID)), hasError: Boolean(policy?.errors?.syncTaxes), title: 'Credit card', interactive: false, From 1c0d2f3b70c039cc4228f7218989f258097b677e Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Fri, 5 Apr 2024 16:59:25 +0300 Subject: [PATCH 07/39] prettier --- src/languages/es.ts | 3 ++- .../Navigation/AppNavigator/ModalStackNavigators/index.tsx | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index 5d9d58c2f2b4..c0a1cf5f0ced 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1864,7 +1864,8 @@ export default { creditCard: 'Tarjeta de crédito', debitCard: 'Tarjeta de débito', vendorBill: 'Factura del proveedor', - exportPreferredExporterNote: 'Puede ser cualquier administrador del espacio de trabajo, pero debe ser un administrador de dominio si configura diferentes cuentas de exportación para tarjetas de empresa individuales en la configuración del dominio.', + exportPreferredExporterNote: + 'Puede ser cualquier administrador del espacio de trabajo, pero debe ser un administrador de dominio si configura diferentes cuentas de exportación para tarjetas de empresa individuales en la configuración del dominio.', exportPreferredExporterSubNote: 'Una vez configurado, el exportador preferido verá los informes para exportar en su cuenta.', }, type: { diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index 0d4446b2a029..f34e9cfa642e 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -256,8 +256,10 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/workspace/accounting/qbo/QuickbooksExportInvoicesPage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARDS]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportCompanyCardsPage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportCompanyCardPage').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: () => require('../../../../pages/workspace/accounting/qbo/QuickBooksExportPreferredExporter').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_LIST]: () => require('../../../../pages/workspace/accounting/qbo/QuickBooksExportPreferredExporterList').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: () => + require('../../../../pages/workspace/accounting/qbo/QuickBooksExportPreferredExporter').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_LIST]: () => + require('../../../../pages/workspace/accounting/qbo/QuickBooksExportPreferredExporterList').default as React.ComponentType, [SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default as React.ComponentType, [SCREENS.GET_ASSISTANCE]: () => require('../../../../pages/GetAssistancePage').default as React.ComponentType, [SCREENS.SETTINGS.TWO_FACTOR_AUTH]: () => require('../../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').default as React.ComponentType, From 20814b7b59814f394773f4db1ac195542ed4dd5f Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Tue, 9 Apr 2024 10:17:31 +0300 Subject: [PATCH 08/39] icon button --- .../accounting/qbo/QuickbooksExportCompanyCardsPage.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardsPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardsPage.tsx index 87c442629c4d..3b7f61efef13 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardsPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardsPage.tsx @@ -32,6 +32,7 @@ function QuickbooksExportCompanyCardsPage({policy}: WithPolicyProps) { description={translate('workspace.qbo.exportAs')} onPress={() => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD.getRoute(policyID))} brickRoadIndicator={undefined} + shouldShowRightIcon /> From 05d28691529464ca89d95dd72492469a8c128f84 Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Tue, 9 Apr 2024 18:41:01 +0300 Subject: [PATCH 09/39] renaming pages + correct routes + initial Expenses config page --- src/ROUTES.ts | 36 ++++++------ src/SCREENS.ts | 11 ++-- src/languages/en.ts | 3 + src/languages/es.ts | 3 + .../ModalStackNavigators/index.tsx | 21 ++++--- .../FULL_SCREEN_TO_RHP_MAPPING.ts | 11 ++-- src/libs/Navigation/linkingConfig/config.ts | 13 +++-- src/libs/Navigation/types.ts | 13 +++-- ...ksCompanyCardExpenseAccountSelectPage.tsx} | 8 +-- ...ksCompanyCardExpenseConfigurationPage.tsx} | 10 ++-- ... => QuickbooksExportConfigurationPage.tsx} | 16 +++--- ...tsx => QuickbooksExportDateSelectPage.tsx} | 8 +-- ...=> QuickbooksInvoiceAccountSelectPage.tsx} | 8 +-- ...oksOutOfPocketExpenseConfigurationPage.tsx | 55 +++++++++++++++++++ ...oksPreferredExporterConfigurationPage.tsx} | 2 +- ...QuickbooksPreferredExporterSelectPage.tsx} | 0 16 files changed, 148 insertions(+), 70 deletions(-) rename src/pages/workspace/accounting/qbo/{QuickbooksExportCompanyCardPage.tsx => QuickbooksCompanyCardExpenseAccountSelectPage.tsx} (87%) rename src/pages/workspace/accounting/qbo/{QuickbooksExportCompanyCardsPage.tsx => QuickbooksCompanyCardExpenseConfigurationPage.tsx} (79%) rename src/pages/workspace/accounting/qbo/{QuickbooksExportPage.tsx => QuickbooksExportConfigurationPage.tsx} (89%) rename src/pages/workspace/accounting/qbo/{QuickbooksExportDatePage.tsx => QuickbooksExportDateSelectPage.tsx} (89%) rename src/pages/workspace/accounting/qbo/{QuickbooksExportInvoicesPage.tsx => QuickbooksInvoiceAccountSelectPage.tsx} (86%) create mode 100644 src/pages/workspace/accounting/qbo/QuickbooksOutOfPocketExpenseConfigurationPage.tsx rename src/pages/workspace/accounting/qbo/{QuickBooksExportPreferredExporter.tsx => QuickbooksPreferredExporterConfigurationPage.tsx} (96%) rename src/pages/workspace/accounting/qbo/{QuickBooksExportPreferredExporterList.tsx => QuickbooksPreferredExporterSelectPage.tsx} (100%) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index dd4d63b0de03..b19be3b0adf3 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -458,25 +458,33 @@ const ROUTES = { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARDS: { - route: 'settings/workspaces/:policyID/accounting/quickbooks-online/company-cards', - getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/company-cards` as const, + WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE: { + route: 'settings/workspaces/:policyID/accounting/quickbooks-online/company-card-expense', + getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/company-card-expense` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD: { - route: 'settings/workspaces/:policyID/accounting/quickbooks-online/company-card', - getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/company-card` as const, + WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT: { + route: 'settings/workspaces/:policyID/accounting/quickbooks-online/company-card-expense-account-select', + getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/company-card-expense-account-select` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICES: { - route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/invoices', - getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/invoices` as const, + WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT: { + route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/invoice-account-select', + getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/invoice-account-select` as const, }, WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/preferred-exporter', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/preferred-exporter` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER_LIST: { - route: 'settings/workspaces/:policyID/accounting/quickbooks-online/preferred-exporter-list', - getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/preferred-exporter-list` as const, + WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER_SELECT: { + route: 'settings/workspaces/:policyID/accounting/quickbooks-online/preferred-exporter/select', + getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/preferred-exporter/select` as const, + }, + WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES: { + route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/out-of-pocket-expense', + getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/out-of-pocket-expense` as const, + }, + WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT: { + route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/date-select', + getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/date-select` as const, }, WORKSPACE_PROFILE_NAME: { route: 'settings/workspaces/:policyID/profile/name', @@ -683,10 +691,6 @@ const ROUTES = { route: 'settings/workspaces/:policyID/distance-rates/:rateID/edit', getRoute: (policyID: string, rateID: string) => `settings/workspaces/${policyID}/distance-rates/${rateID}/edit` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE: { - route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/date', - getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/date` as const, - }, // Referral program promotion REFERRAL_DETAILS_MODAL: { route: 'referral/:contentType', diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 59a9a431008a..0d6694b301b9 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -249,12 +249,13 @@ const SCREENS = { DISTANCE_RATES_SETTINGS: 'Distance_Rates_Settings', DISTANCE_RATE_DETAILS: 'Distance_Rate_Details', QUICKBOOKS_ONLINE_EXPORT: 'Workspace_Accounting_Quickbooks_Online_Export', - QUICKBOOKS_ONLINE_EXPORT_DATE: 'Workspace_Accounting_Quickbooks_Online_Export_Date', - QUICKBOOKS_ONLINE_EXPORT_INVOICES: 'Workspace_Accounting_Quickbooks_Online_Export_Invoices', - QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARDS: 'Workspace_Accounting_Quickbooks_Online_Export_Company_Cards', - QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD: 'Workspace_Accounting_Quickbooks_Online_Export_Company_Card', + QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Date_Select', + QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Invoice_Account_Select', + QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD_EXPENSE: 'Workspace_Accounting_Quickbooks_Online_Export_Company_Card_Expense', + QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Company_Card_Expense_Select', QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER: 'Workspace_Accounting_Quickbooks_Online_Export_Preferred_Exporter', - QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_LIST: 'Workspace_Accounting_Quickbooks_Online_Export_Preferred_Exporter_List', + QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Preferred_Exporter_Select', + QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES: 'Workspace_Accounting_Quickbooks_Online_Export_Out_Of_Pocket_Expenses', DISTANCE_RATE_EDIT: 'Distance_Rate_Edit', }, diff --git a/src/languages/en.ts b/src/languages/en.ts index d68efc4e5e7a..0950a56e355b 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1844,6 +1844,9 @@ export default { vendorBill: 'Vendor Bill', exportPreferredExporterNote: 'This can be any workspace admin, but must be a Domain Admin if you set different export accounts for individual company cards in Domain Settings.', exportPreferredExporterSubNote: 'Once set, the preferred exporter will see reports for export in their account.', + exportOutOfPocketExpensesDescription: 'Set how out-of-pocket expenses export to QuickBooks Online.', + exportVendorBillDescription: + 'We’ll create a single itemized vendor bill for each Expensify report. If the period of the bill is closed, we’ll post to the 1st of the next open period. You can add the vendor bill to your A/P account of choice (below).', }, categories: { deleteCategories: 'Delete categories', diff --git a/src/languages/es.ts b/src/languages/es.ts index c0a1cf5f0ced..f98773c15fdf 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1867,6 +1867,9 @@ export default { exportPreferredExporterNote: 'Puede ser cualquier administrador del espacio de trabajo, pero debe ser un administrador de dominio si configura diferentes cuentas de exportación para tarjetas de empresa individuales en la configuración del dominio.', exportPreferredExporterSubNote: 'Una vez configurado, el exportador preferido verá los informes para exportar en su cuenta.', + exportOutOfPocketExpensesDescription: 'Establezca cómo se exportan los gastos de bolsillo a QuickBooks Online.', + exportVendorBillDescription: + 'Crearemos una única factura de proveedor detallada para cada informe de Expensify. Si el período de la factura está cerrado, lo publicaremos en el día 1 del próximo período abierto. Puede agregar la factura del proveedor a la cuenta A/P de su elección (a continuación).', }, type: { free: 'Gratis', diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index f34e9cfa642e..7229ff3b3a0b 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -251,15 +251,20 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName').default as React.ComponentType, [SCREENS.WORKSPACE.TAXES_SETTINGS_FOREIGN_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsForeignCurrency').default as React.ComponentType, [SCREENS.WORKSPACE.TAXES_SETTINGS_WORKSPACE_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsWorkspaceCurrency').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportPage').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportDatePage').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICES]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportInvoicesPage').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARDS]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportCompanyCardsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportCompanyCardPage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportConfigurationPage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportDateSelectPage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT]: () => + require('../../../../pages/workspace/accounting/qbo/QuickbooksInvoiceAccountSelectPage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES]: () => + require('../../../../pages/workspace/accounting/qbo/QuickbooksOutOfPocketExpenseConfigurationPage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD_EXPENSE]: () => + require('../../../../pages/workspace/accounting/qbo/QuickbooksCompanyCardExpenseConfigurationPage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT]: () => + require('../../../../pages/workspace/accounting/qbo/QuickbooksCompanyCardExpenseAccountSelectPage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: () => - require('../../../../pages/workspace/accounting/qbo/QuickBooksExportPreferredExporter').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_LIST]: () => - require('../../../../pages/workspace/accounting/qbo/QuickBooksExportPreferredExporterList').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/QuickbooksPreferredExporterConfigurationPage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_SELECT]: () => + require('../../../../pages/workspace/accounting/qbo/QuickbooksPreferredExporterSelectPage').default as React.ComponentType, [SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default as React.ComponentType, [SCREENS.GET_ASSISTANCE]: () => require('../../../../pages/GetAssistancePage').default as React.ComponentType, [SCREENS.SETTINGS.TWO_FACTOR_AUTH]: () => require('../../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').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 ba4a1cb7cb38..2cd1736bb003 100755 --- a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts +++ b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts @@ -21,12 +21,13 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial> = { ], [SCREENS.WORKSPACE.ACCOUNTING]: [ SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT, - SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE, - SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICES, - SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARDS, - SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD, + SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT, + SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT, + SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD_EXPENSE, + SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT, SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER, - SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_LIST, + SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_SELECT, + SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES, ], [SCREENS.WORKSPACE.TAXES]: [ SCREENS.WORKSPACE.TAXES_SETTINGS, diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index 9e700d7f66ca..966f1a065615 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -233,12 +233,15 @@ const config: LinkingOptions['config'] = { path: ROUTES.WORKSPACE_PROFILE_CURRENCY.route, }, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT.route}, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE.route}, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICES]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICES.route}, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARDS]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARDS.route}, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD.route}, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT.route}, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT.route}, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.route}, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD_EXPENSE]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE.route}, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT]: { + path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.route, + }, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.route}, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_LIST]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER_LIST.route}, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_SELECT]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER_SELECT.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 89ecb38b66e5..ebbd5f84867a 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -249,22 +249,25 @@ type SettingsNavigatorParamList = { [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT]: { policyID: string; }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE]: { + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT]: { policyID: string; }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICES]: { + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT]: { policyID: string; }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARDS]: { + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES]: { policyID: string; }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD]: { + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD_EXPENSE]: { + policyID: string; + }; + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT]: { policyID: string; }; [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: { policyID: string; }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_LIST]: { + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_SELECT]: { policyID: string; }; [SCREENS.GET_ASSISTANCE]: { diff --git a/src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksCompanyCardExpenseAccountSelectPage.tsx similarity index 87% rename from src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardPage.tsx rename to src/pages/workspace/accounting/qbo/QuickbooksCompanyCardExpenseAccountSelectPage.tsx index eabdbed2e661..6925dde83b8c 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksCompanyCardExpenseAccountSelectPage.tsx @@ -15,7 +15,7 @@ const CARDS = { VENDOR_BILL: 'vendor_bill', }; -function QuickbooksExportCompanyCardPage({policy}: WithPolicyProps) { +function QuickbooksCompanyCardExpenseAccountSelectPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); const {nonReimbursableExpensesExportDestination} = policy?.connections?.quickbooksOnline?.config ?? {}; @@ -49,7 +49,7 @@ function QuickbooksExportCompanyCardPage({policy}: WithPolicyProps) { @@ -64,6 +64,6 @@ function QuickbooksExportCompanyCardPage({policy}: WithPolicyProps) { ); } -QuickbooksExportCompanyCardPage.displayName = 'QuickbooksExportCompanyCardPage'; +QuickbooksCompanyCardExpenseAccountSelectPage.displayName = 'QuickbooksCompanyCardExpenseAccountSelectPage'; -export default withPolicy(QuickbooksExportCompanyCardPage); +export default withPolicy(QuickbooksCompanyCardExpenseAccountSelectPage); diff --git a/src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardsPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksCompanyCardExpenseConfigurationPage.tsx similarity index 79% rename from src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardsPage.tsx rename to src/pages/workspace/accounting/qbo/QuickbooksCompanyCardExpenseConfigurationPage.tsx index 3b7f61efef13..83b967d99ab0 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksExportCompanyCardsPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksCompanyCardExpenseConfigurationPage.tsx @@ -12,7 +12,7 @@ import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; import ROUTES from '@src/ROUTES'; -function QuickbooksExportCompanyCardsPage({policy}: WithPolicyProps) { +function QuickbooksCompanyCardExpenseConfigurationPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); const policyID = policy?.id ?? ''; @@ -21,7 +21,7 @@ function QuickbooksExportCompanyCardsPage({policy}: WithPolicyProps) { @@ -30,7 +30,7 @@ function QuickbooksExportCompanyCardsPage({policy}: WithPolicyProps) { Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD.getRoute(policyID))} + onPress={() => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.getRoute(policyID))} brickRoadIndicator={undefined} shouldShowRightIcon /> @@ -40,6 +40,6 @@ function QuickbooksExportCompanyCardsPage({policy}: WithPolicyProps) { ); } -QuickbooksExportCompanyCardsPage.displayName = 'QuickbooksExportCompanyCardsPage'; +QuickbooksCompanyCardExpenseConfigurationPage.displayName = 'QuickbooksCompanyCardExpenseConfigurationPage'; -export default withPolicy(QuickbooksExportCompanyCardsPage); +export default withPolicy(QuickbooksCompanyCardExpenseConfigurationPage); diff --git a/src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksExportConfigurationPage.tsx similarity index 89% rename from src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx rename to src/pages/workspace/accounting/qbo/QuickbooksExportConfigurationPage.tsx index eb95eb93b06a..3bf77f4f3500 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksExportPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksExportConfigurationPage.tsx @@ -15,7 +15,7 @@ import * as Link from '@userActions/Link'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; -function QuickbooksExportPage({policy}: WithPolicyProps) { +function QuickbooksExportConfigurationPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); const policyID = policy?.id ?? ''; @@ -31,25 +31,25 @@ function QuickbooksExportPage({policy}: WithPolicyProps) { }, { description: translate('workspace.qbo.date'), - action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE.getRoute(policyID)), + action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT.getRoute(policyID)), hasError: Boolean(policy?.errors?.syncClasses), title: 'Date of last expense', }, { description: translate('workspace.qbo.exportExpenses'), - action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT.getRoute(policyID)), + action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)), hasError: Boolean(policy?.errors?.syncCustomers), title: 'Vendor bill', }, { description: translate('workspace.qbo.exportInvoices'), - action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICES.getRoute(policyID)), + action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT.getRoute(policyID)), hasError: Boolean(policy?.errors?.syncLocations), title: 'Accounts Receivable (A/R)', }, { description: translate('workspace.qbo.exportCompany'), - action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARDS.getRoute(policyID)), + action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE.getRoute(policyID)), hasError: Boolean(policy?.errors?.syncTaxes), title: 'Debit card', }, @@ -66,7 +66,7 @@ function QuickbooksExportPage({policy}: WithPolicyProps) { @@ -101,6 +101,6 @@ function QuickbooksExportPage({policy}: WithPolicyProps) { ); } -QuickbooksExportPage.displayName = 'QuickbooksExportPage'; +QuickbooksExportConfigurationPage.displayName = 'QuickbooksExportConfigurationPage'; -export default withPolicy(QuickbooksExportPage); +export default withPolicy(QuickbooksExportConfigurationPage); diff --git a/src/pages/workspace/accounting/qbo/QuickbooksExportDatePage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksExportDateSelectPage.tsx similarity index 89% rename from src/pages/workspace/accounting/qbo/QuickbooksExportDatePage.tsx rename to src/pages/workspace/accounting/qbo/QuickbooksExportDateSelectPage.tsx index 93f26155fb77..3c0200ab116e 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksExportDatePage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksExportDateSelectPage.tsx @@ -12,7 +12,7 @@ import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; import CONST from '@src/CONST'; -function QuickbooksExportDatePage({policy}: WithPolicyProps) { +function QuickbooksExportDateSelectPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); // const policyID = policy?.id ?? ''; @@ -40,7 +40,7 @@ function QuickbooksExportDatePage({policy}: WithPolicyProps) { @@ -56,6 +56,6 @@ function QuickbooksExportDatePage({policy}: WithPolicyProps) { ); } -QuickbooksExportDatePage.displayName = 'QuickbooksExportDatePage'; +QuickbooksExportDateSelectPage.displayName = 'QuickbooksExportDateSelectPage'; -export default withPolicy(QuickbooksExportDatePage); +export default withPolicy(QuickbooksExportDateSelectPage); diff --git a/src/pages/workspace/accounting/qbo/QuickbooksExportInvoicesPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksInvoiceAccountSelectPage.tsx similarity index 86% rename from src/pages/workspace/accounting/qbo/QuickbooksExportInvoicesPage.tsx rename to src/pages/workspace/accounting/qbo/QuickbooksInvoiceAccountSelectPage.tsx index 2fd407faa8c1..430c59059676 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksExportInvoicesPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksInvoiceAccountSelectPage.tsx @@ -10,7 +10,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; -function QuickbooksExportInvoicesPage({policy}: WithPolicyProps) { +function QuickbooksInvoiceAccountSelectPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); // const policyID = policy?.id ?? ''; @@ -37,7 +37,7 @@ function QuickbooksExportInvoicesPage({policy}: WithPolicyProps) { @@ -53,6 +53,6 @@ function QuickbooksExportInvoicesPage({policy}: WithPolicyProps) { ); } -QuickbooksExportInvoicesPage.displayName = 'QuickbooksExportInvoicesPage'; +QuickbooksInvoiceAccountSelectPage.displayName = 'QuickbooksInvoiceAccountSelectPage'; -export default withPolicy(QuickbooksExportInvoicesPage); +export default withPolicy(QuickbooksInvoiceAccountSelectPage); diff --git a/src/pages/workspace/accounting/qbo/QuickbooksOutOfPocketExpenseConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksOutOfPocketExpenseConfigurationPage.tsx new file mode 100644 index 000000000000..4d585fe34d31 --- /dev/null +++ b/src/pages/workspace/accounting/qbo/QuickbooksOutOfPocketExpenseConfigurationPage.tsx @@ -0,0 +1,55 @@ +import React from 'react'; +import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; +import OfflineWithFeedback from '@components/OfflineWithFeedback'; +import ScreenWrapper from '@components/ScreenWrapper'; +import ScrollView from '@components/ScrollView'; +import Text from '@components/Text'; +import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; +import Navigation from '@navigation/Navigation'; +import withPolicy from '@pages/workspace/withPolicy'; +import type {WithPolicyProps} from '@pages/workspace/withPolicy'; +import ROUTES from '@src/ROUTES'; + +const isVendorBill = true; +function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyProps) { + const {translate} = useLocalize(); + const styles = useThemeStyles(); + const policyID = policy?.id ?? ''; + + return ( + + + + {translate('workspace.qbo.exportOutOfPocketExpensesDescription')} + + Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.getRoute(policyID))} + brickRoadIndicator={undefined} + shouldShowRightIcon + /> + + {isVendorBill && {translate('workspace.qbo.exportVendorBillDescription')}} + + Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.getRoute(policyID))} + brickRoadIndicator={undefined} + shouldShowRightIcon + /> + + + + ); +} + +QuickbooksOutOfPocketExpenseConfigurationPage.displayName = 'QuickbooksExportOutOfPocketExpensesPage'; + +export default withPolicy(QuickbooksOutOfPocketExpenseConfigurationPage); diff --git a/src/pages/workspace/accounting/qbo/QuickBooksExportPreferredExporter.tsx b/src/pages/workspace/accounting/qbo/QuickbooksPreferredExporterConfigurationPage.tsx similarity index 96% rename from src/pages/workspace/accounting/qbo/QuickBooksExportPreferredExporter.tsx rename to src/pages/workspace/accounting/qbo/QuickbooksPreferredExporterConfigurationPage.tsx index ffd593591fe2..6127a0626e74 100644 --- a/src/pages/workspace/accounting/qbo/QuickBooksExportPreferredExporter.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksPreferredExporterConfigurationPage.tsx @@ -33,7 +33,7 @@ function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER_LIST.getRoute(policyID))} + onPress={() => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER_SELECT.getRoute(policyID))} brickRoadIndicator={undefined} /> diff --git a/src/pages/workspace/accounting/qbo/QuickBooksExportPreferredExporterList.tsx b/src/pages/workspace/accounting/qbo/QuickbooksPreferredExporterSelectPage.tsx similarity index 100% rename from src/pages/workspace/accounting/qbo/QuickBooksExportPreferredExporterList.tsx rename to src/pages/workspace/accounting/qbo/QuickbooksPreferredExporterSelectPage.tsx From 6490db7d51e3c20c8fca860787e71744c1afa00e Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Wed, 10 Apr 2024 14:25:03 +0300 Subject: [PATCH 10/39] resolve conflicts --- .../WorkspaceSettingsModalStackNavigator.tsx | 5 ----- src/libs/Navigation/types.ts | 6 ------ src/pages/workspace/accounting/WorkspaceAccountingPage.tsx | 2 +- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/WorkspaceSettingsModalStackNavigator.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/WorkspaceSettingsModalStackNavigator.tsx index 3f572cdf542c..2dce4247c7ae 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/WorkspaceSettingsModalStackNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/WorkspaceSettingsModalStackNavigator.tsx @@ -82,11 +82,6 @@ function WorkspaceSettingsModalStackNavigator() { name={SCREENS.WORKSPACE.DISTANCE_RATES} getComponent={() => require('@pages/workspace/distanceRates/PolicyDistanceRatesPage').default as React.ComponentType} /> - require('@pages/workspace/distanceRates/PolicyDistanceRatesPage').default as React.ComponentType} - /> ); } diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index df2727b48cb2..f9d0875b1b73 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -668,18 +668,12 @@ type WorkspacesCentralPaneNavigatorParamList = { [SCREENS.WORKSPACE.TAXES]: { policyID: string; }; - [SCREENS.WORKSPACE.ACCOUNTING]: { - policyID: string; - }; [SCREENS.WORKSPACE.DISTANCE_RATES]: { policyID: string; }; [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT]: { policyID: string; }; - [SCREENS.WORKSPACE.ACCOUNTING]: { - policyID: string; - }; }; type FullScreenNavigatorParamList = { diff --git a/src/pages/workspace/accounting/WorkspaceAccountingPage.tsx b/src/pages/workspace/accounting/WorkspaceAccountingPage.tsx index 6fada466e2bb..775b70bf32eb 100644 --- a/src/pages/workspace/accounting/WorkspaceAccountingPage.tsx +++ b/src/pages/workspace/accounting/WorkspaceAccountingPage.tsx @@ -151,7 +151,7 @@ function WorkspaceAccountingPage({policy}: WithPolicyProps) { shouldShowRightIcon: true, title: translate('workspace.accounting.export'), wrapperStyle: [styles.sectionMenuItemTopDescription], - onPress: () => {}, + onPress: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT.getRoute(policyID)), }, { icon: Expensicons.Gear, From a1349fceb4c46f4837d3415c7fda7882f08fc1c7 Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Wed, 10 Apr 2024 14:33:25 +0300 Subject: [PATCH 11/39] resolve conflicts --- src/ROUTES.ts | 4 ---- src/languages/en.ts | 12 +++++------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 755f9a4e3597..91412066d6f7 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -590,10 +590,6 @@ const ROUTES = { route: 'settings/workspaces/:policyID/members', getRoute: (policyID: string) => `settings/workspaces/${policyID}/members` as const, }, - WORKSPACE_ACCOUNTING: { - route: 'settings/workspaces/:policyID/accounting', - getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting` as const, - }, WORKSPACE_CATEGORIES: { route: 'settings/workspaces/:policyID/categories', getRoute: (policyID: string) => `settings/workspaces/${policyID}/categories` as const, diff --git a/src/languages/en.ts b/src/languages/en.ts index 46da0550cf93..61627359e5cf 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1872,13 +1872,6 @@ export default { taxesDescription: 'Choose whether to import tax rates and tax defaults from your accounting integration.', locationsAdditionalDescription: 'Locations are imported as Tags. This limits exporting expense reports as Vendor Bills or Checks to QuickBooks Online. To unlock these export options, either disable Locations import or upgrade to the Control Plan to export Locations encoded as a Report Field.', - }, - type: { - free: 'Free', - control: 'Control', - collect: 'Collect', - }, - qbo: { export: 'Export', exportAs: 'Export as', exportDescription: 'Configure how data in Expensify gets exported to QuickBooks Online.', @@ -1908,6 +1901,11 @@ export default { exportVendorBillDescription: 'We’ll create a single itemized vendor bill for each Expensify report. If the period of the bill is closed, we’ll post to the 1st of the next open period. You can add the vendor bill to your A/P account of choice (below).', }, + type: { + free: 'Free', + control: 'Control', + collect: 'Collect', + }, categories: { deleteCategories: 'Delete categories', deleteCategoriesPrompt: 'Are you sure you want to delete these categories?', From 5e1f4324b352bd7adb2ae7de04423f768370f4b3 Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Wed, 10 Apr 2024 17:20:55 +0300 Subject: [PATCH 12/39] Out of pocket sub page --- src/ROUTES.ts | 4 + src/SCREENS.ts | 1 + src/languages/en.ts | 9 +++ src/languages/es.ts | 10 ++- .../ModalStackNavigators/index.tsx | 2 + .../FULL_SCREEN_TO_RHP_MAPPING.ts | 2 +- src/libs/Navigation/linkingConfig/config.ts | 3 + src/libs/Navigation/types.ts | 3 + ...oksOutOfPocketExpenseConfigurationPage.tsx | 33 ++++---- ...ooksOutOfPocketExpenseEntitySelectPage.tsx | 78 +++++++++++++++++++ 10 files changed, 130 insertions(+), 15 deletions(-) create mode 100644 src/pages/workspace/accounting/qbo/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 91412066d6f7..b11064a419b0 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -506,6 +506,10 @@ const ROUTES = { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/out-of-pocket-expense', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/out-of-pocket-expense` as const, }, + WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT: { + route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/out-of-pocket-expense/entity-select', + getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/out-of-pocket-expense/entity-select` as const, + }, WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/date-select', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/date-select` as const, diff --git a/src/SCREENS.ts b/src/SCREENS.ts index e2e9e2ed29aa..f1d4e63d2498 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -268,6 +268,7 @@ const SCREENS = { QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER: 'Workspace_Accounting_Quickbooks_Online_Export_Preferred_Exporter', QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Preferred_Exporter_Select', QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES: 'Workspace_Accounting_Quickbooks_Online_Export_Out_Of_Pocket_Expenses', + QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Out_Of_Pocket_Expenses_Select', DISTANCE_RATE_EDIT: 'Distance_Rate_Edit', }, diff --git a/src/languages/en.ts b/src/languages/en.ts index 61627359e5cf..f21fdd57c22e 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1900,6 +1900,15 @@ export default { exportOutOfPocketExpensesDescription: 'Set how out-of-pocket expenses export to QuickBooks Online.', exportVendorBillDescription: 'We’ll create a single itemized vendor bill for each Expensify report. If the period of the bill is closed, we’ll post to the 1st of the next open period. You can add the vendor bill to your A/P account of choice (below).', + check: 'Check', + journalEntry: 'Journal Entry', + optionBelow: 'Choose an option below:', + outOfPocketTaxEnabledDescription: + 'Note: QuickBooks Online doesn’t support a field for tax on Journal Entry exports. Because you have tax tracking enabled on your workspace, this export option is unavailable.', + outOfPocketTaxEnabledError: 'Journal entry is not available when taxes enabled. please select a different export option.', + outOfPocketLocationEnabledError: 'Vendor Bills are not available when locations are enabled. Please select a different export option.', + outOfPocketLocationEnabledDescription: + 'Note: QuickBooks Online does not support a field for Locations as Tags on Vendor Bills exports. As you import Locations from, this this export option is unavailable.', }, type: { free: 'Free', diff --git a/src/languages/es.ts b/src/languages/es.ts index 30a7da7b57c8..3d5f0be75fe4 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1928,7 +1928,15 @@ export default { exportOutOfPocketExpensesDescription: 'Establezca cómo se exportan los gastos de bolsillo a QuickBooks Online.', exportVendorBillDescription: 'Crearemos una única factura de proveedor detallada para cada informe de Expensify. Si el período de la factura está cerrado, lo publicaremos en el día 1 del próximo período abierto. Puede agregar la factura del proveedor a la cuenta A/P de su elección (a continuación).', - + check: 'Cheque', + journalEntry: 'Entrada de diario', + optionBelow: 'Elija una opción a continuación:', + outOfPocketTaxEnabledDescription: + 'Nota: QuickBooks Online no admite un campo para impuestos sobre las exportaciones de asientos de diario. Debido a que tiene habilitado el seguimiento de impuestos en su espacio de trabajo, esta opción de exportación no está disponible.', + outOfPocketTaxEnabledError: 'El asiento de diario no está disponible cuando los impuestos están habilitados. seleccione una opción de exportación diferente.', + outOfPocketLocationEnabledError: 'Las facturas de proveedores no están disponibles cuando las ubicaciones están habilitadas. Seleccione una opción de exportación diferente.', + outOfPocketLocationEnabledDescription: + 'Nota: QuickBooks Online no admite un campo para Ubicaciones como etiquetas en las exportaciones de facturas de proveedores. A medida que importa ubicaciones, esta opción de exportación no está disponible.', }, type: { free: 'Gratis', diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index bde9d89a058d..c2f180a820ad 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -259,6 +259,8 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/workspace/accounting/qbo/QuickbooksOutOfPocketExpenseConfigurationPage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT]: () => + require('../../../../pages/workspace/accounting/qbo/QuickbooksOutOfPocketExpenseEntitySelectPage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD_EXPENSE]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksCompanyCardExpenseConfigurationPage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT]: () => 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 5808d46f0cb0..795f16e5ea35 100755 --- a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts +++ b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts @@ -33,7 +33,7 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial> = { SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER, SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_SELECT, SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES, - + SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT, ], [SCREENS.WORKSPACE.TAXES]: [ SCREENS.WORKSPACE.TAXES_SETTINGS, diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index 72579852d492..0c94d3c1643c 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -273,6 +273,9 @@ const config: LinkingOptions['config'] = { [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT.route}, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT.route}, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.route}, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT]: { + path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT.route, + }, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD_EXPENSE]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE.route}, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT]: { path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.route, diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index f9d0875b1b73..9c003d0d0307 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -271,6 +271,9 @@ type SettingsNavigatorParamList = { [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES]: { policyID: string; }; + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT]: { + policyID: string; + }; [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD_EXPENSE]: { policyID: string; }; diff --git a/src/pages/workspace/accounting/qbo/QuickbooksOutOfPocketExpenseConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksOutOfPocketExpenseConfigurationPage.tsx index 4d585fe34d31..a5e02a7c8b42 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksOutOfPocketExpenseConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksOutOfPocketExpenseConfigurationPage.tsx @@ -10,6 +10,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@navigation/Navigation'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; +import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; const isVendorBill = true; @@ -17,6 +18,8 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyProps const {translate} = useLocalize(); const styles = useThemeStyles(); const policyID = policy?.id ?? ''; + const {syncLocations} = policy?.connections?.quickbooksOnline?.config ?? {}; + const isLocationEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); return ( - {translate('workspace.qbo.exportOutOfPocketExpensesDescription')} + {!isLocationEnabled && {translate('workspace.qbo.exportOutOfPocketExpensesDescription')}} Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.getRoute(policyID))} + onPress={() => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT.getRoute(policyID))} brickRoadIndicator={undefined} - shouldShowRightIcon - /> - - {isVendorBill && {translate('workspace.qbo.exportVendorBillDescription')}} - - Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.getRoute(policyID))} - brickRoadIndicator={undefined} - shouldShowRightIcon + shouldShowRightIcon={!isLocationEnabled} + interactive={!isLocationEnabled} /> + {isVendorBill && !isLocationEnabled && {translate('workspace.qbo.exportVendorBillDescription')}} + {isLocationEnabled && {translate('workspace.qbo.outOfPocketLocationEnabledDescription')}} + {!isLocationEnabled && ( + + Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.getRoute(policyID))} + brickRoadIndicator={undefined} + shouldShowRightIcon + /> + + )} ); diff --git a/src/pages/workspace/accounting/qbo/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx new file mode 100644 index 000000000000..7069fbc3ffe1 --- /dev/null +++ b/src/pages/workspace/accounting/qbo/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx @@ -0,0 +1,78 @@ +import React, {useCallback} from 'react'; +import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import ScreenWrapper from '@components/ScreenWrapper'; +import ScrollView from '@components/ScrollView'; +import SelectionList from '@components/SelectionList'; +import RadioListItem from '@components/SelectionList/RadioListItem'; +import Text from '@components/Text'; +import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; +import withPolicy from '@pages/workspace/withPolicy'; +import type {WithPolicyProps} from '@pages/workspace/withPolicy'; +import CONST from '@src/CONST'; + +const CARDS = { + CHECK: 'check', + JOURNAL_ENTRY: 'journal_entry', + VENDOR_BILL: 'vendor_bill', +}; + +function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyProps) { + const {translate} = useLocalize(); + const styles = useThemeStyles(); + const {nonReimbursableExpensesExportDestination, syncTaxes} = policy?.connections?.quickbooksOnline?.config ?? {}; + const isTaxesEnabled = Boolean(syncTaxes && syncTaxes !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); + + // const policyID = policy?.id ?? ''; + const data = [ + { + value: CARDS.CHECK, + text: translate(`workspace.qbo.check`), + keyForList: CARDS.CHECK, + isSelected: nonReimbursableExpensesExportDestination === CARDS.CHECK, + isShown: true, + }, + { + value: CARDS.JOURNAL_ENTRY, + text: translate(`workspace.qbo.journalEntry`), + keyForList: CARDS.JOURNAL_ENTRY, + isSelected: nonReimbursableExpensesExportDestination === CARDS.JOURNAL_ENTRY, + isShown: !isTaxesEnabled, + }, + { + value: CARDS.VENDOR_BILL, + text: translate(`workspace.qbo.vendorBill`), + keyForList: CARDS.VENDOR_BILL, + isSelected: nonReimbursableExpensesExportDestination === CARDS.VENDOR_BILL, + isShown: true, + }, + ]; + + const updateMode = useCallback((mode: {value: string}) => { + // TODO add API call for change + }, []); + + return ( + + + {translate('workspace.qbo.optionBelow')} + + item.isShown)}]} + ListItem={RadioListItem} + onSelectRow={updateMode} + initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} + /> + {translate('workspace.qbo.outOfPocketTaxEnabledDescription')} + + + ); +} + +QuickbooksOutOfPocketExpenseEntitySelectPage.displayName = 'QuickbooksOutOfPocketExpenseEntitySelectPage'; + +export default withPolicy(QuickbooksOutOfPocketExpenseEntitySelectPage); From d140a2a4d939cce101f43ed069aedf63607ffcd7 Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Thu, 11 Apr 2024 14:11:26 +0300 Subject: [PATCH 13/39] Re-work on Preferred exporter with new design --- src/ROUTES.ts | 4 -- src/SCREENS.ts | 1 - .../ModalStackNavigators/index.tsx | 2 - .../FULL_SCREEN_TO_RHP_MAPPING.ts | 1 - src/libs/Navigation/linkingConfig/config.ts | 1 - src/libs/Navigation/types.ts | 3 - ...ooksPreferredExporterConfigurationPage.tsx | 49 ++++++++++----- .../QuickbooksPreferredExporterSelectPage.tsx | 61 ------------------- 8 files changed, 33 insertions(+), 89 deletions(-) delete mode 100644 src/pages/workspace/accounting/qbo/QuickbooksPreferredExporterSelectPage.tsx diff --git a/src/ROUTES.ts b/src/ROUTES.ts index b11064a419b0..6e911472fe94 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -498,10 +498,6 @@ const ROUTES = { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/preferred-exporter', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/preferred-exporter` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER_SELECT: { - route: 'settings/workspaces/:policyID/accounting/quickbooks-online/preferred-exporter/select', - getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/preferred-exporter/select` as const, - }, WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/out-of-pocket-expense', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/out-of-pocket-expense` as const, diff --git a/src/SCREENS.ts b/src/SCREENS.ts index f1d4e63d2498..d507c0a9475d 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -266,7 +266,6 @@ const SCREENS = { QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD_EXPENSE: 'Workspace_Accounting_Quickbooks_Online_Export_Company_Card_Expense', QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Company_Card_Expense_Select', QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER: 'Workspace_Accounting_Quickbooks_Online_Export_Preferred_Exporter', - QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Preferred_Exporter_Select', QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES: 'Workspace_Accounting_Quickbooks_Online_Export_Out_Of_Pocket_Expenses', QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Out_Of_Pocket_Expenses_Select', DISTANCE_RATE_EDIT: 'Distance_Rate_Edit', diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index c2f180a820ad..869d234ff584 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -267,8 +267,6 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/workspace/accounting/qbo/QuickbooksPreferredExporterConfigurationPage').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/QuickbooksPreferredExporterSelectPage').default as React.ComponentType, [SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default as React.ComponentType, [SCREENS.GET_ASSISTANCE]: () => require('../../../../pages/GetAssistancePage').default as React.ComponentType, [SCREENS.SETTINGS.TWO_FACTOR_AUTH]: () => require('../../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').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 795f16e5ea35..787b401d05d3 100755 --- a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts +++ b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts @@ -31,7 +31,6 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial> = { SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD_EXPENSE, SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT, SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER, - SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_SELECT, SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES, SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT, ], diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index 0c94d3c1643c..c1a0c8158c83 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -281,7 +281,6 @@ const config: LinkingOptions['config'] = { path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.route, }, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.route}, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_SELECT]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER_SELECT.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 9c003d0d0307..4aad74491f8f 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -283,9 +283,6 @@ type SettingsNavigatorParamList = { [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: { policyID: string; }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER_SELECT]: { - policyID: string; - }; [SCREENS.GET_ASSISTANCE]: { backTo: Routes; }; diff --git a/src/pages/workspace/accounting/qbo/QuickbooksPreferredExporterConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksPreferredExporterConfigurationPage.tsx index 6127a0626e74..23d8a8994ba9 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksPreferredExporterConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksPreferredExporterConfigurationPage.tsx @@ -1,23 +1,42 @@ -import React from 'react'; +import React, {useCallback, useMemo} from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; -import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; -import OfflineWithFeedback from '@components/OfflineWithFeedback'; import ScreenWrapper from '@components/ScreenWrapper'; import ScrollView from '@components/ScrollView'; +import SelectionList from '@components/SelectionList'; +import RadioListItem from '@components/SelectionList/RadioListItem'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; -import Navigation from '@navigation/Navigation'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; -import ROUTES from '@src/ROUTES'; + +const draft = [ + {name: '+14153166423@expensify.sms', currency: 'USD', id: '94', email: '+14153166423@expensify.sms'}, + {name: 'Account Maintenance Fee', currency: 'USD', id: '141', email: 'alberto@expensify213.com'}, + {name: 'Admin Test', currency: 'USD', id: '119', email: 'admin@qbocard.com'}, + {name: 'Alberto Gonzalez-Cela', currency: 'USD', id: '104', email: 'alberto@expensify.com'}, + {name: 'Aldo test QBO2 QBO2 Last name', currency: 'USD', id: '140', email: 'admin@qbo.com'}, +]; function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); - const policyID = policy?.id ?? ''; - const policyOwner = policy?.owner ?? ''; - const {exporter} = policy?.connections?.quickbooksOnline?.config?.export ?? {}; + const {data, config} = policy?.connections?.quickbooksOnline ?? {}; + // const policyID = policy?.id ?? ''; + const sections = useMemo( + () => + (data?.vendors ?? draft)?.map((vendor) => ({ + value: vendor.email, + text: vendor.email, + keyForList: vendor.email, + isSelected: config?.export?.exporter === vendor.email, + })) ?? [], + [config?.export?.exporter, data?.vendors], + ); + + const updateMode = useCallback((mode: {value: string}) => { + // TODO add API call for change + }, []); return ( {translate('workspace.qbo.exportPreferredExporterNote')} {translate('workspace.qbo.exportPreferredExporterSubNote')} - - Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER_SELECT.getRoute(policyID))} - brickRoadIndicator={undefined} - /> - + mode.isSelected)?.keyForList} + /> ); diff --git a/src/pages/workspace/accounting/qbo/QuickbooksPreferredExporterSelectPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksPreferredExporterSelectPage.tsx deleted file mode 100644 index 63f4efbe69c0..000000000000 --- a/src/pages/workspace/accounting/qbo/QuickbooksPreferredExporterSelectPage.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import React, {useCallback, useMemo} from 'react'; -import HeaderWithBackButton from '@components/HeaderWithBackButton'; -import ScreenWrapper from '@components/ScreenWrapper'; -import ScrollView from '@components/ScrollView'; -import SelectionList from '@components/SelectionList'; -import RadioListItem from '@components/SelectionList/RadioListItem'; -import useLocalize from '@hooks/useLocalize'; -import useThemeStyles from '@hooks/useThemeStyles'; -import withPolicy from '@pages/workspace/withPolicy'; -import type {WithPolicyProps} from '@pages/workspace/withPolicy'; - -const draft = [ - {name: '+14153166423@expensify.sms', currency: 'USD', id: '94', email: '+14153166423@expensify.sms'}, - {name: 'Account Maintenance Fee', currency: 'USD', id: '141', email: 'alberto@expensify213.com'}, - {name: 'Admin Test', currency: 'USD', id: '119', email: 'admin@qbocard.com'}, - {name: 'Alberto Gonzalez-Cela', currency: 'USD', id: '104', email: 'alberto@expensify.com'}, - {name: 'Aldo test QBO2 QBO2 Last name', currency: 'USD', id: '140', email: 'admin@qbo.com'}, -]; - -function QuickBooksExportPreferredExporterListPage({policy}: WithPolicyProps) { - const {translate} = useLocalize(); - const styles = useThemeStyles(); - const {data, config} = policy?.connections?.quickbooksOnline ?? {}; - // const policyID = policy?.id ?? ''; - const sections = useMemo( - () => - (data?.vendors ?? draft)?.map((vendor) => ({ - value: vendor.email, - text: vendor.email, - keyForList: vendor.email, - isSelected: config?.export?.exporter === vendor.email, - })) ?? [], - [config?.export?.exporter, data?.vendors], - ); - - const updateMode = useCallback((mode: {value: string}) => { - // TODO add API call for change - }, []); - - return ( - - - - mode.isSelected)?.keyForList} - /> - - - ); -} - -QuickBooksExportPreferredExporterListPage.displayName = 'QuickBooksExportPreferredExporterListPage'; - -export default withPolicy(QuickBooksExportPreferredExporterListPage); From a397b7016e6a9456a749f4c2dee518d9a2b45b05 Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Mon, 15 Apr 2024 17:20:24 +0300 Subject: [PATCH 14/39] Design updates + updates for translations + updates for onyx api keys usage --- src/languages/en.ts | 18 ++++----- src/languages/es.ts | 40 +++++++++---------- .../ModalStackNavigators/index.tsx | 16 ++++---- src/libs/PolicyUtils.ts | 6 +++ ...oksCompanyCardExpenseAccountSelectPage.tsx | 35 +++++----------- ...oksCompanyCardExpenseConfigurationPage.tsx | 0 .../QuickbooksExportConfigurationPage.tsx | 0 .../QuickbooksExportDateSelectPage.tsx | 0 .../QuickbooksInvoiceAccountSelectPage.tsx | 25 +++++------- ...oksOutOfPocketExpenseConfigurationPage.tsx | 4 +- ...ooksOutOfPocketExpenseEntitySelectPage.tsx | 2 +- ...ooksPreferredExporterConfigurationPage.tsx | 15 +++---- src/types/onyx/Policy.ts | 2 +- src/types/onyx/PolicyMember.ts | 4 +- tests/utils/collections/policyMembers.ts | 4 +- 15 files changed, 77 insertions(+), 94 deletions(-) rename src/pages/workspace/accounting/qbo/{ => export}/QuickbooksCompanyCardExpenseAccountSelectPage.tsx (64%) rename src/pages/workspace/accounting/qbo/{ => export}/QuickbooksCompanyCardExpenseConfigurationPage.tsx (100%) rename src/pages/workspace/accounting/qbo/{ => export}/QuickbooksExportConfigurationPage.tsx (100%) rename src/pages/workspace/accounting/qbo/{ => export}/QuickbooksExportDateSelectPage.tsx (100%) rename src/pages/workspace/accounting/qbo/{ => export}/QuickbooksInvoiceAccountSelectPage.tsx (83%) rename src/pages/workspace/accounting/qbo/{ => export}/QuickbooksOutOfPocketExpenseConfigurationPage.tsx (93%) rename src/pages/workspace/accounting/qbo/{ => export}/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx (95%) rename src/pages/workspace/accounting/qbo/{ => export}/QuickbooksPreferredExporterConfigurationPage.tsx (78%) diff --git a/src/languages/en.ts b/src/languages/en.ts index f21fdd57c22e..32d301aed491 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1881,15 +1881,15 @@ export default { exportInvoices: 'Export invoices to', exportCompany: 'Export company cards as', exportExpensifyCard: 'Export Expensify Card transactions as', - deepDiveExpensifyCard: 'Expensify Card transactions automatically export to a “Expensify Card Liability Account” created with', + deepDiveExpensifyCard: 'Expensify Card transactions automatically export to a "Expensify Card Liability Account" created with', deepDiveExpensifyCardIntegration: 'our integration.', - exportDate: 'Export Date', + exportDate: 'Export date', exportDateDescription: 'Use this date when exporting reports to QuickBooks Online.', lastExpense: {label: 'Date of last expense', description: 'The date of the most recent expense on the report'}, - exportedDate: {label: 'Export date', description: 'The date the report was exported to QuickBooksOnline'}, - submittedData: {label: 'Submitted data', description: 'The date the report was submitted for approval'}, - receivable: 'Accounts receivable', - archive: 'Accounts receivable archive', + exportedDate: {label: 'Export date', description: 'The date the report was exported to QuickBooks Online'}, + submittedData: {label: 'Submitted date', description: 'The date the report was submitted for approval'}, + receivable: 'Accounts receivable', // This is an account name that will come directly from QBO, so I don't know why we need a translation for it. It should take whatever the name of the account is in QBO. Leaving this note for CS. + archive: 'Accounts receivable archive', // This is an account name that will come directly from QBO, so I don't know why we need a translation for it. It should take whatever the name of the account is in QBO. Leaving this note for CS. exportInvoicesDescription: 'Invoices will be exported to this account in QuickBooks Online.', exportCompanyCardsDescription: 'Set how company card purchases export to QuickBooks Online.', creditCard: 'Credit Card', @@ -1899,16 +1899,16 @@ export default { exportPreferredExporterSubNote: 'Once set, the preferred exporter will see reports for export in their account.', exportOutOfPocketExpensesDescription: 'Set how out-of-pocket expenses export to QuickBooks Online.', exportVendorBillDescription: - 'We’ll create a single itemized vendor bill for each Expensify report. If the period of the bill is closed, we’ll post to the 1st of the next open period. You can add the vendor bill to your A/P account of choice (below).', + 'We`ll create a single itemized vendor bill for each Expensify report. If the period of the bill is closed, we`ll post to the 1st of the next open period. You can add the vendor bill to your A/P account of choice (below).', check: 'Check', journalEntry: 'Journal Entry', optionBelow: 'Choose an option below:', outOfPocketTaxEnabledDescription: - 'Note: QuickBooks Online doesn’t support a field for tax on Journal Entry exports. Because you have tax tracking enabled on your workspace, this export option is unavailable.', + 'Note: QuickBooks Online doesn`t support a field for tax on Journal Entry exports. Because you have tax tracking enabled on your workspace, this export option is unavailable.', outOfPocketTaxEnabledError: 'Journal entry is not available when taxes enabled. please select a different export option.', outOfPocketLocationEnabledError: 'Vendor Bills are not available when locations are enabled. Please select a different export option.', outOfPocketLocationEnabledDescription: - 'Note: QuickBooks Online does not support a field for Locations as Tags on Vendor Bills exports. As you import Locations from, this this export option is unavailable.', + 'Note: QuickBooks Online does not support a field for Locations as Tags on Vendor Bills exports. As you import Locations as Tags, this export option is unavailable.', }, type: { free: 'Free', diff --git a/src/languages/es.ts b/src/languages/es.ts index 3d5f0be75fe4..b7760e856aa3 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1901,42 +1901,42 @@ export default { 'Los lugares son importados como Etiquegas. Esto limita a exportar los informes de gastos como Factura del Proveedor o Cheques a Quicbooks Online. Para desbloquear estas opciones de exportación desactiva la importación de Lugares o cambia al Plan Control para exportar Lugares como Campos de Informes.', export: 'Exportar', exportAs: 'Exportar cómo', - exportDescription: 'Configure cómo se exportan los datos de Expensify a QuickBooks Online.', - preferredExporter: 'Exportador preferido', - date: 'Fecha', exportExpenses: 'Exportar gastos de bolsillo como', exportInvoices: 'Exportar facturas a', exportCompany: 'Exportar tarjetas de empresa como', - exportExpensifyCard: 'Exportar transacciones de la tarjeta Expensify como', + exportDescription: 'Configura cómo se exportan los datos de Expensify a QuickBooks Online.', + preferredExporter: 'Exportador preferido', + date: 'Fecha', deepDiveExpensifyCard: 'Las transacciones de la Tarjeta Expensify se exportan automáticamente a una "Cuenta de Responsabilidad de la Tarjeta Expensify" creada con', deepDiveExpensifyCardIntegration: 'nuestra integración.', + exportExpensifyCard: 'Exportar las transacciones de las tarjetas Expensify como', exportDate: 'Fecha de exportación', - exportDateDescription: 'Utilice esta fecha al exportar informes a QuickBooks Online.', - lastExpense: {label: 'Fecha del último gasto', description: 'La fecha del gasto más reciente en el informe.'}, - exportedDate: {label: 'Fecha de exportación', description: 'La fecha en que se exportó el informe a QuickBooks Online'}, - submittedData: {label: 'Datos enviados', description: 'La fecha en que se presentó el informe para su aprobación.'}, - receivable: 'Cuentas por cobrar', - archive: 'Archivo de cuentas por cobrar', + exportDateDescription: 'Use this date when exporting reports to QuickBooks Online.', + lastExpense: {label: 'Date of last expense', description: 'The date of the most recent expense on the report'}, + exportedDate: {label: 'Fecha de exportación', description: 'Fecha de exportación del informe a QuickBooks Online'}, + submittedData: {label: 'Fecha de envío', description: 'Fecha en la que el informe se envió para su aprobación'}, + receivable: 'Cuentas por cobrar', // This is an account name that will come directly from QBO, so I don't know why we need a translation for it. It should take whatever the name of the account is in QBO. Leaving this note for CS. + archive: 'Archivo de cuentas por cobrar', // This is an account name that will come directly from QBO, so I don't know why we need a translation for it. It should take whatever the name of the account is in QBO. Leaving this note for CS. exportInvoicesDescription: 'Las facturas se exportarán a esta cuenta en QuickBooks Online.', - exportCompanyCardsDescription: 'Establezca cómo se exportan las compras con tarjeta de empresa a QuickBooks Online.', - creditCard: 'Tarjeta de crédito', + exportCompanyCardsDescription: 'Establece cómo se exportan las compras con tarjeta de empresa a QuickBooks Online.', debitCard: 'Tarjeta de débito', + check: 'Cheque', + optionBelow: 'Elija una opción a continuación:', + creditCard: 'Tarjeta de crédito', vendorBill: 'Factura del proveedor', exportPreferredExporterNote: 'Puede ser cualquier administrador del espacio de trabajo, pero debe ser un administrador de dominio si configura diferentes cuentas de exportación para tarjetas de empresa individuales en la configuración del dominio.', exportPreferredExporterSubNote: 'Una vez configurado, el exportador preferido verá los informes para exportar en su cuenta.', + journalEntry: 'Anotación en el diario', // I have no idea what this means in english, sounds ok as a literal tranlsation exportOutOfPocketExpensesDescription: 'Establezca cómo se exportan los gastos de bolsillo a QuickBooks Online.', exportVendorBillDescription: - 'Crearemos una única factura de proveedor detallada para cada informe de Expensify. Si el período de la factura está cerrado, lo publicaremos en el día 1 del próximo período abierto. Puede agregar la factura del proveedor a la cuenta A/P de su elección (a continuación).', - check: 'Cheque', - journalEntry: 'Entrada de diario', - optionBelow: 'Elija una opción a continuación:', + 'Crearemos una única factura de proveedor detallada para cada informe de Expensify. Si el período de la factura está cerrado, lo publicaremos en el día 1 del siguiente período abierto. Puede agregar la factura del proveedor a la cuenta A/P de su elección (a continuación).', outOfPocketTaxEnabledDescription: - 'Nota: QuickBooks Online no admite un campo para impuestos sobre las exportaciones de asientos de diario. Debido a que tiene habilitado el seguimiento de impuestos en su espacio de trabajo, esta opción de exportación no está disponible.', - outOfPocketTaxEnabledError: 'El asiento de diario no está disponible cuando los impuestos están habilitados. seleccione una opción de exportación diferente.', - outOfPocketLocationEnabledError: 'Las facturas de proveedores no están disponibles cuando las ubicaciones están habilitadas. Seleccione una opción de exportación diferente.', + 'Nota: QuickBooks Online no admite un campo para impuestos en las exportaciones de Anotación en el diario. Debido a que tienes habilitado el seguimiento de impuestos en tu área de trabajo, esta opción de exportación no está disponible.', + outOfPocketTaxEnabledError: 'La Anotacion en el diario no está disponible cuando los impuestos están activados. Por favor, selecciona una opción de exportación diferente.', + outOfPocketLocationEnabledError: 'Las facturas de proveedores no están disponibles cuando las ubicaciones están activadas. Seleccione otra opción de exportación.', outOfPocketLocationEnabledDescription: - 'Nota: QuickBooks Online no admite un campo para Ubicaciones como etiquetas en las exportaciones de facturas de proveedores. A medida que importa ubicaciones, esta opción de exportación no está disponible.', + 'Nota: QuickBooks Online no admite un campo para Ubicaciones como Etiquetas en las exportaciones de Facturas de Proveedor. Al importar Ubicaciones como Etiquetas, esta opción de exportación no está disponible.', }, type: { free: 'Gratis', diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index 869d234ff584..6b114cb58633 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -253,20 +253,20 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName').default as React.ComponentType, [SCREENS.WORKSPACE.TAXES_SETTINGS_FOREIGN_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsForeignCurrency').default as React.ComponentType, [SCREENS.WORKSPACE.TAXES_SETTINGS_WORKSPACE_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsWorkspaceCurrency').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportConfigurationPage').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksExportDateSelectPage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT]: () => require('@pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT]: () => require('@pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/QuickbooksInvoiceAccountSelectPage').default as React.ComponentType, + require('@pages/workspace/accounting/qbo/export/QuickbooksInvoiceAccountSelectPage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES]: () => - require('../../../../pages/workspace/accounting/qbo/QuickbooksOutOfPocketExpenseConfigurationPage').default as React.ComponentType, + require('@pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/QuickbooksOutOfPocketExpenseEntitySelectPage').default as React.ComponentType, + require('@pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD_EXPENSE]: () => - require('../../../../pages/workspace/accounting/qbo/QuickbooksCompanyCardExpenseConfigurationPage').default as React.ComponentType, + require('@pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseConfigurationPage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/QuickbooksCompanyCardExpenseAccountSelectPage').default as React.ComponentType, + require('@pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: () => - require('../../../../pages/workspace/accounting/qbo/QuickbooksPreferredExporterConfigurationPage').default as React.ComponentType, + require('@pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage').default as React.ComponentType, [SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default as React.ComponentType, [SCREENS.GET_ASSISTANCE]: () => require('../../../../pages/GetAssistancePage').default as React.ComponentType, [SCREENS.SETTINGS.TWO_FACTOR_AUTH]: () => require('../../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').default as React.ComponentType, diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index 665830ca7167..77b297cdd5e5 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -6,6 +6,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {PersonalDetailsList, Policy, PolicyCategories, PolicyMembers, PolicyTagList, PolicyTags, TaxRate} from '@src/types/onyx'; import type {PolicyFeatureName, Rate} from '@src/types/onyx/Policy'; +import PolicyMember from '@src/types/onyx/PolicyMember'; import type {EmptyObject} from '@src/types/utils/EmptyObject'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import getPolicyIDFromState from './Navigation/getPolicyIDFromState'; @@ -317,6 +318,10 @@ function getPolicyIDFromNavigationState() { return getPolicyIDFromState(navigationRef.getRootState() as State); } +function getAdminEmailList(policy: Policy | null) { + return policy?.employeeList?.filter((employee: PolicyMember) => employee?.role === CONST.POLICY.ROLE.ADMIN).map((admin) => admin.email); +} + export { getActivePolicies, hasAccountingConnections, @@ -355,6 +360,7 @@ export { getTaxByID, hasPolicyCategoriesError, getPolicyIDFromNavigationState, + getAdminEmailList, }; export type {MemberEmailsToAccountIDs}; diff --git a/src/pages/workspace/accounting/qbo/QuickbooksCompanyCardExpenseAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx similarity index 64% rename from src/pages/workspace/accounting/qbo/QuickbooksCompanyCardExpenseAccountSelectPage.tsx rename to src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx index 6925dde83b8c..b7183c1d4224 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksCompanyCardExpenseAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx @@ -9,37 +9,20 @@ import useThemeStyles from '@hooks/useThemeStyles'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; -const CARDS = { - CREDIT_CARD: 'credit_card', - DEBIT_CARD: 'debit_card', - VENDOR_BILL: 'vendor_bill', -}; +const selected = 'selected'; function QuickbooksCompanyCardExpenseAccountSelectPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); - const {nonReimbursableExpensesExportDestination} = policy?.connections?.quickbooksOnline?.config ?? {}; + const {creditCards} = policy?.connections?.quickbooksOnline?.data ?? {}; // const policyID = policy?.id ?? ''; - const data = [ - { - value: CARDS.CREDIT_CARD, - text: translate(`workspace.qbo.creditCard`), - keyForList: CARDS.CREDIT_CARD, - isSelected: nonReimbursableExpensesExportDestination === CARDS.CREDIT_CARD, - }, - { - value: CARDS.DEBIT_CARD, - text: translate(`workspace.qbo.debitCard`), - keyForList: CARDS.DEBIT_CARD, - isSelected: nonReimbursableExpensesExportDestination === CARDS.DEBIT_CARD, - }, - { - value: CARDS.VENDOR_BILL, - text: translate(`workspace.qbo.vendorBill`), - keyForList: CARDS.VENDOR_BILL, - isSelected: nonReimbursableExpensesExportDestination === CARDS.VENDOR_BILL, - }, - ]; + const data = + creditCards?.map((card) => ({ + value: card.name, + text: card.name, + keyForList: card.name, + isSelected: card.name === selected, + })) || []; const updateMode = useCallback((mode: {value: string}) => { // TODO add API call for change diff --git a/src/pages/workspace/accounting/qbo/QuickbooksCompanyCardExpenseConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseConfigurationPage.tsx similarity index 100% rename from src/pages/workspace/accounting/qbo/QuickbooksCompanyCardExpenseConfigurationPage.tsx rename to src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseConfigurationPage.tsx diff --git a/src/pages/workspace/accounting/qbo/QuickbooksExportConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx similarity index 100% rename from src/pages/workspace/accounting/qbo/QuickbooksExportConfigurationPage.tsx rename to src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx diff --git a/src/pages/workspace/accounting/qbo/QuickbooksExportDateSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx similarity index 100% rename from src/pages/workspace/accounting/qbo/QuickbooksExportDateSelectPage.tsx rename to src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx diff --git a/src/pages/workspace/accounting/qbo/QuickbooksInvoiceAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksInvoiceAccountSelectPage.tsx similarity index 83% rename from src/pages/workspace/accounting/qbo/QuickbooksInvoiceAccountSelectPage.tsx rename to src/pages/workspace/accounting/qbo/export/QuickbooksInvoiceAccountSelectPage.tsx index 430c59059676..a2f7c57cbb89 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksInvoiceAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksInvoiceAccountSelectPage.tsx @@ -10,24 +10,21 @@ import useThemeStyles from '@hooks/useThemeStyles'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; +const selected = 'selected'; + function QuickbooksInvoiceAccountSelectPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); + const {accountsReceivable} = policy?.connections?.quickbooksOnline?.data ?? {}; + // const policyID = policy?.id ?? ''; - const data = [ - { - value: 'receivable', - text: translate(`workspace.qbo.receivable`), - keyForList: 'receivable', - isSelected: false, - }, - { - value: 'archive', - text: translate(`workspace.qbo.archive`), - keyForList: 'archive', - isSelected: false, - }, - ]; + const data = + accountsReceivable?.map((account) => ({ + value: account.name, + text: account.name, + keyForList: account.name, + isSelected: account.name === selected, + })) || []; const updateMode = useCallback((mode: {value: string}) => { // TODO add API call for change diff --git a/src/pages/workspace/accounting/qbo/QuickbooksOutOfPocketExpenseConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx similarity index 93% rename from src/pages/workspace/accounting/qbo/QuickbooksOutOfPocketExpenseConfigurationPage.tsx rename to src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx index a5e02a7c8b42..fcacb068b8e5 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksOutOfPocketExpenseConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx @@ -40,8 +40,8 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyProps interactive={!isLocationEnabled} /> - {isVendorBill && !isLocationEnabled && {translate('workspace.qbo.exportVendorBillDescription')}} - {isLocationEnabled && {translate('workspace.qbo.outOfPocketLocationEnabledDescription')}} + {isVendorBill && !isLocationEnabled && {translate('workspace.qbo.exportVendorBillDescription')}} + {isLocationEnabled && {translate('workspace.qbo.outOfPocketLocationEnabledDescription')}} {!isLocationEnabled && ( mode.isSelected)?.keyForList} /> - {translate('workspace.qbo.outOfPocketTaxEnabledDescription')} + {translate('workspace.qbo.outOfPocketTaxEnabledDescription')} ); diff --git a/src/pages/workspace/accounting/qbo/QuickbooksPreferredExporterConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx similarity index 78% rename from src/pages/workspace/accounting/qbo/QuickbooksPreferredExporterConfigurationPage.tsx rename to src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx index 23d8a8994ba9..bd47b4ab0dc3 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksPreferredExporterConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx @@ -7,25 +7,20 @@ import RadioListItem from '@components/SelectionList/RadioListItem'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import {getAdminEmailList} from '@libs/PolicyUtils'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; -const draft = [ - {name: '+14153166423@expensify.sms', currency: 'USD', id: '94', email: '+14153166423@expensify.sms'}, - {name: 'Account Maintenance Fee', currency: 'USD', id: '141', email: 'alberto@expensify213.com'}, - {name: 'Admin Test', currency: 'USD', id: '119', email: 'admin@qbocard.com'}, - {name: 'Alberto Gonzalez-Cela', currency: 'USD', id: '104', email: 'alberto@expensify.com'}, - {name: 'Aldo test QBO2 QBO2 Last name', currency: 'USD', id: '140', email: 'admin@qbo.com'}, -]; - function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); const {data, config} = policy?.connections?.quickbooksOnline ?? {}; + const exporters = getAdminEmailList(policy); + // const policyID = policy?.id ?? ''; const sections = useMemo( () => - (data?.vendors ?? draft)?.map((vendor) => ({ + exporters?.map((vendor) => ({ value: vendor.email, text: vendor.email, keyForList: vendor.email, @@ -34,7 +29,7 @@ function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { [config?.export?.exporter, data?.vendors], ); - const updateMode = useCallback((mode: {value: string}) => { + const updateMode = useCallback((mode: {value?: string}) => { // TODO add API call for change }, []); diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index b7c38f95792e..d2563f1c19eb 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -331,7 +331,7 @@ type Policy = OnyxCommon.OnyxValueWithOfflineFeedback< submitsTo?: number; /** The employee list of the policy */ - employeeList?: OnyxTypes.PolicyMembers | []; + employeeList?: OnyxTypes.PolicyMembers[] | []; /** The reimbursement choice for policy */ reimbursementChoice?: ValueOf; diff --git a/src/types/onyx/PolicyMember.ts b/src/types/onyx/PolicyMember.ts index 366a7ef7d530..bb41a66affe0 100644 --- a/src/types/onyx/PolicyMember.ts +++ b/src/types/onyx/PolicyMember.ts @@ -1,8 +1,10 @@ +import type {ValueOf} from 'type-fest'; +import type CONST from '@src/CONST'; import type * as OnyxCommon from './OnyxCommon'; type PolicyMember = OnyxCommon.OnyxValueWithOfflineFeedback<{ /** Role of the user in the policy */ - role?: string; + role?: ValueOf; /** Email of the user */ email?: string; diff --git a/tests/utils/collections/policyMembers.ts b/tests/utils/collections/policyMembers.ts index 076c8ddb2d3d..74b5945e962c 100644 --- a/tests/utils/collections/policyMembers.ts +++ b/tests/utils/collections/policyMembers.ts @@ -1,9 +1,9 @@ -import {randWord} from '@ngneat/falso'; +import CONST from '@src/CONST'; import type {PolicyMember} from '@src/types/onyx'; export default function createRandomPolicyMember(): PolicyMember { return { - role: randWord(), + role: CONST.POLICY.ROLE.USER, errors: {}, }; } From d7a117bb27a3c2b670a9844202bfec53e0be8de1 Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Tue, 16 Apr 2024 18:06:59 +0300 Subject: [PATCH 15/39] Updates for some mock api calls, clean based on the high level design doc --- src/CONST.ts | 15 ++- src/ROUTES.ts | 4 + src/SCREENS.ts | 1 + src/languages/en.ts | 4 + src/languages/es.ts | 6 +- .../ModalStackNavigators/index.tsx | 19 ++-- .../FULL_SCREEN_TO_RHP_MAPPING.ts | 1 + src/libs/Navigation/linkingConfig/config.ts | 3 + src/libs/Navigation/types.ts | 48 +++++----- src/libs/actions/Policy.ts | 2 +- .../qbo/QuickbooksChartOfAccountsPage.tsx | 2 +- .../accounting/qbo/QuickbooksClassesPage.tsx | 2 +- .../qbo/QuickbooksCustomersPage.tsx | 2 +- .../qbo/QuickbooksLocationsPage.tsx | 2 +- .../accounting/qbo/QuickbooksTaxesPage.tsx | 2 +- ...oksCompanyCardExpenseAccountSelectPage.tsx | 62 +++++++++--- ...oksCompanyCardExpenseConfigurationPage.tsx | 3 +- .../QuickbooksExportConfigurationPage.tsx | 19 ++-- .../export/QuickbooksExportDateSelectPage.tsx | 21 +++-- ...ickbooksExportInvoiceAccountSelectPage.tsx | 79 ++++++++++++++++ .../QuickbooksInvoiceAccountSelectPage.tsx | 55 ----------- ...oksOutOfPocketExpenseAccountSelectPage.tsx | 94 +++++++++++++++++++ ...oksOutOfPocketExpenseConfigurationPage.tsx | 16 ++-- ...ooksOutOfPocketExpenseEntitySelectPage.tsx | 47 +++++----- ...ooksPreferredExporterConfigurationPage.tsx | 42 +++++++-- src/types/onyx/Policy.ts | 11 ++- 26 files changed, 390 insertions(+), 172 deletions(-) create mode 100644 src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx delete mode 100644 src/pages/workspace/accounting/qbo/export/QuickbooksInvoiceAccountSelectPage.tsx create mode 100644 src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx diff --git a/src/CONST.ts b/src/CONST.ts index 52532e4ece0e..2212441b5c49 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1214,12 +1214,25 @@ const CONST = { }, QUICK_BOOKS_ONLINE: 'quickbooksOnline', - QUICK_BOOKS_IMPORTS: { + QUICK_BOOKS_CONFIG: { SYNC_CLASSES: 'syncClasses', ENABLE_NEW_CATEGORIES: 'enableNewCategories', SYNC_CUSTOMERS: 'syncCustomers', SYNC_LOCATIONS: 'syncLocations', SYNC_TAXES: 'syncTaxes', + PREFERRED_EXPORTER: 'exporter', + EXPORT_DATE: 'exportDate', + OUT_OF_POCKET_EXPENSES: 'outOfPocketExpenses', + EXPORT_INVOICE: 'exportInvoice', + EXPORT_ENTITY: 'exportEntity', + EXPORT_ACCOUNT: 'exportAccount', + EXPORT_COMPANY_CARD: 'exportCompanyCard', + }, + + QUICKBOOKS_EXPORT_ENTITY: { + VENDOR_BILL: 'vendorBill', + CHECK: 'check', + JOURNAL_ENTRY: 'journalEntry', }, ACCOUNT_ID: { diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 317e40a16b40..721554d80011 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -511,6 +511,10 @@ const ROUTES = { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/out-of-pocket-expense', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/out-of-pocket-expense` as const, }, + WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT: { + route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/out-of-pocket-expense/account-select', + getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/out-of-pocket-expense/account-select` as const, + }, WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/out-of-pocket-expense/entity-select', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/out-of-pocket-expense/entity-select` as const, diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 4c36235f0250..ae49bcf47fde 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -269,6 +269,7 @@ const SCREENS = { QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER: 'Workspace_Accounting_Quickbooks_Online_Export_Preferred_Exporter', QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES: 'Workspace_Accounting_Quickbooks_Online_Export_Out_Of_Pocket_Expenses', QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Out_Of_Pocket_Expenses_Select', + QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Out_Of_Pocket_Expenses_Account_Select', DISTANCE_RATE_EDIT: 'Distance_Rate_Edit', }, diff --git a/src/languages/en.ts b/src/languages/en.ts index 8f52f5e0e15b..ef491a77275d 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1914,8 +1914,12 @@ export default { exportVendorBillDescription: 'We`ll create a single itemized vendor bill for each Expensify report. If the period of the bill is closed, we`ll post to the 1st of the next open period. You can add the vendor bill to your A/P account of choice (below).', check: 'Check', + accountsPayable: 'Accounts Payable', + accountsPayableDescription: 'This is your chosen A/P account, against which vendor bills for each report are created.', journalEntry: 'Journal Entry', optionBelow: 'Choose an option below:', + companyCardsLocationEnabledDescription: + 'Note: QuickBooks Online does not support a field for Locations as Tags on Vendor Bills exports. As you import Locations from, this this export option is unavailable.', outOfPocketTaxEnabledDescription: 'Note: QuickBooks Online doesn`t support a field for tax on Journal Entry exports. Because you have tax tracking enabled on your workspace, this export option is unavailable.', outOfPocketTaxEnabledError: 'Journal entry is not available when taxes enabled. please select a different export option.', diff --git a/src/languages/es.ts b/src/languages/es.ts index 7aca1669e4c3..669ddd0d89ce 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1937,10 +1937,14 @@ export default { optionBelow: 'Elija una opción a continuación:', creditCard: 'Tarjeta de crédito', vendorBill: 'Factura del proveedor', + accountsPayable: 'Cuentas por pagar', + accountsPayableDescription: 'Esta es la cuenta de cuentas por pagar elegida, contra la cual se crean las facturas de proveedores para cada informe.', + companyCardsLocationEnabledDescription: + 'Nota: QuickBooks Online no admite un campo para Ubicaciones como etiquetas en las exportaciones de facturas de proveedores. A medida que importa ubicaciones, esta opción de exportación no está disponible.', exportPreferredExporterNote: 'Puede ser cualquier administrador del espacio de trabajo, pero debe ser un administrador de dominio si configura diferentes cuentas de exportación para tarjetas de empresa individuales en la configuración del dominio.', exportPreferredExporterSubNote: 'Una vez configurado, el exportador preferido verá los informes para exportar en su cuenta.', - journalEntry: 'Anotación en el diario', // I have no idea what this means in english, sounds ok as a literal tranlsation + journalEntry: 'Asiento contable', exportOutOfPocketExpensesDescription: 'Establezca cómo se exportan los gastos de bolsillo a QuickBooks Online.', exportVendorBillDescription: 'Crearemos una única factura de proveedor detallada para cada informe de Expensify. Si el período de la factura está cerrado, lo publicaremos en el día 1 del siguiente período abierto. Puede agregar la factura del proveedor a la cuenta A/P de su elección (a continuación).', diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index a74387edd9a6..82e266984a11 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -255,20 +255,23 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName').default as React.ComponentType, [SCREENS.WORKSPACE.TAXES_SETTINGS_FOREIGN_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsForeignCurrency').default as React.ComponentType, [SCREENS.WORKSPACE.TAXES_SETTINGS_WORKSPACE_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsWorkspaceCurrency').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT]: () => require('@pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT]: () => require('@pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT]: () => require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT]: () => + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT]: () => - require('@pages/workspace/accounting/qbo/export/QuickbooksInvoiceAccountSelectPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage').default as React.ComponentType, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT]: () => + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES]: () => - require('@pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT]: () => - require('@pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD_EXPENSE]: () => - require('@pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseConfigurationPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseConfigurationPage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT]: () => - require('@pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: () => - require('@pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage').default as React.ComponentType, [SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default as React.ComponentType, [SCREENS.GET_ASSISTANCE]: () => require('../../../../pages/GetAssistancePage').default as React.ComponentType, [SCREENS.SETTINGS.TWO_FACTOR_AUTH]: () => require('../../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').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 787b401d05d3..53e03a4e751d 100755 --- a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts +++ b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts @@ -28,6 +28,7 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial> = { SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT, SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT, SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT, + SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT, SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD_EXPENSE, SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT, SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER, diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index 2b3c7a8d23a7..7d610ffd7310 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -272,6 +272,9 @@ const config: LinkingOptions['config'] = { [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT.route}, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT.route}, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT.route}, + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT]: { + path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT.route, + }, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.route}, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT]: { path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT.route, diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 7352069da1d8..96a47fabde39 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -262,30 +262,6 @@ type SettingsNavigatorParamList = { [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_TAXES]: { policyID: string; }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT]: { - policyID: string; - }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT]: { - policyID: string; - }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT]: { - policyID: string; - }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES]: { - policyID: string; - }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT]: { - policyID: string; - }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD_EXPENSE]: { - policyID: string; - }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT]: { - policyID: string; - }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: { - policyID: string; - }; [SCREENS.GET_ASSISTANCE]: { backTo: Routes; }; @@ -725,6 +701,30 @@ type WorkspacesCentralPaneNavigatorParamList = { [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT]: { policyID: string; }; + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT]: { + policyID: string; + }; + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT]: { + policyID: string; + }; + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT]: { + policyID: string; + }; + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES]: { + policyID: string; + }; + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT]: { + policyID: string; + }; + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD_EXPENSE]: { + policyID: string; + }; + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT]: { + policyID: string; + }; + [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: { + policyID: string; + }; }; type FullScreenNavigatorParamList = { diff --git a/src/libs/actions/Policy.ts b/src/libs/actions/Policy.ts index 74965bcaca13..3c87bfc33065 100644 --- a/src/libs/actions/Policy.ts +++ b/src/libs/actions/Policy.ts @@ -3832,7 +3832,7 @@ function openPolicyDistanceRatesPage(policyID?: string) { API.read(READ_COMMANDS.OPEN_POLICY_DISTANCE_RATES_PAGE, params); } -function updatePolicyConnectionConfig(policyID: string, settingName: ValueOf, settingValue: ValueOf) { +function updatePolicyConnectionConfig(policyID: string, settingName: ValueOf, settingValue: string) { const parameters = {policyID, connectionName: CONST.QUICK_BOOKS_ONLINE, settingName, settingValue, idempotencyKey: settingName}; const optimisticData: OnyxUpdate[] = [ { diff --git a/src/pages/workspace/accounting/qbo/QuickbooksChartOfAccountsPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksChartOfAccountsPage.tsx index 593e5f9dc00a..1fee44687592 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksChartOfAccountsPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksChartOfAccountsPage.tsx @@ -49,7 +49,7 @@ function QuickbooksChartOfAccountsPage({policy}: WithPolicyProps) { onToggle={() => Policy.updatePolicyConnectionConfig( policyID, - CONST.QUICK_BOOKS_IMPORTS.ENABLE_NEW_CATEGORIES, + CONST.QUICK_BOOKS_CONFIG.ENABLE_NEW_CATEGORIES, isSwitchOn ? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE : CONST.INTEGRATION_ENTITY_MAP_TYPES.TAG, ) } diff --git a/src/pages/workspace/accounting/qbo/QuickbooksClassesPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksClassesPage.tsx index f8c631b31476..620d86704308 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksClassesPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksClassesPage.tsx @@ -51,7 +51,7 @@ function QuickbooksClassesPage({policy}: WithPolicyProps) { onToggle={() => Policy.updatePolicyConnectionConfig( policyID, - CONST.QUICK_BOOKS_IMPORTS.SYNC_CLASSES, + CONST.QUICK_BOOKS_CONFIG.SYNC_CLASSES, isSwitchOn ? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE : CONST.INTEGRATION_ENTITY_MAP_TYPES.TAG, ) } diff --git a/src/pages/workspace/accounting/qbo/QuickbooksCustomersPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksCustomersPage.tsx index 27fde14081e7..7dafe1dfd206 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksCustomersPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksCustomersPage.tsx @@ -50,7 +50,7 @@ function QuickbooksCustomersPage({policy}: WithPolicyProps) { onToggle={() => Policy.updatePolicyConnectionConfig( policyID, - CONST.QUICK_BOOKS_IMPORTS.SYNC_CUSTOMERS, + CONST.QUICK_BOOKS_CONFIG.SYNC_CUSTOMERS, isSwitchOn ? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE : CONST.INTEGRATION_ENTITY_MAP_TYPES.TAG, ) } diff --git a/src/pages/workspace/accounting/qbo/QuickbooksLocationsPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksLocationsPage.tsx index 21da79587c0c..0e9150549e64 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksLocationsPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksLocationsPage.tsx @@ -51,7 +51,7 @@ function QuickbooksLocationsPage({policy}: WithPolicyProps) { onToggle={() => Policy.updatePolicyConnectionConfig( policyID, - CONST.QUICK_BOOKS_IMPORTS.SYNC_LOCATIONS, + CONST.QUICK_BOOKS_CONFIG.SYNC_LOCATIONS, isSwitchOn ? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE : CONST.INTEGRATION_ENTITY_MAP_TYPES.TAG, ) } diff --git a/src/pages/workspace/accounting/qbo/QuickbooksTaxesPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksTaxesPage.tsx index 293d6518baa0..433209f2ee51 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksTaxesPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksTaxesPage.tsx @@ -48,7 +48,7 @@ function QuickbooksTaxesPage({policy}: WithPolicyProps) { onToggle={() => Policy.updatePolicyConnectionConfig( policyID, - CONST.QUICK_BOOKS_IMPORTS.SYNC_TAXES, + CONST.QUICK_BOOKS_CONFIG.SYNC_TAXES, isSwitchOn ? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE : CONST.INTEGRATION_ENTITY_MAP_TYPES.TAG, ) } diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx index b7183c1d4224..042b2a8b283d 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx @@ -1,32 +1,63 @@ -import React, {useCallback} from 'react'; +import React, {useCallback, useMemo} from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; import ScrollView from '@components/ScrollView'; import SelectionList from '@components/SelectionList'; import RadioListItem from '@components/SelectionList/RadioListItem'; +import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import Navigation from '@navigation/Navigation'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; - -const selected = 'selected'; +import * as Policy from '@userActions/Policy'; +import CONST from '@src/CONST'; +import ROUTES from '@src/ROUTES'; function QuickbooksCompanyCardExpenseAccountSelectPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); const {creditCards} = policy?.connections?.quickbooksOnline?.data ?? {}; - // const policyID = policy?.id ?? ''; - const data = - creditCards?.map((card) => ({ - value: card.name, - text: card.name, - keyForList: card.name, - isSelected: card.name === selected, - })) || []; - const updateMode = useCallback((mode: {value: string}) => { - // TODO add API call for change - }, []); + const {exportCompanyCard, syncLocations} = policy?.connections?.quickbooksOnline?.config ?? {}; + const isLocationEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); + + const defaultCards = [ + { + name: translate(`workspace.qbo.creditCard`), + }, + { + name: translate(`workspace.qbo.debitCard`), + }, + { + name: translate(`workspace.qbo.vendorBill`), + }, + ]; + const cardsBasedOnLocation = isLocationEnabled ? defaultCards.slice(0, -1) : defaultCards; + const result = creditCards?.length ? creditCards : cardsBasedOnLocation; + const policyID = policy?.id ?? ''; + const data = useMemo( + () => + result?.map((card) => ({ + value: card.name, + text: card.name, + keyForList: card.name, + isSelected: card.name === exportCompanyCard, + })), + [exportCompanyCard, result], + ); + + const onSelectRow = useCallback( + (row: {value: string}) => { + if (exportCompanyCard && row.value === exportCompanyCard) { + Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE.getRoute(policyID)); + return; + } + Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_COMPANY_CARD, row.value); + Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE.getRoute(policyID)); + }, + [exportCompanyCard, policyID], + ); return ( mode.isSelected)?.keyForList} /> + {isLocationEnabled && {translate('workspace.qbo.companyCardsLocationEnabledDescription')}} ); diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseConfigurationPage.tsx index 83b967d99ab0..457e12c3c666 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseConfigurationPage.tsx @@ -16,6 +16,7 @@ function QuickbooksCompanyCardExpenseConfigurationPage({policy}: WithPolicyProps const {translate} = useLocalize(); const styles = useThemeStyles(); const policyID = policy?.id ?? ''; + const {exportCompanyCard} = policy?.connections?.quickbooksOnline?.config ?? {}; return ( {translate('workspace.qbo.exportCompanyCardsDescription')} Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.getRoute(policyID))} brickRoadIndicator={undefined} diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx index 3bf77f4f3500..9964c792f6ad 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx @@ -20,38 +20,37 @@ function QuickbooksExportConfigurationPage({policy}: WithPolicyProps) { const styles = useThemeStyles(); const policyID = policy?.id ?? ''; const policyOwner = policy?.owner ?? ''; - const {exporter} = policy?.connections?.quickbooksOnline?.config?.export ?? {}; - + const {exporter, exportDate, exportEntity, exportInvoice, exportCompanyCard} = policy?.connections?.quickbooksOnline?.config ?? {}; const sections = [ { description: translate('workspace.qbo.preferredExporter'), action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.getRoute(policyID)), - hasError: Boolean(policy?.errors?.enableNewCategories), + hasError: Boolean(policy?.errors?.exporter), title: exporter ?? policyOwner, }, { description: translate('workspace.qbo.date'), action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT.getRoute(policyID)), - hasError: Boolean(policy?.errors?.syncClasses), - title: 'Date of last expense', + hasError: Boolean(policy?.errors?.exportDate), + title: exportDate ? translate(`workspace.qbo.${exportDate}.label`) : undefined, }, { description: translate('workspace.qbo.exportExpenses'), action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)), hasError: Boolean(policy?.errors?.syncCustomers), - title: 'Vendor bill', + title: exportEntity ? translate(`workspace.qbo.${exportEntity}`) : undefined, }, { description: translate('workspace.qbo.exportInvoices'), action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT.getRoute(policyID)), - hasError: Boolean(policy?.errors?.syncLocations), - title: 'Accounts Receivable (A/R)', + hasError: Boolean(policy?.errors?.exportInvoice), + title: exportInvoice, }, { description: translate('workspace.qbo.exportCompany'), action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE.getRoute(policyID)), - hasError: Boolean(policy?.errors?.syncTaxes), - title: 'Debit card', + hasError: Boolean(policy?.errors?.exportCompanyCard), + title: exportCompanyCard, }, { description: translate('workspace.qbo.exportExpensifyCard'), diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx index 3c0200ab116e..4278ecbd72b3 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx @@ -10,30 +10,33 @@ import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@navigation/Navigation'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; +import * as Policy from '@userActions/Policy'; import CONST from '@src/CONST'; +import ROUTES from '@src/ROUTES'; function QuickbooksExportDateSelectPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); - // const policyID = policy?.id ?? ''; + const policyID = policy?.id ?? ''; const {exportDate} = policy?.connections?.quickbooksOnline?.config ?? {}; const data = Object.values(CONST.QUICKBOOKS_EXPORT_DATE).map((dateType) => ({ value: dateType, text: translate(`workspace.qbo.${dateType}.label`), alternateText: translate(`workspace.qbo.${dateType}.description`), keyForList: dateType, - isSelected: exportDate ? CONST.QUICKBOOKS_EXPORT_DATE[exportDate] === dateType : false, + isSelected: exportDate ? exportDate === dateType : false, })); - const updateMode = useCallback( - (mode: {value: string}) => { - if (exportDate && mode.value === CONST.QUICKBOOKS_EXPORT_DATE[exportDate]) { - Navigation.goBack(); + const onSelectRow = useCallback( + (row: {value: string}) => { + if (exportDate && row.value === exportDate) { + Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT.getRoute(policyID)); return; } - // TODO add API call for change + Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_DATE, row.value); + Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT.getRoute(policyID)); }, - [exportDate], + [exportDate, policyID], ); return ( @@ -48,7 +51,7 @@ function QuickbooksExportDateSelectPage({policy}: WithPolicyProps) { mode.isSelected)?.keyForList} /> diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx new file mode 100644 index 000000000000..b9c6c0466dc2 --- /dev/null +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx @@ -0,0 +1,79 @@ +import React, {useCallback, useMemo} from 'react'; +import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import ScreenWrapper from '@components/ScreenWrapper'; +import ScrollView from '@components/ScrollView'; +import SelectionList from '@components/SelectionList'; +import RadioListItem from '@components/SelectionList/RadioListItem'; +import Text from '@components/Text'; +import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; +import Navigation from '@navigation/Navigation'; +import withPolicy from '@pages/workspace/withPolicy'; +import type {WithPolicyProps} from '@pages/workspace/withPolicy'; +import * as Policy from '@userActions/Policy'; +import CONST from '@src/CONST'; +import ROUTES from '@src/ROUTES'; + +function QuickbooksExportInvoiceAccountSelectPage({policy}: WithPolicyProps) { + const {translate} = useLocalize(); + const styles = useThemeStyles(); + const {accountsReceivable} = policy?.connections?.quickbooksOnline?.data ?? {}; + const {exportInvoice} = policy?.connections?.quickbooksOnline?.config ?? {}; + // TODO - should be removed after API fully working + const draft = [ + { + name: translate(`workspace.qbo.receivable`), + }, + { + name: translate(`workspace.qbo.archive`), + }, + ]; + const result = accountsReceivable?.length ? accountsReceivable : draft; + + const policyID = policy?.id ?? ''; + const data = useMemo( + () => + result?.map((account) => ({ + value: account.name, + text: account.name, + keyForList: account.name, + isSelected: account.name === exportInvoice, + })), + [exportInvoice, result], + ); + + const onSelectRow = useCallback( + (row: {value: string}) => { + if (exportInvoice && row.value === exportInvoice) { + Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT.getRoute(policyID)); + return; + } + Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_INVOICE, row.value); + Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT.getRoute(policyID)); + }, + [exportInvoice, policyID], + ); + + return ( + + + + {translate('workspace.qbo.exportInvoicesDescription')} + mode.isSelected)?.keyForList} + /> + + + ); +} + +QuickbooksExportInvoiceAccountSelectPage.displayName = 'QuickbooksExportInvoiceAccountSelectPage'; + +export default withPolicy(QuickbooksExportInvoiceAccountSelectPage); diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksInvoiceAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksInvoiceAccountSelectPage.tsx deleted file mode 100644 index a2f7c57cbb89..000000000000 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksInvoiceAccountSelectPage.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import React, {useCallback} from 'react'; -import HeaderWithBackButton from '@components/HeaderWithBackButton'; -import ScreenWrapper from '@components/ScreenWrapper'; -import ScrollView from '@components/ScrollView'; -import SelectionList from '@components/SelectionList'; -import RadioListItem from '@components/SelectionList/RadioListItem'; -import Text from '@components/Text'; -import useLocalize from '@hooks/useLocalize'; -import useThemeStyles from '@hooks/useThemeStyles'; -import withPolicy from '@pages/workspace/withPolicy'; -import type {WithPolicyProps} from '@pages/workspace/withPolicy'; - -const selected = 'selected'; - -function QuickbooksInvoiceAccountSelectPage({policy}: WithPolicyProps) { - const {translate} = useLocalize(); - const styles = useThemeStyles(); - const {accountsReceivable} = policy?.connections?.quickbooksOnline?.data ?? {}; - - // const policyID = policy?.id ?? ''; - const data = - accountsReceivable?.map((account) => ({ - value: account.name, - text: account.name, - keyForList: account.name, - isSelected: account.name === selected, - })) || []; - - const updateMode = useCallback((mode: {value: string}) => { - // TODO add API call for change - }, []); - - return ( - - - - {translate('workspace.qbo.exportInvoicesDescription')} - mode.isSelected)?.keyForList} - /> - - - ); -} - -QuickbooksInvoiceAccountSelectPage.displayName = 'QuickbooksInvoiceAccountSelectPage'; - -export default withPolicy(QuickbooksInvoiceAccountSelectPage); diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx new file mode 100644 index 000000000000..095d4494a583 --- /dev/null +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx @@ -0,0 +1,94 @@ +import React, {useCallback, useMemo} from 'react'; +import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import ScreenWrapper from '@components/ScreenWrapper'; +import ScrollView from '@components/ScrollView'; +import SelectionList from '@components/SelectionList'; +import RadioListItem from '@components/SelectionList/RadioListItem'; +import Text from '@components/Text'; +import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; +import Navigation from '@navigation/Navigation'; +import withPolicy from '@pages/workspace/withPolicy'; +import type {WithPolicyProps} from '@pages/workspace/withPolicy'; +import * as Policy from '@userActions/Policy'; +import CONST from '@src/CONST'; +import ROUTES from '@src/ROUTES'; + +// TODO - should be removed after API fully working +const draft = [ + { + name: 'Accounts Payable (A/P)', + }, + { + name: 'Payroll Accounts', + }, +]; + +function QuickbooksOutOfPocketExpenseAccountSelectPage({policy}: WithPolicyProps) { + const {translate} = useLocalize(); + const styles = useThemeStyles(); + const {bankAccounts, journalEntryAccounts, accountsPayable} = policy?.connections?.quickbooksOnline?.data ?? {}; + + const {exportEntity, exportAccount} = policy?.connections?.quickbooksOnline?.config ?? {}; + + const data = useMemo(() => { + let result; + switch (exportEntity) { + case CONST.QUICKBOOKS_EXPORT_ENTITY.CHECK: + result = bankAccounts ?? []; + break; + case CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL: + result = accountsPayable ?? []; + break; + case CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY: + result = journalEntryAccounts ?? []; + break; + default: + result = draft; + } + + return (draft ?? result)?.map((card) => ({ + value: card.name, + text: card.name, + keyForList: card.name, + isSelected: card.name === exportAccount, + })); + }, [accountsPayable, bankAccounts, exportAccount, exportEntity, journalEntryAccounts]); + + const policyID = policy?.id ?? ''; + + const onSelectRow = useCallback( + (row: {value: string}) => { + if (exportAccount && row.value === exportAccount) { + Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)); + return; + } + Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_ACCOUNT, row.value); + Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)); + }, + [exportAccount, policyID], + ); + + return ( + + + + {translate('workspace.qbo.accountsPayableDescription')} + mode.isSelected)?.keyForList} + /> + + + ); +} + +QuickbooksOutOfPocketExpenseAccountSelectPage.displayName = 'QuickbooksOutOfPocketExpenseAccountSelectPage'; + +export default withPolicy(QuickbooksOutOfPocketExpenseAccountSelectPage); diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx index fcacb068b8e5..38c0017e04b1 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx @@ -13,12 +13,11 @@ import type {WithPolicyProps} from '@pages/workspace/withPolicy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; -const isVendorBill = true; function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); const policyID = policy?.id ?? ''; - const {syncLocations} = policy?.connections?.quickbooksOnline?.config ?? {}; + const {syncLocations, exportAccount, exportEntity} = policy?.connections?.quickbooksOnline?.config ?? {}; const isLocationEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); return ( @@ -32,21 +31,22 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyProps {!isLocationEnabled && {translate('workspace.qbo.exportOutOfPocketExpensesDescription')}} Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT.getRoute(policyID))} brickRoadIndicator={undefined} - shouldShowRightIcon={!isLocationEnabled} - interactive={!isLocationEnabled} + shouldShowRightIcon /> - {isVendorBill && !isLocationEnabled && {translate('workspace.qbo.exportVendorBillDescription')}} + {exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL && !isLocationEnabled && ( + {translate('workspace.qbo.exportVendorBillDescription')} + )} {isLocationEnabled && {translate('workspace.qbo.outOfPocketLocationEnabledDescription')}} {!isLocationEnabled && ( Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.getRoute(policyID))} + title={exportAccount} + onPress={() => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT.getRoute(policyID))} brickRoadIndicator={undefined} shouldShowRightIcon /> diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx index 9a0d81721951..d099f53b7332 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx @@ -7,50 +7,55 @@ import RadioListItem from '@components/SelectionList/RadioListItem'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import Navigation from '@navigation/Navigation'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; +import * as Policy from '@userActions/Policy'; import CONST from '@src/CONST'; - -const CARDS = { - CHECK: 'check', - JOURNAL_ENTRY: 'journal_entry', - VENDOR_BILL: 'vendor_bill', -}; +import ROUTES from '@src/ROUTES'; function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); - const {nonReimbursableExpensesExportDestination, syncTaxes} = policy?.connections?.quickbooksOnline?.config ?? {}; + const {exportEntity, syncTaxes} = policy?.connections?.quickbooksOnline?.config ?? {}; const isTaxesEnabled = Boolean(syncTaxes && syncTaxes !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); - // const policyID = policy?.id ?? ''; + const policyID = policy?.id ?? ''; const data = [ { - value: CARDS.CHECK, + value: CONST.QUICKBOOKS_EXPORT_ENTITY.CHECK, text: translate(`workspace.qbo.check`), - keyForList: CARDS.CHECK, - isSelected: nonReimbursableExpensesExportDestination === CARDS.CHECK, + keyForList: CONST.QUICKBOOKS_EXPORT_ENTITY.CHECK, + isSelected: exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.CHECK, isShown: true, }, { - value: CARDS.JOURNAL_ENTRY, + value: CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY, text: translate(`workspace.qbo.journalEntry`), - keyForList: CARDS.JOURNAL_ENTRY, - isSelected: nonReimbursableExpensesExportDestination === CARDS.JOURNAL_ENTRY, + keyForList: CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY, + isSelected: exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY, isShown: !isTaxesEnabled, }, { - value: CARDS.VENDOR_BILL, + value: CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL, text: translate(`workspace.qbo.vendorBill`), - keyForList: CARDS.VENDOR_BILL, - isSelected: nonReimbursableExpensesExportDestination === CARDS.VENDOR_BILL, + keyForList: CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL, + isSelected: exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL, isShown: true, }, ]; - const updateMode = useCallback((mode: {value: string}) => { - // TODO add API call for change - }, []); + const onSelectRow = useCallback( + (row: {value: string}) => { + if (exportEntity && row.value === exportEntity) { + Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)); + return; + } + Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_ENTITY, row.value); + Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)); + }, + [exportEntity, policyID], + ); return ( item.isShown)}]} ListItem={RadioListItem} - onSelectRow={updateMode} + onSelectRow={onSelectRow} initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} /> {translate('workspace.qbo.outOfPocketTaxEnabledDescription')} diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx index bd47b4ab0dc3..9b81b17961ed 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx @@ -8,30 +8,53 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import {getAdminEmailList} from '@libs/PolicyUtils'; +import Navigation from '@navigation/Navigation'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; +import * as Policy from '@userActions/Policy'; +import CONST from '@src/CONST'; +import ROUTES from '@src/ROUTES'; +// TODO - should be removed after API fully working +const draft = [ + {name: '+14153166423@expensify.sms', currency: 'USD', id: '94', email: '+14153166423@expensify.sms'}, + {name: 'Account Maintenance Fee', currency: 'USD', id: '141', email: 'alberto@expensify213.com'}, + {name: 'Admin Test', currency: 'USD', id: '119', email: 'admin@qbocard.com'}, + {name: 'Alberto Gonzalez-Cela', currency: 'USD', id: '104', email: 'alberto@expensify.com'}, + {name: 'Aldo test QBO2 QBO2 Last name', currency: 'USD', id: '140', email: 'admin@qbo.com'}, +]; function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); - const {data, config} = policy?.connections?.quickbooksOnline ?? {}; + const {exporter} = policy?.connections?.quickbooksOnline?.config ?? {}; const exporters = getAdminEmailList(policy); + const result = exporters?.length ? exporters : draft; - // const policyID = policy?.id ?? ''; + const policyID = policy?.id ?? ''; const sections = useMemo( () => - exporters?.map((vendor) => ({ + result?.map((vendor) => ({ value: vendor.email, text: vendor.email, keyForList: vendor.email, - isSelected: config?.export?.exporter === vendor.email, + isSelected: exporter === vendor.email, })) ?? [], - [config?.export?.exporter, data?.vendors], + [result, exporter], ); - const updateMode = useCallback((mode: {value?: string}) => { - // TODO add API call for change - }, []); + const onSelectRow = useCallback( + (row: {value?: string}) => { + if (exporter && row.value === exporter) { + Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.getRoute(policyID)); + return; + } + if (row?.value) { + Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.PREFERRED_EXPORTER, row.value); + Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.getRoute(policyID)); + } + }, + [policyID, exporter], + ); return ( {translate('workspace.qbo.exportPreferredExporterNote')} {translate('workspace.qbo.exportPreferredExporterSubNote')} mode.isSelected)?.keyForList} /> diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index 24233018362b..2adf7d4773ef 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -168,15 +168,18 @@ type QBOConnectionConfig = OnyxCommon.OnyxValueWithOfflineFeedback<{ syncLocations: IntegrationEntityMap; syncAccounts: IntegrationEntityMap; syncTaxes: IntegrationEntityMap; - exportDate: keyof typeof CONST.QUICKBOOKS_EXPORT_DATE; lastConfigurationTime: number; syncTax: boolean; enableNewCategories: IntegrationEntityMap; errors?: OnyxCommon.Errors; + exporter: string; + exportDate: ValueOf; + outOfPocketExpenses: string; + exportInvoice: string; + exportAccount: string; + exportEntity: ValueOf; + exportCompanyCard: string; errorFields?: OnyxCommon.ErrorFields; - export: { - exporter: string; - }; }>; type Connection = { lastSync?: ConnectionLastSync; From 8ce62d9efd5d818eca0002c7eac278b44e56156c Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Tue, 16 Apr 2024 18:17:17 +0300 Subject: [PATCH 16/39] fix ts --- src/libs/PolicyUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index 017b747df987..71df3a670594 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -6,7 +6,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {PersonalDetailsList, Policy, PolicyCategories, PolicyMembers, PolicyTagList, PolicyTags, TaxRate} from '@src/types/onyx'; import type {PolicyFeatureName, Rate} from '@src/types/onyx/Policy'; -import PolicyMember from '@src/types/onyx/PolicyMember'; +import type PolicyMember from '@src/types/onyx/PolicyMember'; import type {EmptyObject} from '@src/types/utils/EmptyObject'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import getPolicyIDFromState from './Navigation/getPolicyIDFromState'; From 030f7798f06d56bf4c19b9586d8220683102625e Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Wed, 17 Apr 2024 13:10:26 +0300 Subject: [PATCH 17/39] fix employee list --- src/libs/PolicyUtils.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index cb3e223bea8d..85a20ceaf512 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -6,7 +6,6 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {Policy, PolicyCategories, PolicyEmployeeList, PolicyTagList, PolicyTags, TaxRate} from '@src/types/onyx'; import type {PolicyFeatureName, Rate} from '@src/types/onyx/Policy'; -import type PolicyMember from '@src/types/onyx/PolicyMember'; import type {EmptyObject} from '@src/types/utils/EmptyObject'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import getPolicyIDFromState from './Navigation/getPolicyIDFromState'; @@ -320,7 +319,17 @@ function getPolicyIDFromNavigationState() { } function getAdminEmailList(policy: Policy | null) { - return policy?.employeeList?.filter((employee: PolicyMember) => employee?.role === CONST.POLICY.ROLE.ADMIN).map((admin) => admin.email); + const adminEmailList: Array<{email: string}> = []; + if (!policy?.employeeList) { + return adminEmailList; + } + Object.keys(policy.employeeList).forEach((email: string) => { + if (policy?.employeeList?.[email].role !== CONST.POLICY.ROLE.ADMIN) { + return; + } + adminEmailList.push({email}); + }); + return adminEmailList; } export { From 9aa233c33eb954528fffd433272ed4c21f03438a Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Wed, 17 Apr 2024 14:31:54 +0300 Subject: [PATCH 18/39] Resolve C+ review comments --- ...oksCompanyCardExpenseAccountSelectPage.tsx | 64 ++++++++++------ ...oksCompanyCardExpenseConfigurationPage.tsx | 7 +- .../QuickbooksExportConfigurationPage.tsx | 72 ++++++++---------- .../export/QuickbooksExportDateSelectPage.tsx | 20 ++--- ...ickbooksExportInvoiceAccountSelectPage.tsx | 18 +++-- ...oksOutOfPocketExpenseAccountSelectPage.tsx | 18 +++-- ...oksOutOfPocketExpenseConfigurationPage.tsx | 8 +- ...ooksOutOfPocketExpenseEntitySelectPage.tsx | 75 +++++++++++-------- ...ooksPreferredExporterConfigurationPage.tsx | 31 ++++---- src/types/onyx/PolicyEmployee.ts | 4 +- 10 files changed, 173 insertions(+), 144 deletions(-) diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx index 042b2a8b283d..71dc3118ecc7 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx @@ -1,9 +1,11 @@ import React, {useCallback, useMemo} from 'react'; +import type {SectionListData} from 'react-native'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; import ScrollView from '@components/ScrollView'; import SelectionList from '@components/SelectionList'; import RadioListItem from '@components/SelectionList/RadioListItem'; +import type {ListItem, Section} from '@components/SelectionList/types'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -14,6 +16,12 @@ import * as Policy from '@userActions/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; +type CardListItem = ListItem & { + value: string; +}; +type CardsSection = SectionListData>; +type Card = {name: string}; + function QuickbooksCompanyCardExpenseAccountSelectPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); @@ -22,38 +30,46 @@ function QuickbooksCompanyCardExpenseAccountSelectPage({policy}: WithPolicyProps const {exportCompanyCard, syncLocations} = policy?.connections?.quickbooksOnline?.config ?? {}; const isLocationEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); - const defaultCards = [ - { - name: translate(`workspace.qbo.creditCard`), - }, - { - name: translate(`workspace.qbo.debitCard`), - }, - { - name: translate(`workspace.qbo.vendorBill`), - }, - ]; - const cardsBasedOnLocation = isLocationEnabled ? defaultCards.slice(0, -1) : defaultCards; - const result = creditCards?.length ? creditCards : cardsBasedOnLocation; - const policyID = policy?.id ?? ''; - const data = useMemo( + const defaultCards = useMemo( + () => [ + { + name: translate(`workspace.qbo.creditCard`), + }, + { + name: translate(`workspace.qbo.debitCard`), + }, + { + name: translate(`workspace.qbo.vendorBill`), + }, + ], + [translate], + ); + const cards = useMemo(() => { + if (creditCards?.length) { + return creditCards; + } + return isLocationEnabled ? defaultCards.slice(0, -1) : defaultCards; + }, [creditCards, isLocationEnabled, defaultCards]); + + const data = useMemo( () => - result?.map((card) => ({ + cards.map((card) => ({ value: card.name, text: card.name, keyForList: card.name, isSelected: card.name === exportCompanyCard, })), - [exportCompanyCard, result], + [cards, exportCompanyCard], ); + const sections = useMemo(() => [{data}], [data]); + const policyID = policy?.id ?? ''; + const onSelectRow = useCallback( - (row: {value: string}) => { - if (exportCompanyCard && row.value === exportCompanyCard) { - Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE.getRoute(policyID)); - return; + (row: CardListItem) => { + if (row.value !== exportCompanyCard) { + Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_COMPANY_CARD, row.value); } - Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_COMPANY_CARD, row.value); Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE.getRoute(policyID)); }, [exportCompanyCard, policyID], @@ -68,12 +84,12 @@ function QuickbooksCompanyCardExpenseAccountSelectPage({policy}: WithPolicyProps mode.isSelected)?.keyForList} + footerContent={isLocationEnabled && {translate('workspace.qbo.companyCardsLocationEnabledDescription')}} /> - {isLocationEnabled && {translate('workspace.qbo.companyCardsLocationEnabledDescription')}} ); diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseConfigurationPage.tsx index 457e12c3c666..3a1f40a0de32 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseConfigurationPage.tsx @@ -10,18 +10,17 @@ import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@navigation/Navigation'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; +import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; function QuickbooksCompanyCardExpenseConfigurationPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); const policyID = policy?.id ?? ''; - const {exportCompanyCard} = policy?.connections?.quickbooksOnline?.config ?? {}; - + const {exportCompanyCard, errors} = policy?.connections?.quickbooksOnline?.config ?? {}; return ( @@ -32,7 +31,7 @@ function QuickbooksCompanyCardExpenseConfigurationPage({policy}: WithPolicyProps title={exportCompanyCard} description={translate('workspace.qbo.exportAs')} onPress={() => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.getRoute(policyID))} - brickRoadIndicator={undefined} + brickRoadIndicator={errors?.exportCompanyCard ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} shouldShowRightIcon /> diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx index 9964c792f6ad..1a51d36c9ec2 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx @@ -1,11 +1,12 @@ import React from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import type {MenuItemProps} from '@components/MenuItem'; import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; import OfflineWithFeedback from '@components/OfflineWithFeedback'; -import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback'; import ScreenWrapper from '@components/ScreenWrapper'; import ScrollView from '@components/ScrollView'; import Text from '@components/Text'; +import TextLink from '@components/TextLink'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@navigation/Navigation'; @@ -20,81 +21,74 @@ function QuickbooksExportConfigurationPage({policy}: WithPolicyProps) { const styles = useThemeStyles(); const policyID = policy?.id ?? ''; const policyOwner = policy?.owner ?? ''; - const {exporter, exportDate, exportEntity, exportInvoice, exportCompanyCard} = policy?.connections?.quickbooksOnline?.config ?? {}; - const sections = [ + const {exporter, exportDate, exportEntity, exportInvoice, exportCompanyCard, errors} = policy?.connections?.quickbooksOnline?.config ?? {}; + const menuItems: MenuItemProps[] = [ { description: translate('workspace.qbo.preferredExporter'), - action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.getRoute(policyID)), - hasError: Boolean(policy?.errors?.exporter), + onPress: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.getRoute(policyID)), + brickRoadIndicator: errors?.exporter ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exporter ?? policyOwner, }, { description: translate('workspace.qbo.date'), - action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT.getRoute(policyID)), - hasError: Boolean(policy?.errors?.exportDate), + onPress: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT.getRoute(policyID)), + brickRoadIndicator: errors?.exportDate ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportDate ? translate(`workspace.qbo.${exportDate}.label`) : undefined, }, { description: translate('workspace.qbo.exportExpenses'), - action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)), - hasError: Boolean(policy?.errors?.syncCustomers), + onPress: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)), + brickRoadIndicator: errors?.exportExpenses ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportEntity ? translate(`workspace.qbo.${exportEntity}`) : undefined, }, { description: translate('workspace.qbo.exportInvoices'), - action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT.getRoute(policyID)), - hasError: Boolean(policy?.errors?.exportInvoice), + onPress: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT.getRoute(policyID)), + brickRoadIndicator: errors?.exportInvoice ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportInvoice, }, { description: translate('workspace.qbo.exportCompany'), - action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE.getRoute(policyID)), - hasError: Boolean(policy?.errors?.exportCompanyCard), + onPress: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE.getRoute(policyID)), + brickRoadIndicator: errors?.exportCompanyCard ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportCompanyCard, }, { description: translate('workspace.qbo.exportExpensifyCard'), - action: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT.getRoute(policyID)), - hasError: Boolean(policy?.errors?.syncTaxes), - title: 'Credit card', - interactive: false, + title: translate('workspace.qbo.creditCard'), + shouldShowRightIcon: false, }, ]; return ( {translate('workspace.qbo.exportDescription')} - {sections.map((section) => ( - + {menuItems.map((menuItem) => ( + ))} - { - Link.openExternalLink(CONST.DEEP_DIVE_EXPENSIFY_CARD); - }} - style={[styles.ph5, styles.pb5]} - accessibilityLabel={translate('workspace.qbo.deepDiveExpensifyCard')} - role={CONST.ROLE.LINK} - > - - {`${translate('workspace.qbo.deepDiveExpensifyCard')} `} - {translate('workspace.qbo.deepDiveExpensifyCardIntegration')} - - + + {`${translate('workspace.qbo.deepDiveExpensifyCard')} `} + Link.openExternalLink(CONST.DEEP_DIVE_EXPENSIFY_CARD)} + style={[styles.optionAlternateText, styles.textLabelSupporting, styles.link]} + > + {translate('workspace.qbo.deepDiveExpensifyCardIntegration')} + + ); diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx index 4278ecbd72b3..38e326ff6694 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx @@ -1,9 +1,11 @@ import React, {useCallback} from 'react'; +import type {ValueOf} from 'type-fest'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; import ScrollView from '@components/ScrollView'; import SelectionList from '@components/SelectionList'; import RadioListItem from '@components/SelectionList/RadioListItem'; +import type {ListItem} from '@components/SelectionList/types'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -14,26 +16,27 @@ import * as Policy from '@userActions/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; +type CardListItem = ListItem & { + value: ValueOf; +}; function QuickbooksExportDateSelectPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); const policyID = policy?.id ?? ''; const {exportDate} = policy?.connections?.quickbooksOnline?.config ?? {}; - const data = Object.values(CONST.QUICKBOOKS_EXPORT_DATE).map((dateType) => ({ + const data: CardListItem[] = Object.values(CONST.QUICKBOOKS_EXPORT_DATE).map((dateType) => ({ value: dateType, text: translate(`workspace.qbo.${dateType}.label`), alternateText: translate(`workspace.qbo.${dateType}.description`), keyForList: dateType, - isSelected: exportDate ? exportDate === dateType : false, + isSelected: exportDate === dateType, })); const onSelectRow = useCallback( - (row: {value: string}) => { - if (exportDate && row.value === exportDate) { - Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT.getRoute(policyID)); - return; + (row: CardListItem) => { + if (row.value !== exportDate) { + Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_DATE, row.value); } - Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_DATE, row.value); Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT.getRoute(policyID)); }, [exportDate, policyID], @@ -42,13 +45,12 @@ function QuickbooksExportDateSelectPage({policy}: WithPolicyProps) { return ( - {translate('workspace.qbo.exportDateDescription')} {translate('workspace.qbo.exportDateDescription')}} sections={[{data}]} ListItem={RadioListItem} onSelectRow={onSelectRow} diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx index b9c6c0466dc2..51ec82f65d0a 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx @@ -4,6 +4,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import ScrollView from '@components/ScrollView'; import SelectionList from '@components/SelectionList'; import RadioListItem from '@components/SelectionList/RadioListItem'; +import type {ListItem} from '@components/SelectionList/types'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -14,6 +15,10 @@ import * as Policy from '@userActions/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; +type CardListItem = ListItem & { + value: string; +}; + function QuickbooksExportInvoiceAccountSelectPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); @@ -31,7 +36,7 @@ function QuickbooksExportInvoiceAccountSelectPage({policy}: WithPolicyProps) { const result = accountsReceivable?.length ? accountsReceivable : draft; const policyID = policy?.id ?? ''; - const data = useMemo( + const data: CardListItem[] = useMemo( () => result?.map((account) => ({ value: account.name, @@ -43,12 +48,10 @@ function QuickbooksExportInvoiceAccountSelectPage({policy}: WithPolicyProps) { ); const onSelectRow = useCallback( - (row: {value: string}) => { - if (exportInvoice && row.value === exportInvoice) { - Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT.getRoute(policyID)); - return; + (row: CardListItem) => { + if (row.value !== exportInvoice) { + Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_INVOICE, row.value); } - Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_INVOICE, row.value); Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT.getRoute(policyID)); }, [exportInvoice, policyID], @@ -57,13 +60,12 @@ function QuickbooksExportInvoiceAccountSelectPage({policy}: WithPolicyProps) { return ( - {translate('workspace.qbo.exportInvoicesDescription')} {translate('workspace.qbo.exportInvoicesDescription')}} sections={[{data}]} ListItem={RadioListItem} onSelectRow={onSelectRow} diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx index 095d4494a583..4af0e8ad4261 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx @@ -4,6 +4,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import ScrollView from '@components/ScrollView'; import SelectionList from '@components/SelectionList'; import RadioListItem from '@components/SelectionList/RadioListItem'; +import type {ListItem} from '@components/SelectionList/types'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -24,6 +25,10 @@ const draft = [ }, ]; +type CardListItem = ListItem & { + value: string; +}; + function QuickbooksOutOfPocketExpenseAccountSelectPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); @@ -31,7 +36,7 @@ function QuickbooksOutOfPocketExpenseAccountSelectPage({policy}: WithPolicyProps const {exportEntity, exportAccount} = policy?.connections?.quickbooksOnline?.config ?? {}; - const data = useMemo(() => { + const data: CardListItem[] = useMemo(() => { let result; switch (exportEntity) { case CONST.QUICKBOOKS_EXPORT_ENTITY.CHECK: @@ -58,12 +63,10 @@ function QuickbooksOutOfPocketExpenseAccountSelectPage({policy}: WithPolicyProps const policyID = policy?.id ?? ''; const onSelectRow = useCallback( - (row: {value: string}) => { - if (exportAccount && row.value === exportAccount) { - Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)); - return; + (row: CardListItem) => { + if (row.value !== exportAccount) { + Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_ACCOUNT, row.value); } - Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_ACCOUNT, row.value); Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)); }, [exportAccount, policyID], @@ -72,13 +75,12 @@ function QuickbooksOutOfPocketExpenseAccountSelectPage({policy}: WithPolicyProps return ( - {translate('workspace.qbo.accountsPayableDescription')} {translate('workspace.qbo.accountsPayableDescription')}} sections={[{data}]} ListItem={RadioListItem} onSelectRow={onSelectRow} diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx index 38c0017e04b1..9151afcca9d3 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx @@ -17,13 +17,12 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyProps const {translate} = useLocalize(); const styles = useThemeStyles(); const policyID = policy?.id ?? ''; - const {syncLocations, exportAccount, exportEntity} = policy?.connections?.quickbooksOnline?.config ?? {}; + const {syncLocations, exportAccount, exportEntity, errors} = policy?.connections?.quickbooksOnline?.config ?? {}; const isLocationEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); return ( @@ -34,7 +33,7 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyProps title={exportEntity ? translate(`workspace.qbo.${exportEntity}`) : undefined} description={translate('workspace.qbo.exportAs')} onPress={() => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT.getRoute(policyID))} - brickRoadIndicator={undefined} + brickRoadIndicator={errors?.exportEntity ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} shouldShowRightIcon /> @@ -46,8 +45,9 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyProps Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT.getRoute(policyID))} - brickRoadIndicator={undefined} + brickRoadIndicator={errors?.exportAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} shouldShowRightIcon /> diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx index d099f53b7332..d6ef35a3a1d0 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx @@ -1,9 +1,12 @@ -import React, {useCallback} from 'react'; +import React, {useCallback, useMemo} from 'react'; +import type {SectionListData} from 'react-native'; +import type {ValueOf} from 'type-fest'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; import ScrollView from '@components/ScrollView'; import SelectionList from '@components/SelectionList'; import RadioListItem from '@components/SelectionList/RadioListItem'; +import type {ListItem, Section} from '@components/SelectionList/types'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -14,6 +17,12 @@ import * as Policy from '@userActions/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; +type CardListItem = ListItem & { + value: ValueOf; + isShown: boolean; +}; +type CardsSection = SectionListData>; + function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); @@ -21,37 +30,40 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyProps) const isTaxesEnabled = Boolean(syncTaxes && syncTaxes !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); const policyID = policy?.id ?? ''; - const data = [ - { - value: CONST.QUICKBOOKS_EXPORT_ENTITY.CHECK, - text: translate(`workspace.qbo.check`), - keyForList: CONST.QUICKBOOKS_EXPORT_ENTITY.CHECK, - isSelected: exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.CHECK, - isShown: true, - }, - { - value: CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY, - text: translate(`workspace.qbo.journalEntry`), - keyForList: CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY, - isSelected: exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY, - isShown: !isTaxesEnabled, - }, - { - value: CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL, - text: translate(`workspace.qbo.vendorBill`), - keyForList: CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL, - isSelected: exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL, - isShown: true, - }, - ]; + const data: CardListItem[] = useMemo( + () => [ + { + value: CONST.QUICKBOOKS_EXPORT_ENTITY.CHECK, + text: translate(`workspace.qbo.check`), + keyForList: CONST.QUICKBOOKS_EXPORT_ENTITY.CHECK, + isSelected: exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.CHECK, + isShown: true, + }, + { + value: CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY, + text: translate(`workspace.qbo.journalEntry`), + keyForList: CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY, + isSelected: exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY, + isShown: !isTaxesEnabled, + }, + { + value: CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL, + text: translate(`workspace.qbo.vendorBill`), + keyForList: CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL, + isSelected: exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL, + isShown: true, + }, + ], + [exportEntity, isTaxesEnabled, translate], + ); + + const sections: CardsSection[] = useMemo(() => [{data: data.filter((item) => item.isShown)}], [data]); const onSelectRow = useCallback( - (row: {value: string}) => { - if (exportEntity && row.value === exportEntity) { - Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)); - return; + (row: CardListItem) => { + if (row.value !== exportEntity) { + Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_ENTITY, row.value); } - Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_ENTITY, row.value); Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)); }, [exportEntity, policyID], @@ -60,14 +72,13 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyProps) return ( - {translate('workspace.qbo.optionBelow')} item.isShown)}]} + headerContent={{translate('workspace.qbo.optionBelow')}} + sections={sections} ListItem={RadioListItem} onSelectRow={onSelectRow} initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx index 9b81b17961ed..d86ed1e8d783 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx @@ -4,6 +4,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import ScrollView from '@components/ScrollView'; import SelectionList from '@components/SelectionList'; import RadioListItem from '@components/SelectionList/RadioListItem'; +import type {ListItem} from '@components/SelectionList/types'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -23,6 +24,11 @@ const draft = [ {name: 'Alberto Gonzalez-Cela', currency: 'USD', id: '104', email: 'alberto@expensify.com'}, {name: 'Aldo test QBO2 QBO2 Last name', currency: 'USD', id: '140', email: 'admin@qbo.com'}, ]; + +type CardListItem = ListItem & { + value: string; +}; + function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); @@ -31,7 +37,7 @@ function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { const result = exporters?.length ? exporters : draft; const policyID = policy?.id ?? ''; - const sections = useMemo( + const data: CardListItem[] = useMemo( () => result?.map((vendor) => ({ value: vendor.email, @@ -43,15 +49,11 @@ function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { ); const onSelectRow = useCallback( - (row: {value?: string}) => { - if (exporter && row.value === exporter) { - Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.getRoute(policyID)); - return; - } - if (row?.value) { + (row: CardListItem) => { + if (row.value !== exporter) { Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.PREFERRED_EXPORTER, row.value); - Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.getRoute(policyID)); } + Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.getRoute(policyID)); }, [policyID, exporter], ); @@ -59,19 +61,22 @@ function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { return ( - {translate('workspace.qbo.exportPreferredExporterNote')} - {translate('workspace.qbo.exportPreferredExporterSubNote')} + {translate('workspace.qbo.exportPreferredExporterNote')} + {translate('workspace.qbo.exportPreferredExporterSubNote')} + + } shouldStopPropagation - sections={[{data: sections}]} + sections={[{data}]} ListItem={RadioListItem} onSelectRow={onSelectRow} - initiallyFocusedOptionKey={sections.find((mode) => mode.isSelected)?.keyForList} + initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} /> diff --git a/src/types/onyx/PolicyEmployee.ts b/src/types/onyx/PolicyEmployee.ts index 175bfdfbb149..4a5f374de44a 100644 --- a/src/types/onyx/PolicyEmployee.ts +++ b/src/types/onyx/PolicyEmployee.ts @@ -1,10 +1,8 @@ -import type {ValueOf} from 'type-fest'; -import type CONST from '@src/CONST'; import type * as OnyxCommon from './OnyxCommon'; type PolicyEmployee = OnyxCommon.OnyxValueWithOfflineFeedback<{ /** Role of the user in the policy */ - role?: ValueOf; + role?: string; /** Email of the user */ email?: string; From 9e42ed8bc6905ff73a6c8c1299147386326f82f1 Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Wed, 17 Apr 2024 16:42:24 +0300 Subject: [PATCH 19/39] add errors for out of pockets, design review, remove redundant screen --- src/ROUTES.ts | 4 -- src/SCREENS.ts | 1 - src/languages/en.ts | 3 ++ src/languages/es.ts | 3 ++ .../ModalStackNavigators/index.tsx | 2 - .../FULL_SCREEN_TO_RHP_MAPPING.ts | 1 - src/libs/Navigation/linkingConfig/config.ts | 1 - src/libs/Navigation/types.ts | 3 -- ...oksCompanyCardExpenseAccountSelectPage.tsx | 7 +-- ...oksCompanyCardExpenseConfigurationPage.tsx | 45 ------------------- .../QuickbooksExportConfigurationPage.tsx | 8 ++-- ...oksOutOfPocketExpenseConfigurationPage.tsx | 13 ++++-- ...ooksOutOfPocketExpenseEntitySelectPage.tsx | 26 +++++++---- src/styles/index.ts | 6 +++ 14 files changed, 47 insertions(+), 76 deletions(-) delete mode 100644 src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseConfigurationPage.tsx diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 4b822d4c4f77..3e42e4db5251 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -491,10 +491,6 @@ const ROUTES = { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE: { - route: 'settings/workspaces/:policyID/accounting/quickbooks-online/company-card-expense', - getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/company-card-expense` as const, - }, WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/company-card-expense-account-select', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/company-card-expense-account-select` as const, diff --git a/src/SCREENS.ts b/src/SCREENS.ts index ae49bcf47fde..6fdb1bcd2fd8 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -264,7 +264,6 @@ const SCREENS = { QUICKBOOKS_ONLINE_EXPORT: 'Workspace_Accounting_Quickbooks_Online_Export', QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Date_Select', QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Invoice_Account_Select', - QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD_EXPENSE: 'Workspace_Accounting_Quickbooks_Online_Export_Company_Card_Expense', QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Company_Card_Expense_Select', QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER: 'Workspace_Accounting_Quickbooks_Online_Export_Preferred_Exporter', QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES: 'Workspace_Accounting_Quickbooks_Online_Export_Out_Of_Pocket_Expenses', diff --git a/src/languages/en.ts b/src/languages/en.ts index bd75454fff47..1ba43084ad40 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1920,6 +1920,9 @@ export default { accountsPayableDescription: 'This is your chosen A/P account, against which vendor bills for each report are created.', journalEntry: 'Journal Entry', optionBelow: 'Choose an option below:', + vendorBillError: 'Vendor Bills are not available when locations are enabled. Please select a different export option.', + checkError: 'Check is not available when locations are enabled. Please select a different export option.', + journalEntryError: 'Journal entry is not available when taxes enabled. please select a different export option.', companyCardsLocationEnabledDescription: 'Note: QuickBooks Online does not support a field for Locations as Tags on Vendor Bills exports. As you import Locations from, this this export option is unavailable.', outOfPocketTaxEnabledDescription: diff --git a/src/languages/es.ts b/src/languages/es.ts index f630b70a36f0..d3dc7efeffd4 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1947,6 +1947,9 @@ export default { 'Puede ser cualquier administrador del espacio de trabajo, pero debe ser un administrador de dominio si configura diferentes cuentas de exportación para tarjetas de empresa individuales en la configuración del dominio.', exportPreferredExporterSubNote: 'Una vez configurado, el exportador preferido verá los informes para exportar en su cuenta.', journalEntry: 'Asiento contable', + vendorBillError: 'Las facturas de proveedores no están disponibles cuando las ubicaciones están habilitadas. Seleccione una opción de exportación diferente.', + checkError: 'La verificación no está disponible cuando las ubicaciones están habilitadas. Seleccione una opción de exportación diferente.', + journalEntryError: 'El asiento de diario no está disponible cuando los impuestos están habilitados. seleccione una opción de exportación diferente.', exportOutOfPocketExpensesDescription: 'Establezca cómo se exportan los gastos de bolsillo a QuickBooks Online.', exportVendorBillDescription: 'Crearemos una única factura de proveedor detallada para cada informe de Expensify. Si el período de la factura está cerrado, lo publicaremos en el día 1 del siguiente período abierto. Puede agregar la factura del proveedor a la cuenta A/P de su elección (a continuación).', diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index 82e266984a11..301a55e70e20 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -266,8 +266,6 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD_EXPENSE]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseConfigurationPage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT]: () => require('../../../../pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage').default as React.ComponentType, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: () => 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 53e03a4e751d..9f2a9808ed12 100755 --- a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts +++ b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts @@ -29,7 +29,6 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial> = { SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT, SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT, SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT, - SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD_EXPENSE, SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT, SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER, SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES, diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index 7d610ffd7310..ce111f69435d 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -279,7 +279,6 @@ const config: LinkingOptions['config'] = { [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT]: { path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT.route, }, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD_EXPENSE]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE.route}, [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT]: { path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.route, }, diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 42b3c288f37e..10b4f96d4594 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -718,9 +718,6 @@ type WorkspacesCentralPaneNavigatorParamList = { [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT]: { policyID: string; }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_COMPANY_CARD_EXPENSE]: { - policyID: string; - }; [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT]: { policyID: string; }; diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx index 71dc3118ecc7..9b207868e83b 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx @@ -70,7 +70,7 @@ function QuickbooksCompanyCardExpenseAccountSelectPage({policy}: WithPolicyProps if (row.value !== exportCompanyCard) { Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_COMPANY_CARD, row.value); } - Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE.getRoute(policyID)); + Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT.getRoute(policyID)); }, [exportCompanyCard, policyID], ); @@ -81,14 +81,15 @@ function QuickbooksCompanyCardExpenseAccountSelectPage({policy}: WithPolicyProps shouldEnableMaxHeight testID={QuickbooksCompanyCardExpenseAccountSelectPage.displayName} > - + {translate('workspace.qbo.exportCompanyCardsDescription')}} sections={sections} ListItem={RadioListItem} onSelectRow={onSelectRow} initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} - footerContent={isLocationEnabled && {translate('workspace.qbo.companyCardsLocationEnabledDescription')}} + footerContent={isLocationEnabled && {translate('workspace.qbo.companyCardsLocationEnabledDescription')}} /> diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseConfigurationPage.tsx deleted file mode 100644 index 3a1f40a0de32..000000000000 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseConfigurationPage.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import React from 'react'; -import HeaderWithBackButton from '@components/HeaderWithBackButton'; -import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; -import OfflineWithFeedback from '@components/OfflineWithFeedback'; -import ScreenWrapper from '@components/ScreenWrapper'; -import ScrollView from '@components/ScrollView'; -import Text from '@components/Text'; -import useLocalize from '@hooks/useLocalize'; -import useThemeStyles from '@hooks/useThemeStyles'; -import Navigation from '@navigation/Navigation'; -import withPolicy from '@pages/workspace/withPolicy'; -import type {WithPolicyProps} from '@pages/workspace/withPolicy'; -import CONST from '@src/CONST'; -import ROUTES from '@src/ROUTES'; - -function QuickbooksCompanyCardExpenseConfigurationPage({policy}: WithPolicyProps) { - const {translate} = useLocalize(); - const styles = useThemeStyles(); - const policyID = policy?.id ?? ''; - const {exportCompanyCard, errors} = policy?.connections?.quickbooksOnline?.config ?? {}; - return ( - - - - {translate('workspace.qbo.exportCompanyCardsDescription')} - - Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.getRoute(policyID))} - brickRoadIndicator={errors?.exportCompanyCard ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} - shouldShowRightIcon - /> - - - - ); -} - -QuickbooksCompanyCardExpenseConfigurationPage.displayName = 'QuickbooksCompanyCardExpenseConfigurationPage'; - -export default withPolicy(QuickbooksCompanyCardExpenseConfigurationPage); diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx index 1a51d36c9ec2..cff82c6cad6a 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx @@ -49,7 +49,7 @@ function QuickbooksExportConfigurationPage({policy}: WithPolicyProps) { }, { description: translate('workspace.qbo.exportCompany'), - onPress: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE.getRoute(policyID)), + onPress: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.getRoute(policyID)), brickRoadIndicator: errors?.exportCompanyCard ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportCompanyCard, }, @@ -80,11 +80,11 @@ function QuickbooksExportConfigurationPage({policy}: WithPolicyProps) { /> ))} - - {`${translate('workspace.qbo.deepDiveExpensifyCard')} `} + + {`${translate('workspace.qbo.deepDiveExpensifyCard')} `} Link.openExternalLink(CONST.DEEP_DIVE_EXPENSIFY_CARD)} - style={[styles.optionAlternateText, styles.textLabelSupporting, styles.link]} + style={[styles.mutedNormalTextLabel, styles.link]} > {translate('workspace.qbo.deepDiveExpensifyCardIntegration')} diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx index 9151afcca9d3..8741843066e3 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx @@ -17,8 +17,12 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyProps const {translate} = useLocalize(); const styles = useThemeStyles(); const policyID = policy?.id ?? ''; - const {syncLocations, exportAccount, exportEntity, errors} = policy?.connections?.quickbooksOnline?.config ?? {}; + const {syncLocations, exportAccount, exportEntity, errors, syncTaxes} = policy?.connections?.quickbooksOnline?.config ?? {}; const isLocationEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); + const isTaxesEnabled = Boolean(syncTaxes && syncTaxes !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); + const showTaxError = isTaxesEnabled && exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY; + const showLocationError = isLocationEnabled && exportEntity !== CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY; + const brickEntityRoadIndicator = Boolean(errors?.exportEntity) || showTaxError || showLocationError; return ( Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT.getRoute(policyID))} - brickRoadIndicator={errors?.exportEntity ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} + brickRoadIndicator={brickEntityRoadIndicator ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} shouldShowRightIcon /> {exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL && !isLocationEnabled && ( - {translate('workspace.qbo.exportVendorBillDescription')} + {translate('workspace.qbo.exportVendorBillDescription')} )} - {isLocationEnabled && {translate('workspace.qbo.outOfPocketLocationEnabledDescription')}} + {isLocationEnabled && {translate('workspace.qbo.outOfPocketLocationEnabledDescription')}} {!isLocationEnabled && ( >; function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); - const {exportEntity, syncTaxes} = policy?.connections?.quickbooksOnline?.config ?? {}; + const {exportEntity, syncTaxes, syncLocations} = policy?.connections?.quickbooksOnline?.config ?? {}; + const isLocationsEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); const isTaxesEnabled = Boolean(syncTaxes && syncTaxes !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); - + const isTaxError = isTaxesEnabled && exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY; + const isLocationError = isLocationsEnabled && exportEntity !== CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY; const policyID = policy?.id ?? ''; + + useEffect(() => { + if (!isTaxError && !isLocationError) { + return; + } + Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_ENTITY, ''); + }, [policyID, isTaxError, isLocationError]); + const data: CardListItem[] = useMemo( () => [ { @@ -37,24 +47,24 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyProps) text: translate(`workspace.qbo.check`), keyForList: CONST.QUICKBOOKS_EXPORT_ENTITY.CHECK, isSelected: exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.CHECK, - isShown: true, + isShown: !isLocationsEnabled, }, { value: CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY, text: translate(`workspace.qbo.journalEntry`), keyForList: CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY, isSelected: exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY, - isShown: !isTaxesEnabled, + isShown: !isTaxesEnabled || isLocationsEnabled, }, { value: CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL, text: translate(`workspace.qbo.vendorBill`), keyForList: CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL, isSelected: exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL, - isShown: true, + isShown: !isLocationsEnabled, }, ], - [exportEntity, isTaxesEnabled, translate], + [exportEntity, isTaxesEnabled, translate, isLocationsEnabled], ); const sections: CardsSection[] = useMemo(() => [{data: data.filter((item) => item.isShown)}], [data]); @@ -82,8 +92,8 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyProps) ListItem={RadioListItem} onSelectRow={onSelectRow} initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} + footerContent={isTaxesEnabled && {translate('workspace.qbo.outOfPocketTaxEnabledDescription')}} /> - {translate('workspace.qbo.outOfPocketTaxEnabledDescription')} ); diff --git a/src/styles/index.ts b/src/styles/index.ts index 537038d9f2e1..18b3f0b84bb9 100644 --- a/src/styles/index.ts +++ b/src/styles/index.ts @@ -378,6 +378,12 @@ const styles = (theme: ThemeColors) => lineHeight: variables.lineHeightLarge, }, + mutedNormalTextLabel: { + color: theme.textSupporting, + fontSize: variables.fontSizeLabel, + lineHeight: variables.lineHeightNormal, + }, + textMicro: { fontFamily: FontUtils.fontFamily.platform.EXP_NEUE, fontSize: variables.fontSizeSmall, From 81026f0bce3945de042ded4fe372b9c1464972a9 Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Thu, 18 Apr 2024 11:20:22 +0300 Subject: [PATCH 20/39] resolve merge conflicts --- src/ROUTES.ts | 16 +++--- src/SCREENS.ts | 16 +++--- .../UpdatePolicyConnectionConfigParams.ts | 2 +- .../ModalStackNavigators/index.tsx | 19 +++---- .../FULL_SCREEN_TO_RHP_MAPPING.ts | 16 +++--- src/libs/Navigation/linkingConfig/config.ts | 24 ++++----- src/libs/Navigation/types.ts | 49 +++++++++---------- src/libs/actions/connections/index.ts | 2 +- .../accounting/PolicyAccountingPage.tsx | 2 +- .../qbo/QuickbooksChartOfAccountsPage.tsx | 2 +- .../accounting/qbo/QuickbooksClassesPage.tsx | 2 +- .../qbo/QuickbooksCustomersPage.tsx | 2 +- .../qbo/QuickbooksLocationsPage.tsx | 2 +- .../accounting/qbo/QuickbooksTaxesPage.tsx | 2 +- ...oksCompanyCardExpenseAccountSelectPage.tsx | 7 ++- .../QuickbooksExportConfigurationPage.tsx | 10 ++-- .../export/QuickbooksExportDateSelectPage.tsx | 6 +-- ...ickbooksExportInvoiceAccountSelectPage.tsx | 6 +-- ...oksOutOfPocketExpenseAccountSelectPage.tsx | 6 +-- ...oksOutOfPocketExpenseConfigurationPage.tsx | 4 +- ...ooksOutOfPocketExpenseEntitySelectPage.tsx | 8 +-- ...ooksPreferredExporterConfigurationPage.tsx | 6 +-- 22 files changed, 105 insertions(+), 104 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 46c0500dbabc..058159d52693 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -487,35 +487,35 @@ const ROUTES = { route: 'settings/workspaces/:policyID/profile/currency', getRoute: (policyID: string) => `settings/workspaces/${policyID}/profile/currency` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT: { + POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT: { + POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/company-card-expense-account-select', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/company-card-expense-account-select` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT: { + POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/invoice-account-select', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/invoice-account-select` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER: { + POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/preferred-exporter', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/preferred-exporter` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES: { + POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/out-of-pocket-expense', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/out-of-pocket-expense` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT: { + POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/out-of-pocket-expense/account-select', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/out-of-pocket-expense/account-select` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT: { + POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/out-of-pocket-expense/entity-select', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/out-of-pocket-expense/entity-select` as const, }, - WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT: { + POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT: { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/date-select', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/date-select` as const, }, diff --git a/src/SCREENS.ts b/src/SCREENS.ts index ceed7d5eb8fe..dc51d4b8149d 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -211,6 +211,14 @@ const SCREENS = { QUICKBOOKS_ONLINE_CUSTOMERS: 'Policy_Accounting_Quickbooks_Online_Import_Customers', QUICKBOOKS_ONLINE_LOCATIONS: 'Policy_Accounting_Quickbooks_Online_Import_Locations', QUICKBOOKS_ONLINE_TAXES: 'Policy_Accounting_Quickbooks_Online_Import_Taxes', + QUICKBOOKS_ONLINE_EXPORT: 'Workspace_Accounting_Quickbooks_Online_Export', + QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Date_Select', + QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Invoice_Account_Select', + QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Company_Card_Expense_Select', + QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER: 'Workspace_Accounting_Quickbooks_Online_Export_Preferred_Exporter', + QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES: 'Workspace_Accounting_Quickbooks_Online_Export_Out_Of_Pocket_Expenses', + QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Out_Of_Pocket_Expenses_Select', + QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Out_Of_Pocket_Expenses_Account_Select', }, INITIAL: 'Workspace_Initial', PROFILE: 'Workspace_Profile', @@ -263,14 +271,6 @@ const SCREENS = { CREATE_DISTANCE_RATE: 'Create_Distance_Rate', DISTANCE_RATES_SETTINGS: 'Distance_Rates_Settings', DISTANCE_RATE_DETAILS: 'Distance_Rate_Details', - QUICKBOOKS_ONLINE_EXPORT: 'Workspace_Accounting_Quickbooks_Online_Export', - QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Date_Select', - QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Invoice_Account_Select', - QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Company_Card_Expense_Select', - QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER: 'Workspace_Accounting_Quickbooks_Online_Export_Preferred_Exporter', - QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES: 'Workspace_Accounting_Quickbooks_Online_Export_Out_Of_Pocket_Expenses', - QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Out_Of_Pocket_Expenses_Select', - QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT: 'Workspace_Accounting_Quickbooks_Online_Export_Out_Of_Pocket_Expenses_Account_Select', DISTANCE_RATE_EDIT: 'Distance_Rate_Edit', }, diff --git a/src/libs/API/parameters/UpdatePolicyConnectionConfigParams.ts b/src/libs/API/parameters/UpdatePolicyConnectionConfigParams.ts index c720fe0059c1..32146ec5322f 100644 --- a/src/libs/API/parameters/UpdatePolicyConnectionConfigParams.ts +++ b/src/libs/API/parameters/UpdatePolicyConnectionConfigParams.ts @@ -4,7 +4,7 @@ type UpdatePolicyConnectionConfigParams require('../../../../pages/settings/Profile/Contacts/ContactMethodDetailsPage').default as React.ComponentType, [SCREENS.SETTINGS.PROFILE.NEW_CONTACT_METHOD]: () => require('../../../../pages/settings/Profile/Contacts/NewContactMethodPage').default as React.ComponentType, [SCREENS.SETTINGS.PREFERENCES.PRIORITY_MODE]: () => require('../../../../pages/settings/Preferences/PriorityModePage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING]: () => require('@pages/workspace/accounting/WorkspaceAccountingPage').default as React.ComponentType, + [SCREENS.WORKSPACE.ACCOUNTING.ROOT]: () => require('../../../../pages/workspace/accounting/PolicyAccountingPage').default as React.ComponentType, [SCREENS.SETTINGS.PREFERENCES.LANGUAGE]: () => require('../../../../pages/settings/Preferences/LanguagePage').default as React.ComponentType, [SCREENS.SETTINGS.PREFERENCES.THEME]: () => require('../../../../pages/settings/Preferences/ThemePage').default as React.ComponentType, [SCREENS.SETTINGS.CLOSE]: () => require('../../../../pages/settings/Security/CloseAccountPage').default as React.ComponentType, @@ -255,20 +255,21 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName').default as React.ComponentType, [SCREENS.WORKSPACE.TAXES_SETTINGS_FOREIGN_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsForeignCurrency').default as React.ComponentType, [SCREENS.WORKSPACE.TAXES_SETTINGS_WORKSPACE_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsWorkspaceCurrency').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT]: () => require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT]: () => + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT]: () => + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage').default as React.ComponentType, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT]: () => require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT]: () => + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT]: () => require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT]: () => + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT]: () => require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES]: () => + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES]: () => require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT]: () => + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT]: () => require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT]: () => + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT]: () => require('../../../../pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage').default as React.ComponentType, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: () => + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: () => require('../../../../pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage').default as React.ComponentType, [SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default as React.ComponentType, [SCREENS.GET_ASSISTANCE]: () => require('../../../../pages/GetAssistancePage').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 f09e5383d6d6..7bb1a82fc465 100755 --- a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts +++ b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts @@ -25,14 +25,14 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial> = { SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_TAXES, SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_LOCATIONS, SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CUSTOMERS, - SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT, - SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT, - SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT, - SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT, - SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT, - SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER, - SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES, - SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT, + SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT, + SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT, + SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT, + SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT, + SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT, + SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER, + SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES, + SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT, ], [SCREENS.WORKSPACE.TAXES]: [ SCREENS.WORKSPACE.TAXES_SETTINGS, diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index bd43fa52a6c7..6d9548370ba1 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -269,20 +269,22 @@ const config: LinkingOptions['config'] = { [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CUSTOMERS]: {path: ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_CUSTOMERS.route}, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_LOCATIONS]: {path: ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_LOCATIONS.route}, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_TAXES]: {path: ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_TAXES.route}, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT.route}, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT.route}, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT.route}, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT]: { - path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT.route, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT]: {path: ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT.route}, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT]: {path: ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT.route}, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT]: {path: ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT.route}, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT]: { + path: ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT.route, }, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.route}, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT]: { - path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT.route, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES]: { + path: ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.route, }, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT]: { - path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.route, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT]: { + path: ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT.route, }, - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: {path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.route}, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT]: { + path: ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.route, + }, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: {path: ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.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 4b2fbc439468..b394f1b98968 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -262,6 +262,30 @@ type SettingsNavigatorParamList = { [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_TAXES]: { policyID: string; }; + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT]: { + policyID: string; + }; + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT]: { + policyID: string; + }; + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT]: { + policyID: string; + }; + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT]: { + policyID: string; + }; + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES]: { + policyID: string; + }; + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT]: { + policyID: string; + }; + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT]: { + policyID: string; + }; + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: { + policyID: string; + }; [SCREENS.GET_ASSISTANCE]: { backTo: Routes; }; @@ -681,9 +705,6 @@ type WorkspacesCentralPaneNavigatorParamList = { [SCREENS.WORKSPACE.MEMBERS]: { policyID: string; }; - [SCREENS.WORKSPACE.ACCOUNTING.ROOT]: { - policyID: string; - }; [SCREENS.WORKSPACE.CATEGORIES]: { policyID: string; }; @@ -701,28 +722,6 @@ type WorkspacesCentralPaneNavigatorParamList = { policyID: string; }; [SCREENS.WORKSPACE.ACCOUNTING.ROOT]: { - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT]: { - policyID: string; - }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT]: { - policyID: string; - }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT]: { - policyID: string; - }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT]: { - policyID: string; - }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES]: { - policyID: string; - }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT]: { - policyID: string; - }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT]: { - policyID: string; - }; - [SCREENS.WORKSPACE.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: { policyID: string; }; }; diff --git a/src/libs/actions/connections/index.ts b/src/libs/actions/connections/index.ts index 154036ba70e1..dd8234bf8800 100644 --- a/src/libs/actions/connections/index.ts +++ b/src/libs/actions/connections/index.ts @@ -46,7 +46,7 @@ function updatePolicyConnectionConfig Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT.getRoute(policyID)), + onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT.getRoute(policyID)), }, { icon: Expensicons.Gear, diff --git a/src/pages/workspace/accounting/qbo/QuickbooksChartOfAccountsPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksChartOfAccountsPage.tsx index 10f7500b3ca1..723ac4822424 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksChartOfAccountsPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksChartOfAccountsPage.tsx @@ -50,7 +50,7 @@ function QuickbooksChartOfAccountsPage({policy}: WithPolicyProps) { Connections.updatePolicyConnectionConfig( policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, - CONST.QUICKBOOKS_IMPORTS.ENABLE_NEW_CATEGORIES, + CONST.QUICK_BOOKS_CONFIG.ENABLE_NEW_CATEGORIES, isSwitchOn ? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE : CONST.INTEGRATION_ENTITY_MAP_TYPES.TAG, ) } diff --git a/src/pages/workspace/accounting/qbo/QuickbooksClassesPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksClassesPage.tsx index 62a0a65ac91c..42f4e7e3f728 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksClassesPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksClassesPage.tsx @@ -52,7 +52,7 @@ function QuickbooksClassesPage({policy}: WithPolicyProps) { Connections.updatePolicyConnectionConfig( policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, - CONST.QUICKBOOKS_IMPORTS.SYNC_CLASSES, + CONST.QUICK_BOOKS_CONFIG.SYNC_CLASSES, isSwitchOn ? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE : CONST.INTEGRATION_ENTITY_MAP_TYPES.TAG, ) } diff --git a/src/pages/workspace/accounting/qbo/QuickbooksCustomersPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksCustomersPage.tsx index 3192ff4d83a9..644bd070327c 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksCustomersPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksCustomersPage.tsx @@ -51,7 +51,7 @@ function QuickbooksCustomersPage({policy}: WithPolicyProps) { Connections.updatePolicyConnectionConfig( policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, - CONST.QUICKBOOKS_IMPORTS.SYNC_CUSTOMERS, + CONST.QUICK_BOOKS_CONFIG.SYNC_CUSTOMERS, isSwitchOn ? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE : CONST.INTEGRATION_ENTITY_MAP_TYPES.TAG, ) } diff --git a/src/pages/workspace/accounting/qbo/QuickbooksLocationsPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksLocationsPage.tsx index fa573b813585..06635b1fe7db 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksLocationsPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksLocationsPage.tsx @@ -52,7 +52,7 @@ function QuickbooksLocationsPage({policy}: WithPolicyProps) { Connections.updatePolicyConnectionConfig( policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, - CONST.QUICKBOOKS_IMPORTS.SYNC_LOCATIONS, + CONST.QUICK_BOOKS_CONFIG.SYNC_LOCATIONS, isSwitchOn ? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE : CONST.INTEGRATION_ENTITY_MAP_TYPES.TAG, ) } diff --git a/src/pages/workspace/accounting/qbo/QuickbooksTaxesPage.tsx b/src/pages/workspace/accounting/qbo/QuickbooksTaxesPage.tsx index 215d8397b7ec..714e2638583e 100644 --- a/src/pages/workspace/accounting/qbo/QuickbooksTaxesPage.tsx +++ b/src/pages/workspace/accounting/qbo/QuickbooksTaxesPage.tsx @@ -49,7 +49,7 @@ function QuickbooksTaxesPage({policy}: WithPolicyProps) { Connections.updatePolicyConnectionConfig( policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, - CONST.QUICKBOOKS_IMPORTS.SYNC_TAXES, + CONST.QUICK_BOOKS_CONFIG.SYNC_TAXES, isSwitchOn ? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE : CONST.INTEGRATION_ENTITY_MAP_TYPES.TAG, ) } diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx index 9b207868e83b..58b58163d4ab 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx @@ -9,10 +9,10 @@ import type {ListItem, Section} from '@components/SelectionList/types'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import * as Connections from '@libs/actions/connections'; import Navigation from '@navigation/Navigation'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; -import * as Policy from '@userActions/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -68,9 +68,9 @@ function QuickbooksCompanyCardExpenseAccountSelectPage({policy}: WithPolicyProps const onSelectRow = useCallback( (row: CardListItem) => { if (row.value !== exportCompanyCard) { - Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_COMPANY_CARD, row.value); + Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.EXPORT_COMPANY_CARD, row.value); } - Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT.getRoute(policyID)); + Navigation.goBack(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT.getRoute(policyID)); }, [exportCompanyCard, policyID], ); @@ -78,7 +78,6 @@ function QuickbooksCompanyCardExpenseAccountSelectPage({policy}: WithPolicyProps return ( diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx index cff82c6cad6a..db1fa57047c8 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx @@ -25,31 +25,31 @@ function QuickbooksExportConfigurationPage({policy}: WithPolicyProps) { const menuItems: MenuItemProps[] = [ { description: translate('workspace.qbo.preferredExporter'), - onPress: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.getRoute(policyID)), + onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.getRoute(policyID)), brickRoadIndicator: errors?.exporter ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exporter ?? policyOwner, }, { description: translate('workspace.qbo.date'), - onPress: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT.getRoute(policyID)), + onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT.getRoute(policyID)), brickRoadIndicator: errors?.exportDate ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportDate ? translate(`workspace.qbo.${exportDate}.label`) : undefined, }, { description: translate('workspace.qbo.exportExpenses'), - onPress: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)), + onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)), brickRoadIndicator: errors?.exportExpenses ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportEntity ? translate(`workspace.qbo.${exportEntity}`) : undefined, }, { description: translate('workspace.qbo.exportInvoices'), - onPress: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT.getRoute(policyID)), + onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT.getRoute(policyID)), brickRoadIndicator: errors?.exportInvoice ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportInvoice, }, { description: translate('workspace.qbo.exportCompany'), - onPress: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.getRoute(policyID)), + onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.getRoute(policyID)), brickRoadIndicator: errors?.exportCompanyCard ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportCompanyCard, }, diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx index 38e326ff6694..3b92ec196628 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx @@ -9,10 +9,10 @@ import type {ListItem} from '@components/SelectionList/types'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import * as Connections from '@libs/actions/connections'; import Navigation from '@navigation/Navigation'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; -import * as Policy from '@userActions/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -35,9 +35,9 @@ function QuickbooksExportDateSelectPage({policy}: WithPolicyProps) { const onSelectRow = useCallback( (row: CardListItem) => { if (row.value !== exportDate) { - Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_DATE, row.value); + Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.EXPORT_DATE, row.value); } - Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT.getRoute(policyID)); + Navigation.goBack(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT.getRoute(policyID)); }, [exportDate, policyID], ); diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx index 51ec82f65d0a..857e4ca871ae 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx @@ -8,10 +8,10 @@ import type {ListItem} from '@components/SelectionList/types'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import * as Connections from '@libs/actions/connections'; import Navigation from '@navigation/Navigation'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; -import * as Policy from '@userActions/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -50,9 +50,9 @@ function QuickbooksExportInvoiceAccountSelectPage({policy}: WithPolicyProps) { const onSelectRow = useCallback( (row: CardListItem) => { if (row.value !== exportInvoice) { - Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_INVOICE, row.value); + Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.EXPORT_INVOICE, row.value); } - Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT.getRoute(policyID)); + Navigation.goBack(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT.getRoute(policyID)); }, [exportInvoice, policyID], ); diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx index 4af0e8ad4261..07b6347f9497 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx @@ -8,10 +8,10 @@ import type {ListItem} from '@components/SelectionList/types'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import * as Connections from '@libs/actions/connections'; import Navigation from '@navigation/Navigation'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; -import * as Policy from '@userActions/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -65,9 +65,9 @@ function QuickbooksOutOfPocketExpenseAccountSelectPage({policy}: WithPolicyProps const onSelectRow = useCallback( (row: CardListItem) => { if (row.value !== exportAccount) { - Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_ACCOUNT, row.value); + Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.EXPORT_ACCOUNT, row.value); } - Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)); + Navigation.goBack(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)); }, [exportAccount, policyID], ); diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx index 8741843066e3..c36f6725e0d1 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx @@ -37,7 +37,7 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyProps title={exportEntity ? translate(`workspace.qbo.${exportEntity}`) : undefined} description={translate('workspace.qbo.exportAs')} error={exportEntity && (showTaxError || showLocationError) ? translate(`workspace.qbo.${exportEntity}Error`) : undefined} - onPress={() => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT.getRoute(policyID))} + onPress={() => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT.getRoute(policyID))} brickRoadIndicator={brickEntityRoadIndicator ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} shouldShowRightIcon /> @@ -51,7 +51,7 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyProps Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT.getRoute(policyID))} + onPress={() => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT.getRoute(policyID))} brickRoadIndicator={errors?.exportAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} shouldShowRightIcon /> diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx index 7ec7fe632d96..fb85a4f7518d 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx @@ -10,10 +10,10 @@ import type {ListItem, Section} from '@components/SelectionList/types'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import * as Connections from '@libs/actions/connections'; import Navigation from '@navigation/Navigation'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; -import * as Policy from '@userActions/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -37,7 +37,7 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyProps) if (!isTaxError && !isLocationError) { return; } - Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_ENTITY, ''); + Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.EXPORT_ENTITY, null); }, [policyID, isTaxError, isLocationError]); const data: CardListItem[] = useMemo( @@ -72,9 +72,9 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyProps) const onSelectRow = useCallback( (row: CardListItem) => { if (row.value !== exportEntity) { - Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.EXPORT_ENTITY, row.value); + Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.EXPORT_ENTITY, row.value); } - Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)); + Navigation.goBack(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)); }, [exportEntity, policyID], ); diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx index d86ed1e8d783..d9a151888269 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx @@ -8,11 +8,11 @@ import type {ListItem} from '@components/SelectionList/types'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import * as Connections from '@libs/actions/connections'; import {getAdminEmailList} from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; -import * as Policy from '@userActions/Policy'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -51,9 +51,9 @@ function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { const onSelectRow = useCallback( (row: CardListItem) => { if (row.value !== exporter) { - Policy.updatePolicyConnectionConfig(policyID, CONST.QUICK_BOOKS_CONFIG.PREFERRED_EXPORTER, row.value); + Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.PREFERRED_EXPORTER, row.value); } - Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.getRoute(policyID)); + Navigation.goBack(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.getRoute(policyID)); }, [policyID, exporter], ); From aee7789c3f72ed71041d1a9b98c12d309e0ae37e Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Thu, 18 Apr 2024 11:58:53 +0300 Subject: [PATCH 21/39] address c+ comments --- src/libs/PolicyUtils.ts | 16 ++++------ ...oksCompanyCardExpenseAccountSelectPage.tsx | 6 ++-- .../QuickbooksExportConfigurationPage.tsx | 1 + .../export/QuickbooksExportDateSelectPage.tsx | 17 +++++------ ...ickbooksExportInvoiceAccountSelectPage.tsx | 18 +++++------- ...oksOutOfPocketExpenseAccountSelectPage.tsx | 18 +++++------- ...oksOutOfPocketExpenseConfigurationPage.tsx | 11 +++---- ...ooksOutOfPocketExpenseEntitySelectPage.tsx | 7 ++--- ...ooksPreferredExporterConfigurationPage.tsx | 29 +++++++++---------- 9 files changed, 54 insertions(+), 69 deletions(-) diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index 85a20ceaf512..503f853409e9 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -319,17 +319,11 @@ function getPolicyIDFromNavigationState() { } function getAdminEmailList(policy: Policy | null) { - const adminEmailList: Array<{email: string}> = []; - if (!policy?.employeeList) { - return adminEmailList; - } - Object.keys(policy.employeeList).forEach((email: string) => { - if (policy?.employeeList?.[email].role !== CONST.POLICY.ROLE.ADMIN) { - return; - } - adminEmailList.push({email}); - }); - return adminEmailList; + return Object.values(policy?.employeeList ?? {}) + .filter((employee) => employee.email && employee.role === CONST.POLICY.ROLE.ADMIN) + .map((employee) => ({ + email: employee.email as string, + })); } export { diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx index 58b58163d4ab..06bc3172019d 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx @@ -1,5 +1,5 @@ import React, {useCallback, useMemo} from 'react'; -import type {SectionListData} from 'react-native'; +import {SectionListData, View} from 'react-native'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; import ScrollView from '@components/ScrollView'; @@ -81,7 +81,7 @@ function QuickbooksCompanyCardExpenseAccountSelectPage({policy}: WithPolicyProps testID={QuickbooksCompanyCardExpenseAccountSelectPage.displayName} > - + {translate('workspace.qbo.exportCompanyCardsDescription')}} sections={sections} @@ -90,7 +90,7 @@ function QuickbooksCompanyCardExpenseAccountSelectPage({policy}: WithPolicyProps initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} footerContent={isLocationEnabled && {translate('workspace.qbo.companyCardsLocationEnabledDescription')}} /> - + ); } diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx index db1fa57047c8..f8e03f816df6 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx @@ -57,6 +57,7 @@ function QuickbooksExportConfigurationPage({policy}: WithPolicyProps) { description: translate('workspace.qbo.exportExpensifyCard'), title: translate('workspace.qbo.creditCard'), shouldShowRightIcon: false, + interactive: false, }, ]; diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx index 3b92ec196628..f3ee8f58a6f0 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx @@ -2,7 +2,6 @@ import React, {useCallback} from 'react'; import type {ValueOf} from 'type-fest'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; -import ScrollView from '@components/ScrollView'; import SelectionList from '@components/SelectionList'; import RadioListItem from '@components/SelectionList/RadioListItem'; import type {ListItem} from '@components/SelectionList/types'; @@ -48,15 +47,13 @@ function QuickbooksExportDateSelectPage({policy}: WithPolicyProps) { testID={QuickbooksExportDateSelectPage.displayName} > - - {translate('workspace.qbo.exportDateDescription')}} - sections={[{data}]} - ListItem={RadioListItem} - onSelectRow={onSelectRow} - initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} - /> - + {translate('workspace.qbo.exportDateDescription')}} + sections={[{data}]} + ListItem={RadioListItem} + onSelectRow={onSelectRow} + initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} + /> ); } diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx index 857e4ca871ae..5914ee33fc44 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx @@ -1,7 +1,6 @@ import React, {useCallback, useMemo} from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; -import ScrollView from '@components/ScrollView'; import SelectionList from '@components/SelectionList'; import RadioListItem from '@components/SelectionList/RadioListItem'; import type {ListItem} from '@components/SelectionList/types'; @@ -63,15 +62,14 @@ function QuickbooksExportInvoiceAccountSelectPage({policy}: WithPolicyProps) { testID={QuickbooksExportInvoiceAccountSelectPage.displayName} > - - {translate('workspace.qbo.exportInvoicesDescription')}} - sections={[{data}]} - ListItem={RadioListItem} - onSelectRow={onSelectRow} - initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} - /> - + {translate('workspace.qbo.exportInvoicesDescription')}} + sections={[{data}]} + ListItem={RadioListItem} + onSelectRow={onSelectRow} + initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} + /> ); } diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx index 07b6347f9497..a364b1d173e5 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx @@ -1,7 +1,6 @@ import React, {useCallback, useMemo} from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; -import ScrollView from '@components/ScrollView'; import SelectionList from '@components/SelectionList'; import RadioListItem from '@components/SelectionList/RadioListItem'; import type {ListItem} from '@components/SelectionList/types'; @@ -78,15 +77,14 @@ function QuickbooksOutOfPocketExpenseAccountSelectPage({policy}: WithPolicyProps testID={QuickbooksOutOfPocketExpenseAccountSelectPage.displayName} > - - {translate('workspace.qbo.accountsPayableDescription')}} - sections={[{data}]} - ListItem={RadioListItem} - onSelectRow={onSelectRow} - initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} - /> - + {translate('workspace.qbo.accountsPayableDescription')}} + sections={[{data}]} + ListItem={RadioListItem} + onSelectRow={onSelectRow} + initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} + /> ); } diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx index c36f6725e0d1..263b66a87ebf 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx @@ -20,9 +20,9 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyProps const {syncLocations, exportAccount, exportEntity, errors, syncTaxes} = policy?.connections?.quickbooksOnline?.config ?? {}; const isLocationEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); const isTaxesEnabled = Boolean(syncTaxes && syncTaxes !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); - const showTaxError = isTaxesEnabled && exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY; - const showLocationError = isLocationEnabled && exportEntity !== CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY; - const brickEntityRoadIndicator = Boolean(errors?.exportEntity) || showTaxError || showLocationError; + const shouldShowTaxError = isTaxesEnabled && exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY; + const shouldShowLocationError = isLocationEnabled && exportEntity !== CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY; + const hasErrors = Boolean(errors?.exportEntity) || shouldShowTaxError || shouldShowLocationError; return ( Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT.getRoute(policyID))} - brickRoadIndicator={brickEntityRoadIndicator ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} + brickRoadIndicator={hasErrors ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} shouldShowRightIcon /> @@ -54,6 +54,7 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyProps onPress={() => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT.getRoute(policyID))} brickRoadIndicator={errors?.exportAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} shouldShowRightIcon + error={errors?.exportAccount ? translate('common.genericErrorMessage') : undefined} /> )} diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx index fb85a4f7518d..cbf3593e5895 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx @@ -1,9 +1,8 @@ import React, {useCallback, useEffect, useMemo} from 'react'; -import type {SectionListData} from 'react-native'; +import {SectionListData, View} from 'react-native'; import type {ValueOf} from 'type-fest'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; -import ScrollView from '@components/ScrollView'; import SelectionList from '@components/SelectionList'; import RadioListItem from '@components/SelectionList/RadioListItem'; import type {ListItem, Section} from '@components/SelectionList/types'; @@ -85,7 +84,7 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyProps) testID={QuickbooksOutOfPocketExpenseEntitySelectPage.displayName} > - + {translate('workspace.qbo.optionBelow')}} sections={sections} @@ -94,7 +93,7 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyProps) initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} footerContent={isTaxesEnabled && {translate('workspace.qbo.outOfPocketTaxEnabledDescription')}} /> - + ); } diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx index d9a151888269..7008822f0e2d 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx @@ -1,7 +1,6 @@ import React, {useCallback, useMemo} from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; -import ScrollView from '@components/ScrollView'; import SelectionList from '@components/SelectionList'; import RadioListItem from '@components/SelectionList/RadioListItem'; import type {ListItem} from '@components/SelectionList/types'; @@ -64,21 +63,19 @@ function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { testID={QuickBooksExportPreferredExporterPage.displayName} > - - - {translate('workspace.qbo.exportPreferredExporterNote')} - {translate('workspace.qbo.exportPreferredExporterSubNote')} - - } - shouldStopPropagation - sections={[{data}]} - ListItem={RadioListItem} - onSelectRow={onSelectRow} - initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} - /> - + + {translate('workspace.qbo.exportPreferredExporterNote')} + {translate('workspace.qbo.exportPreferredExporterSubNote')} + + } + sections={[{data}]} + ListItem={RadioListItem} + onSelectRow={onSelectRow} + initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} + /> ); } From 3984f0c75be3f11e652aedc965a1f317a371aa81 Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Thu, 18 Apr 2024 12:13:22 +0300 Subject: [PATCH 22/39] add offline pending actions --- src/libs/PolicyUtils.ts | 4 ++-- ...ooksCompanyCardExpenseAccountSelectPage.tsx | 1 - .../QuickbooksExportConfigurationPage.tsx | 18 ++++++++++++++---- ...ooksOutOfPocketExpenseConfigurationPage.tsx | 6 +++--- ...booksOutOfPocketExpenseEntitySelectPage.tsx | 3 ++- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index 503f853409e9..6594aeb49baf 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -320,9 +320,9 @@ function getPolicyIDFromNavigationState() { function getAdminEmailList(policy: Policy | null) { return Object.values(policy?.employeeList ?? {}) - .filter((employee) => employee.email && employee.role === CONST.POLICY.ROLE.ADMIN) + .filter((employee) => employee.role === CONST.POLICY.ROLE.ADMIN) .map((employee) => ({ - email: employee.email as string, + email: employee.email ?? '', })); } diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx index 06bc3172019d..5395c80f2e8a 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx @@ -2,7 +2,6 @@ import React, {useCallback, useMemo} from 'react'; import {SectionListData, View} from 'react-native'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; -import ScrollView from '@components/ScrollView'; import SelectionList from '@components/SelectionList'; import RadioListItem from '@components/SelectionList/RadioListItem'; import type {ListItem, Section} from '@components/SelectionList/types'; diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx index f8e03f816df6..102c09efe1c9 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx @@ -2,7 +2,7 @@ import React from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import type {MenuItemProps} from '@components/MenuItem'; import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; -import OfflineWithFeedback from '@components/OfflineWithFeedback'; +import OfflineWithFeedback, {OfflineWithFeedbackProps} from '@components/OfflineWithFeedback'; import ScreenWrapper from '@components/ScreenWrapper'; import ScrollView from '@components/ScrollView'; import Text from '@components/Text'; @@ -16,42 +16,49 @@ import * as Link from '@userActions/Link'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; +type MenuItem = MenuItemProps & {pendingAction?: OfflineWithFeedbackProps['pendingAction']}; + function QuickbooksExportConfigurationPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); const policyID = policy?.id ?? ''; const policyOwner = policy?.owner ?? ''; - const {exporter, exportDate, exportEntity, exportInvoice, exportCompanyCard, errors} = policy?.connections?.quickbooksOnline?.config ?? {}; - const menuItems: MenuItemProps[] = [ + const {exporter, exportDate, exportEntity, exportInvoice, exportCompanyCard, errors, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {}; + const menuItems: MenuItem[] = [ { description: translate('workspace.qbo.preferredExporter'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.getRoute(policyID)), brickRoadIndicator: errors?.exporter ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exporter ?? policyOwner, + pendingAction: pendingFields?.exporter, }, { description: translate('workspace.qbo.date'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT.getRoute(policyID)), brickRoadIndicator: errors?.exportDate ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportDate ? translate(`workspace.qbo.${exportDate}.label`) : undefined, + pendingAction: pendingFields?.exportDate, }, { description: translate('workspace.qbo.exportExpenses'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)), brickRoadIndicator: errors?.exportExpenses ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportEntity ? translate(`workspace.qbo.${exportEntity}`) : undefined, + pendingAction: pendingFields?.exportEntity, }, { description: translate('workspace.qbo.exportInvoices'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT.getRoute(policyID)), brickRoadIndicator: errors?.exportInvoice ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportInvoice, + pendingAction: pendingFields?.exportInvoice, }, { description: translate('workspace.qbo.exportCompany'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.getRoute(policyID)), brickRoadIndicator: errors?.exportCompanyCard ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportCompanyCard, + pendingAction: pendingFields?.exportCompanyCard, }, { description: translate('workspace.qbo.exportExpensifyCard'), @@ -70,7 +77,10 @@ function QuickbooksExportConfigurationPage({policy}: WithPolicyProps) { {translate('workspace.qbo.exportDescription')} {menuItems.map((menuItem) => ( - + {!isLocationEnabled && {translate('workspace.qbo.exportOutOfPocketExpensesDescription')}} - + {translate('workspace.qbo.outOfPocketLocationEnabledDescription')}} {!isLocationEnabled && ( - + Date: Thu, 18 Apr 2024 12:26:11 +0300 Subject: [PATCH 23/39] lint --- .../export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx | 3 ++- .../qbo/export/QuickbooksExportConfigurationPage.tsx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx index 5395c80f2e8a..ee797f9e4bd9 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx @@ -1,5 +1,6 @@ import React, {useCallback, useMemo} from 'react'; -import {SectionListData, View} from 'react-native'; +import {View} from 'react-native'; +import type {SectionListData} from 'react-native'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; import SelectionList from '@components/SelectionList'; diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx index 102c09efe1c9..e2f8b3ee3352 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx @@ -2,7 +2,8 @@ import React from 'react'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import type {MenuItemProps} from '@components/MenuItem'; import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; -import OfflineWithFeedback, {OfflineWithFeedbackProps} from '@components/OfflineWithFeedback'; +import OfflineWithFeedback from '@components/OfflineWithFeedback'; +import type {OfflineWithFeedbackProps} from '@components/OfflineWithFeedback'; import ScreenWrapper from '@components/ScreenWrapper'; import ScrollView from '@components/ScrollView'; import Text from '@components/Text'; From fb4f6daa7e7f885f5c1ac0559151608e59e4bf5b Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Thu, 18 Apr 2024 13:38:02 +0300 Subject: [PATCH 24/39] updates after design review --- src/languages/en.ts | 4 ++-- .../qbo/export/QuickbooksExportConfigurationPage.tsx | 3 ++- .../export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 68ba2b6378a3..979580c4e6d3 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1894,7 +1894,7 @@ export default { exportPreferredExporterSubNote: 'Once set, the preferred exporter will see reports for export in their account.', exportOutOfPocketExpensesDescription: 'Set how out-of-pocket expenses export to QuickBooks Online.', exportVendorBillDescription: - 'We`ll create a single itemized vendor bill for each Expensify report. If the period of the bill is closed, we`ll post to the 1st of the next open period. You can add the vendor bill to your A/P account of choice (below).', + "We'll create a single itemized vendor bill for each Expensify report. If the period of the bill is closed, we'll post to the 1st of the next open period. You can add the vendor bill to your A/P account of choice (below).", check: 'Check', accountsPayable: 'Accounts Payable', accountsPayableDescription: 'This is your chosen A/P account, against which vendor bills for each report are created.', @@ -1906,7 +1906,7 @@ export default { companyCardsLocationEnabledDescription: 'Note: QuickBooks Online does not support a field for Locations as Tags on Vendor Bills exports. As you import Locations from, this this export option is unavailable.', outOfPocketTaxEnabledDescription: - 'Note: QuickBooks Online doesn`t support a field for tax on Journal Entry exports. Because you have tax tracking enabled on your workspace, this export option is unavailable.', + "Note: QuickBooks Online doesn't support a field for tax on Journal Entry exports. Because you have tax tracking enabled on your workspace, this export option is unavailable.", outOfPocketTaxEnabledError: 'Journal entry is not available when taxes enabled. please select a different export option.', outOfPocketLocationEnabledError: 'Vendor Bills are not available when locations are enabled. Please select a different export option.', outOfPocketLocationEnabledDescription: diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx index e2f8b3ee3352..439c5e6cadbb 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx @@ -88,7 +88,8 @@ function QuickbooksExportConfigurationPage({policy}: WithPolicyProps) { description={menuItem.description} shouldShowRightIcon={menuItem?.shouldShowRightIcon ?? true} onPress={menuItem?.onPress} - brickRoadIndicator={menuItem.brickRoadIndicator} + brickRoadIndicator={menuItem?.brickRoadIndicator} + error={menuItem?.brickRoadIndicator ? translate('common.genericErrorMessage') : undefined} /> ))} diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx index 47715388dddb..ab7c5f1816f0 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx @@ -43,9 +43,9 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyProps /> {exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL && !isLocationEnabled && ( - {translate('workspace.qbo.exportVendorBillDescription')} + {translate('workspace.qbo.exportVendorBillDescription')} )} - {isLocationEnabled && {translate('workspace.qbo.outOfPocketLocationEnabledDescription')}} + {isLocationEnabled && {translate('workspace.qbo.outOfPocketLocationEnabledDescription')}} {!isLocationEnabled && ( Date: Thu, 18 Apr 2024 17:33:31 +0300 Subject: [PATCH 25/39] add wrappers for permission checks --- ...oksCompanyCardExpenseAccountSelectPage.tsx | 43 ++++++---- .../QuickbooksExportConfigurationPage.tsx | 77 ++++++++++-------- .../export/QuickbooksExportDateSelectPage.tsx | 35 +++++--- ...ickbooksExportInvoiceAccountSelectPage.tsx | 37 +++++---- ...oksOutOfPocketExpenseAccountSelectPage.tsx | 37 +++++---- ...oksOutOfPocketExpenseConfigurationPage.tsx | 79 +++++++++++-------- ...ooksOutOfPocketExpenseEntitySelectPage.tsx | 43 ++++++---- ...ooksPreferredExporterConfigurationPage.tsx | 47 ++++++----- 8 files changed, 237 insertions(+), 161 deletions(-) diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx index ee797f9e4bd9..05bd303bfa3a 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage.tsx @@ -11,6 +11,8 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections'; import Navigation from '@navigation/Navigation'; +import AdminPolicyAccessOrNotFoundWrapper from '@pages/workspace/AdminPolicyAccessOrNotFoundWrapper'; +import FeatureEnabledAccessOrNotFoundWrapper from '@pages/workspace/FeatureEnabledAccessOrNotFoundWrapper'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; import CONST from '@src/CONST'; @@ -76,22 +78,31 @@ function QuickbooksCompanyCardExpenseAccountSelectPage({policy}: WithPolicyProps ); return ( - - - - {translate('workspace.qbo.exportCompanyCardsDescription')}} - sections={sections} - ListItem={RadioListItem} - onSelectRow={onSelectRow} - initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} - footerContent={isLocationEnabled && {translate('workspace.qbo.companyCardsLocationEnabledDescription')}} - /> - - + + + + + + {translate('workspace.qbo.exportCompanyCardsDescription')}} + sections={sections} + ListItem={RadioListItem} + onSelectRow={onSelectRow} + initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} + footerContent={ + isLocationEnabled && {translate('workspace.qbo.companyCardsLocationEnabledDescription')} + } + /> + + + + ); } diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx index 439c5e6cadbb..ba87111d8f8a 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx @@ -11,6 +11,8 @@ import TextLink from '@components/TextLink'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@navigation/Navigation'; +import AdminPolicyAccessOrNotFoundWrapper from '@pages/workspace/AdminPolicyAccessOrNotFoundWrapper'; +import FeatureEnabledAccessOrNotFoundWrapper from '@pages/workspace/FeatureEnabledAccessOrNotFoundWrapper'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; import * as Link from '@userActions/Link'; @@ -70,40 +72,47 @@ function QuickbooksExportConfigurationPage({policy}: WithPolicyProps) { ]; return ( - - - - {translate('workspace.qbo.exportDescription')} - {menuItems.map((menuItem) => ( - - - - ))} - - {`${translate('workspace.qbo.deepDiveExpensifyCard')} `} - Link.openExternalLink(CONST.DEEP_DIVE_EXPENSIFY_CARD)} - style={[styles.mutedNormalTextLabel, styles.link]} - > - {translate('workspace.qbo.deepDiveExpensifyCardIntegration')} - - - - + + + + + + {translate('workspace.qbo.exportDescription')} + {menuItems.map((menuItem) => ( + + + + ))} + + {`${translate('workspace.qbo.deepDiveExpensifyCard')} `} + Link.openExternalLink(CONST.DEEP_DIVE_EXPENSIFY_CARD)} + style={[styles.mutedNormalTextLabel, styles.link]} + > + {translate('workspace.qbo.deepDiveExpensifyCardIntegration')} + + + + + + ); } diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx index f3ee8f58a6f0..5db9126f1860 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage.tsx @@ -10,6 +10,8 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections'; import Navigation from '@navigation/Navigation'; +import AdminPolicyAccessOrNotFoundWrapper from '@pages/workspace/AdminPolicyAccessOrNotFoundWrapper'; +import FeatureEnabledAccessOrNotFoundWrapper from '@pages/workspace/FeatureEnabledAccessOrNotFoundWrapper'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; import CONST from '@src/CONST'; @@ -42,19 +44,26 @@ function QuickbooksExportDateSelectPage({policy}: WithPolicyProps) { ); return ( - - - {translate('workspace.qbo.exportDateDescription')}} - sections={[{data}]} - ListItem={RadioListItem} - onSelectRow={onSelectRow} - initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} - /> - + + + + + {translate('workspace.qbo.exportDateDescription')}} + sections={[{data}]} + ListItem={RadioListItem} + onSelectRow={onSelectRow} + initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} + /> + + + ); } diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx index 5914ee33fc44..7f41f2af8824 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx @@ -9,6 +9,8 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections'; import Navigation from '@navigation/Navigation'; +import AdminPolicyAccessOrNotFoundWrapper from '@pages/workspace/AdminPolicyAccessOrNotFoundWrapper'; +import FeatureEnabledAccessOrNotFoundWrapper from '@pages/workspace/FeatureEnabledAccessOrNotFoundWrapper'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; import CONST from '@src/CONST'; @@ -57,20 +59,27 @@ function QuickbooksExportInvoiceAccountSelectPage({policy}: WithPolicyProps) { ); return ( - - - {translate('workspace.qbo.exportInvoicesDescription')}} - sections={[{data}]} - ListItem={RadioListItem} - onSelectRow={onSelectRow} - initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} - /> - + + + + + {translate('workspace.qbo.exportInvoicesDescription')}} + sections={[{data}]} + ListItem={RadioListItem} + onSelectRow={onSelectRow} + initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} + /> + + + ); } diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx index a364b1d173e5..fead7836442b 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx @@ -9,6 +9,8 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections'; import Navigation from '@navigation/Navigation'; +import AdminPolicyAccessOrNotFoundWrapper from '@pages/workspace/AdminPolicyAccessOrNotFoundWrapper'; +import FeatureEnabledAccessOrNotFoundWrapper from '@pages/workspace/FeatureEnabledAccessOrNotFoundWrapper'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; import CONST from '@src/CONST'; @@ -72,20 +74,27 @@ function QuickbooksOutOfPocketExpenseAccountSelectPage({policy}: WithPolicyProps ); return ( - - - {translate('workspace.qbo.accountsPayableDescription')}} - sections={[{data}]} - ListItem={RadioListItem} - onSelectRow={onSelectRow} - initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} - /> - + + + + + {translate('workspace.qbo.accountsPayableDescription')}} + sections={[{data}]} + ListItem={RadioListItem} + onSelectRow={onSelectRow} + initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} + /> + + + ); } diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx index ab7c5f1816f0..f1fe2052913c 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx @@ -8,6 +8,8 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@navigation/Navigation'; +import AdminPolicyAccessOrNotFoundWrapper from '@pages/workspace/AdminPolicyAccessOrNotFoundWrapper'; +import FeatureEnabledAccessOrNotFoundWrapper from '@pages/workspace/FeatureEnabledAccessOrNotFoundWrapper'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; import CONST from '@src/CONST'; @@ -25,41 +27,48 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyProps const hasErrors = Boolean(errors?.exportEntity) || shouldShowTaxError || shouldShowLocationError; return ( - - - - {!isLocationEnabled && {translate('workspace.qbo.exportOutOfPocketExpensesDescription')}} - - Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT.getRoute(policyID))} - brickRoadIndicator={hasErrors ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} - shouldShowRightIcon - /> - - {exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL && !isLocationEnabled && ( - {translate('workspace.qbo.exportVendorBillDescription')} - )} - {isLocationEnabled && {translate('workspace.qbo.outOfPocketLocationEnabledDescription')}} - {!isLocationEnabled && ( - - Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT.getRoute(policyID))} - brickRoadIndicator={errors?.exportAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} - shouldShowRightIcon - error={errors?.exportAccount ? translate('common.genericErrorMessage') : undefined} - /> - - )} - - + + + + + + {!isLocationEnabled && {translate('workspace.qbo.exportOutOfPocketExpensesDescription')}} + + Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT.getRoute(policyID))} + brickRoadIndicator={hasErrors ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} + shouldShowRightIcon + /> + + {exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL && !isLocationEnabled && ( + {translate('workspace.qbo.exportVendorBillDescription')} + )} + {isLocationEnabled && {translate('workspace.qbo.outOfPocketLocationEnabledDescription')}} + {!isLocationEnabled && ( + + Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT.getRoute(policyID))} + brickRoadIndicator={errors?.exportAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} + shouldShowRightIcon + error={errors?.exportAccount ? translate('common.genericErrorMessage') : undefined} + /> + + )} + + + + ); } diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx index 9c7c9a84465b..63c96e25bb31 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx @@ -12,6 +12,8 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections'; import Navigation from '@navigation/Navigation'; +import AdminPolicyAccessOrNotFoundWrapper from '@pages/workspace/AdminPolicyAccessOrNotFoundWrapper'; +import FeatureEnabledAccessOrNotFoundWrapper from '@pages/workspace/FeatureEnabledAccessOrNotFoundWrapper'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; import CONST from '@src/CONST'; @@ -80,22 +82,31 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyProps) ); return ( - - - - {translate('workspace.qbo.optionBelow')}} - sections={sections} - ListItem={RadioListItem} - onSelectRow={onSelectRow} - initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} - footerContent={isTaxesEnabled && {translate('workspace.qbo.outOfPocketTaxEnabledDescription')}} - /> - - + + + + + + {translate('workspace.qbo.optionBelow')}} + sections={sections} + ListItem={RadioListItem} + onSelectRow={onSelectRow} + initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} + footerContent={ + isTaxesEnabled && {translate('workspace.qbo.outOfPocketTaxEnabledDescription')} + } + /> + + + + ); } diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx index 7008822f0e2d..b0bba1a4e7e7 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx @@ -10,6 +10,8 @@ import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections'; import {getAdminEmailList} from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; +import AdminPolicyAccessOrNotFoundWrapper from '@pages/workspace/AdminPolicyAccessOrNotFoundWrapper'; +import FeatureEnabledAccessOrNotFoundWrapper from '@pages/workspace/FeatureEnabledAccessOrNotFoundWrapper'; import withPolicy from '@pages/workspace/withPolicy'; import type {WithPolicyProps} from '@pages/workspace/withPolicy'; import CONST from '@src/CONST'; @@ -58,25 +60,32 @@ function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { ); return ( - - - - {translate('workspace.qbo.exportPreferredExporterNote')} - {translate('workspace.qbo.exportPreferredExporterSubNote')} - - } - sections={[{data}]} - ListItem={RadioListItem} - onSelectRow={onSelectRow} - initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} - /> - + + + + + + {translate('workspace.qbo.exportPreferredExporterNote')} + {translate('workspace.qbo.exportPreferredExporterSubNote')} + + } + sections={[{data}]} + ListItem={RadioListItem} + onSelectRow={onSelectRow} + initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} + /> + + + ); } From 1e7a98a71d587f20a860d2f3e13e2657888f1996 Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Thu, 18 Apr 2024 18:45:52 +0300 Subject: [PATCH 26/39] updates after review --- .../UpdatePolicyConnectionConfigParams.ts | 2 +- src/libs/PolicyUtils.ts | 4 +- src/libs/actions/connections/index.ts | 2 +- ...oksCompanyCardExpenseAccountSelectPage.tsx | 8 +- .../QuickbooksExportConfigurationPage.tsx | 89 ++++++++++--------- ...ickbooksExportInvoiceAccountSelectPage.tsx | 6 +- ...oksOutOfPocketExpenseAccountSelectPage.tsx | 6 +- ...oksOutOfPocketExpenseConfigurationPage.tsx | 2 +- ...ooksOutOfPocketExpenseEntitySelectPage.tsx | 5 +- ...ooksPreferredExporterConfigurationPage.tsx | 6 +- src/types/onyx/Policy.ts | 2 +- 11 files changed, 62 insertions(+), 70 deletions(-) diff --git a/src/libs/API/parameters/UpdatePolicyConnectionConfigParams.ts b/src/libs/API/parameters/UpdatePolicyConnectionConfigParams.ts index 32146ec5322f..dd1a2edec089 100644 --- a/src/libs/API/parameters/UpdatePolicyConnectionConfigParams.ts +++ b/src/libs/API/parameters/UpdatePolicyConnectionConfigParams.ts @@ -4,7 +4,7 @@ type UpdatePolicyConnectionConfigParams); } -function getAdminEmailList(policy: Policy | null) { +function getAdminEmailList(policy: Policy | null): Array<{email: string}> { return Object.values(policy?.employeeList ?? {}) - .filter((employee) => employee.role === CONST.POLICY.ROLE.ADMIN) + .filter((employee) => employee.email && employee.role === CONST.POLICY.ROLE.ADMIN) .map((employee) => ({ email: employee.email ?? '', })); diff --git a/src/libs/actions/connections/index.ts b/src/libs/actions/connections/index.ts index dd8234bf8800..72048dc4a60d 100644 --- a/src/libs/actions/connections/index.ts +++ b/src/libs/actions/connections/index.ts @@ -46,7 +46,7 @@ function updatePolicyConnectionConfig - + - + {translate('workspace.qbo.exportCompanyCardsDescription')}} sections={sections} ListItem={RadioListItem} diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx index ba87111d8f8a..4b2bb919b832 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx @@ -34,6 +34,7 @@ function QuickbooksExportConfigurationPage({policy}: WithPolicyProps) { brickRoadIndicator: errors?.exporter ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exporter ?? policyOwner, pendingAction: pendingFields?.exporter, + errorText: errors?.exporter, }, { description: translate('workspace.qbo.date'), @@ -41,13 +42,15 @@ function QuickbooksExportConfigurationPage({policy}: WithPolicyProps) { brickRoadIndicator: errors?.exportDate ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportDate ? translate(`workspace.qbo.${exportDate}.label`) : undefined, pendingAction: pendingFields?.exportDate, + errorText: errors?.exportDate, }, { description: translate('workspace.qbo.exportExpenses'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)), - brickRoadIndicator: errors?.exportExpenses ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, + brickRoadIndicator: errors?.exportEntity ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportEntity ? translate(`workspace.qbo.${exportEntity}`) : undefined, pendingAction: pendingFields?.exportEntity, + errorText: errors?.exportEntity, }, { description: translate('workspace.qbo.exportInvoices'), @@ -55,6 +58,7 @@ function QuickbooksExportConfigurationPage({policy}: WithPolicyProps) { brickRoadIndicator: errors?.exportInvoice ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportInvoice, pendingAction: pendingFields?.exportInvoice, + errorText: errors?.exportInvoice, }, { description: translate('workspace.qbo.exportCompany'), @@ -62,6 +66,7 @@ function QuickbooksExportConfigurationPage({policy}: WithPolicyProps) { brickRoadIndicator: errors?.exportCompanyCard ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportCompanyCard, pendingAction: pendingFields?.exportCompanyCard, + errorText: errors?.exportCompanyCard, }, { description: translate('workspace.qbo.exportExpensifyCard'), @@ -72,47 +77,47 @@ function QuickbooksExportConfigurationPage({policy}: WithPolicyProps) { ]; return ( - - - - - - {translate('workspace.qbo.exportDescription')} - {menuItems.map((menuItem) => ( - - - - ))} - - {`${translate('workspace.qbo.deepDiveExpensifyCard')} `} - Link.openExternalLink(CONST.DEEP_DIVE_EXPENSIFY_CARD)} - style={[styles.mutedNormalTextLabel, styles.link]} - > - {translate('workspace.qbo.deepDiveExpensifyCardIntegration')} - - - - - - + // + // + + + + {translate('workspace.qbo.exportDescription')} + {menuItems.map((menuItem) => ( + + + + ))} + + {`${translate('workspace.qbo.deepDiveExpensifyCard')} `} + Link.openExternalLink(CONST.DEEP_DIVE_EXPENSIFY_CARD)} + style={[styles.mutedNormalTextLabel, styles.link]} + > + {translate('workspace.qbo.deepDiveExpensifyCardIntegration')} + + + + + // + // ); } diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx index 7f41f2af8824..de47ca90527e 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage.tsx @@ -64,13 +64,9 @@ function QuickbooksExportInvoiceAccountSelectPage({policy}: WithPolicyProps) { policyID={policyID} featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED} > - + {translate('workspace.qbo.exportInvoicesDescription')}} sections={[{data}]} ListItem={RadioListItem} diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx index fead7836442b..659e42556fcc 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage.tsx @@ -79,13 +79,9 @@ function QuickbooksOutOfPocketExpenseAccountSelectPage({policy}: WithPolicyProps policyID={policyID} featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED} > - + {translate('workspace.qbo.accountsPayableDescription')}} sections={[{data}]} ListItem={RadioListItem} diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx index f1fe2052913c..7232cf890536 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx @@ -61,7 +61,7 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyProps onPress={() => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT.getRoute(policyID))} brickRoadIndicator={errors?.exportAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} shouldShowRightIcon - error={errors?.exportAccount ? translate('common.genericErrorMessage') : undefined} + errorText={errors?.exportAccount} /> )} diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx index 63c96e25bb31..ddfe6e9bdecf 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx @@ -39,7 +39,7 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyProps) if (!isTaxError && !isLocationError) { return; } - Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.EXPORT_ENTITY, null); + Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.EXPORT_ENTITY); }, [policyID, isTaxError, isLocationError]); const data: CardListItem[] = useMemo( @@ -92,8 +92,9 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyProps) testID={QuickbooksOutOfPocketExpenseEntitySelectPage.displayName} > - + {translate('workspace.qbo.optionBelow')}} sections={sections} ListItem={RadioListItem} diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx index b0bba1a4e7e7..38a8b68a222c 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx @@ -65,13 +65,9 @@ function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { policyID={policyID} featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED} > - + {translate('workspace.qbo.exportPreferredExporterNote')} diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index 63d7810d902f..53ac83dfc306 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -157,7 +157,7 @@ type QBOConnectionConfig = OnyxCommon.OnyxValueWithOfflineFeedback<{ syncItems: boolean; markChecksToBePrinted: boolean; reimbursableExpensesExportDestination: IntegrationEntityMap; - nonReimbursableExpensesExportDestination: string; + nonReimbursableExpensesExportDestination: IntegrationEntityMap; reimbursableExpensesAccount?: string; nonReimbursableExpensesAccount?: string; From c9ded6fdb7d5d8ad94e9b254bdbb9ac2d2ec04b0 Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Thu, 18 Apr 2024 18:52:24 +0300 Subject: [PATCH 27/39] lint --- .../QuickbooksExportConfigurationPage.tsx | 82 +++++++++---------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx index 4b2bb919b832..372319e3095a 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx @@ -77,47 +77,47 @@ function QuickbooksExportConfigurationPage({policy}: WithPolicyProps) { ]; return ( - // - // - - - - {translate('workspace.qbo.exportDescription')} - {menuItems.map((menuItem) => ( - - - - ))} - - {`${translate('workspace.qbo.deepDiveExpensifyCard')} `} - Link.openExternalLink(CONST.DEEP_DIVE_EXPENSIFY_CARD)} - style={[styles.mutedNormalTextLabel, styles.link]} - > - {translate('workspace.qbo.deepDiveExpensifyCardIntegration')} - - - - - // - // + + + + + + {translate('workspace.qbo.exportDescription')} + {menuItems.map((menuItem) => ( + + + + ))} + + {`${translate('workspace.qbo.deepDiveExpensifyCard')} `} + Link.openExternalLink(CONST.DEEP_DIVE_EXPENSIFY_CARD)} + style={[styles.mutedNormalTextLabel, styles.link]} + > + {translate('workspace.qbo.deepDiveExpensifyCardIntegration')} + + + + + + ); } From f87fed726d170779af50d43a375c03092c3b5dbb Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Thu, 18 Apr 2024 19:05:00 +0300 Subject: [PATCH 28/39] add more space between items --- .../export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx index 7232cf890536..79f9426a9de8 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx @@ -50,7 +50,7 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyProps /> {exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.VENDOR_BILL && !isLocationEnabled && ( - {translate('workspace.qbo.exportVendorBillDescription')} + {translate('workspace.qbo.exportVendorBillDescription')} )} {isLocationEnabled && {translate('workspace.qbo.outOfPocketLocationEnabledDescription')}} {!isLocationEnabled && ( From d9f1a4e50357d643c225af4c7cea0c9bc1dc63c9 Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Thu, 18 Apr 2024 20:10:52 +0300 Subject: [PATCH 29/39] updates --- .../API/parameters/UpdatePolicyConnectionConfigParams.ts | 2 +- src/libs/PolicyUtils.ts | 9 +++------ src/libs/actions/connections/index.ts | 2 +- .../QuickbooksOutOfPocketExpenseConfigurationPage.tsx | 2 +- .../QuickbooksOutOfPocketExpenseEntitySelectPage.tsx | 2 +- .../QuickbooksPreferredExporterConfigurationPage.tsx | 4 ++-- 6 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/libs/API/parameters/UpdatePolicyConnectionConfigParams.ts b/src/libs/API/parameters/UpdatePolicyConnectionConfigParams.ts index dd1a2edec089..75a5f6360a15 100644 --- a/src/libs/API/parameters/UpdatePolicyConnectionConfigParams.ts +++ b/src/libs/API/parameters/UpdatePolicyConnectionConfigParams.ts @@ -4,7 +4,7 @@ type UpdatePolicyConnectionConfigParams); } -function getAdminEmailList(policy: Policy | null): Array<{email: string}> { - return Object.values(policy?.employeeList ?? {}) - .filter((employee) => employee.email && employee.role === CONST.POLICY.ROLE.ADMIN) - .map((employee) => ({ - email: employee.email ?? '', - })); +function getAdminEmailList(policy: Policy | null): PolicyEmployee[] { + return Object.values(policy?.employeeList ?? {}).filter((employee) => employee.email && employee.role === CONST.POLICY.ROLE.ADMIN); } export { diff --git a/src/libs/actions/connections/index.ts b/src/libs/actions/connections/index.ts index 72048dc4a60d..d1c46242ba9e 100644 --- a/src/libs/actions/connections/index.ts +++ b/src/libs/actions/connections/index.ts @@ -46,7 +46,7 @@ function updatePolicyConnectionConfig Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT.getRoute(policyID))} brickRoadIndicator={hasErrors ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} shouldShowRightIcon diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx index ddfe6e9bdecf..24713a03860c 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx @@ -39,7 +39,7 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyProps) if (!isTaxError && !isLocationError) { return; } - Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.EXPORT_ENTITY); + Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.EXPORT_ENTITY, ''); }, [policyID, isTaxError, isLocationError]); const data: CardListItem[] = useMemo( diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx index 38a8b68a222c..ab31b15ddcba 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx @@ -27,7 +27,7 @@ const draft = [ ]; type CardListItem = ListItem & { - value: string; + value?: string; }; function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { @@ -51,7 +51,7 @@ function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { const onSelectRow = useCallback( (row: CardListItem) => { - if (row.value !== exporter) { + if (row.value && row.value !== exporter) { Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.PREFERRED_EXPORTER, row.value); } Navigation.goBack(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.getRoute(policyID)); From 305d84928bd483e1ab6c7cf83a59797e54f2d4dc Mon Sep 17 00:00:00 2001 From: narefyev91 Date: Fri, 19 Apr 2024 09:38:51 +0300 Subject: [PATCH 30/39] Update src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx Co-authored-by: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> --- .../qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx index ab31b15ddcba..b95f9d56f2dd 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx @@ -51,7 +51,7 @@ function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { const onSelectRow = useCallback( (row: CardListItem) => { - if (row.value && row.value !== exporter) { + if (row.value !== exporter) { Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.PREFERRED_EXPORTER, row.value); } Navigation.goBack(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.getRoute(policyID)); From 756066376d32e41a42af1eceedca01471256e7d1 Mon Sep 17 00:00:00 2001 From: narefyev91 Date: Fri, 19 Apr 2024 09:39:01 +0300 Subject: [PATCH 31/39] Update src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx Co-authored-by: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> --- ...kbooksPreferredExporterConfigurationPage.tsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx index b95f9d56f2dd..b982809c82fc 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx @@ -40,12 +40,17 @@ function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { const policyID = policy?.id ?? ''; const data: CardListItem[] = useMemo( () => - result?.map((vendor) => ({ - value: vendor.email, - text: vendor.email, - keyForList: vendor.email, - isSelected: exporter === vendor.email, - })) ?? [], + result.reduce((vendors, vendor) => { + if (vendor.email) { + vendors.push({ + value: vendor.email, + text: vendor.email, + keyForList: vendor.email, + isSelected: exporter === vendor.email, + }); + } + return vendors; + }, []), [result, exporter], ); From 04166d60e6917a8e0f10a30bbdbb0f920f3e5e7a Mon Sep 17 00:00:00 2001 From: narefyev91 Date: Fri, 19 Apr 2024 09:39:14 +0300 Subject: [PATCH 32/39] Update src/libs/PolicyUtils.ts Co-authored-by: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> --- src/libs/PolicyUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index 59c711aefaf1..698b557a80a0 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -320,7 +320,7 @@ function getPolicyIDFromNavigationState() { } function getAdminEmailList(policy: Policy | null): PolicyEmployee[] { - return Object.values(policy?.employeeList ?? {}).filter((employee) => employee.email && employee.role === CONST.POLICY.ROLE.ADMIN); + return Object.values(policy?.employeeList ?? {}).filter((employee) => employee.role === CONST.POLICY.ROLE.ADMIN); } export { From 7866e3c30446de3696232735b56d3b39b0bc6d7d Mon Sep 17 00:00:00 2001 From: narefyev91 Date: Fri, 19 Apr 2024 09:39:26 +0300 Subject: [PATCH 33/39] Update src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx Co-authored-by: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> --- .../qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx index b982809c82fc..2b7f05f8cf64 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx @@ -27,7 +27,7 @@ const draft = [ ]; type CardListItem = ListItem & { - value?: string; + value: string; }; function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { From df7fa2bf80e11bfa377cc6713486859355791633 Mon Sep 17 00:00:00 2001 From: narefyev91 Date: Fri, 19 Apr 2024 09:39:33 +0300 Subject: [PATCH 34/39] Update src/libs/PolicyUtils.ts Co-authored-by: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> --- src/libs/PolicyUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index 698b557a80a0..56c907e6a7b5 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -319,7 +319,7 @@ function getPolicyIDFromNavigationState() { return getPolicyIDFromState(navigationRef.getRootState() as State); } -function getAdminEmailList(policy: Policy | null): PolicyEmployee[] { +function getAdminEmployees(policy: OnyxEntry): PolicyEmployee[] { return Object.values(policy?.employeeList ?? {}).filter((employee) => employee.role === CONST.POLICY.ROLE.ADMIN); } From 96c66d8efd4db3d301547402e563d9918154c6e2 Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Fri, 19 Apr 2024 10:01:17 +0300 Subject: [PATCH 35/39] updates --- src/libs/PolicyUtils.ts | 2 +- .../export/QuickbooksPreferredExporterConfigurationPage.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index 56c907e6a7b5..ac2b8b10ce6d 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -362,7 +362,7 @@ export { getTaxByID, hasPolicyCategoriesError, getPolicyIDFromNavigationState, - getAdminEmailList, + getAdminEmployees, }; export type {MemberEmailsToAccountIDs}; diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx index 2b7f05f8cf64..5bad9caca706 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx @@ -8,7 +8,7 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections'; -import {getAdminEmailList} from '@libs/PolicyUtils'; +import {getAdminEmployees} from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; import AdminPolicyAccessOrNotFoundWrapper from '@pages/workspace/AdminPolicyAccessOrNotFoundWrapper'; import FeatureEnabledAccessOrNotFoundWrapper from '@pages/workspace/FeatureEnabledAccessOrNotFoundWrapper'; @@ -34,7 +34,7 @@ function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); const {exporter} = policy?.connections?.quickbooksOnline?.config ?? {}; - const exporters = getAdminEmailList(policy); + const exporters = getAdminEmployees(policy); const result = exporters?.length ? exporters : draft; const policyID = policy?.id ?? ''; From 21db4523919b0dab2221a3276c6361ca6ed4c8ba Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Fri, 19 Apr 2024 11:41:11 +0300 Subject: [PATCH 36/39] update api usage --- .../API/parameters/UpdatePolicyConnectionConfigParams.ts | 2 +- src/libs/actions/connections/index.ts | 8 ++++---- .../qbo/export/QuickbooksExportConfigurationPage.tsx | 4 +++- .../QuickbooksOutOfPocketExpenseConfigurationPage.tsx | 4 +++- .../QuickbooksOutOfPocketExpenseEntitySelectPage.tsx | 2 +- src/types/onyx/Policy.ts | 2 +- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/libs/API/parameters/UpdatePolicyConnectionConfigParams.ts b/src/libs/API/parameters/UpdatePolicyConnectionConfigParams.ts index 75a5f6360a15..dd1a2edec089 100644 --- a/src/libs/API/parameters/UpdatePolicyConnectionConfigParams.ts +++ b/src/libs/API/parameters/UpdatePolicyConnectionConfigParams.ts @@ -4,7 +4,7 @@ type UpdatePolicyConnectionConfigParams ))} diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx index 44aa7aea243e..ffa0699f9b76 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx @@ -61,7 +61,9 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyProps onPress={() => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT.getRoute(policyID))} brickRoadIndicator={errors?.exportAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} shouldShowRightIcon - errorText={errors?.exportAccount} + error={errors?.exportAccount ? translate('common.genericErrorMessage') : undefined} + // TODO uncomment when errorText will be fixed + // errorText={errors?.exportAccount} /> )} diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx index 24713a03860c..ddfe6e9bdecf 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx @@ -39,7 +39,7 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyProps) if (!isTaxError && !isLocationError) { return; } - Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.EXPORT_ENTITY, ''); + Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.EXPORT_ENTITY); }, [policyID, isTaxError, isLocationError]); const data: CardListItem[] = useMemo( diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index 53ac83dfc306..4071625c683d 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -177,7 +177,7 @@ type QBOConnectionConfig = OnyxCommon.OnyxValueWithOfflineFeedback<{ outOfPocketExpenses: string; exportInvoice: string; exportAccount: string; - exportEntity: ValueOf; + exportEntity?: ValueOf; exportCompanyCard: string; errorFields?: OnyxCommon.ErrorFields; }>; From 57840baf4fc32bb06177e2706d799c1be6cb13df Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Fri, 19 Apr 2024 16:32:38 +0300 Subject: [PATCH 37/39] updates --- .../export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx index ddfe6e9bdecf..ee191a9575ca 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx @@ -100,9 +100,7 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyProps) ListItem={RadioListItem} onSelectRow={onSelectRow} initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} - footerContent={ - isTaxesEnabled && {translate('workspace.qbo.outOfPocketTaxEnabledDescription')} - } + footerContent={isTaxesEnabled && {translate('workspace.qbo.outOfPocketTaxEnabledDescription')}} /> From 34d123bee43655dee1558edaeaa48614b4309c41 Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Mon, 22 Apr 2024 10:31:21 +0300 Subject: [PATCH 38/39] updates --- .../QuickbooksExportConfigurationPage.tsx | 23 +++++++++---------- ...oksOutOfPocketExpenseConfigurationPage.tsx | 8 +++---- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx index b6aef43385de..8a1bc5799190 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx @@ -26,47 +26,46 @@ function QuickbooksExportConfigurationPage({policy}: WithPolicyProps) { const styles = useThemeStyles(); const policyID = policy?.id ?? ''; const policyOwner = policy?.owner ?? ''; - const {exporter, exportDate, exportEntity, exportInvoice, exportCompanyCard, errors, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {}; + const {exporter, exportDate, exportEntity, exportInvoice, exportCompanyCard, errorFields, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {}; const menuItems: MenuItem[] = [ { description: translate('workspace.qbo.preferredExporter'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.getRoute(policyID)), - brickRoadIndicator: errors?.exporter ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, + brickRoadIndicator: errorFields?.exporter ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exporter ?? policyOwner, pendingAction: pendingFields?.exporter, - errorText: errors?.exporter, + error: errorFields?.exporter ? translate('common.genericErrorMessage') : undefined, }, { description: translate('workspace.qbo.date'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT.getRoute(policyID)), - brickRoadIndicator: errors?.exportDate ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, + brickRoadIndicator: errorFields?.exportDate ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportDate ? translate(`workspace.qbo.${exportDate}.label`) : undefined, pendingAction: pendingFields?.exportDate, - errorText: errors?.exportDate, + error: errorFields?.exportDate ? translate('common.genericErrorMessage') : undefined, }, { description: translate('workspace.qbo.exportExpenses'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)), - brickRoadIndicator: errors?.exportEntity ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, + brickRoadIndicator: errorFields?.exportEntity ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportEntity ? translate(`workspace.qbo.${exportEntity}`) : undefined, pendingAction: pendingFields?.exportEntity, - errorText: errors?.exportEntity, }, { description: translate('workspace.qbo.exportInvoices'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT.getRoute(policyID)), - brickRoadIndicator: errors?.exportInvoice ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, + brickRoadIndicator: errorFields?.exportInvoice ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportInvoice, pendingAction: pendingFields?.exportInvoice, - errorText: errors?.exportInvoice, + error: errorFields?.exportInvoice ? translate('common.genericErrorMessage') : undefined, }, { description: translate('workspace.qbo.exportCompany'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT.getRoute(policyID)), - brickRoadIndicator: errors?.exportCompanyCard ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, + brickRoadIndicator: errorFields?.exportCompanyCard ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportCompanyCard, pendingAction: pendingFields?.exportCompanyCard, - errorText: errors?.exportCompanyCard, + error: errorFields?.exportCompanyCard ? translate('common.genericErrorMessage') : undefined, }, { description: translate('workspace.qbo.exportExpensifyCard'), @@ -103,7 +102,7 @@ function QuickbooksExportConfigurationPage({policy}: WithPolicyProps) { brickRoadIndicator={menuItem?.brickRoadIndicator} // TODO uncomment when errorText will be fixed // errorText={menuItem?.errorText} - error={menuItem?.brickRoadIndicator ? translate('common.genericErrorMessage') : undefined} + error={menuItem?.error} /> ))} diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx index ffa0699f9b76..8ee94e675141 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx @@ -19,12 +19,12 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyProps const {translate} = useLocalize(); const styles = useThemeStyles(); const policyID = policy?.id ?? ''; - const {syncLocations, exportAccount, exportEntity, errors, syncTaxes, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {}; + const {syncLocations, exportAccount, exportEntity, errorFields, syncTaxes, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {}; const isLocationEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); const isTaxesEnabled = Boolean(syncTaxes && syncTaxes !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); const shouldShowTaxError = isTaxesEnabled && exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY; const shouldShowLocationError = isLocationEnabled && exportEntity !== CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY; - const hasErrors = Boolean(errors?.exportEntity) || shouldShowTaxError || shouldShowLocationError; + const hasErrors = Boolean(errorFields?.exportEntity) || shouldShowTaxError || shouldShowLocationError; return ( @@ -59,9 +59,9 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyProps title={exportAccount} description={translate('workspace.qbo.accountsPayable')} onPress={() => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT.getRoute(policyID))} - brickRoadIndicator={errors?.exportAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} + brickRoadIndicator={errorFields?.exportAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} shouldShowRightIcon - error={errors?.exportAccount ? translate('common.genericErrorMessage') : undefined} + error={errorFields?.exportAccount ? translate('common.genericErrorMessage') : undefined} // TODO uncomment when errorText will be fixed // errorText={errors?.exportAccount} /> From 1346a1097d96527859326157ebdc327d75f72324 Mon Sep 17 00:00:00 2001 From: Nicolay Arefyeu Date: Mon, 22 Apr 2024 11:36:14 +0300 Subject: [PATCH 39/39] polish --- .../qbo/export/QuickbooksExportConfigurationPage.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx index 8a1bc5799190..429e7afddd32 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage.tsx @@ -47,9 +47,10 @@ function QuickbooksExportConfigurationPage({policy}: WithPolicyProps) { { description: translate('workspace.qbo.exportExpenses'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)), - brickRoadIndicator: errorFields?.exportEntity ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, + brickRoadIndicator: Boolean(errorFields?.exportEntity) || Boolean(errorFields?.exportAccount) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportEntity ? translate(`workspace.qbo.${exportEntity}`) : undefined, - pendingAction: pendingFields?.exportEntity, + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + pendingAction: pendingFields?.exportEntity || pendingFields?.exportAccount, }, { description: translate('workspace.qbo.exportInvoices'),