-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
106 additions
and
36 deletions.
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
81 changes: 81 additions & 0 deletions
81
src/pages/workspace/accounting/xero/import/XeroCustomerConfigurationPage.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,81 @@ | ||
import React from 'react'; | ||
import { View } from 'react-native'; | ||
import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
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'; | ||
import CONST from '@src/CONST'; | ||
|
||
|
||
function XeroCustomerConfigurationPage({policy}: WithPolicyProps) { | ||
const {translate} = useLocalize(); | ||
const styles = useThemeStyles(); | ||
const policyID = policy?.id ?? ''; | ||
const {syncCustomers, pendingFields} = policy?.connections?.xero?.config ?? {}; | ||
|
||
const isSwitchOn = Boolean(syncCustomers && syncCustomers !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); | ||
const isReportFieldsSelected = syncCustomers === CONST.INTEGRATION_ENTITY_MAP_TYPES.REPORT_FIELD; | ||
return ( | ||
<AccessOrNotFoundWrapper | ||
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN]} | ||
policyID={policyID} | ||
featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED} | ||
> | ||
<ScreenWrapper | ||
includeSafeAreaPaddingBottom={false} | ||
shouldEnableMaxHeight | ||
testID={XeroCustomerConfigurationPage.displayName} | ||
> | ||
<HeaderWithBackButton title={translate('workspace.qbo.customers')} /> | ||
<ScrollView contentContainerStyle={[styles.pb2, styles.ph5]}> | ||
<Text style={styles.pb5}>{translate('workspace.qbo.customersDescription')}</Text> | ||
<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?.xeroConfigSyncCustomers}> | ||
Check failure on line 46 in src/pages/workspace/accounting/xero/import/XeroCustomerConfigurationPage.tsx GitHub Actions / typecheck
|
||
<View style={[styles.flex1, styles.alignItemsEnd, styles.pl3]}> | ||
<Switch | ||
accessibilityLabel={translate('workspace.qbo.customers')} | ||
isOn={isSwitchOn} | ||
onToggle={() => | ||
Connections.updatePolicyConnectionConfig( | ||
policyID, | ||
CONST.POLICY.CONNECTIONS.NAME.XERO, | ||
CONST.QUICK_BOOKS_CONFIG.SYNC_CUSTOMERS, | ||
isSwitchOn ? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE : CONST.INTEGRATION_ENTITY_MAP_TYPES.TAG, | ||
) | ||
} | ||
/> | ||
</View> | ||
</OfflineWithFeedback> | ||
</View> | ||
{isSwitchOn && ( | ||
<OfflineWithFeedback> | ||
<MenuItemWithTopDescription | ||
interactive={false} | ||
title={isReportFieldsSelected ? translate('workspace.common.reportFields') : translate('workspace.common.tags')} | ||
description={translate('workspace.qbo.displayedAs')} | ||
wrapperStyle={styles.sectionMenuItemTopDescription} | ||
/> | ||
</OfflineWithFeedback> | ||
)} | ||
</ScrollView> | ||
</ScreenWrapper> | ||
</AccessOrNotFoundWrapper> | ||
); | ||
} | ||
|
||
XeroCustomerConfigurationPage.displayName = 'XeroCustomerConfigurationPage'; | ||
|
||
export default withPolicyConnections(XeroCustomerConfigurationPage); |
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