Skip to content

Commit e3683d6

Browse files
add company cards
1 parent aab15e5 commit e3683d6

6 files changed

Lines changed: 164 additions & 12 deletions

File tree

src/libs/CardUtils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,9 @@ function isSelectedFeedExpired(directFeed: DirectCardFeedData | undefined): bool
452452
/** Returns list of cards which can be assigned */
453453
function getFilteredCardList(list: WorkspaceCardsList | undefined, directFeed: DirectCardFeedData | undefined, workspaceCardFeeds: OnyxCollection<WorkspaceCardsList> = allWorkspaceCards) {
454454
const {cardList: customFeedCardsToAssign, ...cards} = list ?? {};
455+
console.log('list3434', list);
455456
const assignedCards = Object.values(cards).map((card) => card.cardName);
456-
457+
return cards
457458
// Get cards assigned across all workspaces
458459
const allWorkspaceAssignedCards = new Set<string>();
459460
Object.values(workspaceCardFeeds ?? {}).forEach((workspaceCards) => {

src/pages/workspace/companyCards/WorkspaceCompanyCardsList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ function WorkspaceCompanyCardsList({cardsList, policyID, handleAssignCard, isDis
9595
[styles, translate],
9696
);
9797

98-
if (sortedCards.length === 0) {
98+
if (true) {
9999
return (
100100
<WorkspaceCompanyCardsFeedAddedEmptyPage
101101
handleAssignCard={handleAssignCard}
102-
isDisabledAssignCardButton={isDisabledAssignCardButton}
102+
isDisabledAssignCardButton={false}
103103
/>
104104
);
105105
}

src/pages/workspace/companyCards/WorkspaceCompanyCardsListHeaderButtons.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function WorkspaceCompanyCardsListHeaderButtons({policyID, selectedFeed, shouldS
7474
shouldShowRBR={checkIfFeedConnectionIsBroken(flatAllCardsList(allFeedsCards, workspaceAccountID), selectedFeed)}
7575
/>
7676
<View style={[styles.flexRow, styles.gap2]}>
77-
{!!shouldShowAssignCardButton && (
77+
{true && (
7878
<Button
7979
success
8080
isDisabled={!currentFeedData || !!currentFeedData?.pending || isSelectedFeedConnectionBroken}

src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ function WorkspaceCompanyCardsPage({route}: WorkspaceCompanyCardsPageProps) {
4646
const theme = useTheme();
4747
const policyID = route.params.policyID;
4848
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`);
49-
const workspaceAccountID = policy?.workspaceAccountID ?? CONST.DEFAULT_NUMBER_ID;
50-
const [lastSelectedFeed] = useOnyx(`${ONYXKEYS.COLLECTION.LAST_SELECTED_FEED}${policyID}`);
49+
const workspaceAccountID = 19439476;
50+
const lastSelectedFeed = 'cdf'
5151
const [cardFeeds] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${workspaceAccountID}`);
5252
const selectedFeed = getSelectedFeed(lastSelectedFeed, cardFeeds);
5353
const [cardsList] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}${workspaceAccountID}_${selectedFeed}`, {selector: filterInactiveCards});
54-
54+
console.log('cardsList123', cardsList);
5555
const {cardList, ...cards} = cardsList ?? {};
5656

5757
const [isActingAsDelegate] = useOnyx(ONYXKEYS.ACCOUNT, {selector: (account) => !!account?.delegatedAccess?.delegate});
@@ -63,7 +63,7 @@ function WorkspaceCompanyCardsPage({route}: WorkspaceCompanyCardsPageProps) {
6363
const selectedFeedData = selectedFeed && companyCards[selectedFeed];
6464
const isNoFeed = !selectedFeedData;
6565
const isPending = !!selectedFeedData?.pending;
66-
const isFeedAdded = !isPending && !isNoFeed;
66+
const isFeedAdded = true
6767
const isFeedConnectionBroken = checkIfFeedConnectionIsBroken(cards);
6868
const [shouldShowOfflineModal, setShouldShowOfflineModal] = useState(false);
6969
const {shouldUseNarrowLayout} = useResponsiveLayout();

src/pages/workspace/companyCards/assignCard/AssignCardFeedPage.tsx

Lines changed: 153 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, {useEffect} from 'react';
2-
import {useOnyx} from 'react-native-onyx';
2+
import Onyx,{useOnyx} from 'react-native-onyx';
33
import DelegateNoAccessWrapper from '@components/DelegateNoAccessWrapper';
44
import ScreenWrapper from '@components/ScreenWrapper';
55
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
@@ -28,7 +28,158 @@ function AssignCardFeedPage({route, policy}: AssignCardFeedPageProps) {
2828
const backTo = route.params?.backTo;
2929
const policyID = policy?.id;
3030
const [isActingAsDelegate] = useOnyx(ONYXKEYS.ACCOUNT, {selector: (account) => !!account?.delegatedAccess?.delegate});
31-
31+
Onyx.merge('cards_19439476_cdf', {
32+
'21534545': {
33+
accountID: 1,
34+
bank: 'Expensify Card',
35+
cardID: 21534545,
36+
domainName: 'expensify-policy1.exfy',
37+
nameValuePairs: {cardTitle: 'STATE_NOT_ISSUED', isVirutal: true, issuedBy: 18974130},
38+
isVirtual: true,
39+
lastFourPAN: '',
40+
state: 2,
41+
},
42+
'21534546': {
43+
accountID: 1,
44+
bank: 'Expensify Card',
45+
cardID: 21534546,
46+
domainName: 'expensify-policy1.exfy',
47+
nameValuePairs: {cardTitle: 'OPEN', isVirutal: false, issuedBy: 18974130},
48+
isVirtual: false,
49+
lastFourPAN: '',
50+
state: 2,
51+
},
52+
'21534547': {
53+
accountID: 1,
54+
bank: 'Expensify Card',
55+
cardID: 21534547,
56+
domainName: 'expensify-policy1.exfy',
57+
nameValuePairs: {cardTitle: 'NOT_ACTIVATED', isVirutal: false, issuedBy: 18974130},
58+
isVirtual: false,
59+
lastFourPAN: '',
60+
state: 4,
61+
},
62+
'21534548': {
63+
accountID: 1,
64+
bank: 'Expensify Card',
65+
cardID: 21534548,
66+
domainName: 'expensify-policy1.exfy',
67+
nameValuePairs: {cardTitle: 'STATE_DEACTIVATED', isVirutal: false, issuedBy: 18974130},
68+
isVirtual: false,
69+
lastFourPAN: '',
70+
state: 2,
71+
},
72+
'21534549': {
73+
accountID: 1,
74+
bank: 'Expensify Card',
75+
cardID: 21534549,
76+
domainName: 'expensify-policy1.exfy',
77+
nameValuePairs: {cardTitle: 'CLOSED', isVirutal: false, issuedBy: 18974130},
78+
isVirtual: true,
79+
lastFourPAN: '',
80+
state: 2,
81+
},
82+
'21534550': {
83+
accountID: 1,
84+
bank: 'Expensify Card',
85+
cardID: 21534550,
86+
domainName: 'expensify-policy1.exfy',
87+
nameValuePairs: {cardTitle: 'STATE_SUSPENDED', isVirutal: false, issuedBy: 18974130},
88+
isVirtual: true,
89+
lastFourPAN: '',
90+
state: 2,
91+
},
92+
'21534551': {
93+
accountID: 1,
94+
bank: 'Expensify Card',
95+
cardID: 21534551,
96+
domainName: 'expensify-policy1.exfy',
97+
nameValuePairs: {cardTitle: 'ACTIVE', isVirutal: false, issuedBy: 18974130},
98+
isVirtual: false,
99+
lastFourPAN: '1234',
100+
state: 1,
101+
},
102+
'21534552': {
103+
accountID: 1,
104+
bank: 'Expensify Card',
105+
cardID: 21534552,
106+
domainName: 'expensify-policy1.exfy',
107+
nameValuePairs: {cardTitle: 'EXPIRED', isVirutal: false, issuedBy: 18974130},
108+
isVirtual: false,
109+
lastFourPAN: '5678',
110+
state: 3,
111+
},
112+
'21534553': {
113+
accountID: 1,
114+
bank: 'Expensify Card',
115+
cardID: 21534553,
116+
domainName: 'expensify-policy1.exfy',
117+
nameValuePairs: {cardTitle: 'LOST', isVirutal: false, issuedBy: 18974130},
118+
isVirtual: false,
119+
lastFourPAN: '9876',
120+
state: 5,
121+
},
122+
'21534554': {
123+
accountID: 1,
124+
bank: 'Expensify Card',
125+
cardID: 21534554,
126+
domainName: 'expensify-policy1.exfy',
127+
nameValuePairs: {cardTitle: 'STOLEN', isVirutal: false, issuedBy: 18974130},
128+
isVirtual: false,
129+
lastFourPAN: '4321',
130+
state: 5,
131+
},
132+
'21534555': {
133+
accountID: 1,
134+
bank: 'Expensify Card',
135+
cardID: 21534555,
136+
domainName: 'expensify-policy1.exfy',
137+
nameValuePairs: {cardTitle: 'FRAUD_REPORTED', isVirutal: false, issuedBy: 18974130},
138+
isVirtual: false,
139+
lastFourPAN: '',
140+
state: 6,
141+
},
142+
'21534556': {
143+
accountID: 1,
144+
bank: 'Expensify Card',
145+
cardID: 21534556,
146+
domainName: 'expensify-policy1.exfy',
147+
nameValuePairs: {cardTitle: 'TEMP_BLOCKED', isVirutal: false, issuedBy: 18974130},
148+
isVirtual: false,
149+
lastFourPAN: '',
150+
state: 2,
151+
},
152+
'21534557': {
153+
accountID: 1,
154+
bank: 'Expensify Card',
155+
cardID: 21534557,
156+
domainName: 'expensify-policy1.exfy',
157+
nameValuePairs: {cardTitle: 'PENDING_VERIFICATION', isVirutal: false, issuedBy: 18974130},
158+
isVirtual: false,
159+
lastFourPAN: '',
160+
state: 3,
161+
},
162+
'21534558': {
163+
accountID: 1,
164+
bank: 'Expensify Card',
165+
cardID: 21534558,
166+
domainName: 'expensify-policy1.exfy',
167+
nameValuePairs: {cardTitle: 'REPLACEMENT_REQUESTED', isVirutal: false, issuedBy: 18974130},
168+
isVirtual: false,
169+
lastFourPAN: '',
170+
state: 2,
171+
},
172+
'21534559': {
173+
accountID: 1,
174+
bank: 'Expensify Card',
175+
cardID: 21534559,
176+
domainName: 'expensify-policy1.exfy',
177+
nameValuePairs: {cardTitle: 'LIMIT_REACHED', isVirutal: false, issuedBy: 18974130},
178+
isVirtual: false,
179+
lastFourPAN: '',
180+
state: 2,
181+
},
182+
});
32183
useEffect(() => {
33184
return () => {
34185
clearAssignCardStepAndData();

src/pages/workspace/companyCards/assignCard/CardSelectionStep.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, {useMemo, useState} from 'react';
22
import {View} from 'react-native';
3-
import {useOnyx} from 'react-native-onyx';
3+
import Onyx,{useOnyx} from 'react-native-onyx';
44
import FormAlertWithSubmitButton from '@components/FormAlertWithSubmitButton';
55
import Icon from '@components/Icon';
66
import {BrokenMagnifyingGlass} from '@components/Icon/Illustrations';
@@ -34,7 +34,7 @@ type CardSelectionStepProps = {
3434
};
3535

3636
function CardSelectionStep({feed, policyID}: CardSelectionStepProps) {
37-
const workspaceAccountID = useWorkspaceAccountID(policyID);
37+
const workspaceAccountID = 19439476;
3838

3939
const {translate} = useLocalize();
4040
const styles = useThemeStyles();

0 commit comments

Comments
 (0)