Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feature: implement qbo advanced configuration screens #39899

Merged
Show file tree
Hide file tree
Changes from 143 commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
3dee677
add fake accounting page
teneeto Apr 7, 2024
bf28c9c
add initial quickbooks advanced page
teneeto Apr 7, 2024
80c2e97
add qbo advanced screen options
teneeto Apr 7, 2024
cc91791
add qbo advanced types
teneeto Apr 7, 2024
80c4ea0
add qbo advanced routes
teneeto Apr 7, 2024
d1012f0
add qbo advanced to settings modal stack navigator
teneeto Apr 7, 2024
c4a7363
add accounting page to modal stack navigator
teneeto Apr 7, 2024
03d5cc5
match qbo advanced screen to routes
teneeto Apr 7, 2024
709bf5d
map qbo advanced screen to accouting
teneeto Apr 7, 2024
40a763f
update ToggleSettingOptionRowProps to make icons props optional
teneeto Apr 7, 2024
4d8cdeb
add qbo online account selecetor page to navigation screens
teneeto Apr 9, 2024
ab7fac2
add qbo online account selecetor page navigation types
teneeto Apr 9, 2024
a17124c
add qbo online account selecetor page route
teneeto Apr 9, 2024
c153710
add qbo online account selecetor page to stack navigator
teneeto Apr 9, 2024
cb714f4
match qbo online account selecetor page screen to routes
teneeto Apr 9, 2024
d6a1251
add qbo online account selecetor page to full screen to rhp mapping
teneeto Apr 9, 2024
eaf9660
add qbo online account selecetor page
teneeto Apr 9, 2024
94fbca4
fix lint
teneeto Apr 9, 2024
7630b19
add qbo online invoice account selecetor page to navigation screens
teneeto Apr 9, 2024
65f3b50
add qbo online invoice account selecetor page navigation types
teneeto Apr 9, 2024
0a8f5b8
add qbo online invoice account selecetor page route
teneeto Apr 9, 2024
b09eea1
add qbo online invoice account selecetor page to stack navigator
teneeto Apr 9, 2024
1502d77
match qbo online invoice account selecetor page screen to routes
teneeto Apr 9, 2024
c4918a9
add qbo online invoice account selecetor page to full screen to rhp m…
teneeto Apr 9, 2024
80b7af1
add qbo online invoice account selecetor page
teneeto Apr 9, 2024
b8db3cb
Merge branch 'main' of github.com:teneeto/Expensify into feature/3779…
teneeto Apr 9, 2024
335c020
Merge branch 'main' of github.com:teneeto/Expensify into feature/3779…
teneeto Apr 9, 2024
48c08a1
revert: Podfile lock
teneeto Apr 9, 2024
b6f6c2c
fix tsc
teneeto Apr 9, 2024
3df0f4e
fix tsc
teneeto Apr 9, 2024
e9e3550
remove duplicate stack navigator
teneeto Apr 9, 2024
69f1ccf
put back accounting stack
teneeto Apr 9, 2024
0eb7741
update first section options
teneeto Apr 9, 2024
3c97413
navigate to advanced screen
teneeto Apr 9, 2024
f299acb
move QBO_ONLINE_ACCOUNT_SELECTOR_OPTIONS to const
teneeto Apr 9, 2024
87810f4
use QBO_ONLINE_ACCOUNT_SELECTOR_OPTIONS
teneeto Apr 9, 2024
9e8b4b9
navigate to advanced page
teneeto Apr 9, 2024
448812c
navigate to online invoice account selector page
teneeto Apr 9, 2024
aaaa2f3
Merge branch 'main' of github.com:teneeto/Expensify into feature/3779…
teneeto Apr 9, 2024
6ac5904
add to dependency tray
teneeto Apr 10, 2024
1127d9d
add initial advanced config strings for english
teneeto Apr 10, 2024
df30052
add initial advanced config strings for spanish
teneeto Apr 10, 2024
554d758
use translations for qbo advanced page
teneeto Apr 10, 2024
d390629
use translations for qbo account select page
teneeto Apr 10, 2024
a96eef4
use translations for qbo invoice account select page
teneeto Apr 10, 2024
3bff442
update to qbo selector options
teneeto Apr 10, 2024
bfbb86f
add croissantCo strings for english
teneeto Apr 10, 2024
4e78e0c
add croissantCo strings for spanish
teneeto Apr 10, 2024
f1b5671
use translations for selector options on qbo advanced page
teneeto Apr 10, 2024
ac8b0d8
use translations for selector options on qbo account select page
teneeto Apr 10, 2024
e3b1d1f
use translations for selector options on qbo invoice account select page
teneeto Apr 10, 2024
fbeca89
update select defaults
teneeto Apr 10, 2024
2b874fd
unify all qbo configs and rename to QUICK_BOOKS_CONFIG
teneeto Apr 10, 2024
b298708
update updatePolicyConnectionConfig param types
teneeto Apr 10, 2024
ba34554
update UpdatePolicyConnectionConfigParams types
teneeto Apr 10, 2024
f6f5bf3
group all qbo advance config pages and use updatePolicyConnectionConf…
teneeto Apr 10, 2024
42d8dcc
update qbo param list structure
teneeto Apr 10, 2024
84a3746
group all qbo import config pages
teneeto Apr 10, 2024
7ff7d71
update qbo param list structure
teneeto Apr 10, 2024
ce5924a
add collectionAccountID and reimbursementAccountID and updatePolicyCo…
teneeto Apr 11, 2024
6325a56
implement toggles
teneeto Apr 11, 2024
ae642b8
fix QuickbooksTaxesPage lint
teneeto Apr 11, 2024
5700282
block routes without permission for QuickbooksAdvancedPage
teneeto Apr 11, 2024
5a127b6
block routes without permission for QuickbooksAccountSelectPage
teneeto Apr 11, 2024
798d001
block routes without permission for QuickbooksInvoiceAccountSelectPage
teneeto Apr 11, 2024
fb5e231
fix lint
teneeto Apr 11, 2024
0527498
add pending fields
teneeto Apr 11, 2024
8187293
update toggle switch component
teneeto Apr 12, 2024
4655224
update advanced component
teneeto Apr 12, 2024
bed3136
fix lint
teneeto Apr 12, 2024
e5d09ef
Merge branch 'main' of github.com:teneeto/Expensify into feature/3779…
teneeto Apr 12, 2024
22bdfb0
remove shouldEnableMaxHeight
teneeto Apr 12, 2024
57f7051
use selectionList for QuickbooksAccountSelectPage
teneeto Apr 12, 2024
f195d67
use selectionList for QuickbooksInvoiceAccountSelectPage
teneeto Apr 12, 2024
c3979f6
extend ListItem for SelectorType for QuickbooksAccountSelectPage
teneeto Apr 12, 2024
192ab99
extend ListItem for SelectorType for QuickbooksInvoiceAccountSelectPage
teneeto Apr 12, 2024
39e92ba
fix lint
teneeto Apr 12, 2024
16207ef
Navigate back after selection for QuickbooksAccountSelectPage
teneeto Apr 12, 2024
5b23831
Navigate back after selection for QuickbooksInvoiceAccountSelectPage
teneeto Apr 12, 2024
1794de9
use ToggleSettingOptionRowProps
teneeto Apr 12, 2024
e1fa3ae
use MenuItemWithTopDescription
teneeto Apr 12, 2024
015f7d8
fix lint
teneeto Apr 12, 2024
025758b
rename to policy accounting
teneeto Apr 12, 2024
ac5a924
move close to other policy accounting routes
teneeto Apr 12, 2024
e30539f
use array instead of object spread
teneeto Apr 12, 2024
90f61e7
use useMemo to rerun a ready-to-render view
teneeto Apr 12, 2024
65f8f41
update wrapperStyle types
teneeto Apr 12, 2024
3f4913a
use array instead of object spread
teneeto Apr 12, 2024
06fbd1a
add TODO to unfinished implementations
teneeto Apr 12, 2024
b6dae7c
fix lint: add missing dep.
teneeto Apr 12, 2024
44f8588
remove waitForNavigate
teneeto Apr 15, 2024
76d4ef7
update function name saveSelection
teneeto Apr 15, 2024
459a47a
update object name to qboToggleSettingItems
teneeto Apr 15, 2024
b6d2657
update ToggleSettingOptionRow
teneeto Apr 15, 2024
b06c5bf
add 20px padding bottom to content container
teneeto Apr 15, 2024
d5af5ff
Merge branch 'main' of github.com:teneeto/Expensify into feature/3779…
teneeto Apr 15, 2024
feb7d74
remove croissantCo translations
teneeto Apr 16, 2024
5725e8d
update selections default
teneeto Apr 16, 2024
2420297
remove acount options draft
teneeto Apr 16, 2024
eea8013
remove acount options draft
teneeto Apr 16, 2024
2536146
use acount options draft
teneeto Apr 16, 2024
2b55221
set default
teneeto Apr 16, 2024
f749eb4
should be bank account and creditCards
teneeto Apr 16, 2024
330c2a7
move state to top
teneeto Apr 16, 2024
fb6779b
update qbo advanced spanish translations
teneeto Apr 16, 2024
cfd42c5
update qbo advanced english strings
teneeto Apr 16, 2024
cf3cf1b
update saveSelection
teneeto Apr 16, 2024
81a5cba
fix lint
teneeto Apr 16, 2024
0c8d5ef
add otherCurrentAssetAccounts in accountOptions
teneeto Apr 16, 2024
d4cdb07
fix lint
teneeto Apr 16, 2024
6f7e3fe
fix lint
teneeto Apr 16, 2024
2c1135d
undo podfile change
teneeto Apr 16, 2024
4005fd4
Update src/pages/workspace/accounting/qbo/advanced/QuickbooksAccountS…
teneeto Apr 17, 2024
9a79e2d
Update src/pages/workspace/accounting/qbo/advanced/QuickbooksAccountS…
teneeto Apr 17, 2024
03c86ae
Update src/pages/workspace/accounting/qbo/advanced/QuickbooksAccountS…
teneeto Apr 17, 2024
9a98823
Merge branch 'main' of github.com:teneeto/Expensify into feature/3779…
teneeto Apr 17, 2024
78c4333
update defaults
teneeto Apr 17, 2024
e50c28f
fix lint
teneeto Apr 17, 2024
c5ccafe
use otherCurrentAssetAccounts and bankAccounts
teneeto Apr 17, 2024
9fe0ec3
fix lint
teneeto Apr 17, 2024
9ea39ff
remove enabled from autoSync
teneeto Apr 17, 2024
8086aaf
remove qbo selector options
teneeto Apr 17, 2024
3a428b6
Merge branch 'main' of github.com:teneeto/Expensify into feature/3779…
teneeto Apr 18, 2024
a65b36f
Merge branch 'main' of github.com:teneeto/Expensify into feature/3779…
teneeto Apr 18, 2024
dc6a7ac
update advanced config accounting routes and navigation types
teneeto Apr 18, 2024
47f2092
use prettier
teneeto Apr 18, 2024
fdf28bb
update connection values
teneeto Apr 18, 2024
0e5c2c3
remove key in toggle settings
teneeto Apr 18, 2024
1e3a1e1
update more connection values
teneeto Apr 18, 2024
c3fd4b6
add fallback routes
teneeto Apr 18, 2024
6d286da
fix review comments
teneeto Apr 18, 2024
03f5bfe
update pendingAction and isActive
teneeto Apr 19, 2024
fee6469
add offline with feedback, brickroadIndicator and errorText
teneeto Apr 19, 2024
bb18bf8
update updatePolicyConnectionConfig types and stringify autosync
teneeto Apr 19, 2024
6e9e311
fix lint
teneeto Apr 19, 2024
adf5dff
fix tsc
teneeto Apr 19, 2024
97b5aee
Merge branch 'main' of github.com:teneeto/Expensify into feature/3779…
teneeto Apr 19, 2024
3a81002
Merge branch 'main' of github.com:teneeto/Expensify into feature/3779…
teneeto Apr 22, 2024
22313f2
add errors
teneeto Apr 22, 2024
d5359eb
update OfflineWithFeedback
teneeto Apr 22, 2024
97754fc
update updatePolicyConnectionConfig types and values
teneeto Apr 22, 2024
d04deb0
fix lint
teneeto Apr 22, 2024
f41eb55
fix tsc
teneeto Apr 22, 2024
a6e0eea
update UpdatePolicyConnectionConfigParams
teneeto Apr 22, 2024
46596fb
remove generic type from connectionName
teneeto Apr 22, 2024
80463b2
update toggle errors
teneeto Apr 22, 2024
41edef8
update toggle errors
teneeto Apr 22, 2024
6f73fe4
Merge branch 'main' of github.com:teneeto/Expensify into feature/3779…
teneeto Apr 22, 2024
1caab9f
fix lint
teneeto Apr 22, 2024
1600f9b
update UpdatePolicyConnectionConfigParams types
teneeto Apr 22, 2024
fd6348e
fix tsc
teneeto Apr 22, 2024
3a6364a
make condition boolean
teneeto Apr 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1220,12 +1220,17 @@ const CONST = {
},
QUICKBOOKS_ONLINE: 'quickbooksOnline',

QUICKBOOKS_IMPORTS: {
QUICK_BOOKS_CONFIG: {
SYNC_CLASSES: 'syncClasses',
ENABLE_NEW_CATEGORIES: 'enableNewCategories',
SYNC_CUSTOMERS: 'syncCustomers',
SYNC_LOCATIONS: 'syncLocations',
SYNC_TAXES: 'syncTaxes',
AUTO_SYNC: 'autoSync',
SYNCE_PEOPLE: 'syncPeople',
AUTO_CREATE_VENDOR: 'autoCreateVendor',
REIMBURSEMENT_ACCOUNT_ID: 'reimbursementAccountID',
COLLECTION_ACCOUNT_ID: 'collectionAccountID',
},

ACCOUNT_ID: {
Expand Down
12 changes: 12 additions & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,18 @@ const ROUTES = {
route: 'settings/workspaces/:policyID/accounting',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting` as const,
},
WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_ADVANCED: {
route: 'settings/workspaces/:policyID/accounting/quickbooks-online/advanced',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/advanced` as const,
},
WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_ACCOUNT_SELECTOR: {
route: 'settings/workspaces/:policyID/accounting/quickbooks-online/account-selector',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/account-selector` as const,
},
WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECTOR: {
route: 'settings/workspaces/:policyID/accounting/quickbooks-online/invoice-account-selector',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/invoice-account-selector` as const,
},
WORKSPACE_CATEGORIES: {
route: 'settings/workspaces/:policyID/categories',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/categories` as const,
Expand Down
3 changes: 3 additions & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ 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_ADVANCED: 'Policy_Accounting_Quickbooks_Online_Advanced',
QUICKBOOKS_ONLINE_ACCOUNT_SELECTOR: 'Policy_Accounting_Quickbooks_Online_Account_Selector',
QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECTOR: 'Policy_Accounting_Quickbooks_Online_Invoice_Account_Selector',
},
INITIAL: 'Workspace_Initial',
PROFILE: 'Workspace_Profile',
Expand Down
19 changes: 19 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1872,6 +1872,25 @@ 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.',
advancedConfig: {
advanced: 'Advanced',
autoSync: 'Auto-sync',
autoSyncDescription: 'Changes made in Quickbooks will automatically be reflected in Expensify.',
inviteEmployees: 'Invite employees',
inviteEmployeesDescription: 'Import Quickbooks Online employee records and invite them to this workspace.',
createEntities: 'Automatically create entities',
createEntitiesDescription:
'Expensify will automatically create a vendor in Quickbooks, if one does not exist. Expensify will also automatically create a customer when exporting invoices.',
reimbursedReports: 'Sync reimbursed reports',
reimbursedReportsDescription: 'Any time report is paid using Expensify ACH, the corresponding bill payment will be created in the Quickbooks accounts below.',
qboAccount: 'Quickbooks account',
collectionAccount: 'Invoice collection account',
collectionAccountDescription: 'Once invoices have been paid, the payment will appear in the account configured below.',
accountSelectDescription:
"As you've enabled sync reimbursed reports, you will need select the bank account your reimbursements are coming out of, and we'll create the payment in QuickBooks.",
invoiceAccountSelectDescription:
'If you are exporting invoices from Expensify to Quickbooks Online, this is the account the invoice will appear against once marked as paid.',
},
},
type: {
free: 'Free',
Expand Down
20 changes: 20 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1896,6 +1896,26 @@ export default {
taxesDescription: 'Elige si quires importar las tasas de impuestos y los impuestos por defecto de tu integración de contaduría.',
locationsAdditionalDescription:
'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.',
advancedConfig: {
advanced: 'Avanzado',
autoSync: 'Autosincronización',
autoSyncDescription: 'Los cambios realizados en Quickbooks se reflejarán automáticamente en Expensify.',
inviteEmployees: 'Invitar empleados',
inviteEmployeesDescription: 'Importe los registros de los empleados de Quickbooks Online e invítelos a este espacio de trabajo.',
createEntities: 'Crear entidades automáticamente',
createEntitiesDescription:
'Expensify creará automáticamente un proveedor en Quickbooks, si no existe. Expensify también creará automáticamente un cliente al exportar facturas.',
reimbursedReports: 'Sincronizar informes reembolsados',
reimbursedReportsDescription:
'Cada vez que se pague un informe utilizando Expensify ACH, se creará el pago de la factura correspondiente en las cuentas de Quickbooks indicadas a continuación.',
qboAccount: 'Cuenta Quickbooks',
collectionAccount: 'Cuenta de cobro de facturas',
collectionAccountDescription: 'Una vez abonadas las facturas, el pago aparecerá en la cuenta configurada a continuación.',
accountSelectDescription:
'Como has activado la sincronización de los informes de reembolso, tendrás que seleccionar la cuenta bancaria de la que saldrán tus reembolsos y crearemos el pago en QuickBooks.',
invoiceAccountSelectDescription:
'Si está exportando facturas de Expensify a Quickbooks Online, ésta es la cuenta en la que aparecerá la factura una vez marcada como pagada.',
},
},
type: {
free: 'Gratis',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type UpdatePolicyConnectionConfigParams<TConnectionName extends ConnectionName,
policyID: string;
connectionName: TConnectionName;
teneeto marked this conversation as resolved.
Show resolved Hide resolved
settingName: TSettingName;
settingValue: Connections[TConnectionName]['config'][TSettingName];
settingValue: Connections[TConnectionName]['config'][TSettingName] | string;
teneeto marked this conversation as resolved.
Show resolved Hide resolved
idempotencyKey: string;
};

Expand Down
17 changes: 11 additions & 6 deletions src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,18 @@ const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorP
[SCREENS.SETTINGS.EXIT_SURVEY.REASON]: () => require('../../../../pages/settings/ExitSurvey/ExitSurveyReasonPage').default as React.ComponentType,
[SCREENS.SETTINGS.EXIT_SURVEY.RESPONSE]: () => require('../../../../pages/settings/ExitSurvey/ExitSurveyResponsePage').default as React.ComponentType,
[SCREENS.SETTINGS.EXIT_SURVEY.CONFIRM]: () => require('../../../../pages/settings/ExitSurvey/ExitSurveyConfirmPage').default as React.ComponentType,
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_IMPORT]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksImportPage').default as React.ComponentType,
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_IMPORT]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksImportPage').default as React.ComponentType,
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CHART_OF_ACCOUNTS]: () =>
require('../../../../pages/workspace/accounting/qbo/QuickbooksChartOfAccountsPage').default as React.ComponentType,
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CUSTOMERS]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksCustomersPage').default as React.ComponentType,
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_TAXES]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksTaxesPage').default as React.ComponentType,
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_LOCATIONS]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksLocationsPage').default as React.ComponentType,
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CLASSES]: () => require('../../../../pages/workspace/accounting/qbo/QuickbooksClassesPage').default as React.ComponentType,
require('../../../../pages/workspace/accounting/qbo/import/QuickbooksChartOfAccountsPage').default as React.ComponentType,
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CUSTOMERS]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksCustomersPage').default as React.ComponentType,
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_TAXES]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksTaxesPage').default as React.ComponentType,
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_LOCATIONS]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksLocationsPage').default as React.ComponentType,
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CLASSES]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksClassesPage').default as React.ComponentType,
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_ADVANCED]: () => require('../../../../pages/workspace/accounting/qbo/advanced/QuickbooksAdvancedPage').default as React.ComponentType,
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_ACCOUNT_SELECTOR]: () =>
require('../../../../pages/workspace/accounting/qbo/advanced/QuickbooksAccountSelectPage').default as React.ComponentType,
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECTOR]: () =>
require('../../../../pages/workspace/accounting/qbo/advanced/QuickbooksInvoiceAccountSelectPage').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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial<Record<FullScreenName, string[]>> = {
SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_TAXES,
SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_LOCATIONS,
SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CUSTOMERS,
SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_ADVANCED,
SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_ACCOUNT_SELECTOR,
SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECTOR,
],
[SCREENS.WORKSPACE.TAXES]: [
SCREENS.WORKSPACE.TAXES_SETTINGS,
Expand Down
9 changes: 9 additions & 0 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,15 @@ const config: LinkingOptions<RootStackParamList>['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.ACCOUNTING.QUICKBOOKS_ONLINE_ADVANCED]: {
path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_ADVANCED.route,
},
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_ACCOUNT_SELECTOR]: {
path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_ACCOUNT_SELECTOR.route,
},
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECTOR]: {
path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECTOR.route,
},
[SCREENS.WORKSPACE.DESCRIPTION]: {
path: ROUTES.WORKSPACE_PROFILE_DESCRIPTION.route,
},
Expand Down
10 changes: 10 additions & 0 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -706,9 +706,19 @@ type WorkspacesCentralPaneNavigatorParamList = {
[SCREENS.WORKSPACE.DISTANCE_RATES]: {
policyID: string;
};

[SCREENS.WORKSPACE.ACCOUNTING.ROOT]: {
policyID: string;
};
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_ADVANCED]: {
policyID: string;
};
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_ACCOUNT_SELECTOR]: {
policyID: string;
};
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECTOR]: {
policyID: string;
};
};

type FullScreenNavigatorParamList = {
Expand Down
4 changes: 2 additions & 2 deletions src/libs/actions/connections/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function updatePolicyConnectionConfig<TConnectionName extends ConnectionName, TS
policyID: string,
connectionName: TConnectionName,
settingName: TSettingName,
teneeto marked this conversation as resolved.
Show resolved Hide resolved
settingValue: Connections[TConnectionName]['config'][TSettingName],
settingValue: Partial<Connections[TConnectionName]['config'][TSettingName]>,
) {
const optimisticData: OnyxUpdate[] = [
{
Expand Down Expand Up @@ -118,7 +118,7 @@ function updatePolicyConnectionConfig<TConnectionName extends ConnectionName, TS
policyID,
connectionName,
settingName,
settingValue,
settingValue: JSON.stringify(settingValue),
teneeto marked this conversation as resolved.
Show resolved Hide resolved
idempotencyKey: String(settingName),
};
API.write(WRITE_COMMANDS.UPDATE_POLICY_CONNECTION_CONFIG, parameters, {optimisticData, failureData, successData});
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/accounting/PolicyAccountingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function PolicyAccountingPage({policy, connectionSyncProgress}: PolicyAccounting
shouldShowRightIcon: true,
title: translate('workspace.accounting.advanced'),
wrapperStyle: [styles.sectionMenuItemTopDescription],
onPress: () => {},
onPress: () => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_ADVANCED.getRoute(policyID)),
},
]
: []),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import React, {useCallback, useMemo} from 'react';
import {View} from 'react-native';
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 Navigation from '@libs/Navigation/Navigation';
import AdminPolicyAccessOrNotFoundWrapper from '@pages/workspace/AdminPolicyAccessOrNotFoundWrapper';
import FeatureEnabledAccessOrNotFoundWrapper from '@pages/workspace/FeatureEnabledAccessOrNotFoundWrapper';
import PaidPolicyAccessOrNotFoundWrapper from '@pages/workspace/PaidPolicyAccessOrNotFoundWrapper';
import withPolicy from '@pages/workspace/withPolicy';
import type {WithPolicyProps} from '@pages/workspace/withPolicy';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';

type SelectorType = ListItem & {
value: string;
};

// TODO: remove once UI is approved
const DRAFT = [
{name: 'Croissant Co Payroll Account', id: 'Croissant Co Payroll Account'},
{name: 'Croissant Co Money in Clearing', id: 'Croissant Co Money in Clearing'},
{name: 'Croissant Co Debts and Loans', id: 'Croissant Co Debts and Loans'},
];

function QuickbooksAccountSelectPage({policy}: WithPolicyProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();

const selectedAccount = DRAFT[0].id; // selected

const policyID = policy?.id ?? '';
const {bankAccounts, creditCards} = policy?.connections?.quickbooksOnline?.data ?? {};
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const accountOptions = useMemo(() => DRAFT || [...(bankAccounts ?? []), ...(creditCards ?? [])], [bankAccounts, creditCards]);

const qboOnlineSelectorOptions = useMemo<SelectorType[]>(
() =>
accountOptions?.map(({id, name}) => ({
value: id,
text: name,
keyForList: id,
isSelected: selectedAccount === id,
})),
[selectedAccount, accountOptions],
);
const listHeaderComponent = useMemo(
() => (
<View style={[styles.pb2, styles.ph5]}>
<Text style={[styles.pb5, styles.textNormal]}>{translate('workspace.qbo.advancedConfig.invoiceAccountSelectDescription')}</Text>
</View>
),
[translate, styles.pb2, styles.ph5, styles.pb5, styles.textNormal],
);

const initiallyFocusedOptionKey = useMemo(() => qboOnlineSelectorOptions?.find((mode) => mode.isSelected)?.keyForList, [qboOnlineSelectorOptions]);

const saveSelection = useCallback(
({value}: SelectorType) => {
Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.REIMBURSEMENT_ACCOUNT_ID, value);
Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_ADVANCED.getRoute(policyID));
},
[policyID],
);

return (
<AdminPolicyAccessOrNotFoundWrapper policyID={policyID}>
<PaidPolicyAccessOrNotFoundWrapper policyID={policyID}>
<FeatureEnabledAccessOrNotFoundWrapper
policyID={policyID}
featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED}
>
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
testID={QuickbooksAccountSelectPage.displayName}
>
<HeaderWithBackButton title={translate('workspace.qbo.advancedConfig.qboAccount')} />

<SelectionList
sections={[{data: qboOnlineSelectorOptions}]}
ListItem={RadioListItem}
headerContent={listHeaderComponent}
onSelectRow={saveSelection}
initiallyFocusedOptionKey={initiallyFocusedOptionKey}
/>
</ScreenWrapper>
</FeatureEnabledAccessOrNotFoundWrapper>
</PaidPolicyAccessOrNotFoundWrapper>
</AdminPolicyAccessOrNotFoundWrapper>
);
}

QuickbooksAccountSelectPage.displayName = 'QuickbooksAccountSelectPage';

export default withPolicy(QuickbooksAccountSelectPage);
Loading
Loading