@vtex/faststore-plugin-buyer-portal 1.1.4 → 1.1.6
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/buying-policies/components/AddBuyingPolicyDrawer/AddBuyingPolicyDrawer.tsx +1 -0
- package/src/features/org-units/components/AddAllToOrgUnitDropdown/AddAllToOrgUnitDropdown.tsx +78 -14
- package/src/features/org-units/layouts/OrgUnitDetailsLayout/OrgUnitDetailsLayout.tsx +5 -1
- package/src/features/payment-methods/services/index.ts +6 -6
package/package.json
CHANGED
package/src/features/buying-policies/components/AddBuyingPolicyDrawer/AddBuyingPolicyDrawer.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import { useAddBuyingPolicy } from "../../hooks";
|
|
|
5
5
|
import type { BuyingPolicy } from "../../types";
|
|
6
6
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
7
7
|
import { BasicBuyingPolicyDrawer, type BasicBuyingPolicyDrawerProps } from "..";
|
|
8
|
+
import { useBuyerPortal } from "../../../shared/hooks";
|
|
8
9
|
|
|
9
10
|
export type AddBuyingPolicyDrawerProps = Omit<
|
|
10
11
|
BasicBuyingPolicyDrawerProps,
|
package/src/features/org-units/components/AddAllToOrgUnitDropdown/AddAllToOrgUnitDropdown.tsx
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
|
-
import { DropdownItem } from "@faststore/ui"
|
|
2
|
-
import { BasicDropdownMenu, Icon } from "../../../shared/components"
|
|
3
|
-
import { useDrawerProps } from "../../../shared/hooks"
|
|
4
|
-
import { CreateCreditCardDrawer } from "../../../credit-cards/components"
|
|
1
|
+
import { DropdownItem } from "@faststore/ui"
|
|
2
|
+
import { BasicDropdownMenu, Icon } from "../../../shared/components"
|
|
3
|
+
import { useDrawerProps } from "../../../shared/hooks"
|
|
4
|
+
import { CreateCreditCardDrawer } from "../../../credit-cards/components"
|
|
5
|
+
import { CreateAddressDrawer } from "../../../addresses/components"
|
|
6
|
+
import { CreateUserDrawer } from "../../../users/components"
|
|
7
|
+
import { CreateOrgUnitDrawer } from "../CreateOrgUnitDrawer/CreateOrgUnitDrawer"
|
|
8
|
+
import { AddBuyingPolicyDrawer } from "../../../buying-policies/components"
|
|
9
|
+
import type { OrgUnitBasicData } from "../../types"
|
|
10
|
+
import type { ContractData } from "../../../contracts/types"
|
|
5
11
|
|
|
6
12
|
export type AddAllToOrgUnitDropdownProps = {
|
|
7
|
-
isSingleContract: boolean
|
|
8
|
-
|
|
13
|
+
isSingleContract: boolean,
|
|
14
|
+
unitId: string;
|
|
15
|
+
contractId: string;
|
|
16
|
+
}
|
|
9
17
|
|
|
10
18
|
export const AddAllToOrgUnitDropdown = ({
|
|
11
19
|
isSingleContract,
|
|
20
|
+
unitId,
|
|
21
|
+
contractId,
|
|
12
22
|
}: AddAllToOrgUnitDropdownProps) => {
|
|
13
23
|
const sizeProps = { width: 20, height: 20 };
|
|
14
24
|
|
|
@@ -18,16 +28,43 @@ export const AddAllToOrgUnitDropdown = ({
|
|
|
18
28
|
...creditCardDrawerProps
|
|
19
29
|
} = useDrawerProps();
|
|
20
30
|
|
|
31
|
+
const {
|
|
32
|
+
open: openAddressDrawer,
|
|
33
|
+
isOpen: isOpenAddressDrawer,
|
|
34
|
+
...addressDrawerProps
|
|
35
|
+
} = useDrawerProps();
|
|
36
|
+
|
|
37
|
+
const {
|
|
38
|
+
open: openUserDrawer,
|
|
39
|
+
isOpen: isOpenUserDrawer,
|
|
40
|
+
...userDrawerProps
|
|
41
|
+
} = useDrawerProps();
|
|
42
|
+
|
|
43
|
+
const {
|
|
44
|
+
open: openOrganizationDrawer,
|
|
45
|
+
isOpen: isOpenOrganizationDrawer,
|
|
46
|
+
...organizationDrawerProps
|
|
47
|
+
} = useDrawerProps();
|
|
48
|
+
|
|
49
|
+
const {
|
|
50
|
+
open: openBuyingPolicyDrawer,
|
|
51
|
+
isOpen: isOpenBuyingPolicyDrawer,
|
|
52
|
+
...buyingPolicyDrawerProps
|
|
53
|
+
} = useDrawerProps();
|
|
54
|
+
|
|
21
55
|
return (
|
|
22
56
|
<>
|
|
23
57
|
<BasicDropdownMenu>
|
|
24
|
-
|
|
58
|
+
{/* TODO: Liberar quando adição de contrato estiver finalizada
|
|
59
|
+
levando em consideração as integrações das outras etapas de desenvolviemento
|
|
60
|
+
de Contratos */}
|
|
61
|
+
{/* <DropdownItem>
|
|
25
62
|
<Icon name="Description" {...sizeProps} />
|
|
26
63
|
Add contract
|
|
27
|
-
</DropdownItem>
|
|
64
|
+
</DropdownItem> */}
|
|
28
65
|
{isSingleContract && (
|
|
29
66
|
<>
|
|
30
|
-
<DropdownItem>
|
|
67
|
+
<DropdownItem onClick={openAddressDrawer}>
|
|
31
68
|
<Icon name="LocalPostOffice" {...sizeProps} />
|
|
32
69
|
Add address
|
|
33
70
|
</DropdownItem>
|
|
@@ -51,11 +88,11 @@ export const AddAllToOrgUnitDropdown = ({
|
|
|
51
88
|
)}
|
|
52
89
|
<BasicDropdownMenu.Separator />
|
|
53
90
|
|
|
54
|
-
<DropdownItem>
|
|
91
|
+
<DropdownItem onClick={openUserDrawer}>
|
|
55
92
|
<Icon name="Profile" {...sizeProps} />
|
|
56
93
|
Add user
|
|
57
94
|
</DropdownItem>
|
|
58
|
-
<DropdownItem>
|
|
95
|
+
<DropdownItem onClick={openOrganizationDrawer}>
|
|
59
96
|
<Icon name="Folder" {...sizeProps} />
|
|
60
97
|
Add organization unit
|
|
61
98
|
</DropdownItem>
|
|
@@ -65,11 +102,12 @@ export const AddAllToOrgUnitDropdown = ({
|
|
|
65
102
|
<Icon name="Paid" {...sizeProps} />
|
|
66
103
|
Add budget
|
|
67
104
|
</DropdownItem>
|
|
68
|
-
<DropdownItem>
|
|
105
|
+
<DropdownItem onClick={openBuyingPolicyDrawer}>
|
|
69
106
|
<Icon name="Rebase" {...sizeProps} />
|
|
70
107
|
Add buying policy
|
|
71
108
|
</DropdownItem>
|
|
72
109
|
</BasicDropdownMenu>
|
|
110
|
+
|
|
73
111
|
{isOpenCreditCardDrawer && (
|
|
74
112
|
<CreateCreditCardDrawer
|
|
75
113
|
readonly
|
|
@@ -77,6 +115,32 @@ export const AddAllToOrgUnitDropdown = ({
|
|
|
77
115
|
isOpen={isOpenCreditCardDrawer}
|
|
78
116
|
/>
|
|
79
117
|
)}
|
|
118
|
+
{isOpenAddressDrawer && (
|
|
119
|
+
<CreateAddressDrawer
|
|
120
|
+
{...addressDrawerProps}
|
|
121
|
+
isOpen={isOpenAddressDrawer}
|
|
122
|
+
/>
|
|
123
|
+
)}
|
|
124
|
+
{isOpenUserDrawer && (
|
|
125
|
+
<CreateUserDrawer
|
|
126
|
+
{...userDrawerProps}
|
|
127
|
+
isOpen={isOpenUserDrawer}
|
|
128
|
+
/>
|
|
129
|
+
)}
|
|
130
|
+
{isOpenOrganizationDrawer && (
|
|
131
|
+
<CreateOrgUnitDrawer
|
|
132
|
+
{...organizationDrawerProps}
|
|
133
|
+
isOpen={isOpenOrganizationDrawer}
|
|
134
|
+
/>
|
|
135
|
+
)}
|
|
136
|
+
{isOpenBuyingPolicyDrawer && (
|
|
137
|
+
<AddBuyingPolicyDrawer
|
|
138
|
+
{...buyingPolicyDrawerProps}
|
|
139
|
+
isOpen={isOpenBuyingPolicyDrawer}
|
|
140
|
+
orgUnitId={unitId}
|
|
141
|
+
contractId={contractId}
|
|
142
|
+
/>
|
|
143
|
+
)}
|
|
80
144
|
</>
|
|
81
|
-
)
|
|
82
|
-
}
|
|
145
|
+
)
|
|
146
|
+
}
|
|
@@ -56,7 +56,11 @@ export const OrgUnitsDetailsLayout = ({
|
|
|
56
56
|
<DropdownButton asChild>
|
|
57
57
|
<HeaderInside.Button />
|
|
58
58
|
</DropdownButton>
|
|
59
|
-
|
|
59
|
+
<AddAllToOrgUnitDropdown
|
|
60
|
+
isSingleContract={isSingleContract}
|
|
61
|
+
contractId={contracts[0].id}
|
|
62
|
+
unitId={orgUnit.id}
|
|
63
|
+
/>
|
|
60
64
|
</Dropdown>
|
|
61
65
|
</HeaderInside>
|
|
62
66
|
<div data-fs-org-units-details-grid>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
addPaymentMethodsToUnitService,
|
|
3
|
+
type AddPaymentMethodsToUnitServiceProps,
|
|
4
4
|
} from "./add-payment-methods-to-unit.service";
|
|
5
5
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
getPaymentMethodsByUnitIdService,
|
|
7
|
+
type GetPaymentMethodsByUnitIdServiceProps,
|
|
8
8
|
} from "./get-payment-methods-by-unit-id.service";
|
|
9
9
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
removePaymentMethodFromUnitService,
|
|
11
|
+
type RemovePaymentMethodFromUnitServiceProps,
|
|
12
12
|
} from "./remove-payment-methods-from-unit.service";
|