-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add XeroChartOfAccountsPage #41849
Add XeroChartOfAccountsPage #41849
Changes from 6 commits
7e1868a
7eaa38e
b34d095
16794e8
bc7465b
b576dc5
c059270
22c81b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,73 @@ | ||||
import React from 'react'; | ||||
import {View} from 'react-native'; | ||||
import ConnectionLayout from '@components/ConnectionLayout'; | ||||
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; | ||||
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 * as ErrorUtils from '@libs/ErrorUtils'; | ||||
import type {WithPolicyProps} from '@pages/workspace/withPolicy'; | ||||
import withPolicyConnections from '@pages/workspace/withPolicyConnections'; | ||||
import ToggleSettingOptionRow from '@pages/workspace/workflows/ToggleSettingsOptionRow'; | ||||
import variables from '@styles/variables'; | ||||
import * as Policy from '@userActions/Policy'; | ||||
import CONST from '@src/CONST'; | ||||
|
||||
function XeroChartOfAccountsPage({policy}: WithPolicyProps) { | ||||
const {translate} = useLocalize(); | ||||
const styles = useThemeStyles(); | ||||
const policyID = policy?.id ?? ''; | ||||
const xeroConfig = policy?.connections?.xero?.config; | ||||
const {enableNewCategories, pendingFields} = xeroConfig ?? {}; | ||||
|
||||
return ( | ||||
<ConnectionLayout | ||||
displayName={XeroChartOfAccountsPage.displayName} | ||||
headerTitle="workspace.accounting.accounts" | ||||
title="workspace.xero.accountsDescription" | ||||
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN]} | ||||
policyID={policyID} | ||||
featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED} | ||||
contentContainerStyle={[styles.pb2, styles.ph5]} | ||||
> | ||||
<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.common.displayedAs')} | ||||
wrapperStyle={styles.sectionMenuItemTopDescription} | ||||
/> | ||||
<Text style={styles.pv5}>{translate('workspace.xero.accountsSwitchTitle')}</Text> | ||||
<ToggleSettingOptionRow | ||||
key={translate('workspace.xero.accountsSwitchTitle')} | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is key needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. blooper on my side 😅 |
||||
title={translate('workspace.common.enabled')} | ||||
subtitle={translate('workspace.xero.accountsSwitchDescription')} | ||||
shouldPlaceSubtitleBelowSwitch | ||||
wrapperStyle={styles.mv3} | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In QBO we don't have the extra margin |
||||
isActive={!!enableNewCategories} | ||||
onToggle={() => Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.XERO, CONST.XERO_CONFIG.ENABLE_NEW_CATEGORIES, !enableNewCategories)} | ||||
pendingAction={pendingFields?.enableNewCategories} | ||||
errors={ErrorUtils.getLatestErrorField(xeroConfig ?? {}, CONST.XERO_CONFIG.ENABLE_NEW_CATEGORIES)} | ||||
onCloseError={() => Policy.clearXeroErrorField(policyID, CONST.XERO_CONFIG.ENABLE_NEW_CATEGORIES)} | ||||
/> | ||||
</ConnectionLayout> | ||||
); | ||||
} | ||||
|
||||
XeroChartOfAccountsPage.displayName = 'XeroChartOfAccountsPage'; | ||||
|
||||
export default withPolicyConnections(XeroChartOfAccountsPage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this
Import
added intentionally?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's intended. Quickbooks Chart of accounts page has the same naming and I'm trying to keep the same convention 😄