-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[QBD] [Import] Chart of accounts page #50545
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
Merged
lakchote
merged 11 commits into
Expensify:main
from
hoangzinh:49703-qbd-chart-of-accounts-page
Oct 15, 2024
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a754ea3
Setup screen & route for QBD import chart of accounts page
hoangzinh 3e0b832
Implement QBD chart of accounts page
hoangzinh 94eb5b4
Temporary hide enabled button
hoangzinh 66ae508
Fix eslint
hoangzinh 4fd1844
Add todo comment
hoangzinh 73be4e5
Remove redundant subscribed settings
hoangzinh 918fc91
Merge branch 'main' into 49703-qbd-chart-of-accounts-page
hoangzinh 3f06ba0
Update QBD enabled new categories setting
hoangzinh 6f767e4
Fix clear QBD error field
hoangzinh 7583d30
Merge branch 'main' into 49703-qbd-chart-of-accounts-page
hoangzinh 37dad4c
Fix merge main
hoangzinh 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
72 changes: 72 additions & 0 deletions
72
src/pages/workspace/accounting/qbd/import/QuickbooksDesktopChartOfAccountsPage.tsx
This file contains hidden or 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,72 @@ | ||
| import React from 'react'; | ||
| import ConnectionLayout from '@components/ConnectionLayout'; | ||
| import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; | ||
| import Text from '@components/Text'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import usePermissions from '@hooks/usePermissions'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import * as QuickbooksDesktop from '@libs/actions/connections/QuickbooksDesktop'; | ||
| import * as ErrorUtils from '@libs/ErrorUtils'; | ||
| import Navigation from '@libs/Navigation/Navigation'; | ||
| import {settingsPendingAction} from '@libs/PolicyUtils'; | ||
| import type {WithPolicyProps} from '@pages/workspace/withPolicy'; | ||
| import withPolicyConnections from '@pages/workspace/withPolicyConnections'; | ||
| import ToggleSettingOptionRow from '@pages/workspace/workflows/ToggleSettingsOptionRow'; | ||
| import {clearQBDErrorField} from '@userActions/Policy/Policy'; | ||
| import CONST from '@src/CONST'; | ||
| import ROUTES from '@src/ROUTES'; | ||
|
|
||
| function QuickbooksDesktopChartOfAccountsPage({policy}: WithPolicyProps) { | ||
| const {translate} = useLocalize(); | ||
| const styles = useThemeStyles(); | ||
| const policyID = policy?.id ?? '-1'; | ||
| const {canUseNewDotQBD} = usePermissions(); | ||
| const qbdConfig = policy?.connections?.quickbooksDesktop?.config; | ||
|
|
||
| return ( | ||
| <ConnectionLayout | ||
| policyID={policyID} | ||
| displayName={QuickbooksDesktopChartOfAccountsPage.displayName} | ||
| headerTitle="workspace.accounting.accounts" | ||
| title="workspace.qbd.accountsDescription" | ||
| accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN]} | ||
| featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED} | ||
| contentContainerStyle={[styles.pb2, styles.ph5]} | ||
| connectionName={CONST.POLICY.CONNECTIONS.NAME.QBD} | ||
| shouldBeBlocked={!canUseNewDotQBD} // TODO: [QBD] Will be removed when release | ||
| onBackButtonPress={() => Navigation.goBack(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_DESKTOP_IMPORT.getRoute(policyID))} | ||
| > | ||
| <ToggleSettingOptionRow | ||
| title={translate('workspace.accounting.import')} | ||
| switchAccessibilityLabel={translate('workspace.accounting.accounts')} | ||
| shouldPlaceSubtitleBelowSwitch | ||
| isActive | ||
| onToggle={() => {}} | ||
| disabled | ||
| showLockIcon | ||
| /> | ||
| <MenuItemWithTopDescription | ||
| interactive={false} | ||
| title={translate('workspace.common.categories')} | ||
| description={translate('workspace.common.displayedAs')} | ||
| wrapperStyle={[styles.sectionMenuItemTopDescription, styles.mt2]} | ||
| /> | ||
| <Text style={styles.pv5}>{translate('workspace.qbd.accountsSwitchTitle')}</Text> | ||
| <ToggleSettingOptionRow | ||
| title={translate('workspace.common.enabled')} | ||
| subtitle={translate('workspace.qbd.accountsSwitchDescription')} | ||
| switchAccessibilityLabel={translate('workspace.accounting.accounts')} | ||
| shouldPlaceSubtitleBelowSwitch | ||
| isActive={!!qbdConfig?.enableNewCategories} | ||
| onToggle={() => QuickbooksDesktop.updateQuickbooksDesktopEnableNewCategories(policyID, !qbdConfig?.enableNewCategories)} | ||
| pendingAction={settingsPendingAction([CONST.QUICKBOOKS_DESKTOP_CONFIG.ENABLE_NEW_CATEGORIES], qbdConfig?.pendingFields)} | ||
| errors={ErrorUtils.getLatestErrorField(qbdConfig, CONST.QUICKBOOKS_DESKTOP_CONFIG.ENABLE_NEW_CATEGORIES)} | ||
| onCloseError={() => clearQBDErrorField(policyID, CONST.QUICKBOOKS_DESKTOP_CONFIG.ENABLE_NEW_CATEGORIES)} | ||
| /> | ||
| </ConnectionLayout> | ||
| ); | ||
| } | ||
|
|
||
| QuickbooksDesktopChartOfAccountsPage.displayName = 'QuickbooksDesktopChartOfAccountsPage'; | ||
|
|
||
| export default withPolicyConnections(QuickbooksDesktopChartOfAccountsPage); |
This file contains hidden or 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 hidden or 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 hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.