-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-work on Preferred exporter with new design
- Loading branch information
1 parent
5e1f432
commit d140a2a
Showing
8 changed files
with
33 additions
and
89 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,42 @@ | ||
import React from 'react'; | ||
import React, {useCallback, useMemo} from 'react'; | ||
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 SelectionList from '@components/SelectionList'; | ||
import RadioListItem from '@components/SelectionList/RadioListItem'; | ||
import Text from '@components/Text'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import Navigation from '@navigation/Navigation'; | ||
import withPolicy from '@pages/workspace/withPolicy'; | ||
import type {WithPolicyProps} from '@pages/workspace/withPolicy'; | ||
import ROUTES from '@src/ROUTES'; | ||
|
||
const draft = [ | ||
{name: '[email protected]', currency: 'USD', id: '94', email: '[email protected]'}, | ||
{name: 'Account Maintenance Fee', currency: 'USD', id: '141', email: '[email protected]'}, | ||
{name: 'Admin Test', currency: 'USD', id: '119', email: '[email protected]'}, | ||
{name: 'Alberto Gonzalez-Cela', currency: 'USD', id: '104', email: '[email protected]'}, | ||
{name: 'Aldo test QBO2 QBO2 Last name', currency: 'USD', id: '140', email: '[email protected]'}, | ||
]; | ||
|
||
function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { | ||
const {translate} = useLocalize(); | ||
const styles = useThemeStyles(); | ||
const policyID = policy?.id ?? ''; | ||
const policyOwner = policy?.owner ?? ''; | ||
const {exporter} = policy?.connections?.quickbooksOnline?.config?.export ?? {}; | ||
const {data, config} = policy?.connections?.quickbooksOnline ?? {}; | ||
// const policyID = policy?.id ?? ''; | ||
const sections = useMemo( | ||
() => | ||
(data?.vendors ?? draft)?.map((vendor) => ({ | ||
value: vendor.email, | ||
text: vendor.email, | ||
keyForList: vendor.email, | ||
isSelected: config?.export?.exporter === vendor.email, | ||
This comment has been minimized.
Sorry, something went wrong. |
||
})) ?? [], | ||
[config?.export?.exporter, data?.vendors], | ||
); | ||
|
||
const updateMode = useCallback((mode: {value: string}) => { | ||
// TODO add API call for change | ||
}, []); | ||
|
||
return ( | ||
<ScreenWrapper | ||
|
@@ -29,14 +48,12 @@ function QuickBooksExportPreferredExporterPage({policy}: WithPolicyProps) { | |
<ScrollView contentContainerStyle={styles.pb2}> | ||
<Text style={[styles.ph5, styles.pb5]}>{translate('workspace.qbo.exportPreferredExporterNote')}</Text> | ||
<Text style={[styles.ph5, styles.pb5]}>{translate('workspace.qbo.exportPreferredExporterSubNote')}</Text> | ||
<OfflineWithFeedback> | ||
<MenuItemWithTopDescription | ||
shouldShowRightIcon | ||
title={exporter ?? policyOwner} | ||
onPress={() => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER_SELECT.getRoute(policyID))} | ||
brickRoadIndicator={undefined} | ||
/> | ||
</OfflineWithFeedback> | ||
<SelectionList | ||
sections={[{data: sections}]} | ||
ListItem={RadioListItem} | ||
onSelectRow={updateMode} | ||
initiallyFocusedOptionKey={sections.find((mode) => mode.isSelected)?.keyForList} | ||
/> | ||
</ScrollView> | ||
</ScreenWrapper> | ||
); | ||
|
61 changes: 0 additions & 61 deletions
61
src/pages/workspace/accounting/qbo/QuickbooksPreferredExporterSelectPage.tsx
This file was deleted.
Oops, something went wrong.
Sometimes,
config?.export?.exporter
returns undefined, which causes #46675.More details in this #46675 (comment)