@vtex/faststore-plugin-buyer-portal 2.0.13 → 2.0.14
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/CHANGELOG.md +18 -1
- package/cms/b2b/components/.gitkeep +0 -0
- package/cms/b2b/pages/cms_content_type__i18n.jsonc +36 -0
- package/cypress/integration/localization.test.ts +482 -0
- package/cypress/support/commands.ts +8 -0
- package/docs/i18n/i18n-messages-format.md +391 -0
- package/docs/i18n/locales.json +701 -0
- package/docs/i18n/migration-inventory.md +959 -0
- package/package.json +3 -3
- package/specs/custom-localization-system.md +711 -0
- package/specs/multi-locale-e2e-validation.md +277 -0
- package/src/__mocks__/discovery.config.ts +12 -0
- package/src/features/accounting-fields/components/AccountingConfirmDelete/AccountingConfirmDelete.tsx +14 -4
- package/src/features/accounting-fields/components/AccountingFieldConfirmEdit/AccountingFieldConfirmEdit.tsx +11 -6
- package/src/features/accounting-fields/components/AccountingFieldDropdown/AccountingFieldDropdown.tsx +5 -3
- package/src/features/accounting-fields/components/AccountingFieldForm/AccountingFieldForm.tsx +33 -23
- package/src/features/accounting-fields/components/AccountingValueConfirmEdit/AccountingValueConfirmEdit.tsx +10 -6
- package/src/features/accounting-fields/components/AccountingValueDropdown/AccountingValueDropdown.tsx +19 -9
- package/src/features/accounting-fields/components/AccountingValueForm/AccountingValueForm.tsx +21 -10
- package/src/features/accounting-fields/components/CreateAccountingFieldDrawer/CreateAccountingFieldDrawer.tsx +11 -8
- package/src/features/accounting-fields/components/CreateAccountingValueDrawer/CreateAccountingValueDrawer.tsx +18 -7
- package/src/features/accounting-fields/components/DeleteAccountingFieldDrawer/DeleteAccountingFieldDrawer.tsx +14 -12
- package/src/features/accounting-fields/components/DeleteAccountingValueDrawer/DeleteAccountingValueDrawer.tsx +20 -10
- package/src/features/accounting-fields/components/EditAccountingFieldDrawer/EditAccountingFieldDrawer.tsx +5 -3
- package/src/features/accounting-fields/components/EditAccountingValueDrawer/EditAccountingValueDrawer.tsx +13 -6
- package/src/features/accounting-fields/components/RemoveValueFromUnitDrawer/RemoveValueFromUnitDrawer.tsx +19 -8
- package/src/features/accounting-fields/layouts/AccountingFieldLayout/AccountingFieldLayout.tsx +11 -9
- package/src/features/addresses/components/AddRecipientsDrawer/AddRecipientsDrawer.tsx +13 -7
- package/src/features/addresses/components/AddressDropdownMenu/AddressDropdownMenu.tsx +22 -20
- package/src/features/addresses/components/AddressForm/AddressForm.tsx +33 -22
- package/src/features/addresses/components/AddressLine/AddressLine.tsx +29 -25
- package/src/features/addresses/components/AddressLocationsList/AddressLocationsList.tsx +15 -6
- package/src/features/addresses/components/AddressRecipientsList/AddressRecipientsList.tsx +9 -4
- package/src/features/addresses/components/AddressesCard/AddressesCard.tsx +8 -5
- package/src/features/addresses/components/CreateAddressDrawer/CreateAddressDrawer.tsx +27 -14
- package/src/features/addresses/components/CreateAddressSettingsDrawer/CreateAddressSettingsDrawer.tsx +26 -21
- package/src/features/addresses/components/DeleteAddressDrawer/DeleteAddressDrawer.tsx +20 -16
- package/src/features/addresses/components/DeleteAddressLocationDrawer/DeleteAddressLocationDrawer.tsx +26 -14
- package/src/features/addresses/components/DeleteRecipientAddressDrawer/DeleteRecipientAddressDrawer.tsx +20 -17
- package/src/features/addresses/components/EditAddressDrawer/EditAddressDrawer.tsx +12 -6
- package/src/features/addresses/components/EditAddressLocationDrawer/EditAddressLocationDrawer.tsx +24 -17
- package/src/features/addresses/components/EditRecipientAddressDrawer/EditRecipientAddressDrawer.tsx +17 -15
- package/src/features/addresses/components/LocationForm/LocationField/LocationField.tsx +8 -5
- package/src/features/addresses/components/LocationForm/LocationForm.tsx +9 -3
- package/src/features/addresses/components/LocationsDrawer/LocationsDrawer.tsx +15 -9
- package/src/features/addresses/components/RecipientsForm/RecipientItem/RecipientItem.tsx +55 -46
- package/src/features/addresses/components/RecipientsForm/RecipientsForm.tsx +4 -1
- package/src/features/addresses/components/RemoveAddressDrawer/RemoveAddressDrawer.tsx +21 -14
- package/src/features/addresses/layouts/AddressDetailsLayout/AddressDetailsLayout.tsx +16 -9
- package/src/features/addresses/layouts/AddressesLayout/AddressesLayout.tsx +11 -8
- package/src/features/b2b-agent/layouts/B2BAgentLayout/B2BAgentLayout.tsx +3 -1
- package/src/features/budgets/components/BudgetAddForm/BudgetAddForm.tsx +14 -12
- package/src/features/budgets/components/BudgetAddSuccess/BudgetAddSuccess.tsx +16 -14
- package/src/features/budgets/components/BudgetAllocationsSelection/BudgetAllocationsSelection.tsx +8 -5
- package/src/features/budgets/components/BudgetAllocationsTable/BudgetAllocationsTable.tsx +9 -6
- package/src/features/budgets/components/BudgetDeleteDrawer/BudgetDeleteDrawer.tsx +23 -17
- package/src/features/budgets/components/BudgetEditNotificationDrawer/BudgetEditNotificationDrawer.tsx +13 -6
- package/src/features/budgets/components/BudgetNotificationForm/BudgetNotificationForm.tsx +31 -24
- package/src/features/budgets/components/BudgetNotificationsInfo/BudgetNotificationsInfo.tsx +15 -9
- package/src/features/budgets/components/BudgetRemainingBalance/BudgetRemainingBalance.tsx +6 -2
- package/src/features/budgets/components/BudgetSettingsInfo/BudgetSettingsInfo.tsx +27 -10
- package/src/features/budgets/components/BudgetUsersTable/BudgetUsersTable.tsx +14 -7
- package/src/features/budgets/components/BudgetsTable/BudgetsTable.tsx +11 -8
- package/src/features/budgets/components/CreateBudgetAllocationDrawer/CreateBudgetAllocationDrawer.tsx +8 -5
- package/src/features/budgets/components/CreateBudgetDrawer/CreateBudgetDrawer.tsx +31 -18
- package/src/features/budgets/components/DeleteBudgetAllocationDrawer/DeleteBudgetAllocationDrawer.tsx +17 -12
- package/src/features/budgets/components/EditBudgetDrawer/EditBudgetDrawer.tsx +14 -8
- package/src/features/budgets/components/EmptyState.tsx/EmptyState.tsx +4 -1
- package/src/features/budgets/layouts/BudgetsDetailsLayout/BudgetsDetailsLayout.tsx +7 -5
- package/src/features/budgets/layouts/BudgetsLayout/BudgetsLayout.tsx +5 -3
- package/src/features/budgets/messages/budgetNotifications.ts +5 -5
- package/src/features/budgets/utils/handleBudgetError.tsx +5 -8
- package/src/features/budgets/utils/handleBudgetError.types.ts +3 -0
- package/src/features/buying-policies/components/AccountingFieldCriteriaSelector/AccountingFieldCriteriaSelector.tsx +5 -3
- package/src/features/buying-policies/components/AccountingFieldCriteriaSelector/AccountingValueCriteriaSelector.tsx +20 -9
- package/src/features/buying-policies/components/AddBuyingPolicyDrawer/AddBuyingPolicyDrawer.tsx +8 -5
- package/src/features/buying-policies/components/BasicBuyingPolicyDrawer/BasicBuyingPolicyDrawer.tsx +49 -33
- package/src/features/buying-policies/components/BudgetCriteriaSelector/BudgetCriteriaSelector.tsx +8 -2
- package/src/features/buying-policies/components/BuyingPolicyDropdownMenu/BuyingPolicyDropdownMenu.tsx +5 -3
- package/src/features/buying-policies/components/DeleteBuyingPolicyDrawer/DeleteBuyingPolicyDrawer.tsx +28 -24
- package/src/features/buying-policies/components/UpdateBuyingPolicyDrawer/UpdateBuyingPolicyDrawer.tsx +10 -7
- package/src/features/buying-policies/layouts/BuyingPoliciesLayout/BuyingPoliciesLayout.tsx +11 -4
- package/src/features/buying-policies/layouts/BuyingPolicyDetailsLayout/BuyingPolicyDetailsLayout.tsx +26 -9
- package/src/features/buying-policies/utils/accountingFieldCriteriaHelpers.ts +2 -2
- package/src/features/buying-policies/utils/buyingPoliciesWorkflowTypes.ts +3 -3
- package/src/features/buying-policies/utils/orderFieldsCriteriaOptions.ts +8 -8
- package/src/features/buying-policies/utils/spendingLimitsCriteriaOptions.ts +6 -6
- package/src/features/contracts/components/ContractsCard/ContractsCard.tsx +7 -5
- package/src/features/contracts/layouts/ContractsLayout/ContractsLayout.tsx +9 -4
- package/src/features/credit-cards/components/CreateCreditCardDrawer/CreateCreditCardDrawer.tsx +17 -11
- package/src/features/credit-cards/components/CreditCardDropdownMenu/CreditCardDropdownMenu.tsx +17 -11
- package/src/features/credit-cards/components/CreditCardForm/CreditCardForm.tsx +8 -5
- package/src/features/credit-cards/components/CreditCardSettingsDrawer/CreditCardSettingsDrawer.tsx +10 -8
- package/src/features/credit-cards/components/DeleteCreditCardDrawer/DeleteCreditCardDrawer.tsx +19 -14
- package/src/features/credit-cards/components/EditCreditCardDrawer/EditCreditCardDrawer.tsx +14 -13
- package/src/features/credit-cards/components/RemoveCreditCardDrawer/RemoveCreditCardDrawer.tsx +18 -15
- package/src/features/credit-cards/layouts/CreditCardsLayout/CreditCardLayout.tsx +10 -4
- package/src/features/order-entry/layouts/OrderEntryLayout.tsx +3 -1
- package/src/features/org-units/components/AddAllToOrgUnitDropdown/AddAllToOrgUnitDropdown.tsx +11 -9
- package/src/features/org-units/components/AuthSetupDrawer/AuthSetupDrawer.tsx +28 -16
- package/src/features/org-units/components/CreateOrgUnitDrawer/CreateOrgUnitDrawer.tsx +18 -12
- package/src/features/org-units/components/DeleteOrgUnitDrawer/DeleteOrgUnitDrawer.tsx +28 -29
- package/src/features/org-units/components/OrgUnitBreadcrumb/OrgUnitBreadcrumbLink.tsx +4 -4
- package/src/features/org-units/components/OrgUnitDetailsDropdownMenu/OrgUnitDetailsDropdownMenu.tsx +4 -2
- package/src/features/org-units/components/OrgUnitDetailsNavbar/OrgUnitDetailsNavbar.tsx +23 -5
- package/src/features/org-units/components/OrgUnitDetailsNavbar/org-unit-details-navbar.scss +18 -2
- package/src/features/org-units/components/OrgUnitsDropdownMenu/OrgUnitsDropdownMenu.tsx +6 -4
- package/src/features/org-units/components/OrgUnitsHierarchyTree/OrgUnitsHierarchyTree.tsx +9 -6
- package/src/features/org-units/components/OrganizationalUnitsCard/OrganizationalUnitsCard.tsx +15 -7
- package/src/features/org-units/components/UpdateOrgUnitDrawer/UpdateOrgUnitDrawer.tsx +15 -9
- package/src/features/org-units/layouts/OrgUnitDetailsLayout/OrgUnitDetailsLayout.tsx +27 -26
- package/src/features/org-units/layouts/OrgUnitsLayout/OrgUnitsLayout.tsx +8 -3
- package/src/features/payment-methods/components/AddPaymentMethodsDrawer/AddPaymentMethodsDrawer.tsx +29 -18
- package/src/features/payment-methods/components/PaymentMethodSettingsDrawer/PaymentMethodSettingsDrawer.tsx +13 -9
- package/src/features/payment-methods/components/RemoveMethodButton/RemoveMethodButton.tsx +5 -2
- package/src/features/payment-methods/components/RemovePaymentMethodsDrawer/RemovePaymentMethodsDrawer.tsx +10 -7
- package/src/features/payment-methods/hooks/useRemovePaymentMethodSubmit.ts +6 -4
- package/src/features/payment-methods/layouts/PaymentMethodsLayout/PaymentMethodsLayout.tsx +21 -15
- package/src/features/product-assortment/components/ProductAssortmentTable/ProductAssortmentTable.tsx +11 -7
- package/src/features/product-assortment/layouts/ProductAssortmentLayout/ProductAssortmentLayout.tsx +9 -6
- package/src/features/profile/components/ProfileCard/ProfileCard.tsx +8 -5
- package/src/features/profile/components/ProfileSummary/ProfileSummary.tsx +13 -6
- package/src/features/profile/layouts/ProfileLayout/ProfileLayout.tsx +16 -6
- package/src/features/roles/layout/RoleDetailsLayout/RoleDetailsLayout.tsx +4 -2
- package/src/features/roles/layout/RolesLayout/RolesLayout.tsx +5 -3
- package/src/features/shared/components/BasicCard/BasicCard.tsx +6 -4
- package/src/features/shared/components/BasicCard/BasicCardLine.tsx +5 -4
- package/src/features/shared/components/CustomerSwitch/CustomerSwitchDrawer.tsx +10 -2
- package/src/features/shared/components/CustomerSwitch/CustomerSwitchSearch.tsx +4 -1
- package/src/features/shared/components/DropdownFilter/DropdownFilter.tsx +11 -7
- package/src/features/shared/components/Error/Error.tsx +13 -6
- package/src/features/shared/components/HeaderInside/HeaderInside.tsx +5 -2
- package/src/features/shared/components/InternalSearch/InternalSearch.tsx +4 -1
- package/src/features/shared/components/InternalTopbar/InternalTopbar.tsx +7 -5
- package/src/features/shared/components/MainLinksDropdownMenu/MainLinksDropdownMenu.tsx +23 -8
- package/src/features/shared/components/OrgUnitInputSearch/OrgUnitInputSearch.tsx +7 -2
- package/src/features/shared/components/Pagination/Pagination.tsx +6 -2
- package/src/features/shared/components/Paginator/Counter.tsx +11 -5
- package/src/features/shared/components/Paginator/Interval.tsx +4 -3
- package/src/features/shared/components/Paginator/NextPageButton.tsx +6 -2
- package/src/features/shared/components/SettingsDrawer/SettingsDrawer.tsx +6 -4
- package/src/features/shared/components/SettingsDrawer/SettingsDrawerListType.tsx +11 -10
- package/src/features/shared/components/SettingsDrawer/listTypeOptions.ts +10 -7
- package/src/features/shared/components/SortFilter/SortFilter.tsx +15 -8
- package/src/features/shared/components/Table/TableRow/TableRow.tsx +5 -1
- package/src/features/shared/components/VerticalNav/VerticalNavLink.tsx +7 -3
- package/src/features/shared/layouts/BaseTabsLayout/Navbar.tsx +28 -4
- package/src/features/shared/layouts/BaseTabsLayout/about-drawer/AboutDrawer.tsx +15 -5
- package/src/features/shared/layouts/BaseTabsLayout/base-tabs-layout.scss +24 -9
- package/src/features/shared/layouts/BaseTabsLayout/sidebar-drawer/SidebarDrawer.tsx +5 -2
- package/src/features/shared/layouts/ContractTabsLayout/ContractTabsLayout.tsx +10 -5
- package/src/features/shared/layouts/ErrorTabsLayout/ErrorTabsLayout.tsx +7 -4
- package/src/features/shared/layouts/FinanceTabsLayout/FinanceTabsLayout.tsx +9 -4
- package/src/features/shared/layouts/LoadingTabsLayout/LoadingTabsLayout.tsx +7 -4
- package/src/features/shared/layouts/OrgUnitTabsLayout/OrgUnitTabLayout.tsx +3 -0
- package/src/features/shared/layouts/SumaPageLayout/FullSidebarNav.tsx +13 -7
- package/src/features/shared/layouts/SumaPageLayout/SumaSidebar.tsx +9 -5
- package/src/features/shared/localization/LocalizationContext.tsx +35 -0
- package/src/features/shared/localization/__tests__/createLocalize.test.ts +166 -0
- package/src/features/shared/localization/__tests__/get-localization-labels.service.test.ts +202 -0
- package/src/features/shared/localization/clients/LocalizationClient.ts +19 -0
- package/src/features/shared/localization/constants.ts +31 -0
- package/src/features/shared/localization/createLocalize.ts +78 -0
- package/src/features/shared/localization/services/get-localization-labels.service.ts +76 -0
- package/src/features/shared/localization/types.ts +66 -0
- package/src/features/shared/localization/withLocalization.tsx +22 -0
- package/src/features/shared/types/AuthRouteProps.ts +5 -0
- package/src/features/shared/types/LoaderData.ts +1 -0
- package/src/features/shared/utils/addresLabelToPropMapping.ts +10 -10
- package/src/features/shared/utils/constants.ts +1 -4
- package/src/features/shared/utils/getContractSettingsLinks.ts +17 -12
- package/src/features/shared/utils/getFinanceSettingsLinks.ts +14 -9
- package/src/features/shared/utils/getKeyByValue.ts +2 -2
- package/src/features/shared/utils/getOrganizationSettingsLinks.ts +13 -3
- package/src/features/shared/utils/getSumaListingSidebarLinks.ts +15 -10
- package/src/features/shared/utils/index.ts +2 -0
- package/src/features/shared/utils/routeLayoutMapping.ts +30 -30
- package/src/features/shared/utils/search.tsx +10 -0
- package/src/features/shared/utils/withAuth.tsx +6 -0
- package/src/features/shared/utils/withAuthLoader.ts +11 -0
- package/src/features/shared/utils/withLoaderErrorBoundary.ts +9 -0
- package/src/features/shared/utils/withProviders.tsx +13 -2
- package/src/features/users/components/CreateUserDrawer/CreateUserDrawer.tsx +39 -27
- package/src/features/users/components/CreateUserDrawerWithUsername/CreateUserDrawerWithUsername.tsx +41 -39
- package/src/features/users/components/DeleteUserDrawer/DeleteUserDrawer.tsx +27 -23
- package/src/features/users/components/EmailTransactionalSection/EmailTransactionalSection.tsx +6 -8
- package/src/features/users/components/LoginField/LoginField.tsx +4 -4
- package/src/features/users/components/ReassignOrgUnitDrawer/ReassignOrgUnitDrawer.tsx +22 -19
- package/src/features/users/components/ResetPasswordDrawer/ResetPasswordDrawer.tsx +16 -21
- package/src/features/users/components/UpdateUserDrawer/UpdateUserDrawer.tsx +26 -15
- package/src/features/users/components/UpdateUserDrawerWithUsername/UpdateUserDrawerWithUsername.tsx +22 -8
- package/src/features/users/components/UserDropdownMenu/UserDropdownMenu.tsx +7 -5
- package/src/features/users/components/UserFormFields/UserFormFields.tsx +9 -8
- package/src/features/users/components/UsersCard/UsersCard.tsx +4 -2
- package/src/features/users/layouts/UserDetailsLayout/UserDetailsLayout.tsx +26 -10
- package/src/features/users/layouts/UsersLayout/UsersLayout.tsx +12 -8
- package/src/pages/accounting-field.tsx +28 -15
- package/src/pages/address-details.tsx +37 -26
- package/src/pages/addresses.tsx +27 -12
- package/src/pages/budgets-details.tsx +25 -15
- package/src/pages/budgets.tsx +31 -17
- package/src/pages/buyer-organization-manager.tsx +23 -12
- package/src/pages/buying-policies.tsx +38 -20
- package/src/pages/buying-policy-details.tsx +20 -19
- package/src/pages/contracts.tsx +15 -1
- package/src/pages/credit-cards.tsx +30 -17
- package/src/pages/order-entry.tsx +26 -15
- package/src/pages/org-unit-details.tsx +20 -6
- package/src/pages/org-units.tsx +20 -6
- package/src/pages/payment-groups.tsx +15 -12
- package/src/pages/productAssortment.tsx +10 -1
- package/src/pages/profile.tsx +14 -1
- package/src/pages/role-details.tsx +19 -6
- package/src/pages/roles.tsx +27 -14
- package/src/pages/user-details.tsx +29 -17
- package/src/pages/users.tsx +11 -0
- package/vitest.config.ts +13 -0
- package/src/features/addresses/constants/messages.ts +0 -8
- package/src/features/credit-cards/constants/messages.ts +0 -6
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import { useBuyerPortal, useDrawerProps } from "../../../shared/hooks";
|
|
9
9
|
import { GlobalLayout } from "../../../shared/layouts";
|
|
10
10
|
import { OrgUnitTabsLayout } from "../../../shared/layouts/OrgUnitTabsLayout/OrgUnitTabLayout";
|
|
11
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
11
12
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
12
13
|
import { maskPhoneNumber } from "../../../shared/utils/phoneNumber";
|
|
13
14
|
import { ReassignOrgUnitDrawer } from "../../components";
|
|
@@ -29,6 +30,7 @@ export const UserDetailsLayout = ({
|
|
|
29
30
|
data: { user, rolesOptions },
|
|
30
31
|
}: UserDetailsLayoutProps) => {
|
|
31
32
|
const { currentOrgUnit } = useBuyerPortal();
|
|
33
|
+
const { t } = useLocalization();
|
|
32
34
|
|
|
33
35
|
const {
|
|
34
36
|
open: openReassignDrawer,
|
|
@@ -45,7 +47,7 @@ export const UserDetailsLayout = ({
|
|
|
45
47
|
return (
|
|
46
48
|
<GlobalLayout>
|
|
47
49
|
{/* // TODO: Add org unit name and id */}
|
|
48
|
-
<OrgUnitTabsLayout pageName="
|
|
50
|
+
<OrgUnitTabsLayout pageName={t("shared.navigation.organization")}>
|
|
49
51
|
<section data-fs-user-details-section>
|
|
50
52
|
{/* TODO: add a link to the org unit users page */}
|
|
51
53
|
<HeaderInside
|
|
@@ -60,7 +62,7 @@ export const UserDetailsLayout = ({
|
|
|
60
62
|
data-fs-buyer-portal-user-details-edit
|
|
61
63
|
onClick={openUpdateUser}
|
|
62
64
|
>
|
|
63
|
-
|
|
65
|
+
{t("users.actions.editDetails")}
|
|
64
66
|
</button>
|
|
65
67
|
<BasicDropdownMenu.Trigger />
|
|
66
68
|
<UserDropdownMenu
|
|
@@ -72,12 +74,16 @@ export const UserDetailsLayout = ({
|
|
|
72
74
|
</HeaderInside>
|
|
73
75
|
<div data-fs-user-details>
|
|
74
76
|
<div data-fs-buyer-portal-user-details-title>
|
|
75
|
-
<span data-fs-buyer-portal-user-details-title-label>
|
|
77
|
+
<span data-fs-buyer-portal-user-details-title-label>
|
|
78
|
+
{t("users.titles.details")}
|
|
79
|
+
</span>
|
|
76
80
|
</div>
|
|
77
81
|
<hr data-fs-user-details-divider />
|
|
78
82
|
|
|
79
83
|
<div data-fs-user-details-row>
|
|
80
|
-
<span data-fs-user-details-row-label>
|
|
84
|
+
<span data-fs-user-details-row-label>
|
|
85
|
+
{t("users.labels.name")}
|
|
86
|
+
</span>
|
|
81
87
|
<span data-fs-user-details-row-value>{user?.name}</span>
|
|
82
88
|
</div>
|
|
83
89
|
|
|
@@ -85,7 +91,9 @@ export const UserDetailsLayout = ({
|
|
|
85
91
|
<>
|
|
86
92
|
<hr data-fs-user-details-divider />
|
|
87
93
|
<div data-fs-user-details-row>
|
|
88
|
-
<span data-fs-user-details-row-label>
|
|
94
|
+
<span data-fs-user-details-row-label>
|
|
95
|
+
{t("users.labels.username")}
|
|
96
|
+
</span>
|
|
89
97
|
<span data-fs-user-details-row-value>{user?.userName}</span>
|
|
90
98
|
</div>
|
|
91
99
|
</>
|
|
@@ -94,7 +102,9 @@ export const UserDetailsLayout = ({
|
|
|
94
102
|
<hr data-fs-user-details-divider />
|
|
95
103
|
|
|
96
104
|
<div data-fs-user-details-row>
|
|
97
|
-
<span data-fs-user-details-row-label>
|
|
105
|
+
<span data-fs-user-details-row-label>
|
|
106
|
+
{t("users.labels.phoneNumber")}
|
|
107
|
+
</span>
|
|
98
108
|
<span data-fs-user-details-row-value>
|
|
99
109
|
{maskPhoneNumber(user?.phone ?? "", "USA")}
|
|
100
110
|
</span>
|
|
@@ -103,7 +113,9 @@ export const UserDetailsLayout = ({
|
|
|
103
113
|
<hr data-fs-user-details-divider />
|
|
104
114
|
|
|
105
115
|
<div data-fs-user-details-row>
|
|
106
|
-
<span data-fs-user-details-row-label>
|
|
116
|
+
<span data-fs-user-details-row-label>
|
|
117
|
+
{t("users.labels.email")}
|
|
118
|
+
</span>
|
|
107
119
|
<a href={`mailto:${user?.email}`} data-fs-user-details-row-value>
|
|
108
120
|
{user?.email}
|
|
109
121
|
</a>
|
|
@@ -112,7 +124,9 @@ export const UserDetailsLayout = ({
|
|
|
112
124
|
<hr data-fs-user-details-divider />
|
|
113
125
|
|
|
114
126
|
<div data-fs-user-details-row>
|
|
115
|
-
<span data-fs-user-details-row-label>
|
|
127
|
+
<span data-fs-user-details-row-label>
|
|
128
|
+
{t("users.labels.role")}
|
|
129
|
+
</span>
|
|
116
130
|
<span
|
|
117
131
|
data-fs-user-details-row-value
|
|
118
132
|
data-fs-user-details-row-value-roles
|
|
@@ -128,14 +142,16 @@ export const UserDetailsLayout = ({
|
|
|
128
142
|
<hr data-fs-user-details-divider />
|
|
129
143
|
|
|
130
144
|
<div data-fs-user-details-row data-fs-user-details-row-org-unit>
|
|
131
|
-
<span data-fs-user-details-row-label>
|
|
145
|
+
<span data-fs-user-details-row-label>
|
|
146
|
+
{t("users.labels.organizationalUnit")}
|
|
147
|
+
</span>
|
|
132
148
|
<span data-fs-user-details-row-value>{user?.orgUnit.name}</span>
|
|
133
149
|
<button
|
|
134
150
|
type="button"
|
|
135
151
|
data-fs-user-details-change
|
|
136
152
|
onClick={openReassignDrawer}
|
|
137
153
|
>
|
|
138
|
-
|
|
154
|
+
{t("users.actions.change")}
|
|
139
155
|
</button>
|
|
140
156
|
</div>
|
|
141
157
|
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
import { GlobalLayout } from "../../../shared/layouts";
|
|
20
20
|
import { OrgUnitTabsLayout } from "../../../shared/layouts/OrgUnitTabsLayout/OrgUnitTabLayout";
|
|
21
21
|
import { SumaPageLayout } from "../../../shared/layouts/SumaPageLayout/SumaPageLayout";
|
|
22
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
22
23
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
23
24
|
import { CreateUserDrawerSelector } from "../../components";
|
|
24
25
|
import { UserDropdownMenu } from "../../components/UserDropdownMenu/UserDropdownMenu";
|
|
@@ -47,6 +48,7 @@ export const UsersLayout = ({
|
|
|
47
48
|
});
|
|
48
49
|
|
|
49
50
|
const { currentOrgUnit, featureFlags } = useBuyerPortal();
|
|
51
|
+
const { t } = useLocalization();
|
|
50
52
|
|
|
51
53
|
const {
|
|
52
54
|
open: openCreateUserDrawer,
|
|
@@ -56,34 +58,34 @@ export const UsersLayout = ({
|
|
|
56
58
|
|
|
57
59
|
const columns = getTableColumns({
|
|
58
60
|
actionsLength: 1,
|
|
59
|
-
nameColumnLabel: "
|
|
61
|
+
nameColumnLabel: t("users.table.columnLogin"),
|
|
60
62
|
nameColumnKey: "login",
|
|
61
63
|
nameColumnSize: "12rem",
|
|
62
64
|
extraColumns: [
|
|
63
65
|
{
|
|
64
66
|
key: "fullname",
|
|
65
|
-
label: "
|
|
67
|
+
label: t("users.table.columnFullName"),
|
|
66
68
|
size: "10rem",
|
|
67
69
|
align: "left",
|
|
68
70
|
hideOnScreenSize: "phonemid",
|
|
69
71
|
},
|
|
70
72
|
{
|
|
71
73
|
key: "email",
|
|
72
|
-
label: "
|
|
74
|
+
label: t("users.table.columnEmail"),
|
|
73
75
|
size: "8rem",
|
|
74
76
|
align: "left",
|
|
75
77
|
hideOnScreenSize: "phonemid",
|
|
76
78
|
},
|
|
77
79
|
{
|
|
78
80
|
key: "phone",
|
|
79
|
-
label: "
|
|
81
|
+
label: t("users.table.columnPhone"),
|
|
80
82
|
size: "8rem",
|
|
81
83
|
align: "left",
|
|
82
84
|
hideOnScreenSize: "tablet",
|
|
83
85
|
},
|
|
84
86
|
{
|
|
85
87
|
key: "roles",
|
|
86
|
-
label: "
|
|
88
|
+
label: t("users.table.columnRoles"),
|
|
87
89
|
size: "100%",
|
|
88
90
|
align: "left",
|
|
89
91
|
hideOnScreenSize: "phonemid",
|
|
@@ -116,7 +118,7 @@ export const UsersLayout = ({
|
|
|
116
118
|
|
|
117
119
|
const usersSection = (
|
|
118
120
|
<section data-fs-users-section>
|
|
119
|
-
<HeaderInside title="
|
|
121
|
+
<HeaderInside title={t("shared.labels.users")}>
|
|
120
122
|
<HeaderInside.Button onClick={openCreateUserDrawer} />
|
|
121
123
|
</HeaderInside>
|
|
122
124
|
|
|
@@ -179,7 +181,9 @@ export const UsersLayout = ({
|
|
|
179
181
|
onClick={increasePage}
|
|
180
182
|
disabled={isLoading}
|
|
181
183
|
>
|
|
182
|
-
{isLoading
|
|
184
|
+
{isLoading
|
|
185
|
+
? t("shared.labels.loading")
|
|
186
|
+
: t("shared.buttons.loadMore")}
|
|
183
187
|
</Paginator.NextPageButton>
|
|
184
188
|
)}
|
|
185
189
|
|
|
@@ -207,7 +211,7 @@ export const UsersLayout = ({
|
|
|
207
211
|
{featureFlags?.suma ? (
|
|
208
212
|
<SumaPageLayout>{usersSection}</SumaPageLayout>
|
|
209
213
|
) : (
|
|
210
|
-
<OrgUnitTabsLayout pageName="
|
|
214
|
+
<OrgUnitTabsLayout pageName={t("shared.navigation.organization")}>
|
|
211
215
|
{usersSection}
|
|
212
216
|
</OrgUnitTabsLayout>
|
|
213
217
|
)}
|
|
@@ -4,6 +4,8 @@ import { getContractDetailsService } from "../features/contracts/services";
|
|
|
4
4
|
import { getOrgUnitBasicDataService } from "../features/org-units/services";
|
|
5
5
|
import { withErrorBoundary } from "../features/shared/components";
|
|
6
6
|
import { ErrorTabsLayout } from "../features/shared/layouts/ErrorTabsLayout/ErrorTabsLayout";
|
|
7
|
+
import { LOCALIZATION_ENTRY_IDS } from "../features/shared/localization/constants";
|
|
8
|
+
import { getLocalizationLabelsService } from "../features/shared/localization/services/get-localization-labels.service";
|
|
7
9
|
import {
|
|
8
10
|
withAuthLoader,
|
|
9
11
|
withLoaderErrorBoundary,
|
|
@@ -16,6 +18,7 @@ import type { AccountingField } from "../features/accounting-fields/types";
|
|
|
16
18
|
import type { ContractData } from "../features/contracts/types";
|
|
17
19
|
import type { OrgUnitBasicData } from "../features/org-units/types";
|
|
18
20
|
import type { ErrorBoundaryProps } from "../features/shared/components/ErrorBoundary/types";
|
|
21
|
+
import type { LabelMap } from "../features/shared/localization/types";
|
|
19
22
|
import type { AuthRouteProps, LoaderData } from "../features/shared/types";
|
|
20
23
|
import type { UserData } from "../features/users/types";
|
|
21
24
|
|
|
@@ -28,6 +31,7 @@ type AccountingFieldPageData = {
|
|
|
28
31
|
currentOrgUnit: OrgUnitBasicData | null;
|
|
29
32
|
currentUser: UserData | null;
|
|
30
33
|
currentContract: ContractData | null;
|
|
34
|
+
localization?: { labels: LabelMap };
|
|
31
35
|
};
|
|
32
36
|
hasError?: boolean;
|
|
33
37
|
error?: ErrorBoundaryProps;
|
|
@@ -47,7 +51,12 @@ const loaderFunction = async (
|
|
|
47
51
|
return withAuthLoader(
|
|
48
52
|
data,
|
|
49
53
|
async ({ customerId, cookie, userId, ...clientContext }) => {
|
|
50
|
-
const
|
|
54
|
+
const labelsPromise = getLocalizationLabelsService({
|
|
55
|
+
entryIds: LOCALIZATION_ENTRY_IDS.accountingFields,
|
|
56
|
+
locale: data.locale,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const buildEmptyState = (localizationLabels: LabelMap) => ({
|
|
51
60
|
data: {
|
|
52
61
|
accountingField: null,
|
|
53
62
|
},
|
|
@@ -56,30 +65,33 @@ const loaderFunction = async (
|
|
|
56
65
|
currentOrgUnit: null,
|
|
57
66
|
currentUser: null,
|
|
58
67
|
currentContract: null,
|
|
68
|
+
localization: { labels: localizationLabels },
|
|
59
69
|
},
|
|
60
|
-
};
|
|
70
|
+
});
|
|
61
71
|
|
|
62
72
|
if (!contractId || !orgUnitId || !accountingFieldId) {
|
|
63
|
-
return
|
|
73
|
+
return buildEmptyState(await labelsPromise);
|
|
64
74
|
}
|
|
65
75
|
|
|
66
|
-
const [orgUnit, contract, user, accountingField] =
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
const [orgUnit, contract, user, accountingField, localizationLabels] =
|
|
77
|
+
await Promise.all([
|
|
78
|
+
getOrgUnitBasicDataService({ id: orgUnitId, cookie }),
|
|
79
|
+
getContractDetailsService({ contractId, unitId: orgUnitId, cookie }),
|
|
80
|
+
getUserByIdService({ orgUnitId, userId, cookie }),
|
|
81
|
+
detailsAccoutingFieldService({
|
|
82
|
+
contractId,
|
|
83
|
+
orgUnitId,
|
|
84
|
+
cookie,
|
|
85
|
+
accountingFieldId,
|
|
86
|
+
}),
|
|
87
|
+
labelsPromise,
|
|
88
|
+
]);
|
|
77
89
|
|
|
78
90
|
if (!accountingField) {
|
|
79
91
|
data.res?.writeHead(302, { Location: "/" });
|
|
80
92
|
data.res?.end();
|
|
81
93
|
|
|
82
|
-
return
|
|
94
|
+
return buildEmptyState(localizationLabels);
|
|
83
95
|
}
|
|
84
96
|
|
|
85
97
|
return {
|
|
@@ -91,6 +103,7 @@ const loaderFunction = async (
|
|
|
91
103
|
currentOrgUnit: orgUnit,
|
|
92
104
|
currentUser: user,
|
|
93
105
|
currentContract: contract,
|
|
106
|
+
localization: { labels: localizationLabels },
|
|
94
107
|
},
|
|
95
108
|
};
|
|
96
109
|
}
|
|
@@ -11,6 +11,8 @@ import {
|
|
|
11
11
|
SEARCH_PARAMS,
|
|
12
12
|
} from "../features/shared/hooks/usePageItems";
|
|
13
13
|
import { ErrorTabsLayout } from "../features/shared/layouts/ErrorTabsLayout/ErrorTabsLayout";
|
|
14
|
+
import { LOCALIZATION_ENTRY_IDS } from "../features/shared/localization/constants";
|
|
15
|
+
import { getLocalizationLabelsService } from "../features/shared/localization/services/get-localization-labels.service";
|
|
14
16
|
import {
|
|
15
17
|
type ClientContext,
|
|
16
18
|
getValidPage,
|
|
@@ -27,6 +29,7 @@ import type {
|
|
|
27
29
|
} from "../features/addresses/types/AddressData";
|
|
28
30
|
import type { ContractData } from "../features/contracts/types";
|
|
29
31
|
import type { OrgUnitBasicData } from "../features/org-units/types";
|
|
32
|
+
import type { LabelMap } from "../features/shared/localization/types";
|
|
30
33
|
import type { AuthRouteProps, LoaderData } from "../features/shared/types";
|
|
31
34
|
import type { UserData } from "../features/users/types";
|
|
32
35
|
|
|
@@ -60,6 +63,7 @@ export type AddressDetailsPageData = {
|
|
|
60
63
|
currentOrgUnit: OrgUnitBasicData | null;
|
|
61
64
|
currentContract: ContractData | null;
|
|
62
65
|
currentUser: UserData | null;
|
|
66
|
+
localization?: { labels: LabelMap };
|
|
63
67
|
};
|
|
64
68
|
hasError?: boolean;
|
|
65
69
|
error?: ErrorBoundaryProps;
|
|
@@ -83,7 +87,14 @@ const loaderFunction = async (
|
|
|
83
87
|
return withAuthLoader(
|
|
84
88
|
data,
|
|
85
89
|
async ({ customerId, cookie, userId, ...clientContext }) => {
|
|
90
|
+
const labelsPromise = getLocalizationLabelsService({
|
|
91
|
+
entryIds: LOCALIZATION_ENTRY_IDS.addresses,
|
|
92
|
+
locale: data.locale,
|
|
93
|
+
});
|
|
94
|
+
|
|
86
95
|
if (!contractId || !orgUnitId) {
|
|
96
|
+
const localizationLabels = await labelsPromise;
|
|
97
|
+
|
|
87
98
|
return {
|
|
88
99
|
data: {
|
|
89
100
|
addressDetails: null,
|
|
@@ -95,51 +106,50 @@ const loaderFunction = async (
|
|
|
95
106
|
currentOrgUnit: null,
|
|
96
107
|
currentContract: null,
|
|
97
108
|
currentUser: null,
|
|
109
|
+
localization: { labels: localizationLabels },
|
|
98
110
|
},
|
|
99
111
|
};
|
|
100
112
|
}
|
|
101
113
|
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
const [
|
|
115
|
+
orgUnit,
|
|
116
|
+
contract,
|
|
117
|
+
user,
|
|
118
|
+
{ data: recipients = [], total = 0 },
|
|
119
|
+
{ data: locations, total: totalLocations },
|
|
120
|
+
addressDetails,
|
|
121
|
+
localizationLabels,
|
|
122
|
+
] = await Promise.all([
|
|
123
|
+
getOrgUnitBasicDataService({ cookie, id: orgUnitId }),
|
|
124
|
+
getContractDetailsService({
|
|
125
|
+
contractId,
|
|
126
|
+
cookie,
|
|
127
|
+
unitId: orgUnitId,
|
|
128
|
+
}),
|
|
129
|
+
getUserByIdService({ orgUnitId, userId, cookie }),
|
|
130
|
+
getAddressRecipientsService({
|
|
117
131
|
unitId: orgUnitId,
|
|
118
132
|
customerId: contractId,
|
|
119
133
|
addressId,
|
|
120
134
|
cookie,
|
|
121
135
|
search: searchRecipients,
|
|
122
136
|
page: pageRecipients,
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
const { data: locations, total: totalLocations } =
|
|
126
|
-
await getAddressLocationService({
|
|
137
|
+
}),
|
|
138
|
+
getAddressLocationService({
|
|
127
139
|
contractId,
|
|
128
140
|
addressId,
|
|
129
141
|
cookie,
|
|
130
142
|
unitId: orgUnitId,
|
|
131
143
|
search: searchLocations,
|
|
132
144
|
page: pageLocation,
|
|
133
|
-
})
|
|
145
|
+
}),
|
|
146
|
+
getAddressDetailsService(addressId, cookie, contractId, orgUnitId),
|
|
147
|
+
labelsPromise,
|
|
148
|
+
]);
|
|
134
149
|
|
|
135
150
|
return {
|
|
136
151
|
data: {
|
|
137
|
-
addressDetails
|
|
138
|
-
addressId,
|
|
139
|
-
cookie,
|
|
140
|
-
contractId,
|
|
141
|
-
orgUnitId
|
|
142
|
-
),
|
|
152
|
+
addressDetails,
|
|
143
153
|
recipientsData: {
|
|
144
154
|
data: recipients,
|
|
145
155
|
total,
|
|
@@ -158,6 +168,7 @@ const loaderFunction = async (
|
|
|
158
168
|
currentOrgUnit: orgUnit,
|
|
159
169
|
currentContract: contract,
|
|
160
170
|
currentUser: user,
|
|
171
|
+
localization: { labels: localizationLabels },
|
|
161
172
|
},
|
|
162
173
|
};
|
|
163
174
|
}
|
package/src/pages/addresses.tsx
CHANGED
|
@@ -4,6 +4,8 @@ import { getOrgUnitBasicDataService } from "../features/org-units/services";
|
|
|
4
4
|
import { withErrorBoundary } from "../features/shared/components";
|
|
5
5
|
import { ErrorBoundaryProps } from "../features/shared/components/ErrorBoundary/types";
|
|
6
6
|
import { ErrorTabsLayout } from "../features/shared/layouts/ErrorTabsLayout/ErrorTabsLayout";
|
|
7
|
+
import { LOCALIZATION_ENTRY_IDS } from "../features/shared/localization/constants";
|
|
8
|
+
import { getLocalizationLabelsService } from "../features/shared/localization/services/get-localization-labels.service";
|
|
7
9
|
import {
|
|
8
10
|
type ClientContext,
|
|
9
11
|
withLoaderErrorBoundary,
|
|
@@ -14,6 +16,7 @@ import { getUserByIdService } from "../features/users/services";
|
|
|
14
16
|
|
|
15
17
|
import type { ContractData } from "../features/contracts/types";
|
|
16
18
|
import type { OrgUnitBasicData } from "../features/org-units/types";
|
|
19
|
+
import type { LabelMap } from "../features/shared/localization/types";
|
|
17
20
|
import type { AuthRouteProps, LoaderData } from "../features/shared/types";
|
|
18
21
|
import type { UserData } from "../features/users/types";
|
|
19
22
|
|
|
@@ -23,6 +26,7 @@ export type AddressesPageData = {
|
|
|
23
26
|
clientContext: ClientContext;
|
|
24
27
|
currentOrgUnit: OrgUnitBasicData | null;
|
|
25
28
|
currentUser: UserData | null;
|
|
29
|
+
localization?: { labels: LabelMap };
|
|
26
30
|
};
|
|
27
31
|
hasError?: boolean;
|
|
28
32
|
error?: ErrorBoundaryProps;
|
|
@@ -41,29 +45,39 @@ const loaderFunction = async (
|
|
|
41
45
|
return withAuthLoader(
|
|
42
46
|
data,
|
|
43
47
|
async ({ cookie, userId, customerId, ...clientContext }) => {
|
|
48
|
+
const labelsPromise = getLocalizationLabelsService({
|
|
49
|
+
entryIds: LOCALIZATION_ENTRY_IDS.addresses,
|
|
50
|
+
locale: data.locale,
|
|
51
|
+
});
|
|
52
|
+
|
|
44
53
|
if (!contractId || !orgUnitId) {
|
|
54
|
+
const localizationLabels = await labelsPromise;
|
|
55
|
+
|
|
45
56
|
return {
|
|
46
57
|
context: {
|
|
47
58
|
clientContext: { customerId, cookie, userId, ...clientContext },
|
|
48
59
|
currentOrgUnit: null,
|
|
49
60
|
currentContract: null,
|
|
50
61
|
currentUser: null,
|
|
62
|
+
localization: { labels: localizationLabels },
|
|
51
63
|
},
|
|
52
64
|
};
|
|
53
65
|
}
|
|
54
66
|
|
|
55
|
-
const [currentOrgUnit, user, contract] =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
const [currentOrgUnit, user, contract, localizationLabels] =
|
|
68
|
+
await Promise.all([
|
|
69
|
+
getOrgUnitBasicDataService({
|
|
70
|
+
id: orgUnitId,
|
|
71
|
+
cookie,
|
|
72
|
+
}),
|
|
73
|
+
getUserByIdService({ orgUnitId, userId, cookie }),
|
|
74
|
+
getContractDetailsService({
|
|
75
|
+
contractId,
|
|
76
|
+
cookie,
|
|
77
|
+
unitId: orgUnitId,
|
|
78
|
+
}),
|
|
79
|
+
labelsPromise,
|
|
80
|
+
]);
|
|
67
81
|
|
|
68
82
|
return {
|
|
69
83
|
context: {
|
|
@@ -71,6 +85,7 @@ const loaderFunction = async (
|
|
|
71
85
|
currentOrgUnit,
|
|
72
86
|
currentUser: user,
|
|
73
87
|
currentContract: contract,
|
|
88
|
+
localization: { labels: localizationLabels },
|
|
74
89
|
},
|
|
75
90
|
};
|
|
76
91
|
}
|
|
@@ -6,6 +6,8 @@ import { getOrgUnitBasicDataService } from "../features/org-units/services";
|
|
|
6
6
|
import { withErrorBoundary } from "../features/shared/components";
|
|
7
7
|
import { ErrorBoundaryProps } from "../features/shared/components/ErrorBoundary/types";
|
|
8
8
|
import { ErrorTabsLayout } from "../features/shared/layouts/ErrorTabsLayout/ErrorTabsLayout";
|
|
9
|
+
import { LOCALIZATION_ENTRY_IDS } from "../features/shared/localization/constants";
|
|
10
|
+
import { getLocalizationLabelsService } from "../features/shared/localization/services/get-localization-labels.service";
|
|
9
11
|
import {
|
|
10
12
|
type ClientContext,
|
|
11
13
|
withLoaderErrorBoundary,
|
|
@@ -16,6 +18,7 @@ import { getUserByIdService } from "../features/users/services";
|
|
|
16
18
|
|
|
17
19
|
import type { ContractData } from "../features/contracts/types";
|
|
18
20
|
import type { OrgUnitBasicData } from "../features/org-units/types";
|
|
21
|
+
import type { LabelMap } from "../features/shared/localization/types";
|
|
19
22
|
import type { AuthRouteProps, LoaderData } from "../features/shared/types";
|
|
20
23
|
import type { UserData } from "../features/users/types";
|
|
21
24
|
|
|
@@ -26,6 +29,7 @@ export type BudgetsDetailsData = {
|
|
|
26
29
|
currentOrgUnit: OrgUnitBasicData | null;
|
|
27
30
|
currentContract: ContractData | null;
|
|
28
31
|
currentUser: UserData | null;
|
|
32
|
+
localization?: { labels: LabelMap };
|
|
29
33
|
};
|
|
30
34
|
hasError?: boolean;
|
|
31
35
|
error?: ErrorBoundaryProps;
|
|
@@ -45,21 +49,26 @@ const loaderFunction = async (
|
|
|
45
49
|
return withAuthLoader(
|
|
46
50
|
data,
|
|
47
51
|
async ({ customerId, cookie, userId, ...clientContext }) => {
|
|
48
|
-
const [orgUnit, contract, user, budgetsData] =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
const [orgUnit, contract, user, budgetsData, localizationLabels] =
|
|
53
|
+
await Promise.all([
|
|
54
|
+
getOrgUnitBasicDataService({ cookie, id: orgUnitId }),
|
|
55
|
+
getContractDetailsService({
|
|
56
|
+
contractId,
|
|
57
|
+
cookie,
|
|
58
|
+
unitId: orgUnitId,
|
|
59
|
+
}),
|
|
60
|
+
getUserByIdService({ orgUnitId, userId, cookie }),
|
|
61
|
+
getBudgetByIdService({
|
|
62
|
+
budgetId,
|
|
63
|
+
customerId,
|
|
64
|
+
unitId: orgUnitId,
|
|
65
|
+
cookie,
|
|
66
|
+
}),
|
|
67
|
+
getLocalizationLabelsService({
|
|
68
|
+
entryIds: LOCALIZATION_ENTRY_IDS.budgets,
|
|
69
|
+
locale: data.locale,
|
|
70
|
+
}),
|
|
71
|
+
]);
|
|
63
72
|
|
|
64
73
|
return {
|
|
65
74
|
budget: budgetsData,
|
|
@@ -68,6 +77,7 @@ const loaderFunction = async (
|
|
|
68
77
|
currentOrgUnit: orgUnit,
|
|
69
78
|
currentContract: contract,
|
|
70
79
|
currentUser: user,
|
|
80
|
+
localization: { labels: localizationLabels },
|
|
71
81
|
},
|
|
72
82
|
};
|
|
73
83
|
}
|
package/src/pages/budgets.tsx
CHANGED
|
@@ -5,6 +5,8 @@ import { getOrgUnitBasicDataService } from "../features/org-units/services";
|
|
|
5
5
|
import { withErrorBoundary } from "../features/shared/components";
|
|
6
6
|
import { ErrorBoundaryProps } from "../features/shared/components/ErrorBoundary/types";
|
|
7
7
|
import { ErrorTabsLayout } from "../features/shared/layouts/ErrorTabsLayout/ErrorTabsLayout";
|
|
8
|
+
import { LOCALIZATION_ENTRY_IDS } from "../features/shared/localization/constants";
|
|
9
|
+
import { getLocalizationLabelsService } from "../features/shared/localization/services/get-localization-labels.service";
|
|
8
10
|
import {
|
|
9
11
|
type ClientContext,
|
|
10
12
|
withLoaderErrorBoundary,
|
|
@@ -16,6 +18,7 @@ import { getUserByIdService } from "../features/users/services";
|
|
|
16
18
|
import type { BudgetListResponse } from "../features/budgets/types";
|
|
17
19
|
import type { ContractData } from "../features/contracts/types";
|
|
18
20
|
import type { OrgUnitBasicData } from "../features/org-units/types";
|
|
21
|
+
import type { LabelMap } from "../features/shared/localization/types";
|
|
19
22
|
import type { AuthRouteProps, LoaderData } from "../features/shared/types";
|
|
20
23
|
import type { UserData } from "../features/users/types";
|
|
21
24
|
|
|
@@ -26,6 +29,7 @@ export type BudgetPageData = {
|
|
|
26
29
|
currentContract: ContractData | null;
|
|
27
30
|
currentOrgUnit: OrgUnitBasicData | null;
|
|
28
31
|
currentUser: UserData | null;
|
|
32
|
+
localization?: { labels: LabelMap };
|
|
29
33
|
};
|
|
30
34
|
hasError?: boolean;
|
|
31
35
|
error?: ErrorBoundaryProps;
|
|
@@ -44,7 +48,13 @@ const loaderFunction = async (
|
|
|
44
48
|
return withAuthLoader(
|
|
45
49
|
data,
|
|
46
50
|
async ({ customerId, cookie, userId, ...clientContext }) => {
|
|
51
|
+
const labelsPromise = getLocalizationLabelsService({
|
|
52
|
+
entryIds: LOCALIZATION_ENTRY_IDS.budgets,
|
|
53
|
+
locale: data.locale,
|
|
54
|
+
});
|
|
55
|
+
|
|
47
56
|
if (!contractId || !orgUnitId) {
|
|
57
|
+
const localizationLabels = await labelsPromise;
|
|
48
58
|
return {
|
|
49
59
|
data: { data: [], total: 0 },
|
|
50
60
|
context: {
|
|
@@ -52,27 +62,30 @@ const loaderFunction = async (
|
|
|
52
62
|
currentOrgUnit: null,
|
|
53
63
|
currentContract: null,
|
|
54
64
|
currentUser: null,
|
|
65
|
+
localization: { labels: localizationLabels },
|
|
55
66
|
},
|
|
56
67
|
};
|
|
57
68
|
}
|
|
58
69
|
|
|
59
|
-
const [orgUnit, contract, user, budgetsData] =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
const [orgUnit, contract, user, budgetsData, localizationLabels] =
|
|
71
|
+
await Promise.all([
|
|
72
|
+
getOrgUnitBasicDataService({
|
|
73
|
+
cookie,
|
|
74
|
+
id: orgUnitId,
|
|
75
|
+
}),
|
|
76
|
+
getContractDetailsService({
|
|
77
|
+
contractId,
|
|
78
|
+
unitId: orgUnitId,
|
|
79
|
+
cookie,
|
|
80
|
+
}),
|
|
81
|
+
getUserByIdService({ orgUnitId, userId, cookie }),
|
|
82
|
+
listBudgetsService({
|
|
83
|
+
customerId,
|
|
84
|
+
cookie,
|
|
85
|
+
unitId: orgUnitId,
|
|
86
|
+
}),
|
|
87
|
+
labelsPromise,
|
|
88
|
+
]);
|
|
76
89
|
|
|
77
90
|
return {
|
|
78
91
|
data: budgetsData,
|
|
@@ -81,6 +94,7 @@ const loaderFunction = async (
|
|
|
81
94
|
currentOrgUnit: orgUnit,
|
|
82
95
|
currentContract: contract,
|
|
83
96
|
currentUser: user,
|
|
97
|
+
localization: { labels: localizationLabels },
|
|
84
98
|
},
|
|
85
99
|
};
|
|
86
100
|
}
|