-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
10 changed files
with
120 additions
and
105 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: 0 additions & 81 deletions
81
src/pages/workspace/accounting/ReconciliationAccountSettingsPage.tsx
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
src/pages/workspace/accounting/reconciliation/CardReconciliationPage.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,38 @@ | ||
import React from 'react'; | ||
import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
import ScreenWrapper from '@components/ScreenWrapper'; | ||
import ScrollView from '@components/ScrollView'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; | ||
import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; | ||
import withPolicyConnections from '@pages/workspace/withPolicyConnections'; | ||
import CONST from '@src/CONST'; | ||
|
||
function CardReconciliationPage({policy}: WithPolicyConnectionsProps) { | ||
const styles = useThemeStyles(); | ||
const {translate} = useLocalize(); | ||
|
||
const policyID = policy?.id ?? '-1'; | ||
|
||
return ( | ||
<AccessOrNotFoundWrapper | ||
policyID={policyID} | ||
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.PAID]} | ||
featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED} | ||
> | ||
<ScreenWrapper | ||
includeSafeAreaPaddingBottom={false} | ||
shouldEnableMaxHeight | ||
testID={CardReconciliationPage.displayName} | ||
> | ||
<HeaderWithBackButton title={translate('workspace.accounting.cardReconciliation')} /> | ||
<ScrollView contentContainerStyle={[styles.ph5, styles.pb5]} /> | ||
</ScreenWrapper> | ||
</AccessOrNotFoundWrapper> | ||
); | ||
} | ||
|
||
CardReconciliationPage.displayName = 'CardReconciliationPage'; | ||
|
||
export default withPolicyConnections(CardReconciliationPage); |
86 changes: 65 additions & 21 deletions
86
src/pages/workspace/accounting/reconciliation/ReconciliationAccountSettingsPage.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 |
---|---|---|
@@ -1,37 +1,81 @@ | ||
import React from 'react'; | ||
import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
import ScreenWrapper from '@components/ScreenWrapper'; | ||
import ScrollView from '@components/ScrollView'; | ||
import type {StackScreenProps} from '@react-navigation/stack'; | ||
import React, {useMemo} from 'react'; | ||
import {useOnyx} from 'react-native-onyx'; | ||
import ConnectionLayout from '@components/ConnectionLayout'; | ||
import SelectionList from '@components/SelectionList'; | ||
import RadioListItem from '@components/SelectionList/RadioListItem'; | ||
import Text from '@components/Text'; | ||
import TextLink from '@components/TextLink'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; | ||
import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; | ||
import withPolicyConnections from '@pages/workspace/withPolicyConnections'; | ||
import type {SettingsNavigatorParamList} from '@navigation/types'; | ||
import CONST from '@src/CONST'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
import type SCREENS from '@src/SCREENS'; | ||
|
||
type ReconciliationAccountSettingsPageProps = StackScreenProps<SettingsNavigatorParamList, typeof SCREENS.WORKSPACE.ACCOUNTING.RECONCILIATION_ACCOUNT_SETTINGS>; | ||
|
||
function ReconciliationAccountSettingsPage({route}: ReconciliationAccountSettingsPageProps) { | ||
const {policyID, connection} = route.params; | ||
const settlementAccountEnding = '1234'; // TODO: use correct settlement account ending value https://github.com/Expensify/App/issues/44313 | ||
|
||
function ReconciliationAccountSettingsPage({policy}: WithPolicyConnectionsProps) { | ||
const styles = useThemeStyles(); | ||
const {translate} = useLocalize(); | ||
|
||
const policyID = policy?.id ?? '-1'; | ||
const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST); | ||
const [reconciliationConnection] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_EXPENSIFY_CARD_CONTINUOUS_RECONCILIATION_CONNECTION}${policyID}`); | ||
|
||
const selectedBankAccount = useMemo(() => reconciliationConnection ?? Object.values(bankAccountList ?? {})[0], [reconciliationConnection, bankAccountList]); | ||
|
||
const sections = useMemo(() => { | ||
const data = Object.values(bankAccountList ?? {}).map((bankAccount) => ({ | ||
text: bankAccount.title, | ||
value: bankAccount.accountData?.bankAccountID, | ||
keyForList: bankAccount.accountData?.bankAccountID?.toString(), | ||
isSelected: bankAccount.accountData?.bankAccountID === selectedBankAccount?.accountData?.bankAccountID, | ||
})); | ||
return [{data}]; | ||
}, [bankAccountList, selectedBankAccount]); | ||
|
||
const selectBankAccount = () => { | ||
// TODO: add API call when it's implemented https://github.com/Expensify/Expensify/issues/407836 | ||
// Navigation.goBack(); | ||
}; | ||
|
||
return ( | ||
<AccessOrNotFoundWrapper | ||
policyID={policyID} | ||
<ConnectionLayout | ||
displayName={ReconciliationAccountSettingsPage.displayName} | ||
headerTitle="workspace.accounting.reconciliationAccount" | ||
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.PAID]} | ||
policyID={policyID} | ||
featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED} | ||
contentContainerStyle={[styles.flex1, styles.pb2]} | ||
connectionName={connection} | ||
shouldUseScrollView={false} | ||
> | ||
<ScreenWrapper | ||
includeSafeAreaPaddingBottom={false} | ||
shouldEnableMaxHeight | ||
testID={ReconciliationAccountSettingsPage.displayName} | ||
> | ||
<HeaderWithBackButton title={translate('workspace.accounting.cardReconciliation')} /> | ||
<ScrollView contentContainerStyle={[styles.ph5, styles.pb5]} /> | ||
</ScreenWrapper> | ||
</AccessOrNotFoundWrapper> | ||
<Text style={[styles.textNormal, styles.mb5, styles.ph5]}>{translate('workspace.accounting.chooseReconciliationAccount.chooseBankAccount')}</Text> | ||
<Text style={[styles.textNormal, styles.mb6, styles.ph5]}> | ||
{translate('workspace.accounting.chooseReconciliationAccount.accountMatches')} | ||
<TextLink | ||
onPress={() => { | ||
// TODO: navigate to Settlement Account https://github.com/Expensify/App/issues/44313 | ||
}} | ||
> | ||
{translate('workspace.accounting.chooseReconciliationAccount.settlementAccount')} | ||
</TextLink> | ||
{translate('workspace.accounting.chooseReconciliationAccount.reconciliationWorks', settlementAccountEnding)} | ||
</Text> | ||
|
||
<SelectionList | ||
sections={sections} | ||
onSelectRow={selectBankAccount} | ||
ListItem={RadioListItem} | ||
initiallyFocusedOptionKey={selectedBankAccount?.accountData?.bankAccountID?.toString()} | ||
/> | ||
</ConnectionLayout> | ||
); | ||
} | ||
|
||
ReconciliationAccountSettingsPage.displayName = 'ReconciliationAccountSettingsPage'; | ||
|
||
export default withPolicyConnections(ReconciliationAccountSettingsPage); | ||
export default ReconciliationAccountSettingsPage; |