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

[Wave Collect][Xero] Main export configuration #41554

Merged
merged 31 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c26c9fe
add export route
rushatgabhane May 3, 2024
b6c49bf
add export screen
rushatgabhane May 3, 2024
a94c5a0
add export to navigation
rushatgabhane May 3, 2024
284a576
navigate to export page
rushatgabhane May 3, 2024
d430569
add default export page
rushatgabhane May 3, 2024
460effc
add helper text to menu item
rushatgabhane May 3, 2024
7b85464
add lang
rushatgabhane May 3, 2024
70c405d
add default export page
rushatgabhane May 3, 2024
2ef017b
link to export page
rushatgabhane May 3, 2024
6fc8538
fix type
rushatgabhane May 3, 2024
6633fd8
add comment
rushatgabhane May 3, 2024
7becdd4
fix merge
rushatgabhane May 3, 2024
7925d95
use conenction layput
rushatgabhane May 3, 2024
1bd9350
move set status to exports page
rushatgabhane May 3, 2024
a28cc87
revert proj changes
rushatgabhane May 3, 2024
ee8c920
revert proj changes
rushatgabhane May 3, 2024
783ff95
revert
rushatgabhane May 3, 2024
db5ca03
Update en.ts
rushatgabhane May 4, 2024
03fbbbe
Update src/languages/es.ts
rushatgabhane May 6, 2024
b7953fd
Update src/languages/es.ts
rushatgabhane May 6, 2024
e4cf440
Update src/languages/es.ts
rushatgabhane May 6, 2024
7e88d91
Update src/languages/es.ts
rushatgabhane May 6, 2024
5477528
Update src/languages/es.ts
rushatgabhane May 6, 2024
840111c
Update src/languages/es.ts
rushatgabhane May 6, 2024
666c1ee
Update src/languages/es.ts
rushatgabhane May 6, 2024
e42a8f6
Update src/pages/workspace/accounting/xero/export/XeroExportConfigura…
rushatgabhane May 6, 2024
b98c1cc
Update src/languages/es.ts
rushatgabhane May 6, 2024
a95e49c
Update src/languages/es.ts
rushatgabhane May 6, 2024
94198a3
Update src/languages/es.ts
rushatgabhane May 6, 2024
61c111d
Update src/languages/es.ts
rushatgabhane May 6, 2024
8c8dfd4
Merge branch 'main' into xero-export
rushatgabhane May 6, 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
4 changes: 4 additions & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,10 @@ const ROUTES = {
route: 'settings/workspaces/:policyID/accounting/xero/import/taxes',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/import/taxes` as const,
},
POLICY_ACCOUNTING_XERO_EXPORT: {
route: 'settings/workspaces/:policyID/accounting/xero/export',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/export` as const,
},
POLICY_ACCOUNTING_XERO_ADVANCED: {
route: 'settings/workspaces/:policyID/accounting/xero/advanced',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/advanced` as const,
Expand Down
1 change: 1 addition & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ const SCREENS = {
XERO_ORGANIZATION: 'Policy_Accounting_Xero_Customers',
XERO_CUSTOMER: 'Policy_Acounting_Xero_Import_Customer',
XERO_TAXES: 'Policy_Accounting_Xero_Taxes',
XERO_EXPORT: 'Policy_Accounting_Xero_Export',
XERO_ADVANCED: 'Policy_Accounting_Xero_Advanced',
XERO_INVOICE_ACCOUNT_SELECTOR: 'Policy_Accounting_Xero_Invoice_Account_Selector',
},
Expand Down
9 changes: 9 additions & 0 deletions src/components/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ type MenuItemBaseProps = {
/** A description text to show under the title */
description?: string;

/** Text to show below menu item. This text is not interactive */
helperText?: string;

/** Any additional styles to pass to helper text. */
helperTextStyle?: StyleProp<TextStyle>;
rushatgabhane marked this conversation as resolved.
Show resolved Hide resolved

/** Should the description be shown above the title (instead of the other way around) */
shouldShowDescriptionOnTop?: boolean;

Expand Down Expand Up @@ -296,6 +302,8 @@ function MenuItem(
furtherDetailsIcon,
furtherDetails,
description,
helperText,
helperTextStyle,
error,
errorText,
success = false,
Expand Down Expand Up @@ -679,6 +687,7 @@ function MenuItem(
</PressableWithSecondaryInteraction>
)}
</Hoverable>
{!!helperText && <Text style={[styles.mutedNormalTextLabel, styles.ph5, styles.pb5, helperTextStyle]}>{helperText}</Text>}
</View>
);
}
Expand Down
17 changes: 16 additions & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2024,11 +2024,26 @@ export default {
customersDescription: 'Import customer contacts. Billable expenses need tags for export. Expenses will carry the customer information to Xero for sales invoices.',
taxesDescription: 'Choose whether to import tax rates and tax defaults from your accounting integration.',
notImported: 'Not imported',
export: 'Export',
exportDescription: 'Configure how data in Expensify gets exported to Xero.',
exportCompanyCard: 'Export company card expenses as',
purchaseBill: 'Purchase bill',
exportDeepDiveCompanyCard:
'Each exported expense posts as a bank transaction to the Xero bank account you select below, and transaction dates will match the dates on your bank statement.',
bankTransactions: 'Bank transactions',
xeroBankAccount: 'Xero bank account',
preferredExporter: 'Preferred exporter',
exportExpenses: 'Export out-of-pocket expenses as',
exportExpensesDescription: 'Reports will export as a purchase bill, using the date and status you select below.',
purchaseBillDate: 'Purchase bill date',
exportInvoices: 'Export invoices as',
salesInvoice: 'Sales invoice',
exportInvoicesDescription: 'Sales invoices always display the date on which the invoice was sent.',
advancedConfig: {
advanced: 'Advanced',
autoSync: 'Auto-Sync',
autoSyncDescription: 'Sync Xero and Expensify automatically every day.',
purchaseBillStatusTitle: 'Set purchase bill status (optional)',
purchaseBillStatusTitle: 'Purchase bill status',
reimbursedReports: 'Sync reimbursed reports',
reimbursedReportsDescription: 'Any time a report is paid using Expensify ACH, the corresponding bill payment will be created in the Xero account below.',
xeroBillPaymentAccount: 'Xero Bill Payment Account',
Expand Down
17 changes: 16 additions & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2057,11 +2057,26 @@ export default {
'Importar contactos de clientes. Los gastos facturables necesitan etiquetas para la exportación. Los gastos llevarán la información del cliente a Xero para las facturas de ventas.',
taxesDescription: 'Elige si quires importar las tasas de impuestos y los impuestos por defecto de tu integración de contaduría.',
notImported: 'No importado',
export: 'Exportar',
exportDescription: 'Configura cómo se exportan los datos de Expensify a Xero.',
exportCompanyCard: 'Exportar gastos de la tarjeta de empresa como',
purchaseBill: 'Factura de compra',
exportDeepDiveCompanyCard:
'Cada gasto exportado se contabiliza como una transacción bancaria en la cuenta bancaria de Xero que selecciones a continuación. Las fechas de las transacciones coincidirán con las fechas de el extracto bancario.',
bankTransactions: 'Transacciones bancarias',
xeroBankAccount: 'Cuenta bancaria de Xero',
preferredExporter: 'Exportador preferido',
exportExpenses: 'Exportar gastos por cuenta propia como',
exportExpensesDescription: 'Los informes se exportarán como una factura de compra utilizando la fecha y el estado que seleccione a continuación',
purchaseBillDate: 'Fecha de la factura de compra',
exportInvoices: 'Exportar facturas como',
salesInvoice: 'Factura de venta',
exportInvoicesDescription: 'Las facturas de venta siempre muestran la fecha en la que se envió la factura.',
advancedConfig: {
advanced: 'Avanzado',
autoSync: 'Autosincronización',
autoSyncDescription: 'Sincroniza Xero y Expensify automáticamente todos los días.',
purchaseBillStatusTitle: 'Set purchase bill status (optional)',
purchaseBillStatusTitle: 'Estado de la factura de compra',
reimbursedReports: 'Sincronizar informes reembolsados',
reimbursedReportsDescription:
'Cada vez que se pague un informe utilizando Expensify ACH, se creará el correspondiente pago de la factura en la cuenta de Xero indicadas a continuación.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorP
[SCREENS.WORKSPACE.ACCOUNTING.XERO_ORGANIZATION]: () => require('../../../../pages/workspace/accounting/xero/XeroOrganizationConfigurationPage').default as React.ComponentType,
[SCREENS.WORKSPACE.ACCOUNTING.XERO_CUSTOMER]: () => require('../../../../pages/workspace/accounting/xero/import/XeroCustomerConfigurationPage').default as React.ComponentType,
[SCREENS.WORKSPACE.ACCOUNTING.XERO_TAXES]: () => require('../../../../pages/workspace/accounting/xero/XeroTaxesConfigurationPage').default as React.ComponentType,
[SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT]: () => require('../../../../pages/workspace/accounting/xero/export/XeroExportConfigurationPage').default as React.ComponentType,
[SCREENS.WORKSPACE.ACCOUNTING.XERO_ADVANCED]: () => 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial<Record<FullScreenName, string[]>> = {
SCREENS.WORKSPACE.ACCOUNTING.XERO_ORGANIZATION,
SCREENS.WORKSPACE.ACCOUNTING.XERO_CUSTOMER,
SCREENS.WORKSPACE.ACCOUNTING.XERO_TAXES,
SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT,
SCREENS.WORKSPACE.ACCOUNTING.XERO_ADVANCED,
SCREENS.WORKSPACE.ACCOUNTING.XERO_INVOICE_ACCOUNT_SELECTOR,
],
Expand Down
1 change: 1 addition & 0 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ const config: LinkingOptions<RootStackParamList>['config'] = {
[SCREENS.WORKSPACE.ACCOUNTING.XERO_ORGANIZATION]: {path: ROUTES.POLICY_ACCOUNTING_XERO_ORGANIZATION.route},
[SCREENS.WORKSPACE.ACCOUNTING.XERO_CUSTOMER]: {path: ROUTES.POLICY_ACCOUNTING_XERO_CUSTOMER.route},
[SCREENS.WORKSPACE.ACCOUNTING.XERO_TAXES]: {path: ROUTES.POLICY_ACCOUNTING_XERO_TAXES.route},
[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.DESCRIPTION]: {
Expand Down
3 changes: 3 additions & 0 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ type SettingsNavigatorParamList = {
[SCREENS.WORKSPACE.ACCOUNTING.XERO_TAXES]: {
policyID: string;
};
[SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT]: {
policyID: string;
};
[SCREENS.WORKSPACE.ACCOUNTING.XERO_ADVANCED]: {
policyID: string;
};
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 @@ -92,7 +92,7 @@ function accountingIntegrationData(
/>
),
onImportPagePress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_XERO_IMPORT.getRoute(policyID)),
onExportPagePress: () => {},
onExportPagePress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_XERO_EXPORT.getRoute(policyID)),
onAdvancedPagePress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_XERO_ADVANCED.getRoute(policyID)),
};
default:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import React from 'react';
import ConnectionLayout from '@components/ConnectionLayout';
import type {MenuItemProps} from '@components/MenuItem';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
import type {OfflineWithFeedbackProps} from '@components/OfflineWithFeedback';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections';
import withPolicyConnections from '@pages/workspace/withPolicyConnections';
import CONST from '@src/CONST';

type MenuItem = MenuItemProps & {pendingAction?: OfflineWithFeedbackProps['pendingAction']};

function XeroExportConfigurationPage({policy}: WithPolicyConnectionsProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
const policyID = policy?.id ?? '';
const policyOwner = policy?.owner ?? '';

const {export: exportConfiguration, errorFields, pendingFields} = policy?.connections?.xero?.config ?? {};
const menuItems: MenuItem[] = [
{
description: translate('workspace.xero.preferredExporter'),
onPress: () => {},
brickRoadIndicator: errorFields?.exporter ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined,
title: exportConfiguration?.exporter ?? policyOwner,
pendingAction: pendingFields?.export,
error: errorFields?.exporter ? translate('common.genericErrorMessage') : undefined,
},
{
description: translate('workspace.xero.exportExpenses'),
title: translate('workspace.xero.purchaseBill'),
interactive: false,
shouldShowRightIcon: false,
helperText: translate('workspace.xero.exportExpensesDescription'),
},
{
description: translate('workspace.xero.purchaseBillDate'),
brickRoadIndicator: errorFields?.billDate ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined,
title: exportConfiguration?.billDate,
pendingAction: pendingFields?.export,
error: errorFields?.billDate ? translate('common.genericErrorMessage') : undefined,
},
{
description: translate('workspace.xero.advancedConfig.purchaseBillStatusTitle'),
onPress: () => {},
title: exportConfiguration?.billStatus?.purchase,
pendingAction: pendingFields?.export,
error: errorFields?.purchase ? translate('common.genericErrorMessage') : undefined,
},
{
description: translate('workspace.xero.exportInvoices'),
title: translate('workspace.xero.salesInvoice'),
interactive: false,
shouldShowRightIcon: false,
helperText: translate('workspace.xero.exportInvoicesDescription'),
},
{
description: translate('workspace.xero.exportCompanyCard'),
title: translate('workspace.xero.bankTransactions'),
shouldShowRightIcon: false,
interactive: false,
helperText: translate('workspace.xero.exportDeepDiveCompanyCard'),
},
{
description: translate('workspace.xero.xeroBankAccount'),
onPress: () => {},
brickRoadIndicator: errorFields?.nonReimbursableAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined,
title: undefined,
pendingAction: pendingFields?.export,
error: undefined,
},
];

return (
<ConnectionLayout
displayName={XeroExportConfigurationPage.displayName}
headerTitle="workspace.xero.export"
title="workspace.xero.exportDescription"
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN]}
policyID={policyID}
featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED}
contentContainerStyle={styles.pb2}
titleStyle={styles.ph5}
>
{menuItems.map((menuItem) => (
<OfflineWithFeedback
key={menuItem.description}
pendingAction={menuItem.pendingAction}
>
<MenuItemWithTopDescription
title={menuItem.title}
interactive={menuItem?.interactive ?? true}
description={menuItem.description}
shouldShowRightIcon={menuItem?.shouldShowRightIcon ?? true}
onPress={menuItem?.onPress}
brickRoadIndicator={menuItem?.brickRoadIndicator}
helperText={menuItem?.helperText}
error={menuItem?.error}
/>
</OfflineWithFeedback>
))}
</ConnectionLayout>
);
}

XeroExportConfigurationPage.displayName = 'XeroExportConfigurationPage';

export default withPolicyConnections(XeroExportConfigurationPage);
Loading