From cbecce77774d0d2a4ca78115756c0acfed611c56 Mon Sep 17 00:00:00 2001 From: Hans Date: Sat, 4 May 2024 23:13:33 +0700 Subject: [PATCH 1/6] xero preferred export select page --- src/CONST.ts | 1 + src/ROUTES.ts | 4 + src/SCREENS.ts | 1 + src/languages/en.ts | 2 + src/languages/es.ts | 3 + .../ModalStackNavigators/index.tsx | 45 +++------- .../FULL_SCREEN_TO_RHP_MAPPING.ts | 1 + src/libs/Navigation/linkingConfig/config.ts | 1 + src/libs/Navigation/types.ts | 3 + .../export/XeroExportConfigurationPage.tsx | 6 +- .../XeroPreferredExporterSelectPage.tsx | 84 +++++++++++++++++++ 11 files changed, 115 insertions(+), 36 deletions(-) create mode 100644 src/pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage.tsx diff --git a/src/CONST.ts b/src/CONST.ts index 310bb3959300..44f990f1c1cb 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1272,6 +1272,7 @@ const CONST = { SYNC: 'sync', IMPORT_CUSTOMERS: 'importCustomers', IMPORT_TAX_RATES: 'importTaxRates', + EXPORT: 'export', }, QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE: { diff --git a/src/ROUTES.ts b/src/ROUTES.ts index c61e16127f31..8a687059a6cd 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -790,6 +790,10 @@ const ROUTES = { route: 'settings/workspaces/:policyID/accounting/xero/export', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/export` as const, }, + POLICY_ACCOUNTING_XERO_PREFERRED_EXPORTER_SELECT: { + route: '/settings/workspaces/:policyID/connections/xero/export/preferred-exporter/select', + getRoute: (policyID: string) => `/settings/workspaces/${policyID}/connections/xero/export/preferred-exporter/select` as const, + }, POLICY_ACCOUNTING_XERO_ADVANCED: { route: 'settings/workspaces/:policyID/accounting/xero/advanced', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/advanced` as const, diff --git a/src/SCREENS.ts b/src/SCREENS.ts index a066821e8e97..28d877f6e548 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -242,6 +242,7 @@ const SCREENS = { XERO_EXPORT: 'Policy_Accounting_Xero_Export', XERO_ADVANCED: 'Policy_Accounting_Xero_Advanced', XERO_INVOICE_ACCOUNT_SELECTOR: 'Policy_Accounting_Xero_Invoice_Account_Selector', + XERO_EXPORT_PREFERRED_EXPORTER_SELECT: 'Workspace_Accounting_Xero_Export_Preferred_Exporter_Select', }, INITIAL: 'Workspace_Initial', PROFILE: 'Workspace_Profile', diff --git a/src/languages/en.ts b/src/languages/en.ts index 9806125067fc..4b61711f4cde 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -2027,6 +2027,8 @@ export default { xeroInvoiceCollectionAccount: 'Xero Invoice Collections Account', invoiceAccountSelectorDescription: "As you've enabled exporting invoices from Expensify to Xero, this is the account the invoice will appear against once marked as paid.", }, + 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.', }, type: { free: 'Free', diff --git a/src/languages/es.ts b/src/languages/es.ts index e11c0569a7f2..271e4e3903ab 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -2062,6 +2062,9 @@ export default { invoiceAccountSelectorDescription: 'Como ha activado la exportación de facturas de Expensify a Xero, esta es la cuenta en la que aparecerá la factura una vez marcada como pagada.', }, + 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 a9451ed573b6..e70c7f7d2402 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -1,42 +1,15 @@ -import type {ParamListBase} from '@react-navigation/routers'; -import type {StackNavigationOptions} from '@react-navigation/stack'; -import {createStackNavigator} from '@react-navigation/stack'; +import type { ParamListBase } from '@react-navigation/routers'; +import type { StackNavigationOptions } from '@react-navigation/stack'; +import { createStackNavigator } from '@react-navigation/stack'; import React from 'react'; -import type { - AddPersonalBankAccountNavigatorParamList, - ChatFinderNavigatorParamList, - DetailsNavigatorParamList, - EditRequestNavigatorParamList, - EnablePaymentsNavigatorParamList, - FlagCommentNavigatorParamList, - MoneyRequestNavigatorParamList, - NewChatNavigatorParamList, - NewTaskNavigatorParamList, - ParticipantsNavigatorParamList, - PrivateNotesNavigatorParamList, - ProfileNavigatorParamList, - ReferralDetailsNavigatorParamList, - ReimbursementAccountNavigatorParamList, - ReportDescriptionNavigatorParamList, - ReportDetailsNavigatorParamList, - ReportSettingsNavigatorParamList, - RoomInviteNavigatorParamList, - RoomMembersNavigatorParamList, - SearchReportParamList, - SettingsNavigatorParamList, - SignInNavigatorParamList, - SplitDetailsNavigatorParamList, - TaskDetailsNavigatorParamList, - TeachersUniteNavigatorParamList, - WalletStatementNavigatorParamList, - WorkspaceSwitcherNavigatorParamList, -} from '@navigation/types'; -import type {ThemeStyles} from '@styles/index'; -import type {Screen} from '@src/SCREENS'; +import type { AddPersonalBankAccountNavigatorParamList, ChatFinderNavigatorParamList, DetailsNavigatorParamList, EditRequestNavigatorParamList, EnablePaymentsNavigatorParamList, FlagCommentNavigatorParamList, MoneyRequestNavigatorParamList, NewChatNavigatorParamList, NewTaskNavigatorParamList, ParticipantsNavigatorParamList, PrivateNotesNavigatorParamList, ProfileNavigatorParamList, ReferralDetailsNavigatorParamList, ReimbursementAccountNavigatorParamList, ReportDescriptionNavigatorParamList, ReportDetailsNavigatorParamList, ReportSettingsNavigatorParamList, RoomInviteNavigatorParamList, RoomMembersNavigatorParamList, SearchReportParamList, SettingsNavigatorParamList, SignInNavigatorParamList, SplitDetailsNavigatorParamList, TaskDetailsNavigatorParamList, TeachersUniteNavigatorParamList, WalletStatementNavigatorParamList, WorkspaceSwitcherNavigatorParamList } from '@navigation/types'; +import type { ThemeStyles } from '@styles/index'; +import type { Screen } from '@src/SCREENS'; import SCREENS from '@src/SCREENS'; import useModalScreenOptions from './useModalScreenOptions'; import WorkspaceSettingsModalStackNavigator from './WorkspaceSettingsModalStackNavigator'; + type Screens = Partial React.ComponentType>>; /** @@ -303,6 +276,8 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/workspace/accounting/xero/advanced/XeroAdvancedPage').default as React.ComponentType, [SCREENS.WORKSPACE.ACCOUNTING.XERO_INVOICE_ACCOUNT_SELECTOR]: () => require('../../../../pages/workspace/accounting/xero/advanced/XeroInvoiceAccountSelectorPage').default as React.ComponentType, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_SELECT]: () => + require('../../../../pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage').default as React.ComponentType, [SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_FREQUENCY]: () => require('../../../../pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage').default as React.ComponentType, [SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_MONTHLY_OFFSET]: () => require('../../../../pages/workspace/workflows/WorkspaceAutoReportingMonthlyOffsetPage').default as React.ComponentType, @@ -387,4 +362,4 @@ export { ProcessMoneyRequestHoldStackNavigator, WorkspaceSettingsModalStackNavigator, SearchReportModalStackNavigator, -}; +}; \ No newline at end of file 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 4024e0ad2278..103d3bc3d475 100755 --- a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts +++ b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts @@ -47,6 +47,7 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial> = { SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT, SCREENS.WORKSPACE.ACCOUNTING.XERO_ADVANCED, SCREENS.WORKSPACE.ACCOUNTING.XERO_INVOICE_ACCOUNT_SELECTOR, + SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_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 5d5b63b56d11..7e842c09a01d 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -334,6 +334,7 @@ const config: LinkingOptions['config'] = { [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT]: {path: ROUTES.POLICY_ACCOUNTING_XERO_EXPORT.route}, [SCREENS.WORKSPACE.ACCOUNTING.XERO_ADVANCED]: {path: ROUTES.POLICY_ACCOUNTING_XERO_ADVANCED.route}, [SCREENS.WORKSPACE.ACCOUNTING.XERO_INVOICE_ACCOUNT_SELECTOR]: {path: ROUTES.POLICY_ACCOUNTING_XERO_INVOICE_SELECTOR.route}, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_SELECT]: {path: ROUTES.POLICY_ACCOUNTING_XERO_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 37c95bd5c5c8..ed52e983fde2 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -333,6 +333,9 @@ type SettingsNavigatorParamList = { [SCREENS.WORKSPACE.ACCOUNTING.XERO_INVOICE_ACCOUNT_SELECTOR]: { policyID: string; }; + [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_SELECT]: { + policyID: string; + }; [SCREENS.GET_ASSISTANCE]: { backTo: Routes; }; diff --git a/src/pages/workspace/accounting/xero/export/XeroExportConfigurationPage.tsx b/src/pages/workspace/accounting/xero/export/XeroExportConfigurationPage.tsx index 962804969ff8..c345f3ade490 100644 --- a/src/pages/workspace/accounting/xero/export/XeroExportConfigurationPage.tsx +++ b/src/pages/workspace/accounting/xero/export/XeroExportConfigurationPage.tsx @@ -9,6 +9,8 @@ import useThemeStyles from '@hooks/useThemeStyles'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import CONST from '@src/CONST'; +import Navigation from '@libs/Navigation/Navigation'; +import ROUTES from '@src/ROUTES'; type MenuItem = MenuItemProps & {pendingAction?: OfflineWithFeedbackProps['pendingAction']}; @@ -22,7 +24,9 @@ function XeroExportConfigurationPage({policy}: WithPolicyConnectionsProps) { const menuItems: MenuItem[] = [ { description: translate('workspace.xero.preferredExporter'), - onPress: () => {}, + onPress: () => { + Navigation.navigate(ROUTES.POLICY_ACCOUNTING_XERO_PREFERRED_EXPORTER_SELECT.getRoute(policyID)); + }, brickRoadIndicator: errorFields?.exporter ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportConfiguration?.exporter ?? policyOwner, pendingAction: pendingFields?.export, diff --git a/src/pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage.tsx b/src/pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage.tsx new file mode 100644 index 000000000000..d9316239f0e9 --- /dev/null +++ b/src/pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage.tsx @@ -0,0 +1,84 @@ +import React, { useCallback, useMemo } from 'react'; +import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import ScreenWrapper from '@components/ScreenWrapper'; +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'; +import * as Connections from '@libs/actions/connections'; +import { getAdminEmployees } from '@libs/PolicyUtils'; +import Navigation from '@navigation/Navigation'; +import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; +import type { WithPolicyConnectionsProps } from '@pages/workspace/withPolicyConnections'; +import withPolicyConnections from '@pages/workspace/withPolicyConnections'; +import CONST from '@src/CONST'; +import ROUTES from '@src/ROUTES'; + + +type CardListItem = ListItem & { + value: string; +}; + +function XeroPreferredExporterSelectPage({policy}: WithPolicyConnectionsProps) { + const {translate} = useLocalize(); + const styles = useThemeStyles(); + const {export: exportConfiguration} = policy?.connections?.xero?.config ?? {}; + const exporters = getAdminEmployees(policy); + + const policyID = policy?.id ?? ''; + const data: CardListItem[] = useMemo( + () => + exporters?.reduce((vendors, vendor) => { + if (vendor.email) { + vendors.push({ + value: vendor.email, + text: vendor.email, + keyForList: vendor.email, + isSelected: exportConfiguration?.exporter === vendor.email, + }); + } + return vendors; + }, []), + [exportConfiguration, exporters], + ); + + const selectExporter = useCallback( + (row: CardListItem) => { + if (row.value !== exportConfiguration?.exporter) { + Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.XERO, CONST.XERO_CONFIG.EXPORT, {exporter: row.value}); + } + Navigation.goBack(ROUTES.POLICY_ACCOUNTING_XERO_EXPORT.getRoute(policyID)); + }, + [policyID, exportConfiguration], + ); + + return ( + + + + + {translate('workspace.xero.exportPreferredExporterNote')} + {translate('workspace.xero.exportPreferredExporterSubNote')} + + } + sections={[{data}]} + ListItem={RadioListItem} + onSelectRow={selectExporter} + initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} + /> + + + ); +} + +XeroPreferredExporterSelectPage.displayName = 'XeroPreferredExporterSelectPage'; + +export default withPolicyConnections(XeroPreferredExporterSelectPage); \ No newline at end of file From 4c1546beecb65597e9c8d762892ee87c76812bb6 Mon Sep 17 00:00:00 2001 From: Hans Date: Mon, 6 May 2024 16:09:20 +0700 Subject: [PATCH 2/6] add PreferredExportedConfiguration screen --- src/ROUTES.ts | 4 + src/SCREENS.ts | 1 + src/languages/es.ts | 4 +- .../ModalStackNavigators/index.tsx | 45 ++++++++-- .../FULL_SCREEN_TO_RHP_MAPPING.ts | 1 + src/libs/Navigation/linkingConfig/config.ts | 1 + src/libs/Navigation/types.ts | 3 + .../export/XeroExportConfigurationPage.tsx | 4 +- ...XeroPreferredExporterConfigurationPage.tsx | 56 ++++++++++++ .../XeroPreferredExporterSelectPage.tsx | 90 +++++++++---------- 10 files changed, 148 insertions(+), 61 deletions(-) create mode 100644 src/pages/workspace/accounting/xero/export/XeroPreferredExporterConfigurationPage.tsx diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 8a687059a6cd..49424f2fb711 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -794,6 +794,10 @@ const ROUTES = { route: '/settings/workspaces/:policyID/connections/xero/export/preferred-exporter/select', getRoute: (policyID: string) => `/settings/workspaces/${policyID}/connections/xero/export/preferred-exporter/select` as const, }, + POLICY_ACCOUNTING_XERO_PREFERRED_EXPORTER_CONFIGURATION: { + route: '/settings/workspaces/:policyID/connections/xero/export/preferred-exporter', + getRoute: (policyID: string) => `/settings/workspaces/${policyID}/connections/xero/export/preferred-exporter` as const, + }, POLICY_ACCOUNTING_XERO_ADVANCED: { route: 'settings/workspaces/:policyID/accounting/xero/advanced', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/advanced` as const, diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 28d877f6e548..bee891372ee9 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -243,6 +243,7 @@ const SCREENS = { XERO_ADVANCED: 'Policy_Accounting_Xero_Advanced', XERO_INVOICE_ACCOUNT_SELECTOR: 'Policy_Accounting_Xero_Invoice_Account_Selector', XERO_EXPORT_PREFERRED_EXPORTER_SELECT: 'Workspace_Accounting_Xero_Export_Preferred_Exporter_Select', + XERO_EXPORT_PREFERRED_EXPORTER_CONFIGURATION: 'Workspace_Accounting_Xero_Export_Preferred_Exporter_Configuration', }, INITIAL: 'Workspace_Initial', PROFILE: 'Workspace_Profile', diff --git a/src/languages/es.ts b/src/languages/es.ts index 271e4e3903ab..824ed07acf11 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -2063,8 +2063,8 @@ export default { 'Como ha activado la exportación de facturas de Expensify a Xero, esta es la cuenta en la que aparecerá la factura una vez marcada como pagada.', }, 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.', + '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 e70c7f7d2402..d84212fc7744 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -1,15 +1,42 @@ -import type { ParamListBase } from '@react-navigation/routers'; -import type { StackNavigationOptions } from '@react-navigation/stack'; -import { createStackNavigator } from '@react-navigation/stack'; +import type {ParamListBase} from '@react-navigation/routers'; +import type {StackNavigationOptions} from '@react-navigation/stack'; +import {createStackNavigator} from '@react-navigation/stack'; import React from 'react'; -import type { AddPersonalBankAccountNavigatorParamList, ChatFinderNavigatorParamList, DetailsNavigatorParamList, EditRequestNavigatorParamList, EnablePaymentsNavigatorParamList, FlagCommentNavigatorParamList, MoneyRequestNavigatorParamList, NewChatNavigatorParamList, NewTaskNavigatorParamList, ParticipantsNavigatorParamList, PrivateNotesNavigatorParamList, ProfileNavigatorParamList, ReferralDetailsNavigatorParamList, ReimbursementAccountNavigatorParamList, ReportDescriptionNavigatorParamList, ReportDetailsNavigatorParamList, ReportSettingsNavigatorParamList, RoomInviteNavigatorParamList, RoomMembersNavigatorParamList, SearchReportParamList, SettingsNavigatorParamList, SignInNavigatorParamList, SplitDetailsNavigatorParamList, TaskDetailsNavigatorParamList, TeachersUniteNavigatorParamList, WalletStatementNavigatorParamList, WorkspaceSwitcherNavigatorParamList } from '@navigation/types'; -import type { ThemeStyles } from '@styles/index'; -import type { Screen } from '@src/SCREENS'; +import type { + AddPersonalBankAccountNavigatorParamList, + ChatFinderNavigatorParamList, + DetailsNavigatorParamList, + EditRequestNavigatorParamList, + EnablePaymentsNavigatorParamList, + FlagCommentNavigatorParamList, + MoneyRequestNavigatorParamList, + NewChatNavigatorParamList, + NewTaskNavigatorParamList, + ParticipantsNavigatorParamList, + PrivateNotesNavigatorParamList, + ProfileNavigatorParamList, + ReferralDetailsNavigatorParamList, + ReimbursementAccountNavigatorParamList, + ReportDescriptionNavigatorParamList, + ReportDetailsNavigatorParamList, + ReportSettingsNavigatorParamList, + RoomInviteNavigatorParamList, + RoomMembersNavigatorParamList, + SearchReportParamList, + SettingsNavigatorParamList, + SignInNavigatorParamList, + SplitDetailsNavigatorParamList, + TaskDetailsNavigatorParamList, + TeachersUniteNavigatorParamList, + WalletStatementNavigatorParamList, + WorkspaceSwitcherNavigatorParamList, +} from '@navigation/types'; +import type {ThemeStyles} from '@styles/index'; +import type {Screen} from '@src/SCREENS'; import SCREENS from '@src/SCREENS'; import useModalScreenOptions from './useModalScreenOptions'; import WorkspaceSettingsModalStackNavigator from './WorkspaceSettingsModalStackNavigator'; - type Screens = Partial React.ComponentType>>; /** @@ -278,6 +305,8 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage').default as React.ComponentType, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_CONFIGURATION]: () => + require('../../../../pages/workspace/accounting/xero/export/XeroPreferredExporterConfigurationPage').default as React.ComponentType, [SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_FREQUENCY]: () => require('../../../../pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage').default as React.ComponentType, [SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_MONTHLY_OFFSET]: () => require('../../../../pages/workspace/workflows/WorkspaceAutoReportingMonthlyOffsetPage').default as React.ComponentType, @@ -362,4 +391,4 @@ export { ProcessMoneyRequestHoldStackNavigator, WorkspaceSettingsModalStackNavigator, SearchReportModalStackNavigator, -}; \ No newline at end of file +}; 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 103d3bc3d475..22d5abcd80ea 100755 --- a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts +++ b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts @@ -48,6 +48,7 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial> = { SCREENS.WORKSPACE.ACCOUNTING.XERO_ADVANCED, SCREENS.WORKSPACE.ACCOUNTING.XERO_INVOICE_ACCOUNT_SELECTOR, SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_SELECT, + SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_CONFIGURATION, ], [SCREENS.WORKSPACE.TAXES]: [ SCREENS.WORKSPACE.TAXES_SETTINGS, diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index 7e842c09a01d..ac3789219f6e 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -335,6 +335,7 @@ const config: LinkingOptions['config'] = { [SCREENS.WORKSPACE.ACCOUNTING.XERO_ADVANCED]: {path: ROUTES.POLICY_ACCOUNTING_XERO_ADVANCED.route}, [SCREENS.WORKSPACE.ACCOUNTING.XERO_INVOICE_ACCOUNT_SELECTOR]: {path: ROUTES.POLICY_ACCOUNTING_XERO_INVOICE_SELECTOR.route}, [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_SELECT]: {path: ROUTES.POLICY_ACCOUNTING_XERO_PREFERRED_EXPORTER_SELECT.route}, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_CONFIGURATION]: {path: ROUTES.POLICY_ACCOUNTING_XERO_PREFERRED_EXPORTER_CONFIGURATION.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 ed52e983fde2..5b4822c07fc4 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -336,6 +336,9 @@ type SettingsNavigatorParamList = { [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_SELECT]: { policyID: string; }; + [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_CONFIGURATION]: { + policyID: string; + }; [SCREENS.GET_ASSISTANCE]: { backTo: Routes; }; diff --git a/src/pages/workspace/accounting/xero/export/XeroExportConfigurationPage.tsx b/src/pages/workspace/accounting/xero/export/XeroExportConfigurationPage.tsx index c345f3ade490..bb6755cb6859 100644 --- a/src/pages/workspace/accounting/xero/export/XeroExportConfigurationPage.tsx +++ b/src/pages/workspace/accounting/xero/export/XeroExportConfigurationPage.tsx @@ -6,10 +6,10 @@ import OfflineWithFeedback from '@components/OfflineWithFeedback'; import type {OfflineWithFeedbackProps} from '@components/OfflineWithFeedback'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import Navigation from '@libs/Navigation/Navigation'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import CONST from '@src/CONST'; -import Navigation from '@libs/Navigation/Navigation'; import ROUTES from '@src/ROUTES'; type MenuItem = MenuItemProps & {pendingAction?: OfflineWithFeedbackProps['pendingAction']}; @@ -25,7 +25,7 @@ function XeroExportConfigurationPage({policy}: WithPolicyConnectionsProps) { { description: translate('workspace.xero.preferredExporter'), onPress: () => { - Navigation.navigate(ROUTES.POLICY_ACCOUNTING_XERO_PREFERRED_EXPORTER_SELECT.getRoute(policyID)); + Navigation.navigate(ROUTES.POLICY_ACCOUNTING_XERO_PREFERRED_EXPORTER_CONFIGURATION.getRoute(policyID)); }, brickRoadIndicator: errorFields?.exporter ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportConfiguration?.exporter ?? policyOwner, diff --git a/src/pages/workspace/accounting/xero/export/XeroPreferredExporterConfigurationPage.tsx b/src/pages/workspace/accounting/xero/export/XeroPreferredExporterConfigurationPage.tsx new file mode 100644 index 000000000000..b7bfe1eb3790 --- /dev/null +++ b/src/pages/workspace/accounting/xero/export/XeroPreferredExporterConfigurationPage.tsx @@ -0,0 +1,56 @@ +import React, {useMemo} from 'react'; +import ConnectionLayout from '@components/ConnectionLayout'; +import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; +import OfflineWithFeedback from '@components/OfflineWithFeedback'; +import useThemeStyles from '@hooks/useThemeStyles'; +import {getAdminEmployees} from '@libs/PolicyUtils'; +import Navigation from '@navigation/Navigation'; +import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; +import withPolicyConnections from '@pages/workspace/withPolicyConnections'; +import CONST from '@src/CONST'; +import ROUTES from '@src/ROUTES'; + +function XeroPreferredExporterConfigurationPage({policy}: WithPolicyConnectionsProps) { + const styles = useThemeStyles(); + const {export: exportConfiguration, pendingFields} = policy?.connections?.xero?.config ?? {}; + const exporters = getAdminEmployees(policy); + const policyOwner = policy?.owner ?? ''; + + const selectedExporter = useMemo(() => { + const currentExporter = exporters.find((exporter) => exporter.email === exportConfiguration?.exporter); + return currentExporter?.email ?? policyOwner; + }, [exportConfiguration, exporters, policyOwner]); + + const policyID = policy?.id ?? ''; + + return ( + + + { + Navigation.navigate(ROUTES.POLICY_ACCOUNTING_XERO_PREFERRED_EXPORTER_SELECT.getRoute(policyID)); + }} + /> + + + ); +} + +XeroPreferredExporterConfigurationPage.displayName = 'XeroPreferredExporterConfigurationPage'; + +export default withPolicyConnections(XeroPreferredExporterConfigurationPage); diff --git a/src/pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage.tsx b/src/pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage.tsx index d9316239f0e9..cfd42d814f7d 100644 --- a/src/pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage.tsx +++ b/src/pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage.tsx @@ -1,48 +1,49 @@ -import React, { useCallback, useMemo } from 'react'; -import HeaderWithBackButton from '@components/HeaderWithBackButton'; -import ScreenWrapper from '@components/ScreenWrapper'; -import SelectionList from '@components/SelectionList'; +import isEmpty from 'lodash/isEmpty'; +import React, {useCallback, useMemo} from 'react'; 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'; +import type {ListItem} from '@components/SelectionList/types'; +import SelectionScreen from '@components/SelectionScreen'; import * as Connections from '@libs/actions/connections'; -import { getAdminEmployees } from '@libs/PolicyUtils'; +import {getAdminEmployees} from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; -import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; -import type { WithPolicyConnectionsProps } from '@pages/workspace/withPolicyConnections'; +import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; - type CardListItem = ListItem & { value: string; }; function XeroPreferredExporterSelectPage({policy}: WithPolicyConnectionsProps) { - const {translate} = useLocalize(); - const styles = useThemeStyles(); const {export: exportConfiguration} = policy?.connections?.xero?.config ?? {}; + const policyOwner = policy?.owner ?? ''; const exporters = getAdminEmployees(policy); const policyID = policy?.id ?? ''; - const data: CardListItem[] = useMemo( - () => - exporters?.reduce((vendors, vendor) => { - if (vendor.email) { - vendors.push({ - value: vendor.email, - text: vendor.email, - keyForList: vendor.email, - isSelected: exportConfiguration?.exporter === vendor.email, - }); - } - return vendors; - }, []), - [exportConfiguration, exporters], - ); + const data: CardListItem[] = useMemo(() => { + if (!isEmpty(policyOwner) && isEmpty(exporters)) { + return [ + { + value: policyOwner, + text: policyOwner, + keyForList: policyOwner, + isSelected: true, + }, + ]; + } + return exporters?.reduce((vendors, vendor) => { + if (vendor.email) { + vendors.push({ + value: vendor.email, + text: vendor.email, + keyForList: vendor.email, + isSelected: exportConfiguration?.exporter === vendor.email, + }); + } + return vendors; + }, []); + }, [exportConfiguration, exporters, policyOwner]); const selectExporter = useCallback( (row: CardListItem) => { @@ -55,30 +56,21 @@ function XeroPreferredExporterSelectPage({policy}: WithPolicyConnectionsProps) { ); return ( - - - - - {translate('workspace.xero.exportPreferredExporterNote')} - {translate('workspace.xero.exportPreferredExporterSubNote')} - - } - sections={[{data}]} - ListItem={RadioListItem} - onSelectRow={selectExporter} - initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} - /> - - + displayName={XeroPreferredExporterSelectPage.displayName} + sections={[{data}]} + listItem={RadioListItem} + onSelectRow={selectExporter} + initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} + onBackButtonPress={() => Navigation.goBack(ROUTES.POLICY_ACCOUNTING_XERO_PREFERRED_EXPORTER_CONFIGURATION.getRoute(policyID))} + title="workspace.xero.preferredExporter" + /> ); } XeroPreferredExporterSelectPage.displayName = 'XeroPreferredExporterSelectPage'; -export default withPolicyConnections(XeroPreferredExporterSelectPage); \ No newline at end of file +export default withPolicyConnections(XeroPreferredExporterSelectPage); From e53f3e2981583de4ecbf5d06af43bddce6a72e1b Mon Sep 17 00:00:00 2001 From: Hans Date: Mon, 6 May 2024 16:16:17 +0700 Subject: [PATCH 3/6] update pendingFields --- .../xero/export/XeroPreferredExporterConfigurationPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/accounting/xero/export/XeroPreferredExporterConfigurationPage.tsx b/src/pages/workspace/accounting/xero/export/XeroPreferredExporterConfigurationPage.tsx index b7bfe1eb3790..1635bb5fb3ca 100644 --- a/src/pages/workspace/accounting/xero/export/XeroPreferredExporterConfigurationPage.tsx +++ b/src/pages/workspace/accounting/xero/export/XeroPreferredExporterConfigurationPage.tsx @@ -36,7 +36,7 @@ function XeroPreferredExporterConfigurationPage({policy}: WithPolicyConnectionsP subtitle="workspace.xero.exportPreferredExporterSubNote" contentContainerStyle={[styles.ph5, styles.pb2]} > - + Date: Tue, 7 May 2024 10:26:19 +0700 Subject: [PATCH 4/6] update translation --- src/languages/en.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 4b61711f4cde..fb59e6c334f6 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -2027,7 +2027,7 @@ export default { xeroInvoiceCollectionAccount: 'Xero Invoice Collections Account', invoiceAccountSelectorDescription: "As you've enabled exporting invoices from Expensify to Xero, this is the account the invoice will appear against once marked as paid.", }, - 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.', + 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.', }, type: { From f992572c40bb59319d7665db8c14373534b4ee49 Mon Sep 17 00:00:00 2001 From: Hans Date: Wed, 8 May 2024 10:03:30 +0700 Subject: [PATCH 5/6] remove unused code --- src/ROUTES.ts | 4 -- .../ModalStackNavigators/index.tsx | 2 - .../FULL_SCREEN_TO_RHP_MAPPING.ts | 1 - src/libs/Navigation/linkingConfig/config.ts | 1 - src/libs/Navigation/types.ts | 3 - .../export/XeroExportConfigurationPage.tsx | 2 +- ...XeroPreferredExporterConfigurationPage.tsx | 56 ------------------- .../XeroPreferredExporterSelectPage.tsx | 19 ++++++- 8 files changed, 19 insertions(+), 69 deletions(-) delete mode 100644 src/pages/workspace/accounting/xero/export/XeroPreferredExporterConfigurationPage.tsx diff --git a/src/ROUTES.ts b/src/ROUTES.ts index dc06c93f3137..5d2d0f71aef5 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -796,10 +796,6 @@ const ROUTES = { route: '/settings/workspaces/:policyID/connections/xero/export/preferred-exporter/select', getRoute: (policyID: string) => `/settings/workspaces/${policyID}/connections/xero/export/preferred-exporter/select` as const, }, - POLICY_ACCOUNTING_XERO_PREFERRED_EXPORTER_CONFIGURATION: { - route: '/settings/workspaces/:policyID/connections/xero/export/preferred-exporter', - getRoute: (policyID: string) => `/settings/workspaces/${policyID}/connections/xero/export/preferred-exporter` as const, - }, POLICY_ACCOUNTING_XERO_ADVANCED: { route: 'settings/workspaces/:policyID/accounting/xero/advanced', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/advanced` as const, diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index ea2a52e04c0a..0d4238a08fb3 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -311,8 +311,6 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../../pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_CONFIGURATION]: () => - require('../../../../pages/workspace/accounting/xero/export/XeroPreferredExporterConfigurationPage').default as React.ComponentType, [SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_FREQUENCY]: () => require('../../../../pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage').default as React.ComponentType, [SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_MONTHLY_OFFSET]: () => require('../../../../pages/workspace/workflows/WorkspaceAutoReportingMonthlyOffsetPage').default as React.ComponentType, diff --git a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts index 22d5abcd80ea..103d3bc3d475 100755 --- a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts +++ b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts @@ -48,7 +48,6 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial> = { SCREENS.WORKSPACE.ACCOUNTING.XERO_ADVANCED, SCREENS.WORKSPACE.ACCOUNTING.XERO_INVOICE_ACCOUNT_SELECTOR, SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_SELECT, - SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_CONFIGURATION, ], [SCREENS.WORKSPACE.TAXES]: [ SCREENS.WORKSPACE.TAXES_SETTINGS, diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index a9891abf3995..426b1bac31de 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -335,7 +335,6 @@ const config: LinkingOptions['config'] = { [SCREENS.WORKSPACE.ACCOUNTING.XERO_ADVANCED]: {path: ROUTES.POLICY_ACCOUNTING_XERO_ADVANCED.route}, [SCREENS.WORKSPACE.ACCOUNTING.XERO_INVOICE_ACCOUNT_SELECTOR]: {path: ROUTES.POLICY_ACCOUNTING_XERO_INVOICE_SELECTOR.route}, [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_SELECT]: {path: ROUTES.POLICY_ACCOUNTING_XERO_PREFERRED_EXPORTER_SELECT.route}, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_CONFIGURATION]: {path: ROUTES.POLICY_ACCOUNTING_XERO_PREFERRED_EXPORTER_CONFIGURATION.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 1dc0e889137e..f3ec4c4e067b 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -336,9 +336,6 @@ type SettingsNavigatorParamList = { [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_SELECT]: { policyID: string; }; - [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_CONFIGURATION]: { - policyID: string; - }; [SCREENS.GET_ASSISTANCE]: { backTo: Routes; }; diff --git a/src/pages/workspace/accounting/xero/export/XeroExportConfigurationPage.tsx b/src/pages/workspace/accounting/xero/export/XeroExportConfigurationPage.tsx index fb92ff3cb8e6..86316509c909 100644 --- a/src/pages/workspace/accounting/xero/export/XeroExportConfigurationPage.tsx +++ b/src/pages/workspace/accounting/xero/export/XeroExportConfigurationPage.tsx @@ -25,7 +25,7 @@ function XeroExportConfigurationPage({policy}: WithPolicyConnectionsProps) { { description: translate('workspace.xero.preferredExporter'), onPress: () => { - Navigation.navigate(ROUTES.POLICY_ACCOUNTING_XERO_PREFERRED_EXPORTER_CONFIGURATION.getRoute(policyID)); + Navigation.navigate(ROUTES.POLICY_ACCOUNTING_XERO_PREFERRED_EXPORTER_SELECT.getRoute(policyID)); }, brickRoadIndicator: errorFields?.exporter ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, title: exportConfiguration?.exporter ?? policyOwner, diff --git a/src/pages/workspace/accounting/xero/export/XeroPreferredExporterConfigurationPage.tsx b/src/pages/workspace/accounting/xero/export/XeroPreferredExporterConfigurationPage.tsx deleted file mode 100644 index 1635bb5fb3ca..000000000000 --- a/src/pages/workspace/accounting/xero/export/XeroPreferredExporterConfigurationPage.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import React, {useMemo} from 'react'; -import ConnectionLayout from '@components/ConnectionLayout'; -import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; -import OfflineWithFeedback from '@components/OfflineWithFeedback'; -import useThemeStyles from '@hooks/useThemeStyles'; -import {getAdminEmployees} from '@libs/PolicyUtils'; -import Navigation from '@navigation/Navigation'; -import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; -import withPolicyConnections from '@pages/workspace/withPolicyConnections'; -import CONST from '@src/CONST'; -import ROUTES from '@src/ROUTES'; - -function XeroPreferredExporterConfigurationPage({policy}: WithPolicyConnectionsProps) { - const styles = useThemeStyles(); - const {export: exportConfiguration, pendingFields} = policy?.connections?.xero?.config ?? {}; - const exporters = getAdminEmployees(policy); - const policyOwner = policy?.owner ?? ''; - - const selectedExporter = useMemo(() => { - const currentExporter = exporters.find((exporter) => exporter.email === exportConfiguration?.exporter); - return currentExporter?.email ?? policyOwner; - }, [exportConfiguration, exporters, policyOwner]); - - const policyID = policy?.id ?? ''; - - return ( - - - { - Navigation.navigate(ROUTES.POLICY_ACCOUNTING_XERO_PREFERRED_EXPORTER_SELECT.getRoute(policyID)); - }} - /> - - - ); -} - -XeroPreferredExporterConfigurationPage.displayName = 'XeroPreferredExporterConfigurationPage'; - -export default withPolicyConnections(XeroPreferredExporterConfigurationPage); diff --git a/src/pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage.tsx b/src/pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage.tsx index cfd42d814f7d..d56eb3476863 100644 --- a/src/pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage.tsx +++ b/src/pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage.tsx @@ -1,8 +1,12 @@ import isEmpty from 'lodash/isEmpty'; import React, {useCallback, useMemo} from 'react'; +import {View} from 'react-native'; import RadioListItem from '@components/SelectionList/RadioListItem'; import type {ListItem} from '@components/SelectionList/types'; import SelectionScreen from '@components/SelectionScreen'; +import Text from '@components/Text'; +import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections'; import {getAdminEmployees} from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; @@ -17,6 +21,8 @@ type CardListItem = ListItem & { function XeroPreferredExporterSelectPage({policy}: WithPolicyConnectionsProps) { const {export: exportConfiguration} = policy?.connections?.xero?.config ?? {}; + const {translate} = useLocalize(); + const styles = useThemeStyles(); const policyOwner = policy?.owner ?? ''; const exporters = getAdminEmployees(policy); @@ -55,6 +61,16 @@ function XeroPreferredExporterSelectPage({policy}: WithPolicyConnectionsProps) { [policyID, exportConfiguration], ); + const headerContent = useMemo( + () => ( + + {translate('workspace.xero.exportPreferredExporterNote')} + {translate('workspace.xero.exportPreferredExporterSubNote')} + + ), + [translate, styles.pb2, styles.ph5, styles.pb5, styles.textNormal], + ); + return ( mode.isSelected)?.keyForList} - onBackButtonPress={() => Navigation.goBack(ROUTES.POLICY_ACCOUNTING_XERO_PREFERRED_EXPORTER_CONFIGURATION.getRoute(policyID))} + onBackButtonPress={() => Navigation.goBack(ROUTES.POLICY_ACCOUNTING_XERO_EXPORT.getRoute(policyID))} title="workspace.xero.preferredExporter" /> ); From 1822e23f76f526eeaee48e345c0bf74bbcf006cf Mon Sep 17 00:00:00 2001 From: Hans Date: Thu, 9 May 2024 14:40:25 +0700 Subject: [PATCH 6/6] update prettier --- src/libs/Navigation/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 331f29affa9a..dfb965e312fb 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -347,7 +347,7 @@ type SettingsNavigatorParamList = { }; [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_SELECT]: { policyID: string; - }, + }; [SCREENS.WORKSPACE.ACCOUNTING.XERO_BILL_PAYMENT_ACCOUNT_SELECTOR]: { policyID: string; };