Skip to content

Commit

Permalink
Merge pull request #41547 from Expensify/aldo_fix-chart-of-accounts-a…
Browse files Browse the repository at this point in the history
…nd-exporter

Fix/improve chart of accounts import page
  • Loading branch information
aldo-expensify authored May 6, 2024
2 parents 54ed3a6 + c1942c8 commit 9d235c8
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 47 deletions.
6 changes: 3 additions & 3 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1914,9 +1914,9 @@ export default {
locations: 'Locations',
customers: 'Customers/Projects',
displayedAs: 'Displayed as',
accountsDescription: 'Chart of Accounts import as categories when connected to an accounting integration, this cannot be disabled.',
accountsSwitchTitle: 'Enable newly imported Chart of Accounts.',
accountsSwitchDescription: 'New categories imported from QuickBooks Online to Expensify will be either enabled or disabled by default.',
accountsDescription: 'When connected to Quickbooks Online, chart of accounts are always imported to Expensify as categories.',
accountsSwitchTitle: 'Below you can choose to have any new account imported as an enabled or disabled category by default.',
accountsSwitchDescription: 'Enabled categories are available for members to select when creating their expenses.',
classesDescription: 'Choose whether to import classes, and see where classes are displayed.',
customersDescription: 'Choose whether to import customers/projects and see where customers/projects are displayed.',
locationsDescription: 'Choose whether to import locations, and see where locations are displayed.',
Expand Down
6 changes: 3 additions & 3 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1938,9 +1938,9 @@ export default {
locations: 'Lugares',
customers: 'Clientes/Proyectos',
displayedAs: 'Mostrado como',
accountsDescription: 'Los planes de cuentas se importan como categorías cuando está conectado con una integración de contaduría, esto no se puede desactivar.',
accountsSwitchTitle: 'Habilita el plan de cuentas recien importado',
accountsSwitchDescription: 'Las nuevas categorías importadas desde QuickBooks Online a Expensify serán activadas o desactivadas por defecto.',
accountsDescription: 'Cuando estás conectado a Quickbooks Online, los planes de cuentas siempre se importan a Expensify como categorías.',
accountsSwitchTitle: 'Elige abajo si las categorías importadas serán activadas o desactivadas por defecto.',
accountsSwitchDescription: 'Las categorías activas estarán disponibles para ser escogidas cuando se crea un gasto.',
classesDescription: 'Elige si quieres importar las clases y donde las clases son mostradas.',
customersDescription: 'Elige si queres importar clientes/proyectos y donde los clientes/proyectos son mostrados.',
locationsDescription: 'Elige si quieres importar lugares y donde los lugares son mostrados.',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import React from 'react';
import {View} from 'react-native';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import ConnectionLayout from '@components/ConnectionLayout';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
import ScreenWrapper from '@components/ScreenWrapper';
import ScrollView from '@components/ScrollView';
import Switch from '@components/Switch';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import * as Connections from '@libs/actions/connections';
import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper';
import type {WithPolicyProps} from '@pages/workspace/withPolicy';
import withPolicyConnections from '@pages/workspace/withPolicyConnections';
import variables from '@styles/variables';
Expand All @@ -22,46 +20,54 @@ function QuickbooksChartOfAccountsPage({policy}: WithPolicyProps) {
const {enableNewCategories, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {};

return (
<AccessOrNotFoundWrapper
<ConnectionLayout
displayName={QuickbooksChartOfAccountsPage.displayName}
headerTitle="workspace.accounting.accounts"
title="workspace.qbo.accountsDescription"
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN]}
policyID={policyID}
featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED}
>
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
shouldEnableMaxHeight
testID={QuickbooksChartOfAccountsPage.displayName}
>
<HeaderWithBackButton title={translate('workspace.accounting.accounts')} />
<ScrollView contentContainerStyle={[styles.pb2, styles.ph5]}>
<Text style={styles.pb5}>{translate('workspace.qbo.accountsDescription')}</Text>
<View style={[styles.flexRow, styles.mb2, styles.alignItemsCenter, styles.justifyContentBetween]}>
<View style={styles.flex1}>
<Text fontSize={variables.fontSizeNormal}>{translate('workspace.qbo.accountsSwitchTitle')}</Text>
</View>
<OfflineWithFeedback pendingAction={pendingFields?.enableNewCategories}>
<View style={[styles.flex1, styles.alignItemsEnd, styles.pl3]}>
<Switch
accessibilityLabel={translate('workspace.accounting.accounts')}
isOn={!!enableNewCategories}
onToggle={() =>
Connections.updatePolicyConnectionConfig(
policyID,
CONST.POLICY.CONNECTIONS.NAME.QBO,
CONST.QUICK_BOOKS_CONFIG.ENABLE_NEW_CATEGORIES,
!enableNewCategories,
)
}
/>
</View>
</OfflineWithFeedback>
<View style={[styles.flexRow, styles.mb4, styles.alignItemsCenter, styles.justifyContentBetween]}>
<View style={styles.flex1}>
<Text fontSize={variables.fontSizeNormal}>{translate('workspace.accounting.import')}</Text>
</View>
<View style={[styles.flex1, styles.alignItemsEnd, styles.pl3]}>
<Switch
accessibilityLabel={translate('workspace.accounting.accounts')}
isOn
disabled
onToggle={() => {}}
/>
</View>
</View>
<MenuItemWithTopDescription
interactive={false}
title={translate('workspace.common.categories')}
description={translate('workspace.qbo.displayedAs')}
wrapperStyle={styles.sectionMenuItemTopDescription}
/>
<Text style={styles.pv5}>{translate('workspace.qbo.accountsSwitchTitle')}</Text>
<View style={[styles.flexRow, styles.mb2, styles.alignItemsCenter, styles.justifyContentBetween]}>
<View style={styles.flex1}>
<Text fontSize={variables.fontSizeNormal}>{translate('workspace.common.enabled')}</Text>
</View>
<OfflineWithFeedback pendingAction={pendingFields?.enableNewCategories}>
<View style={[styles.flex1, styles.alignItemsEnd, styles.pl3]}>
<Switch
accessibilityLabel={translate('workspace.accounting.accounts')}
isOn={!!enableNewCategories}
onToggle={() =>
Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.ENABLE_NEW_CATEGORIES, !enableNewCategories)
}
/>
</View>
<View style={styles.flex1}>
<Text style={styles.mutedTextLabel}>{translate('workspace.qbo.accountsSwitchDescription')}</Text>
</View>
</ScrollView>
</ScreenWrapper>
</AccessOrNotFoundWrapper>
</OfflineWithFeedback>
</View>
<View style={styles.flex1}>
<Text style={styles.mutedTextLabel}>{translate('workspace.qbo.accountsSwitchDescription')}</Text>
</View>
</ConnectionLayout>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ function QuickbooksImportPage({policy}: WithPolicyProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
const policyID = policy?.id ?? '';
const {syncClasses, syncCustomers, syncLocations, syncTax, enableNewCategories, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {};
const {syncClasses, syncCustomers, syncLocations, syncTax, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {};

const sections = [
{
description: translate('workspace.accounting.accounts'),
action: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_CHART_OF_ACCOUNTS.getRoute(policyID)),
hasError: Boolean(policy?.errors?.enableNewCategories),
title: enableNewCategories ? translate('workspace.accounting.importAsCategory') : translate('workspace.accounting.importTypes.NONE'),
title: translate('workspace.accounting.importAsCategory'),
pendingAction: pendingFields?.enableNewCategories,
},
{
Expand Down

0 comments on commit 9d235c8

Please sign in to comment.