-
Notifications
You must be signed in to change notification settings - Fork 4k
Feat/xero import customer #41377
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
Merged
Feat/xero import customer #41377
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b6e964d
xero import customer
hungvu193 3f7639f
add connection layout
hungvu193 5b7c037
fix linting
hungvu193 f021eff
add pending field for switch
hungvu193 5fc3442
fix linting
hungvu193 f9eb8c5
Merge remote-tracking branch 'origin/main' into feat/xero-import-cust…
hungvu193 e8f04da
resolve conflicts
hungvu193 b459314
update to use importCustomers
hungvu193 a937e6e
remove unused spacing
hungvu193 bad19d0
Update src/pages/workspace/accounting/PolicyAccountingPage.tsx
hungvu193 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import React from 'react'; | ||
| import {View} from 'react-native'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import Navigation from '@libs/Navigation/Navigation'; | ||
| import type {PolicyAccessVariant} from '@pages/workspace/AccessOrNotFoundWrapper'; | ||
| import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; | ||
| import type {TranslationPaths} from '@src/languages/types'; | ||
| import type {PolicyFeatureName} from '@src/types/onyx/Policy'; | ||
| import HeaderWithBackButton from './HeaderWithBackButton'; | ||
| import ScreenWrapper from './ScreenWrapper'; | ||
| import ScrollView from './ScrollView'; | ||
| import Text from './Text'; | ||
|
|
||
| type ConnectionLayoutProps = { | ||
| /** Used to set the testID for tests */ | ||
| displayName: string; | ||
| /** Header title for the connection */ | ||
| headerTitle: TranslationPaths; | ||
| /** React nodes that will be shown */ | ||
| children?: React.ReactNode; | ||
| /** Title of the connection component */ | ||
| title?: TranslationPaths; | ||
| /** Subtitle of the connection */ | ||
| subtitle?: TranslationPaths; | ||
| /** The current policyID */ | ||
| policyID: string; | ||
| /** Defines which types of access should be verified */ | ||
| accessVariants?: PolicyAccessVariant[]; | ||
| /** The current feature name that the user tries to get access to */ | ||
| featureName?: PolicyFeatureName; | ||
| }; | ||
|
|
||
| function ConnectionLayout({displayName, headerTitle, children, title, subtitle, policyID, accessVariants, featureName}: ConnectionLayoutProps) { | ||
| const styles = useThemeStyles(); | ||
| const {translate} = useLocalize(); | ||
|
|
||
| return ( | ||
| <AccessOrNotFoundWrapper | ||
| policyID={policyID} | ||
| accessVariants={accessVariants} | ||
| featureName={featureName} | ||
| > | ||
| <ScreenWrapper | ||
| includeSafeAreaPaddingBottom={false} | ||
| shouldEnableMaxHeight | ||
| testID={displayName} | ||
| > | ||
| <HeaderWithBackButton | ||
| title={translate(headerTitle)} | ||
| onBackButtonPress={() => Navigation.goBack()} | ||
| /> | ||
| <ScrollView contentContainerStyle={[styles.pb2, styles.ph5]}> | ||
| <View style={[styles.pb2]}>{title && <Text style={styles.pb5}>{translate(title)}</Text>}</View> | ||
| {subtitle && <Text style={styles.textLabelSupporting}>{translate(subtitle)}</Text>} | ||
| {children} | ||
| </ScrollView> | ||
| </ScreenWrapper> | ||
| </AccessOrNotFoundWrapper> | ||
| ); | ||
| } | ||
|
|
||
| ConnectionLayout.displayName = 'ConnectionLayout'; | ||
| export default ConnectionLayout; |
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
65 changes: 65 additions & 0 deletions
65
src/pages/workspace/accounting/xero/import/XeroCustomerConfigurationPage.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,65 @@ | ||
| import React from 'react'; | ||
| import {View} from 'react-native'; | ||
| import ConnectionLayout from '@components/ConnectionLayout'; | ||
| import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; | ||
| import OfflineWithFeedback from '@components/OfflineWithFeedback'; | ||
| 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 type {WithPolicyProps} from '@pages/workspace/withPolicy'; | ||
| import withPolicyConnections from '@pages/workspace/withPolicyConnections'; | ||
| import variables from '@styles/variables'; | ||
| import CONST from '@src/CONST'; | ||
|
|
||
| function XeroCustomerConfigurationPage({policy}: WithPolicyProps) { | ||
| const {translate} = useLocalize(); | ||
| const styles = useThemeStyles(); | ||
| const policyID = policy?.id ?? ''; | ||
| const {importCustomers, pendingFields} = policy?.connections?.xero?.config ?? {}; | ||
|
|
||
| const isSwitchOn = Boolean(importCustomers); | ||
|
|
||
| return ( | ||
| <ConnectionLayout | ||
| displayName={XeroCustomerConfigurationPage.displayName} | ||
| headerTitle="workspace.xero.customers" | ||
| title="workspace.xero.customersDescription" | ||
| accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN]} | ||
| policyID={policyID} | ||
| featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED} | ||
| > | ||
| <View> | ||
| <View style={[styles.flexRow, styles.mb4, styles.alignItemsCenter, styles.justifyContentBetween]}> | ||
| <View style={styles.flex1}> | ||
| <Text fontSize={variables.fontSizeNormal}>{translate('workspace.accounting.import')}</Text> | ||
| </View> | ||
| <OfflineWithFeedback pendingAction={pendingFields?.importCustomers}> | ||
| <View style={[styles.flex1, styles.alignItemsEnd, styles.pl3]}> | ||
| <Switch | ||
| accessibilityLabel={translate('workspace.xero.customers')} | ||
| isOn={isSwitchOn} | ||
| onToggle={() => Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.XERO, CONST.XERO_CONFIG.IMPORT_CUSTOMERS, !importCustomers)} | ||
| /> | ||
| </View> | ||
| </OfflineWithFeedback> | ||
| </View> | ||
| {isSwitchOn && ( | ||
| <OfflineWithFeedback pendingAction={pendingFields?.importCustomers}> | ||
| <MenuItemWithTopDescription | ||
| interactive={false} | ||
| title={translate('workspace.common.tags')} | ||
| description={translate('workspace.qbo.displayedAs')} | ||
| wrapperStyle={styles.sectionMenuItemTopDescription} | ||
| /> | ||
| </OfflineWithFeedback> | ||
| )} | ||
| </View> | ||
| </ConnectionLayout> | ||
| ); | ||
| } | ||
|
|
||
| XeroCustomerConfigurationPage.displayName = 'XeroCustomerConfigurationPage'; | ||
|
|
||
| export default withPolicyConnections(XeroCustomerConfigurationPage); |
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.