@vtex/faststore-plugin-buyer-portal 1.1.95 → 1.1.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/features/addresses/components/AddressLocationsList/AddressLocationsList.tsx +28 -39
- package/src/features/addresses/components/AddressRecipientsList/AddressRecipientsList.tsx +42 -42
- package/src/features/addresses/layouts/AddressDetailsLayout/address-details-layout.scss +285 -286
- package/src/features/addresses/layouts/AddressesLayout/AddressesLayout.tsx +26 -29
- package/src/features/addresses/layouts/AddressesLayout/addresses-layout.scss +144 -151
- package/src/features/budgets/components/BudgetAllocationsSelection/BudgetAllocationsSelection.tsx +61 -57
- package/src/features/budgets/components/BudgetAllocationsSelection/budget-allocations-selection.scss +131 -232
- package/src/features/budgets/components/BudgetAllocationsTable/BudgetAllocationsTable.tsx +104 -91
- package/src/features/budgets/components/BudgetAllocationsTable/budget-allocations-table.scss +80 -182
- package/src/features/budgets/components/BudgetsTable/BudgetsTable.tsx +90 -107
- package/src/features/budgets/components/BudgetsTable/budgets-table.scss +128 -126
- package/src/features/budgets/layouts/BudgetsLayout/BudgetsLayout.tsx +0 -15
- package/src/features/buying-policies/components/AddBuyingPolicyDrawer/AddBuyingPolicyDrawer.tsx +4 -0
- package/src/features/buying-policies/components/BasicBuyingPolicyDrawer/BasicBuyingPolicyDrawer.tsx +35 -4
- package/src/features/buying-policies/components/BasicBuyingPolicyDrawer/basic-buying-policy-drawer.scss +2 -1
- package/src/features/buying-policies/components/BudgetCriteriaSelector/BudgetCriteriaSelector.tsx +113 -0
- package/src/features/buying-policies/components/BudgetCriteriaSelector/budget-criteria-selector.scss +139 -0
- package/src/features/buying-policies/components/BudgetCriteriaSelector/index.ts +4 -0
- package/src/features/buying-policies/components/BuyingPolicyDropdownMenu/BuyingPolicyDropdownMenu.tsx +5 -0
- package/src/features/buying-policies/components/UpdateBuyingPolicyDrawer/UpdateBuyingPolicyDrawer.tsx +5 -0
- package/src/features/buying-policies/layouts/BuyingPoliciesLayout/BuyingPoliciesLayout.tsx +66 -46
- package/src/features/buying-policies/layouts/BuyingPoliciesLayout/buying-policies-layout.scss +64 -70
- package/src/features/buying-policies/utils/index.ts +4 -1
- package/src/features/buying-policies/utils/orderFieldsCriteriaOptions.ts +12 -9
- package/src/features/collections/components/CollectionsTable/CollectionsTable.tsx +12 -18
- package/src/features/collections/components/CollectionsTable/collections-table.scss +138 -118
- package/src/features/collections/components/table/AddCollectionsDrawerTable.tsx +48 -54
- package/src/features/collections/components/table/add-collections-drawer-table.scss +57 -56
- package/src/features/credit-cards/layouts/CreditCardsLayout/CreditCardLayout.tsx +55 -61
- package/src/features/credit-cards/layouts/CreditCardsLayout/credit-card-layout.scss +63 -153
- package/src/features/payment-methods/components/AddPaymentMethodsDrawer/AddPaymentMethodsDrawer.tsx +58 -49
- package/src/features/payment-methods/components/AddPaymentMethodsDrawer/add-payment-methods-drawer.scss +58 -63
- package/src/features/payment-methods/layouts/PaymentMethodsLayout/PaymentMethodsLayout.tsx +15 -12
- package/src/features/roles/layout/RoleDetailsLayout/RoleDetailsLayout.tsx +57 -26
- package/src/features/roles/layout/RoleDetailsLayout/role-details-layout.scss +77 -0
- package/src/features/roles/layout/RolesLayout/RolesLayout.tsx +4 -12
- package/src/features/roles/layout/RolesLayout/roles-layout.scss +8 -22
- package/src/features/shared/components/CustomField/table/CustomFieldTable.tsx +67 -110
- package/src/features/shared/components/CustomField/table/custom-field-table.scss +39 -144
- package/src/features/shared/components/IconBookmarked/IconBookmarked.tsx +9 -0
- package/src/features/shared/components/IconBookmarked/icon-bookmarked.scss +9 -0
- package/src/features/shared/components/Table/Table.tsx +7 -2
- package/src/features/shared/components/Table/TableCell/TableCell.tsx +15 -3
- package/src/features/shared/components/Table/TableCell/table-cell.scss +34 -0
- package/src/features/shared/components/Table/TableHead/TableHead.tsx +34 -6
- package/src/features/shared/components/Table/TableHead/table-head.scss +53 -49
- package/src/features/shared/components/Table/TableLoading/TableLoading.tsx +16 -6
- package/src/features/shared/components/Table/TableLoading/table-loading.scss +13 -8
- package/src/features/shared/components/Table/TableRow/TableRow.tsx +65 -42
- package/src/features/shared/components/Table/TableRow/table-row.scss +104 -68
- package/src/features/shared/components/Table/table.scss +11 -6
- package/src/features/shared/components/Table/utils/tableColumns.ts +30 -33
- package/src/features/shared/components/index.ts +1 -0
- package/src/features/users/layouts/UsersLayout/UsersLayout.tsx +20 -27
- package/src/pages/budgets.tsx +1 -1
- package/src/pages/buying-policies.tsx +14 -1
- package/src/themes/layouts.scss +1 -0
|
@@ -1,120 +1,140 @@
|
|
|
1
1
|
[data-fs-bp-collection-table] {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
2
|
+
@import "@faststore/ui/src/components/molecules/Tooltip/styles.scss";
|
|
3
|
+
@import "../AddCollectionsDrawer/add-collections-drawer.scss";
|
|
4
|
+
@import "../../../shared/components/Table/table.scss";
|
|
5
|
+
|
|
6
|
+
width: 100%;
|
|
7
|
+
|
|
8
|
+
[data-fs-table] {
|
|
9
|
+
overflow-x: visible;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
[data-fs-bp-head-row] {
|
|
13
|
+
border-bottom: var(--fs-table-bordered-border-width) solid
|
|
14
|
+
var(--fs-table-bordered-border-color);
|
|
15
|
+
|
|
16
|
+
color: #5c5c5c;
|
|
17
|
+
height: var(--fs-spacing-8);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
[data-fs-table-head="true"] {
|
|
21
|
+
[data-fs-bp-head-row="true"] {
|
|
22
|
+
&:hover {
|
|
23
|
+
background-color: initial;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
[data-fs-tooltip] {
|
|
29
|
+
--fs-tooltip-background: #1f1f1f;
|
|
30
|
+
border-bottom: none;
|
|
31
|
+
text-wrap: balance;
|
|
32
|
+
text-align: justify;
|
|
33
|
+
|
|
34
|
+
[data-fs-tooltip-placement="left-center"] {
|
|
35
|
+
[data-fs-tooltip-indicator="true"] {
|
|
36
|
+
margin-left: -0.1%;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
[data-fs-tooltip-placement="top-center"] {
|
|
40
|
+
[data-fs-tooltip-indicator="true"] {
|
|
41
|
+
margin-top: -1%;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
[data-fs-collections-row-action-button] {
|
|
47
|
+
width: var(--fs-spacing-6);
|
|
48
|
+
height: var(--fs-spacing-6);
|
|
49
|
+
display: inline-flex;
|
|
50
|
+
border-radius: var(--fs-border-radius-pill);
|
|
51
|
+
justify-content: center;
|
|
52
|
+
align-items: center;
|
|
53
|
+
|
|
54
|
+
&:hover:not(:disabled) {
|
|
55
|
+
background-color: #ebebeb;
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
[data-fs-button-icon] {
|
|
60
|
+
display: block;
|
|
61
|
+
width: calc(var(--fs-spacing-4) - var(--fs-spacing-0));
|
|
62
|
+
height: calc(var(--fs-spacing-4) - var(--fs-spacing-0));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
[data-fs-bp-table-row-options] {
|
|
67
|
+
[data-fs-collections-row-action-button] {
|
|
68
|
+
margin: 0 var(--fs-spacing-1);
|
|
69
|
+
border-radius: var(--fs-border-radius-pill);
|
|
70
|
+
width: var(--fs-spacing-5);
|
|
71
|
+
aspect-ratio: 1;
|
|
72
|
+
display: flex;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
align-items: center;
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
|
|
77
|
+
&:disabled {
|
|
78
|
+
cursor: not-allowed;
|
|
79
|
+
|
|
80
|
+
[data-fs-icon] {
|
|
81
|
+
color: #adadad;
|
|
82
|
+
|
|
83
|
+
&[data-fs-icon-loading="true"] {
|
|
84
|
+
@keyframes rotate {
|
|
85
|
+
from {
|
|
86
|
+
transform: rotate(0deg);
|
|
87
|
+
}
|
|
88
|
+
to {
|
|
89
|
+
transform: rotate(360deg);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
animation: rotate 2s linear infinite;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&:hover {
|
|
98
|
+
background-color: #e0e0e0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&:active {
|
|
102
|
+
opacity: 0.8;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
[data-fs-icon] {
|
|
106
|
+
color: #000;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
[data-fs-table-row] {
|
|
112
|
+
height: var(--fs-spacing-8);
|
|
113
|
+
|
|
114
|
+
&:hover {
|
|
115
|
+
background-color: var(--fs-color-neutral-bkg);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
[data-fs-table-cell="header"] {
|
|
119
|
+
display: flex;
|
|
120
|
+
height: var(--fs-spacing-8);
|
|
121
|
+
cursor: pointer;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
[data-fs-bp-table-row-options] {
|
|
125
|
+
width: 3rem;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
[data-fs-table-cell="data"] {
|
|
129
|
+
padding: var(--fs-spacing-0);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
[data-fs-bp-text-medium] {
|
|
134
|
+
font-family: Inter;
|
|
135
|
+
font-weight: var(--fs-text-weight-medium);
|
|
136
|
+
font-size: var(--fs-text-size-1);
|
|
137
|
+
line-height: calc(var(--fs-spacing-3) + var(--fs-spacing-0));
|
|
138
|
+
letter-spacing: -1%;
|
|
139
|
+
}
|
|
120
140
|
}
|
|
@@ -6,19 +6,12 @@ import {
|
|
|
6
6
|
useState,
|
|
7
7
|
} from "react";
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
Checkbox,
|
|
11
|
-
Skeleton,
|
|
12
|
-
Table,
|
|
13
|
-
TableBody,
|
|
14
|
-
TableCell,
|
|
15
|
-
TableHead,
|
|
16
|
-
TableRow,
|
|
17
|
-
} from "@faststore/ui";
|
|
9
|
+
import { Checkbox } from "@faststore/ui";
|
|
18
10
|
|
|
19
|
-
import {
|
|
11
|
+
import { Table } from "../../../shared/components";
|
|
20
12
|
import { CollectionsSummary } from "../../types";
|
|
21
|
-
|
|
13
|
+
|
|
14
|
+
import type { TableColumn } from "../../../shared/components/Table/TableHead/TableHead";
|
|
22
15
|
|
|
23
16
|
interface AddCollectionsDrawerTableProps {
|
|
24
17
|
loading?: boolean;
|
|
@@ -57,55 +50,56 @@ export const AddCollectionsDrawerTable = ({
|
|
|
57
50
|
onChange(selectedItems);
|
|
58
51
|
}, [allSelected, allIds, data, onChange]);
|
|
59
52
|
|
|
53
|
+
const columns: TableColumn[] = [
|
|
54
|
+
{
|
|
55
|
+
key: "check",
|
|
56
|
+
align: "center",
|
|
57
|
+
size: "2.5rem",
|
|
58
|
+
label: (
|
|
59
|
+
<Checkbox
|
|
60
|
+
data-fs-bp-collections-checkbox
|
|
61
|
+
checked={allSelected}
|
|
62
|
+
partial={partiallySelected}
|
|
63
|
+
onChange={handleSelectAll}
|
|
64
|
+
/>
|
|
65
|
+
),
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
key: "name",
|
|
69
|
+
label: "Name",
|
|
70
|
+
align: "left",
|
|
71
|
+
size: "100%",
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
|
|
60
75
|
return (
|
|
61
76
|
<div data-fs-bp-add-collections-drawer-table>
|
|
62
|
-
<Table
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
<TableBody>
|
|
78
|
-
{loading
|
|
79
|
-
? Array.from({ length: PAGE_SIZE }).map((_, index) => (
|
|
80
|
-
<TableRow key={index}>
|
|
81
|
-
<TableCell>
|
|
82
|
-
<Skeleton size={{ width: "1.25rem", height: "1.25rem" }} />
|
|
83
|
-
</TableCell>
|
|
84
|
-
<TableCell>
|
|
85
|
-
<Skeleton size={{ width: "90%", height: "1.25rem" }} />
|
|
86
|
-
</TableCell>
|
|
87
|
-
</TableRow>
|
|
88
|
-
))
|
|
89
|
-
: data.map((option) => (
|
|
90
|
-
<TableRow
|
|
91
|
-
key={option.id}
|
|
92
|
-
data-selected={selectedIds.includes(option.id)}
|
|
93
|
-
>
|
|
94
|
-
<TableCell>
|
|
77
|
+
<Table layoutFixed>
|
|
78
|
+
<Table.Head columns={columns} />
|
|
79
|
+
<Table.Body>
|
|
80
|
+
{loading ? (
|
|
81
|
+
<Table.Loading columns={columns.length} />
|
|
82
|
+
) : (
|
|
83
|
+
data.map((option) => (
|
|
84
|
+
<Table.Row
|
|
85
|
+
key={option.id}
|
|
86
|
+
title={option.name}
|
|
87
|
+
iconName="Shapes"
|
|
88
|
+
iconSize={24}
|
|
89
|
+
selected={selectedIds.includes(option.id)}
|
|
90
|
+
prependColumns={
|
|
91
|
+
<Table.Cell align="center">
|
|
95
92
|
<Checkbox
|
|
93
|
+
data-fs-bp-collections-checkbox
|
|
96
94
|
checked={selectedIds.includes(option.id)}
|
|
97
95
|
onChange={() => handleSelect(option.id)}
|
|
98
96
|
/>
|
|
99
|
-
</
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
</TableCell>
|
|
106
|
-
</TableRow>
|
|
107
|
-
))}
|
|
108
|
-
</TableBody>
|
|
97
|
+
</Table.Cell>
|
|
98
|
+
}
|
|
99
|
+
/>
|
|
100
|
+
))
|
|
101
|
+
)}
|
|
102
|
+
</Table.Body>
|
|
109
103
|
</Table>
|
|
110
104
|
</div>
|
|
111
105
|
);
|
|
@@ -1,70 +1,71 @@
|
|
|
1
|
-
@import "@faststore/ui/src/components/molecules/Table/styles.scss";
|
|
2
|
-
|
|
3
1
|
[data-fs-bp-add-collections-drawer-table] {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
@import "@faststore/ui/src/components/atoms/Checkbox/styles.scss";
|
|
3
|
+
@import "../../../shared/components/Table/table.scss";
|
|
4
|
+
|
|
5
|
+
margin-top: 1.25rem;
|
|
6
|
+
[data-fs-table-content] {
|
|
7
|
+
table-layout: initial;
|
|
8
|
+
}
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
10
|
+
[data-fs-table-head="true"] {
|
|
11
|
+
[data-fs-table-row="true"] {
|
|
12
|
+
border-bottom: 1px solid #d6d6d6;
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
[data-fs-table-cell="header"] {
|
|
15
|
+
height: 2.5rem;
|
|
16
|
+
padding: 0 0.875rem;
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
font-weight: var(--fs-text-weight-regular);
|
|
19
|
+
color: #5c5c5c;
|
|
20
|
+
font-size: var(--fs-text-size-1);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
25
|
+
[data-fs-table-body="true"] {
|
|
26
|
+
[data-fs-table-row="true"] {
|
|
27
|
+
&[data-selected="true"] {
|
|
28
|
+
background-color: #f1f8fe;
|
|
29
|
+
}
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
background-color: #f1f8fe;
|
|
32
|
-
}
|
|
31
|
+
&:last-child {
|
|
32
|
+
border-bottom: 1px solid #d6d6d6;
|
|
33
|
+
}
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
[data-fs-table-cell] {
|
|
36
|
+
height: 3.5rem;
|
|
37
|
+
font-weight: var(--fs-text-weight-medium);
|
|
38
|
+
color: #1f1f1f;
|
|
39
|
+
font-size: var(--fs-text-size-1);
|
|
40
|
+
padding: 0 0.875rem;
|
|
41
|
+
text-align: left;
|
|
37
42
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
font-size: var(--fs-text-size-1);
|
|
43
|
-
padding: 0 0.875rem;
|
|
44
|
-
text-align: left;
|
|
43
|
+
[data-fs-bp-add-collections-drawer-cell-span] {
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
}
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
48
|
+
&:first-child {
|
|
49
|
+
width: 2.5rem;
|
|
50
|
+
text-align: center;
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
> svg {
|
|
53
|
+
margin: 0;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
54
59
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
60
|
+
[data-fs-skeleton] {
|
|
61
|
+
display: inline-block;
|
|
62
|
+
}
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
[data-fs-tooltip] {
|
|
65
|
+
--fs-tooltip-background: #1f1f1f;
|
|
66
|
+
}
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
[data-fs-bp-collections-checkbox] {
|
|
69
|
+
margin: 0 auto;
|
|
70
|
+
}
|
|
70
71
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { useEffect, type ChangeEvent } from "react";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Toggle } from "@faststore/ui";
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
Icon,
|
|
7
6
|
HeaderInside,
|
|
8
|
-
|
|
7
|
+
Table,
|
|
8
|
+
IconBookmarked,
|
|
9
9
|
} from "../../../shared/components";
|
|
10
10
|
import { EmptyState } from "../../../shared/components/EmptyState/EmptyState";
|
|
11
|
+
import { getTableColumns } from "../../../shared/components/Table/utils/tableColumns";
|
|
11
12
|
import {
|
|
12
13
|
useDrawerProps,
|
|
13
14
|
useBuyerPortal,
|
|
@@ -84,6 +85,35 @@ export const CreditCardLayout = ({ data }: CreditCardsLayoutProps) => {
|
|
|
84
85
|
refetchCreditCards();
|
|
85
86
|
};
|
|
86
87
|
|
|
88
|
+
const columns = getTableColumns({
|
|
89
|
+
actionsLength: 3,
|
|
90
|
+
nameColumnLabel: "Card Nickname",
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const renderRowActions = (creditCard: CreditCardData) => {
|
|
94
|
+
const actions = [
|
|
95
|
+
<Toggle
|
|
96
|
+
id="isContractActive"
|
|
97
|
+
aria-label="is contract active"
|
|
98
|
+
defaultChecked={creditCard.isActive}
|
|
99
|
+
onChange={(event) => {
|
|
100
|
+
creditCard.isActive = !creditCard.isActive;
|
|
101
|
+
handleCardChangeStatus(
|
|
102
|
+
event,
|
|
103
|
+
creditCard.accountId,
|
|
104
|
+
creditCard.isActive
|
|
105
|
+
);
|
|
106
|
+
}}
|
|
107
|
+
/>,
|
|
108
|
+
];
|
|
109
|
+
|
|
110
|
+
if (creditCard.isDefault) {
|
|
111
|
+
actions.unshift(<IconBookmarked />);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return actions;
|
|
115
|
+
};
|
|
116
|
+
|
|
87
117
|
return (
|
|
88
118
|
<GlobalLayout>
|
|
89
119
|
<ContractTabsLayout
|
|
@@ -105,65 +135,29 @@ export const CreditCardLayout = ({ data }: CreditCardsLayoutProps) => {
|
|
|
105
135
|
{data.length === 0 ? (
|
|
106
136
|
<EmptyState iconName="CreditCard" title="No credit cards yet" />
|
|
107
137
|
) : (
|
|
108
|
-
<
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
<
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
<li data-fs-credit-card-line key={creditCard.accountId}>
|
|
125
|
-
<div data-fs-credit-card-row>
|
|
126
|
-
<div data-fs-credit-card-row-information>
|
|
127
|
-
<span data-fs-credit-card-row-icon-wrapper>
|
|
128
|
-
<Icon name="CreditCard" width={24} height={24} />
|
|
129
|
-
</span>
|
|
130
|
-
<div data-fs-credit-card-name>
|
|
131
|
-
{creditCard.cardLabel ?? creditCard.cardNumber}
|
|
132
|
-
</div>
|
|
133
|
-
</div>
|
|
134
|
-
{creditCard.isDefault && (
|
|
135
|
-
<div data-fs-credit-card-default-icon>
|
|
136
|
-
<Icon name="Bookmark" width={20} height={20} />
|
|
137
|
-
</div>
|
|
138
|
-
)}
|
|
139
|
-
<div data-fs-credit-card-row-action>
|
|
140
|
-
<Toggle
|
|
141
|
-
id="isContractActive"
|
|
142
|
-
aria-label="is contract active"
|
|
143
|
-
defaultChecked={creditCard.isActive}
|
|
144
|
-
onChange={(event) => {
|
|
145
|
-
creditCard.isActive = !creditCard.isActive;
|
|
146
|
-
handleCardChangeStatus(
|
|
147
|
-
event,
|
|
148
|
-
creditCard.accountId,
|
|
149
|
-
creditCard.isActive
|
|
150
|
-
);
|
|
151
|
-
}}
|
|
138
|
+
<Table layoutFixed>
|
|
139
|
+
<Table.Head columns={columns} />
|
|
140
|
+
<Table.Body>
|
|
141
|
+
{isLoading ? (
|
|
142
|
+
<Table.Loading columns={columns.length} />
|
|
143
|
+
) : (
|
|
144
|
+
creditCards.map((creditCard) => (
|
|
145
|
+
<Table.Row
|
|
146
|
+
iconName="CreditCard"
|
|
147
|
+
iconSize={24}
|
|
148
|
+
title={creditCard.cardLabel ?? creditCard.cardNumber}
|
|
149
|
+
actionIcons={renderRowActions(creditCard)}
|
|
150
|
+
dropdownMenu={
|
|
151
|
+
<CreditCardDropdownMenu
|
|
152
|
+
currentCreditCard={creditCard}
|
|
153
|
+
onUpdate={handleUpdateCreditCard}
|
|
152
154
|
/>
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
/>
|
|
160
|
-
</Dropdown>
|
|
161
|
-
</div>
|
|
162
|
-
</div>
|
|
163
|
-
</li>
|
|
164
|
-
))
|
|
165
|
-
)}
|
|
166
|
-
</ul>
|
|
155
|
+
}
|
|
156
|
+
/>
|
|
157
|
+
))
|
|
158
|
+
)}
|
|
159
|
+
</Table.Body>
|
|
160
|
+
</Table>
|
|
167
161
|
)}
|
|
168
162
|
{isCreateCreditCardDrawerOpen && (
|
|
169
163
|
<CreateCreditCardDrawer
|