-
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.
Merge pull request #41393 from rushatgabhane/xero-taxes
Xero import taxes page
- Loading branch information
Showing
11 changed files
with
83 additions
and
1 deletion.
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
62 changes: 62 additions & 0 deletions
62
src/pages/workspace/accounting/xero/XeroTaxesConfigurationPage.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,62 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
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 XeroTaxesConfigurationPage({policy}: WithPolicyProps) { | ||
const {translate} = useLocalize(); | ||
const styles = useThemeStyles(); | ||
const policyID = policy?.id ?? ''; | ||
const {importTaxRates, pendingFields} = policy?.connections?.xero?.config ?? {}; | ||
const isSwitchOn = Boolean(importTaxRates); | ||
return ( | ||
<AccessOrNotFoundWrapper | ||
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN]} | ||
policyID={policyID} | ||
featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED} | ||
> | ||
<ScreenWrapper | ||
includeSafeAreaPaddingBottom={false} | ||
shouldEnableMaxHeight | ||
testID={XeroTaxesConfigurationPage.displayName} | ||
> | ||
<HeaderWithBackButton title={translate('workspace.accounting.taxes')} /> | ||
<ScrollView contentContainerStyle={[styles.pb2, styles.ph5]}> | ||
<Text style={styles.pb5}>{translate('workspace.xero.taxesDescription')}</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?.importTaxRates}> | ||
<View style={[styles.flex1, styles.alignItemsEnd, styles.pl3]}> | ||
<Switch | ||
accessibilityLabel={translate('workspace.accounting.taxes')} | ||
isOn={isSwitchOn} | ||
onToggle={() => | ||
Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.XERO, CONST.XERO_CONFIG.IMPORT_TAX_RATES, !importTaxRates) | ||
} | ||
/> | ||
</View> | ||
</OfflineWithFeedback> | ||
</View> | ||
</ScrollView> | ||
</ScreenWrapper> | ||
</AccessOrNotFoundWrapper> | ||
); | ||
} | ||
|
||
XeroTaxesConfigurationPage.displayName = 'XeroTaxesConfigurationPage'; | ||
|
||
export default withPolicyConnections(XeroTaxesConfigurationPage); |