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 12 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 @@ -786,6 +786,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 @@ -239,6 +239,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',
},
INITIAL: 'Workspace_Initial',
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
16 changes: 16 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2001,6 +2001,22 @@ 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 awaiting payment, posting on the last day of the month in which expenses were incurred. This is the only export option with Xero.',
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',
Expand Down
16 changes: 16 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2034,6 +2034,22 @@ 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: 'Export company card expenses as',
rushatgabhane marked this conversation as resolved.
Show resolved Hide resolved
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.',
rushatgabhane marked this conversation as resolved.
Show resolved Hide resolved
bankTransactions: 'Bank transactions',
rushatgabhane marked this conversation as resolved.
Show resolved Hide resolved
xeroBankAccount: 'Xero días laborales',
rushatgabhane marked this conversation as resolved.
Show resolved Hide resolved
preferredExporter: 'Exportador preferido',
exportExpenses: 'Exportar gastos de bolsillo como',
rushatgabhane marked this conversation as resolved.
Show resolved Hide resolved
exportExpensesDescription:
'Reports will export as a Purchase Bill awaiting payment, posting on the last day of the month in which expenses were incurred. This is the only export option with Xero.',
purchaseBillDate: 'Purchase Bill Date',
exportInvoices: 'Exportar facturas como',
salesInvoice: 'Sales invoice',
rushatgabhane marked this conversation as resolved.
Show resolved Hide resolved
exportInvoicesDescription: 'Sales invoices always display the date on which the invoice was sent.',
rushatgabhane marked this conversation as resolved.
Show resolved Hide resolved
advancedConfig: {
advanced: 'Avanzado',
autoSync: 'Autosincronización',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,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.WORKFLOWS_AUTO_REPORTING_FREQUENCY]: () => require('../../../../pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage').default as React.ComponentType,
[SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_MONTHLY_OFFSET]: () =>
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.TAXES]: [
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.DESCRIPTION]: {
path: ROUTES.WORKSPACE_PROFILE_DESCRIPTION.route,
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,111 @@
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 type {OfflineWithFeedbackProps} 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 AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper';
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'),
onPress: () => {},
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.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 (
<AccessOrNotFoundWrapper
rushatgabhane marked this conversation as resolved.
Show resolved Hide resolved
policyID={policyID}
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN]}
featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED}
>
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
testID={XeroExportConfigurationPage.displayName}
>
<HeaderWithBackButton title={translate('workspace.xero.export')} />
<ScrollView contentContainerStyle={styles.pb2}>
<Text style={[styles.ph5, styles.pb5]}>{translate('workspace.xero.exportDescription')}</Text>
{menuItems.map((menuItem) => (
<OfflineWithFeedback
key={menuItem.description}
pendingAction={menuItem.pendingAction}
>
<MenuItemWithTopDescription
title={menuItem.title}
interactive={menuItem?.interactive ?? true}
rushatgabhane marked this conversation as resolved.
Show resolved Hide resolved
description={menuItem.description}
shouldShowRightIcon={menuItem?.shouldShowRightIcon ?? true}
rushatgabhane marked this conversation as resolved.
Show resolved Hide resolved
onPress={menuItem?.onPress}
brickRoadIndicator={menuItem?.brickRoadIndicator}
helperText={menuItem?.helperText}
error={menuItem?.error}
/>
</OfflineWithFeedback>
))}
</ScrollView>
</ScreenWrapper>
</AccessOrNotFoundWrapper>
);
}

XeroExportConfigurationPage.displayName = 'XeroExportConfigurationPage';

export default withPolicyConnections(XeroExportConfigurationPage);
Loading