@vtex/faststore-plugin-buyer-portal 2.0.48 → 2.0.49
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/public/buyer-portal-icons.svg +9 -0
- package/src/features/budgets/layouts/BudgetsDetailsLayout/BudgetsDetailsLayout.tsx +4 -9
- package/src/features/budgets/layouts/BudgetsLayout/BudgetsLayout.tsx +2 -9
- package/src/features/buying-policies/layouts/BuyingPoliciesLayout/BuyingPoliciesLayout.tsx +14 -31
- package/src/features/contracts/layouts/ContractListingLayout/ContractListingLayout.tsx +8 -1
- package/src/features/contracts/layouts/ContractListingLayout/ContractSettingsNav.tsx +39 -63
- package/src/features/contracts/layouts/ContractListingLayout/__tests__/utils.test.ts +51 -0
- package/src/features/contracts/layouts/ContractListingLayout/contract-listing-layout.scss +36 -9
- package/src/features/contracts/layouts/ContractListingLayout/utils.ts +53 -0
- package/src/features/org-units/components/OrgUnitDetailsNavbar/OrgUnitDetailsNavbar.tsx +4 -1
- package/src/features/org-units/layouts/OrgUnitsLayout/OrgUnitsLayout.tsx +2 -9
- package/src/features/roles/layout/RolesLayout/RolesLayout.tsx +2 -9
- package/src/features/shared/components/BasicDrawer/BasicDrawer.tsx +3 -2
- package/src/features/shared/components/BasicDrawer/BasicDrawerHeading.tsx +4 -1
- package/src/features/shared/hooks/index.ts +1 -0
- package/src/features/shared/hooks/useShellScrollReset.ts +27 -0
- package/src/features/shared/layouts/ContractTabsLayout/ContractTabsLayout.tsx +26 -65
- package/src/features/shared/layouts/FinanceTabsLayout/FinanceTabsLayout.tsx +4 -41
- package/src/features/shared/layouts/OrgUnitTabsLayout/OrgUnitTabLayout.tsx +4 -39
- package/src/features/shared/layouts/SumaPageLayout/SumaPageLayout.tsx +11 -5
- package/src/features/shared/layouts/SumaPageLayout/SumaSidebar.tsx +17 -8
- package/src/features/shared/layouts/SumaPageLayout/SumaSidebarDrawer.tsx +25 -1
- package/src/features/shared/layouts/SumaPageLayout/suma-sidebar-drawer.scss +133 -5
- package/src/features/shared/localization/__tests__/page-loader-entries.test.ts +2 -2
- package/src/features/shared/utils/__tests__/getSumaListingSidebarLinks.test.ts +30 -0
- package/src/features/shared/utils/__tests__/routeLayoutMapping.test.ts +21 -1
- package/src/features/shared/utils/constants.ts +1 -1
- package/src/features/shared/utils/getSumaListingSidebarLinks.ts +8 -1
- package/src/features/shared/utils/routeLayoutMapping.ts +17 -4
- package/src/features/users/layouts/UsersLayout/UsersLayout.tsx +2 -9
- package/src/pages/contract-information.tsx +1 -1
- package/src/pages/contracts.tsx +30 -45
- package/src/pages/home.tsx +17 -25
- package/src/pages/org-unit-details.tsx +15 -102
package/package.json
CHANGED
|
@@ -261,6 +261,15 @@
|
|
|
261
261
|
fill="currentColor" />
|
|
262
262
|
</symbol>
|
|
263
263
|
|
|
264
|
+
<symbol
|
|
265
|
+
id="CloseSymbol"
|
|
266
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
267
|
+
viewBox="0 -960 960 960"
|
|
268
|
+
fill="currentColor">
|
|
269
|
+
<path
|
|
270
|
+
d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z" />
|
|
271
|
+
</symbol>
|
|
272
|
+
|
|
264
273
|
<symbol
|
|
265
274
|
id="OpenInNew"
|
|
266
275
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -12,7 +12,8 @@ import {
|
|
|
12
12
|
useDebounce,
|
|
13
13
|
useDrawerProps,
|
|
14
14
|
} from "../../../shared/hooks";
|
|
15
|
-
import {
|
|
15
|
+
import { GlobalLayout } from "../../../shared/layouts";
|
|
16
|
+
import { SumaPageLayout } from "../../../shared/layouts/SumaPageLayout/SumaPageLayout";
|
|
16
17
|
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
17
18
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
18
19
|
import { BudgetAllocationsTable } from "../../components/BudgetAllocationsTable/BudgetAllocationsTable";
|
|
@@ -141,13 +142,7 @@ export const BudgetsDetailsLayout = ({ budget }: BudgetsDetailsLayoutProps) => {
|
|
|
141
142
|
|
|
142
143
|
return (
|
|
143
144
|
<GlobalLayout>
|
|
144
|
-
<
|
|
145
|
-
orgUnitName={orgUnit?.name ?? ""}
|
|
146
|
-
orgUnitId={orgUnit?.id ?? ""}
|
|
147
|
-
contractName={contract?.name ?? ""}
|
|
148
|
-
contractId={contract?.id ?? ""}
|
|
149
|
-
pageName={t("budgets.titles.budgets")}
|
|
150
|
-
>
|
|
145
|
+
<SumaPageLayout>
|
|
151
146
|
<div data-fs-bp-budgets-details-layout>
|
|
152
147
|
<header data-fs-bp-budgets-details-header-wrapper>
|
|
153
148
|
<div data-fs-bp-budgets-details-header-arrow>
|
|
@@ -268,7 +263,7 @@ export const BudgetsDetailsLayout = ({ budget }: BudgetsDetailsLayoutProps) => {
|
|
|
268
263
|
)}
|
|
269
264
|
</section>
|
|
270
265
|
</div>
|
|
271
|
-
</
|
|
266
|
+
</SumaPageLayout>
|
|
272
267
|
</GlobalLayout>
|
|
273
268
|
);
|
|
274
269
|
};
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
useDrawerProps,
|
|
9
9
|
useQueryParams,
|
|
10
10
|
} from "../../../shared/hooks";
|
|
11
|
-
import {
|
|
11
|
+
import { GlobalLayout } from "../../../shared/layouts";
|
|
12
12
|
import { SumaPageLayout } from "../../../shared/layouts/SumaPageLayout/SumaPageLayout";
|
|
13
13
|
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
14
14
|
import { BudgetDeleteDrawer } from "../../components/BudgetDeleteDrawer/BudgetDeleteDrawer";
|
|
@@ -39,7 +39,6 @@ export const BudgetsLayout = ({ data }: BudgetsLayoutProps) => {
|
|
|
39
39
|
clientContext: { cookie },
|
|
40
40
|
currentOrgUnit: orgUnit,
|
|
41
41
|
currentContract: contract,
|
|
42
|
-
featureFlags,
|
|
43
42
|
} = useBuyerPortal();
|
|
44
43
|
const [paginationLoading, setPaginationLoading] = useState<boolean>(false);
|
|
45
44
|
const [loading, setLoading] = useState<boolean>(false);
|
|
@@ -276,13 +275,7 @@ export const BudgetsLayout = ({ data }: BudgetsLayoutProps) => {
|
|
|
276
275
|
|
|
277
276
|
return (
|
|
278
277
|
<GlobalLayout>
|
|
279
|
-
{
|
|
280
|
-
<SumaPageLayout>{budgetsSection}</SumaPageLayout>
|
|
281
|
-
) : (
|
|
282
|
-
<FinanceTabsLayout pageName={t("budgets.titles.financeAndCompliance")}>
|
|
283
|
-
{budgetsSection}
|
|
284
|
-
</FinanceTabsLayout>
|
|
285
|
-
)}
|
|
278
|
+
<SumaPageLayout>{budgetsSection}</SumaPageLayout>
|
|
286
279
|
</GlobalLayout>
|
|
287
280
|
);
|
|
288
281
|
};
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
useBuyerPortal,
|
|
16
16
|
useDrawerProps,
|
|
17
17
|
} from "../../../shared/hooks";
|
|
18
|
-
import {
|
|
18
|
+
import { GlobalLayout } from "../../../shared/layouts";
|
|
19
19
|
import { SumaPageLayout } from "../../../shared/layouts/SumaPageLayout/SumaPageLayout";
|
|
20
20
|
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
21
21
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
@@ -37,7 +37,7 @@ export const BuyingPoliciesLayout = ({
|
|
|
37
37
|
search,
|
|
38
38
|
page,
|
|
39
39
|
}: BuyingPoliciesLayoutProps) => {
|
|
40
|
-
const { currentContract, currentOrgUnit
|
|
40
|
+
const { currentContract, currentOrgUnit } = useBuyerPortal();
|
|
41
41
|
const { t } = useLocalization();
|
|
42
42
|
|
|
43
43
|
const router = useRouter();
|
|
@@ -183,35 +183,18 @@ export const BuyingPoliciesLayout = ({
|
|
|
183
183
|
|
|
184
184
|
return (
|
|
185
185
|
<GlobalLayout>
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
</SumaPageLayout>
|
|
199
|
-
) : (
|
|
200
|
-
<FinanceTabsLayout
|
|
201
|
-
pageName={t("buyingPolicies.titles.financeAndCompliance")}
|
|
202
|
-
>
|
|
203
|
-
{buyingPoliciesSection}
|
|
204
|
-
{isAddBuyingPolicyDrawerOpen && (
|
|
205
|
-
<AddBuyingPolicyDrawer
|
|
206
|
-
orgUnitId={currentOrgUnit?.id ?? ""}
|
|
207
|
-
contractId={currentContract?.id ?? ""}
|
|
208
|
-
isOpen={isAddBuyingPolicyDrawerOpen}
|
|
209
|
-
onCreate={handleRefetchBuyingPolicies}
|
|
210
|
-
{...addBuyingPolicyDrawerProps}
|
|
211
|
-
/>
|
|
212
|
-
)}
|
|
213
|
-
</FinanceTabsLayout>
|
|
214
|
-
)}
|
|
186
|
+
<SumaPageLayout>
|
|
187
|
+
{buyingPoliciesSection}
|
|
188
|
+
{isAddBuyingPolicyDrawerOpen && (
|
|
189
|
+
<AddBuyingPolicyDrawer
|
|
190
|
+
orgUnitId={currentOrgUnit?.id ?? ""}
|
|
191
|
+
contractId={currentContract?.id ?? ""}
|
|
192
|
+
isOpen={isAddBuyingPolicyDrawerOpen}
|
|
193
|
+
onCreate={handleRefetchBuyingPolicies}
|
|
194
|
+
{...addBuyingPolicyDrawerProps}
|
|
195
|
+
/>
|
|
196
|
+
)}
|
|
197
|
+
</SumaPageLayout>
|
|
215
198
|
</GlobalLayout>
|
|
216
199
|
);
|
|
217
200
|
};
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
useBuyerPortal,
|
|
20
20
|
useRefreshPageData,
|
|
21
21
|
useReloadOnBfcacheRestore,
|
|
22
|
+
useShellScrollReset,
|
|
22
23
|
} from "../../../shared/hooks";
|
|
23
24
|
import { GlobalLayout } from "../../../shared/layouts";
|
|
24
25
|
import { SumaSidebar } from "../../../shared/layouts/SumaPageLayout/SumaSidebar";
|
|
@@ -113,6 +114,7 @@ export const ContractListingLayout = ({
|
|
|
113
114
|
} = useDrawerProps();
|
|
114
115
|
|
|
115
116
|
const { featureFlags, clientContext } = useBuyerPortal();
|
|
117
|
+
const sectionRef = useShellScrollReset();
|
|
116
118
|
const { switchContract } = useSwitchContract();
|
|
117
119
|
|
|
118
120
|
const {
|
|
@@ -368,6 +370,7 @@ export const ContractListingLayout = ({
|
|
|
368
370
|
}}
|
|
369
371
|
loading={loading}
|
|
370
372
|
sidebarVariant="unit"
|
|
373
|
+
sidebarContractId={defaultContractId}
|
|
371
374
|
/>
|
|
372
375
|
<div data-fs-bp-contract-listing-body>
|
|
373
376
|
<SumaSidebar
|
|
@@ -376,7 +379,11 @@ export const ContractListingLayout = ({
|
|
|
376
379
|
variant="unit"
|
|
377
380
|
/>
|
|
378
381
|
|
|
379
|
-
<section
|
|
382
|
+
<section
|
|
383
|
+
data-fs-bp-contract-listing-section
|
|
384
|
+
aria-busy={isBusy}
|
|
385
|
+
ref={sectionRef}
|
|
386
|
+
>
|
|
380
387
|
<HeaderInside
|
|
381
388
|
title={loading ? undefined : t("contracts.titles.contracts")}
|
|
382
389
|
info={loading ? undefined : headerInfo}
|
|
@@ -6,6 +6,8 @@ import { Icon } from "../../../shared/components";
|
|
|
6
6
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
7
7
|
import { contractScopedLink } from "../../../shared/utils/contractScopedLink";
|
|
8
8
|
|
|
9
|
+
import { getContractCardLinks } from "./utils";
|
|
10
|
+
|
|
9
11
|
import type { AccountingField } from "../../../accounting-fields/types";
|
|
10
12
|
import type { FeatureFlags } from "../../../shared/components/BuyerPortalProvider/BuyerPortalProvider";
|
|
11
13
|
import type { LocalizeFn } from "../../../shared/localization/types";
|
|
@@ -36,71 +38,45 @@ export const buildContractSettingsNavItems = ({
|
|
|
36
38
|
}: BuildContractSettingsNavItemsParams): VerticalNavTreeItemProps[] => {
|
|
37
39
|
const linkParams = { orgUnitId, contractId };
|
|
38
40
|
|
|
39
|
-
const items: VerticalNavTreeItemProps[] =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
{
|
|
45
|
-
name: t("layouts.navigation.addresses"),
|
|
46
|
-
link: contractScopedLink(buyerPortalRoutes.addresses, linkParams),
|
|
47
|
-
},
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
if (featureFlags?.enableRecipientsContractLevel) {
|
|
51
|
-
items.push({
|
|
52
|
-
name: t("layouts.navigation.recipients"),
|
|
53
|
-
link: contractScopedLink(buyerPortalRoutes.recipients, linkParams),
|
|
54
|
-
});
|
|
55
|
-
}
|
|
41
|
+
const items: VerticalNavTreeItemProps[] = getContractCardLinks(
|
|
42
|
+
linkParams,
|
|
43
|
+
t,
|
|
44
|
+
featureFlags
|
|
45
|
+
);
|
|
56
46
|
|
|
57
|
-
items.push(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
47
|
+
items.push({
|
|
48
|
+
name: t("layouts.navigation.accountingFields"),
|
|
49
|
+
loading: accountingFieldsLoading,
|
|
50
|
+
submenu: {
|
|
51
|
+
items: accountingFields.map((field) => ({
|
|
52
|
+
name: field.name,
|
|
53
|
+
link: contractScopedLink(
|
|
54
|
+
(params) =>
|
|
55
|
+
buyerPortalRoutes.accountingFields({
|
|
56
|
+
...params,
|
|
57
|
+
accountingFieldId: field.id,
|
|
58
|
+
}),
|
|
59
|
+
linkParams
|
|
60
|
+
),
|
|
61
|
+
hasNotification: checkAccountingFieldIsEmpty(field),
|
|
62
|
+
actions: (
|
|
63
|
+
<AccountingFieldDropdown
|
|
64
|
+
accountingField={field}
|
|
65
|
+
orgUnitId={orgUnitId}
|
|
66
|
+
refreshList={onAccountingFieldChange}
|
|
67
|
+
contractId={contractId}
|
|
68
|
+
/>
|
|
69
|
+
),
|
|
70
|
+
})),
|
|
65
71
|
},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
items: accountingFields.map((field) => ({
|
|
75
|
-
name: field.name,
|
|
76
|
-
link: contractScopedLink(
|
|
77
|
-
(params) =>
|
|
78
|
-
buyerPortalRoutes.accountingFields({
|
|
79
|
-
...params,
|
|
80
|
-
accountingFieldId: field.id,
|
|
81
|
-
}),
|
|
82
|
-
linkParams
|
|
83
|
-
),
|
|
84
|
-
hasNotification: checkAccountingFieldIsEmpty(field),
|
|
85
|
-
actions: (
|
|
86
|
-
<AccountingFieldDropdown
|
|
87
|
-
accountingField={field}
|
|
88
|
-
orgUnitId={orgUnitId}
|
|
89
|
-
refreshList={onAccountingFieldChange}
|
|
90
|
-
contractId={contractId}
|
|
91
|
-
/>
|
|
92
|
-
),
|
|
93
|
-
})),
|
|
94
|
-
},
|
|
95
|
-
actions: (
|
|
96
|
-
<IconButton
|
|
97
|
-
aria-label="add account field"
|
|
98
|
-
icon={<Icon name="Add" width={ICON_SIZE} height={ICON_SIZE} />}
|
|
99
|
-
onClick={onAddAccountingField}
|
|
100
|
-
/>
|
|
101
|
-
),
|
|
102
|
-
}
|
|
103
|
-
);
|
|
72
|
+
actions: (
|
|
73
|
+
<IconButton
|
|
74
|
+
aria-label="add account field"
|
|
75
|
+
icon={<Icon name="Add" width={ICON_SIZE} height={ICON_SIZE} />}
|
|
76
|
+
onClick={onAddAccountingField}
|
|
77
|
+
/>
|
|
78
|
+
),
|
|
79
|
+
});
|
|
104
80
|
|
|
105
81
|
return items;
|
|
106
82
|
};
|
|
@@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
buildRemovedRedirectUrl,
|
|
5
|
+
getContractCardLinks,
|
|
5
6
|
getDefaultContractId,
|
|
6
7
|
parseRemovedCount,
|
|
7
8
|
pluralSuffixArgs,
|
|
@@ -77,3 +78,53 @@ describe("parseRemovedCount", () => {
|
|
|
77
78
|
expect(parseRemovedCount("abc")).toBeNull();
|
|
78
79
|
});
|
|
79
80
|
});
|
|
81
|
+
|
|
82
|
+
describe("getContractCardLinks", () => {
|
|
83
|
+
const linkParams = { orgUnitId: "unit-1", contractId: "contract-1" };
|
|
84
|
+
const t = (key: string) => key;
|
|
85
|
+
|
|
86
|
+
it("keeps the pre-SUMA labels without SUMA", () => {
|
|
87
|
+
expect(getContractCardLinks(linkParams, t).map(({ name }) => name)).toEqual(
|
|
88
|
+
[
|
|
89
|
+
"layouts.navigation.profile",
|
|
90
|
+
"layouts.navigation.addresses",
|
|
91
|
+
"layouts.navigation.paymentMethods",
|
|
92
|
+
"layouts.navigation.creditCards",
|
|
93
|
+
"layouts.navigation.assortments",
|
|
94
|
+
]
|
|
95
|
+
);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it("uses the SUMA labels under SUMA", () => {
|
|
99
|
+
expect(
|
|
100
|
+
getContractCardLinks(linkParams, t, { suma: true }).map(
|
|
101
|
+
({ name }) => name
|
|
102
|
+
)
|
|
103
|
+
).toEqual([
|
|
104
|
+
"contracts.nav.basicInformation",
|
|
105
|
+
"layouts.navigation.addresses",
|
|
106
|
+
"layouts.navigation.paymentMethods",
|
|
107
|
+
"layouts.navigation.creditCards",
|
|
108
|
+
"contracts.nav.assortment",
|
|
109
|
+
]);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it("adds Recipients when enabled at contract level", () => {
|
|
113
|
+
for (const suma of [false, true]) {
|
|
114
|
+
expect(
|
|
115
|
+
getContractCardLinks(linkParams, t, {
|
|
116
|
+
suma,
|
|
117
|
+
enableRecipientsContractLevel: true,
|
|
118
|
+
}).map(({ name }) => name)
|
|
119
|
+
).toContain("layouts.navigation.recipients");
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it("links to the same pages with and without SUMA", () => {
|
|
124
|
+
expect(
|
|
125
|
+
getContractCardLinks(linkParams, t, { suma: true }).map(
|
|
126
|
+
({ link }) => link
|
|
127
|
+
)
|
|
128
|
+
).toEqual(getContractCardLinks(linkParams, t).map(({ link }) => link));
|
|
129
|
+
});
|
|
130
|
+
});
|
|
@@ -13,19 +13,47 @@
|
|
|
13
13
|
@import "../../components/AddContractsDrawer/add-contracts-drawer.scss";
|
|
14
14
|
@import "../../components/ConfirmRemoveDrawer/confirm-remove-drawer.scss";
|
|
15
15
|
|
|
16
|
-
//
|
|
16
|
+
// App shell: the page fills the viewport and only the content section (and
|
|
17
|
+
// the sidebar, when it is taller than the space left) scrolls. The window
|
|
18
|
+
// never scrolls, so the header, the sidebar and the menus opened from the
|
|
19
|
+
// header stay in place.
|
|
20
|
+
:root:has([data-fs-bp-contract-listing-page]) {
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
|
|
23
|
+
// FastStore places a dropdown menu against the document when it opens, so
|
|
24
|
+
// it can't follow the section's scroll. Keep the content still while a menu
|
|
25
|
+
// opened from it is open; header menus don't need it.
|
|
26
|
+
&:has(
|
|
27
|
+
body
|
|
28
|
+
> [data-fs-dropdown-overlay]
|
|
29
|
+
> [data-fs-dropdown-menu]:not(
|
|
30
|
+
[data-fs-bp-org-unit-details-navbar-menu],
|
|
31
|
+
[data-fs-bp-org-unit-header-nav-menu]
|
|
32
|
+
)
|
|
33
|
+
)
|
|
34
|
+
[data-fs-bp-contract-listing-section] {
|
|
35
|
+
overflow-y: hidden;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
17
39
|
[data-fs-bp-contract-listing-page] {
|
|
18
40
|
display: flex;
|
|
19
41
|
flex-direction: column;
|
|
20
|
-
|
|
21
|
-
|
|
42
|
+
height: 100vh;
|
|
43
|
+
height: 100dvh;
|
|
44
|
+
|
|
45
|
+
> [data-fs-bp-org-unit-details-navbar] {
|
|
46
|
+
flex: none;
|
|
47
|
+
}
|
|
22
48
|
}
|
|
23
49
|
|
|
24
50
|
[data-fs-bp-contract-listing-body] {
|
|
25
51
|
display: grid;
|
|
26
|
-
flex: 1
|
|
52
|
+
flex: 1;
|
|
27
53
|
grid-template-columns: 1fr;
|
|
54
|
+
grid-template-rows: minmax(0, 1fr);
|
|
28
55
|
width: 100%;
|
|
56
|
+
min-height: 0;
|
|
29
57
|
|
|
30
58
|
@include u.media(">=notebook") {
|
|
31
59
|
grid-template-columns: 20rem 1fr;
|
|
@@ -33,13 +61,8 @@
|
|
|
33
61
|
|
|
34
62
|
> [data-fs-bp-contract-listing-sidebar] {
|
|
35
63
|
@include u.media(">=notebook") {
|
|
36
|
-
position: sticky;
|
|
37
|
-
top: 0;
|
|
38
|
-
align-self: start;
|
|
39
64
|
width: 20rem;
|
|
40
65
|
min-width: 20rem;
|
|
41
|
-
max-height: 100vh;
|
|
42
|
-
max-height: 100dvh;
|
|
43
66
|
}
|
|
44
67
|
}
|
|
45
68
|
}
|
|
@@ -181,8 +204,12 @@
|
|
|
181
204
|
@import "../../../accounting-fields/components/AccountingFieldEmptyAlert/accounting-field-empty-alert.scss";
|
|
182
205
|
|
|
183
206
|
width: 100%;
|
|
207
|
+
min-width: 0;
|
|
184
208
|
padding: var(--fs-bp-margin-0) var(--fs-bp-padding-5);
|
|
185
209
|
padding-bottom: var(--fs-bp-padding-12);
|
|
210
|
+
overflow-y: auto;
|
|
211
|
+
// Hiding the scrollbar while a menu is open doesn't shift the content
|
|
212
|
+
scrollbar-gutter: stable;
|
|
186
213
|
|
|
187
214
|
@include u.media(">=tablet") {
|
|
188
215
|
padding-left: var(--fs-bp-padding-10);
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
2
|
+
import { contractScopedLink } from "../../../shared/utils/contractScopedLink";
|
|
3
|
+
import { getContractSettingsLinks } from "../../../shared/utils/getContractSettingsLinks";
|
|
2
4
|
|
|
5
|
+
import type { FeatureFlags } from "../../../shared/components/BuyerPortalProvider/BuyerPortalProvider";
|
|
6
|
+
import type { LocalizeFn } from "../../../shared/localization/types";
|
|
3
7
|
import type { ContractData } from "../../types";
|
|
4
8
|
|
|
5
9
|
export const getDefaultContractId = (contracts: ContractData[]) =>
|
|
@@ -40,3 +44,52 @@ export const parseRemovedCount = (
|
|
|
40
44
|
const count = Number(raw);
|
|
41
45
|
return Number.isInteger(count) && count > 0 ? count : null;
|
|
42
46
|
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Page links of the single-contract card. Without SUMA they keep the labels of
|
|
50
|
+
* the contract sidebar ("Profile", "Assortments"), as on the pre-SUMA unit page.
|
|
51
|
+
*/
|
|
52
|
+
export const getContractCardLinks = (
|
|
53
|
+
linkParams: { orgUnitId: string; contractId: string },
|
|
54
|
+
t: LocalizeFn,
|
|
55
|
+
featureFlags?: FeatureFlags
|
|
56
|
+
) => {
|
|
57
|
+
if (!featureFlags?.suma) {
|
|
58
|
+
return getContractSettingsLinks(linkParams, t, featureFlags);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const links = [
|
|
62
|
+
{
|
|
63
|
+
name: t("contracts.nav.basicInformation"),
|
|
64
|
+
link: contractScopedLink(buyerPortalRoutes.profileDetails, linkParams),
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: t("layouts.navigation.addresses"),
|
|
68
|
+
link: contractScopedLink(buyerPortalRoutes.addresses, linkParams),
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
if (featureFlags.enableRecipientsContractLevel) {
|
|
73
|
+
links.push({
|
|
74
|
+
name: t("layouts.navigation.recipients"),
|
|
75
|
+
link: contractScopedLink(buyerPortalRoutes.recipients, linkParams),
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
links.push(
|
|
80
|
+
{
|
|
81
|
+
name: t("layouts.navigation.paymentMethods"),
|
|
82
|
+
link: contractScopedLink(buyerPortalRoutes.paymentMethods, linkParams),
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: t("layouts.navigation.creditCards"),
|
|
86
|
+
link: contractScopedLink(buyerPortalRoutes.creditCards, linkParams),
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: t("contracts.nav.assortment"),
|
|
90
|
+
link: contractScopedLink(buyerPortalRoutes.productAssortment, linkParams),
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
return links;
|
|
95
|
+
};
|
|
@@ -55,6 +55,8 @@ export type OrgUnitDetailsNavbarProps = {
|
|
|
55
55
|
* value, no Menu button.
|
|
56
56
|
*/
|
|
57
57
|
sidebarVariant?: SumaSidebarVariant | "full";
|
|
58
|
+
/** Contract the drawer's links point to, when it differs from `contractId`. */
|
|
59
|
+
sidebarContractId?: string;
|
|
58
60
|
showBackLink?: boolean;
|
|
59
61
|
/** Page name shown by the `"full"` drawer. */
|
|
60
62
|
pageName?: string;
|
|
@@ -65,6 +67,7 @@ export const OrgUnitDetailsNavbar = ({
|
|
|
65
67
|
orgId,
|
|
66
68
|
contractId = "",
|
|
67
69
|
sidebarVariant,
|
|
70
|
+
sidebarContractId = contractId,
|
|
68
71
|
showBackLink = false,
|
|
69
72
|
pageName = "",
|
|
70
73
|
}: OrgUnitDetailsNavbarProps) => {
|
|
@@ -176,7 +179,7 @@ export const OrgUnitDetailsNavbar = ({
|
|
|
176
179
|
{sidebarVariant && sidebarVariant !== "full" && isOpenSidebarMenu && (
|
|
177
180
|
<SumaSidebarDrawer
|
|
178
181
|
orgUnitId={orgId}
|
|
179
|
-
contractId={
|
|
182
|
+
contractId={sidebarContractId}
|
|
180
183
|
variant={sidebarVariant}
|
|
181
184
|
showBackLink={showBackLink}
|
|
182
185
|
{...sidebarMenuDrawerProps}
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
useQueryParams,
|
|
13
13
|
} from "../../../shared/hooks";
|
|
14
14
|
import { GlobalLayout } from "../../../shared/layouts";
|
|
15
|
-
import { OrgUnitTabsLayout } from "../../../shared/layouts/OrgUnitTabsLayout/OrgUnitTabLayout";
|
|
16
15
|
import { SumaPageLayout } from "../../../shared/layouts/SumaPageLayout/SumaPageLayout";
|
|
17
16
|
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
18
17
|
import { CreateOrgUnitDrawer, OrgUnitsHierarchyTree } from "../../components";
|
|
@@ -27,7 +26,7 @@ export type OrgUnitsLayoutProps = {
|
|
|
27
26
|
|
|
28
27
|
export const OrgUnitsLayout = ({ data, search }: OrgUnitsLayoutProps) => {
|
|
29
28
|
const { setQueryString, removeQueryString } = useQueryParams();
|
|
30
|
-
const { currentOrgUnit
|
|
29
|
+
const { currentOrgUnit } = useBuyerPortal();
|
|
31
30
|
const { t } = useLocalization();
|
|
32
31
|
|
|
33
32
|
const { open, ...drawerProps } = useDrawerProps();
|
|
@@ -108,13 +107,7 @@ export const OrgUnitsLayout = ({ data, search }: OrgUnitsLayoutProps) => {
|
|
|
108
107
|
|
|
109
108
|
return (
|
|
110
109
|
<GlobalLayout>
|
|
111
|
-
{
|
|
112
|
-
<SumaPageLayout>{orgUnitsSection}</SumaPageLayout>
|
|
113
|
-
) : (
|
|
114
|
-
<OrgUnitTabsLayout pageName={t("orgUnits.titles.organization")}>
|
|
115
|
-
{orgUnitsSection}
|
|
116
|
-
</OrgUnitTabsLayout>
|
|
117
|
-
)}
|
|
110
|
+
<SumaPageLayout>{orgUnitsSection}</SumaPageLayout>
|
|
118
111
|
</GlobalLayout>
|
|
119
112
|
);
|
|
120
113
|
};
|
|
@@ -3,7 +3,6 @@ import { Table } from "../../../shared/components/Table/Table";
|
|
|
3
3
|
import { getTableColumns } from "../../../shared/components/Table/utils/tableColumns";
|
|
4
4
|
import { useBuyerPortal } from "../../../shared/hooks";
|
|
5
5
|
import { GlobalLayout } from "../../../shared/layouts";
|
|
6
|
-
import { OrgUnitTabsLayout } from "../../../shared/layouts/OrgUnitTabsLayout/OrgUnitTabLayout";
|
|
7
6
|
import { SumaPageLayout } from "../../../shared/layouts/SumaPageLayout/SumaPageLayout";
|
|
8
7
|
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
9
8
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
@@ -19,7 +18,7 @@ export type RolesLayoutProps = {
|
|
|
19
18
|
export const RolesLayout = ({
|
|
20
19
|
data: { rolesAndPermissions },
|
|
21
20
|
}: RolesLayoutProps) => {
|
|
22
|
-
const { currentOrgUnit
|
|
21
|
+
const { currentOrgUnit } = useBuyerPortal();
|
|
23
22
|
const { t } = useLocalization();
|
|
24
23
|
|
|
25
24
|
const columns = getTableColumns({ nameColumnLabel: t("shared.labels.name") });
|
|
@@ -49,13 +48,7 @@ export const RolesLayout = ({
|
|
|
49
48
|
|
|
50
49
|
return (
|
|
51
50
|
<GlobalLayout>
|
|
52
|
-
{
|
|
53
|
-
<SumaPageLayout>{rolesSection}</SumaPageLayout>
|
|
54
|
-
) : (
|
|
55
|
-
<OrgUnitTabsLayout pageName={t("shared.labels.organization")}>
|
|
56
|
-
{rolesSection}
|
|
57
|
-
</OrgUnitTabsLayout>
|
|
58
|
-
)}
|
|
51
|
+
<SumaPageLayout>{rolesSection}</SumaPageLayout>
|
|
59
52
|
</GlobalLayout>
|
|
60
53
|
);
|
|
61
54
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { type TransitionEventHandler } from "react";
|
|
2
2
|
|
|
3
3
|
import { SlideOver, useFadeEffect } from "@faststore/ui";
|
|
4
4
|
|
|
@@ -9,8 +9,9 @@ import { BasicDrawerButton } from "./BasicDrawerButton";
|
|
|
9
9
|
import { BasicDrawerFooter } from "./BasicDrawerFooter";
|
|
10
10
|
import { BasicDrawerHeading } from "./BasicDrawerHeading";
|
|
11
11
|
|
|
12
|
-
export type BasicDrawerProps = Omit<DrawerProps, "open"> & {
|
|
12
|
+
export type BasicDrawerProps = Omit<DrawerProps, "open" | "onTransitionEnd"> & {
|
|
13
13
|
children: React.ReactNode;
|
|
14
|
+
onTransitionEnd: TransitionEventHandler<HTMLDivElement>;
|
|
14
15
|
id?: string;
|
|
15
16
|
isOpen: boolean;
|
|
16
17
|
onDismiss?: () => void;
|
|
@@ -8,12 +8,15 @@ export type BasicDrawerHeadingProps = {
|
|
|
8
8
|
title: React.ReactNode;
|
|
9
9
|
onClose?: () => void;
|
|
10
10
|
onBack?: () => void;
|
|
11
|
+
/** Overrides the default close icon. */
|
|
12
|
+
closeIcon?: React.ReactNode;
|
|
11
13
|
} & Omit<ComponentProps<"header">, "title">;
|
|
12
14
|
|
|
13
15
|
export const BasicDrawerHeading = ({
|
|
14
16
|
title,
|
|
15
17
|
onClose,
|
|
16
18
|
onBack,
|
|
19
|
+
closeIcon = <Icon name="Close" width={14} height={14} />,
|
|
17
20
|
...props
|
|
18
21
|
}: BasicDrawerHeadingProps) => {
|
|
19
22
|
return (
|
|
@@ -31,7 +34,7 @@ export const BasicDrawerHeading = ({
|
|
|
31
34
|
data-fs-bp-basic-drawer-heading-close-button
|
|
32
35
|
aria-label="close drawer btn"
|
|
33
36
|
onClick={onClose}
|
|
34
|
-
icon={
|
|
37
|
+
icon={closeIcon}
|
|
35
38
|
/>
|
|
36
39
|
</header>
|
|
37
40
|
);
|
|
@@ -23,3 +23,4 @@ export { useSetScopeConfig } from "./useSetScopeConfig";
|
|
|
23
23
|
export { useUrlPaginatedSearch } from "./useUrlPaginatedSearch";
|
|
24
24
|
export { useReloadOnBfcacheRestore } from "./useReloadOnBfcacheRestore";
|
|
25
25
|
export { useRefreshPageData } from "./useRefreshPageData";
|
|
26
|
+
export { useShellScrollReset } from "./useShellScrollReset";
|