-
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
Merged
lakchote
merged 8 commits into
Expensify:xero-merge-freeze
from
software-mansion-labs:@szymczak/xero-chart-of-accounts
May 13, 2024
Merged
Add XeroChartOfAccountsPage #41849
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7e1868a
refactor workspace.qbo and workspace.common translations
SzymczakJ 7eaa38e
add XeroChartOfAccountsPage
SzymczakJ b34d095
fix enable toggle not working
SzymczakJ 16794e8
fix translations on XeroImportPage
SzymczakJ bc7465b
Merge branch 'xero-merge-freeze' into @szymczak/xero-chart-of-accounts
SzymczakJ b576dc5
fix pr comments
SzymczakJ c059270
delete usused key prop
SzymczakJ 22c81b3
fix PR comments
SzymczakJ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
src/pages/workspace/accounting/xero/import/XeroChartOfAccountsPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
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 | ||
title={translate('workspace.common.enabled')} | ||
subtitle={translate('workspace.xero.accountsSwitchDescription')} | ||
shouldPlaceSubtitleBelowSwitch | ||
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 😄