@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
|
@@ -13,9 +13,9 @@ import {
|
|
|
13
13
|
Icon,
|
|
14
14
|
} from "../../../shared/components";
|
|
15
15
|
import { useAnalytics, useBuyerPortal } from "../../../shared/hooks";
|
|
16
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
16
17
|
import { ANALYTICS_EVENTS } from "../../../shared/services/logger/analytics/constants";
|
|
17
18
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
18
|
-
import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
|
|
19
19
|
import { resolveContractId } from "../../../shared/utils/resolveContractId";
|
|
20
20
|
import { useCreateNewOrgUnit } from "../../hooks";
|
|
21
21
|
|
|
@@ -44,6 +44,7 @@ export const CreateOrgUnitDrawer = ({
|
|
|
44
44
|
currentContract,
|
|
45
45
|
currentOrgUnit,
|
|
46
46
|
});
|
|
47
|
+
const { t } = useLocalization();
|
|
47
48
|
const { trackEntityCreated, trackEntityCreateError } = useAnalytics({
|
|
48
49
|
entityType: "org_unit",
|
|
49
50
|
defaultTimerName: "org_unit_creation",
|
|
@@ -67,7 +68,9 @@ export const CreateOrgUnitDrawer = ({
|
|
|
67
68
|
});
|
|
68
69
|
|
|
69
70
|
pushToast({
|
|
70
|
-
message:
|
|
71
|
+
message: `${t("orgUnits.toasts.createSuccess")}\n${t(
|
|
72
|
+
"shared.messages.changesTimeout"
|
|
73
|
+
)}`,
|
|
71
74
|
status: "INFO",
|
|
72
75
|
icon: (
|
|
73
76
|
<button
|
|
@@ -82,7 +85,7 @@ export const CreateOrgUnitDrawer = ({
|
|
|
82
85
|
)
|
|
83
86
|
}
|
|
84
87
|
>
|
|
85
|
-
|
|
88
|
+
{t("shared.buttons.view")}
|
|
86
89
|
</button>
|
|
87
90
|
),
|
|
88
91
|
});
|
|
@@ -106,14 +109,14 @@ export const CreateOrgUnitDrawer = ({
|
|
|
106
109
|
|
|
107
110
|
if (error.code === "InvalidOrganizationUnitName") {
|
|
108
111
|
pushToast({
|
|
109
|
-
message: "
|
|
112
|
+
message: t("orgUnits.errors.duplicateName"),
|
|
110
113
|
status: "ERROR",
|
|
111
114
|
});
|
|
112
115
|
return;
|
|
113
116
|
}
|
|
114
117
|
|
|
115
118
|
pushToast({
|
|
116
|
-
message: "
|
|
119
|
+
message: t("orgUnits.errors.createFailed"),
|
|
117
120
|
status: "ERROR",
|
|
118
121
|
});
|
|
119
122
|
},
|
|
@@ -137,10 +140,13 @@ export const CreateOrgUnitDrawer = ({
|
|
|
137
140
|
|
|
138
141
|
return (
|
|
139
142
|
<BasicDrawer data-fs-bp-create-org-unit-drawer close={close} {...props}>
|
|
140
|
-
<BasicDrawer.Heading
|
|
143
|
+
<BasicDrawer.Heading
|
|
144
|
+
title={t("orgUnits.drawers.create.title")}
|
|
145
|
+
onClose={close}
|
|
146
|
+
/>
|
|
141
147
|
<BasicDrawer.Body>
|
|
142
148
|
<AutocompleteDropdown
|
|
143
|
-
label="
|
|
149
|
+
label={t("orgUnits.forms.parentLabel")}
|
|
144
150
|
value={parentOrgUnit?.name ?? ""}
|
|
145
151
|
options={options}
|
|
146
152
|
onConfirmKeyPress={(option) => setParentOrgUnit(option)}
|
|
@@ -164,11 +170,11 @@ export const CreateOrgUnitDrawer = ({
|
|
|
164
170
|
|
|
165
171
|
<ErrorMessage
|
|
166
172
|
show={isTouched && !parentOrgUnit.name?.trim()}
|
|
167
|
-
message="
|
|
173
|
+
message={t("orgUnits.validation.parentRequired")}
|
|
168
174
|
/>
|
|
169
175
|
|
|
170
176
|
<InputText
|
|
171
|
-
label="
|
|
177
|
+
label={t("shared.labels.name")}
|
|
172
178
|
value={name}
|
|
173
179
|
wrapperProps={{ style: { marginTop: 16 } }}
|
|
174
180
|
hasError={isTouched && !name?.trim()}
|
|
@@ -177,12 +183,12 @@ export const CreateOrgUnitDrawer = ({
|
|
|
177
183
|
|
|
178
184
|
<ErrorMessage
|
|
179
185
|
show={isTouched && !name?.trim()}
|
|
180
|
-
message="
|
|
186
|
+
message={t("orgUnits.validation.nameRequired")}
|
|
181
187
|
/>
|
|
182
188
|
</BasicDrawer.Body>
|
|
183
189
|
<BasicDrawer.Footer>
|
|
184
190
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
185
|
-
|
|
191
|
+
{t("shared.buttons.cancel")}
|
|
186
192
|
</BasicDrawer.Button>
|
|
187
193
|
<BasicDrawer.Button
|
|
188
194
|
variant="confirm"
|
|
@@ -190,7 +196,7 @@ export const CreateOrgUnitDrawer = ({
|
|
|
190
196
|
onClick={handleConfirmClick}
|
|
191
197
|
isLoading={isCreateNewOrgUnitLoading}
|
|
192
198
|
>
|
|
193
|
-
|
|
199
|
+
{t("orgUnits.buttons.add")}
|
|
194
200
|
</BasicDrawer.Button>
|
|
195
201
|
</BasicDrawer.Footer>
|
|
196
202
|
</BasicDrawer>
|
|
@@ -12,9 +12,9 @@ import {
|
|
|
12
12
|
type BasicDrawerProps,
|
|
13
13
|
} from "../../../shared/components";
|
|
14
14
|
import { useBuyerPortal, useAnalytics } from "../../../shared/hooks";
|
|
15
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
15
16
|
import { ANALYTICS_EVENTS } from "../../../shared/services/logger/analytics/constants";
|
|
16
17
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
17
|
-
import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
|
|
18
18
|
import { resolveContractId } from "../../../shared/utils/resolveContractId";
|
|
19
19
|
import { useGetUserByOrgUnitId } from "../../../users/hooks/useGetUserByOrgUnitId";
|
|
20
20
|
import { useChildrenOrgUnits } from "../../hooks";
|
|
@@ -44,6 +44,7 @@ export const DeleteOrgUnitDrawer = ({
|
|
|
44
44
|
const { childrenOrgUnits } = useChildrenOrgUnits(id, name);
|
|
45
45
|
const { users } = useGetUserByOrgUnitId(id);
|
|
46
46
|
const { pushToast } = useUI();
|
|
47
|
+
const { t } = useLocalization();
|
|
47
48
|
const { trackEvent } = useAnalytics({
|
|
48
49
|
entityType: "org_unit",
|
|
49
50
|
entityId: id,
|
|
@@ -66,7 +67,9 @@ export const DeleteOrgUnitDrawer = ({
|
|
|
66
67
|
});
|
|
67
68
|
|
|
68
69
|
pushToast({
|
|
69
|
-
message:
|
|
70
|
+
message: `${t("orgUnits.toasts.deleteSuccess")}\n${t(
|
|
71
|
+
"shared.messages.changesTimeout"
|
|
72
|
+
)}`,
|
|
70
73
|
status: "INFO",
|
|
71
74
|
});
|
|
72
75
|
|
|
@@ -112,7 +115,7 @@ export const DeleteOrgUnitDrawer = ({
|
|
|
112
115
|
});
|
|
113
116
|
|
|
114
117
|
pushToast({
|
|
115
|
-
message: "
|
|
118
|
+
message: t("orgUnits.errors.deleteFailed"),
|
|
116
119
|
status: "ERROR",
|
|
117
120
|
});
|
|
118
121
|
},
|
|
@@ -137,26 +140,28 @@ export const DeleteOrgUnitDrawer = ({
|
|
|
137
140
|
size={hasChildren ? "large" : "partial"}
|
|
138
141
|
{...props}
|
|
139
142
|
>
|
|
140
|
-
<BasicDrawer.Heading
|
|
143
|
+
<BasicDrawer.Heading
|
|
144
|
+
title={t("orgUnits.drawers.delete.title")}
|
|
145
|
+
onClose={close}
|
|
146
|
+
/>
|
|
141
147
|
<BasicDrawer.Body>
|
|
142
148
|
{!hasChildren && (
|
|
143
149
|
<>
|
|
144
150
|
<p data-fs-bp-delete-org-unit-drawer-message>
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
151
|
+
{t("orgUnits.delete.confirmMessage", [
|
|
152
|
+
<span key="name" data-fs-bp-delete-org-unit-drawer-message-name>
|
|
153
|
+
{name}
|
|
154
|
+
</span>,
|
|
155
|
+
])}
|
|
150
156
|
</p>
|
|
151
157
|
<p data-fs-bp-delete-org-unit-drawer-message>
|
|
152
|
-
|
|
158
|
+
{t("orgUnits.delete.warningDeleteAllData")}
|
|
153
159
|
<br />
|
|
154
|
-
|
|
155
|
-
bellow:
|
|
160
|
+
{t("orgUnits.delete.confirmNamePrompt")}
|
|
156
161
|
</p>
|
|
157
162
|
|
|
158
163
|
<InputText
|
|
159
|
-
label="
|
|
164
|
+
label={t("shared.labels.name")}
|
|
160
165
|
value={confirmName}
|
|
161
166
|
onChange={(e) => setConfirmName(e.target.value)}
|
|
162
167
|
hasError={isTouched && confirmName !== name}
|
|
@@ -164,7 +169,7 @@ export const DeleteOrgUnitDrawer = ({
|
|
|
164
169
|
|
|
165
170
|
<ErrorMessage
|
|
166
171
|
show={isTouched && confirmName !== name}
|
|
167
|
-
message="
|
|
172
|
+
message={t("orgUnits.validation.nameMismatch")}
|
|
168
173
|
/>
|
|
169
174
|
</>
|
|
170
175
|
)}
|
|
@@ -172,22 +177,16 @@ export const DeleteOrgUnitDrawer = ({
|
|
|
172
177
|
{hasChildren && (
|
|
173
178
|
<>
|
|
174
179
|
<p data-fs-bp-delete-org-unit-drawer-message>
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
<br />
|
|
182
|
-
Please delete them individually, starting from the lowest level.
|
|
183
|
-
<br />
|
|
184
|
-
<br />
|
|
185
|
-
Once all child units {users?.length ? "and users" : ""} bellow are
|
|
186
|
-
removed, you’ll be able to delete {name}.
|
|
180
|
+
{t("orgUnits.delete.hasChildrenMessage", [
|
|
181
|
+
<span key="name" data-fs-bp-delete-org-unit-drawer-message-name>
|
|
182
|
+
{name}
|
|
183
|
+
</span>,
|
|
184
|
+
users?.length ? t("orgUnits.delete.andUsers") : "",
|
|
185
|
+
])}
|
|
187
186
|
</p>
|
|
188
187
|
|
|
189
188
|
<span data-fs-bp-delete-org-unit-drawer-subtitle>
|
|
190
|
-
|
|
189
|
+
{t("orgUnits.titles.organizationalUnits")}
|
|
191
190
|
</span>
|
|
192
191
|
{childrenOrgUnits && (
|
|
193
192
|
<OrgUnitsHierarchyTree
|
|
@@ -200,14 +199,14 @@ export const DeleteOrgUnitDrawer = ({
|
|
|
200
199
|
</BasicDrawer.Body>
|
|
201
200
|
<BasicDrawer.Footer>
|
|
202
201
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
203
|
-
|
|
202
|
+
{t("shared.buttons.cancel")}
|
|
204
203
|
</BasicDrawer.Button>
|
|
205
204
|
<BasicDrawer.Button
|
|
206
205
|
onClick={handleDelete}
|
|
207
206
|
variant={hasChildren ? "confirm" : "danger"}
|
|
208
207
|
isLoading={isDeleteOrgUnitLoading}
|
|
209
208
|
>
|
|
210
|
-
{hasChildren ? "
|
|
209
|
+
{hasChildren ? t("shared.buttons.ok") : t("shared.buttons.delete")}
|
|
211
210
|
</BasicDrawer.Button>
|
|
212
211
|
</BasicDrawer.Footer>
|
|
213
212
|
</BasicDrawer>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from "react";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import { Tooltip } from "@faststore/ui";
|
|
3
|
+
import { useLink_unstable as useLink } from "@faststore/core/experimental";
|
|
4
|
+
import { Link, Tooltip } from "@faststore/ui";
|
|
6
5
|
|
|
7
6
|
import { OrgUnitBreadcrumbItemProps } from "../../types";
|
|
8
7
|
|
|
@@ -12,6 +11,7 @@ export const OrgUnitBreadcrumbLink = ({
|
|
|
12
11
|
isLast,
|
|
13
12
|
enabled,
|
|
14
13
|
}: OrgUnitBreadcrumbItemProps) => {
|
|
14
|
+
const { resolveLink } = useLink();
|
|
15
15
|
const [truncate, setTruncate] = useState(false);
|
|
16
16
|
const linkRef = useRef<HTMLParagraphElement | HTMLAnchorElement>(null);
|
|
17
17
|
|
|
@@ -38,7 +38,7 @@ export const OrgUnitBreadcrumbLink = ({
|
|
|
38
38
|
<Link
|
|
39
39
|
ref={linkRef as React.RefObject<HTMLAnchorElement>}
|
|
40
40
|
data-fs-bp-breadcrumb-text
|
|
41
|
-
href={item}
|
|
41
|
+
href={resolveLink(item)}
|
|
42
42
|
>
|
|
43
43
|
{name}
|
|
44
44
|
</Link>
|
package/src/features/org-units/components/OrgUnitDetailsDropdownMenu/OrgUnitDetailsDropdownMenu.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import { DropdownItem } from "@faststore/ui";
|
|
|
2
2
|
|
|
3
3
|
import { BasicDropdownMenu, Icon } from "../../../shared/components";
|
|
4
4
|
import { useDrawerProps } from "../../../shared/hooks";
|
|
5
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
5
6
|
import { AuthSetupDrawer } from "../AuthSetupDrawer";
|
|
6
7
|
import { UpdateOrgUnitDrawer } from "../UpdateOrgUnitDrawer/UpdateOrgUnitDrawer";
|
|
7
8
|
|
|
@@ -32,6 +33,7 @@ export const OrgUnitDetailsDropdownMenu = ({
|
|
|
32
33
|
...authSetupDrawerProps
|
|
33
34
|
} = useDrawerProps();
|
|
34
35
|
|
|
36
|
+
const { t } = useLocalization();
|
|
35
37
|
const sizeProps = { width: 20, height: 20 };
|
|
36
38
|
|
|
37
39
|
return (
|
|
@@ -39,12 +41,12 @@ export const OrgUnitDetailsDropdownMenu = ({
|
|
|
39
41
|
<BasicDropdownMenu>
|
|
40
42
|
<DropdownItem onClick={openUpdateDrawerProps}>
|
|
41
43
|
<Icon name="FormatSize" {...sizeProps} />
|
|
42
|
-
|
|
44
|
+
{t("orgUnitDetails.dropdown.rename")}
|
|
43
45
|
</DropdownItem>
|
|
44
46
|
<BasicDropdownMenu.Separator />
|
|
45
47
|
<DropdownItem onClick={openAuthSetupDrawerProps}>
|
|
46
48
|
<Icon name="Settings" {...sizeProps} />
|
|
47
|
-
|
|
49
|
+
{t("orgUnitDetails.dropdown.authentication")}
|
|
48
50
|
</DropdownItem>
|
|
49
51
|
</BasicDropdownMenu>
|
|
50
52
|
{isUpdateDrawerOpen && (
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import storeConfig from "discovery.config";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import dynamic from "next/dynamic";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { useLink_unstable as useLink } from "@faststore/core/experimental";
|
|
6
|
+
import { Dropdown, DropdownMenu, IconButton, Link } from "@faststore/ui";
|
|
7
|
+
|
|
8
|
+
const LocalizationButton = dynamic(
|
|
9
|
+
() =>
|
|
10
|
+
import("@faststore/core/experimental").then(
|
|
11
|
+
(m) => m.LocalizationButton_unstable
|
|
12
|
+
),
|
|
13
|
+
{ ssr: false }
|
|
14
|
+
);
|
|
6
15
|
|
|
7
16
|
import { ProfileSummary } from "../../../profile/components";
|
|
8
17
|
import { BasicDropdownMenu, Icon } from "../../../shared/components";
|
|
9
18
|
import { useDrawerProps } from "../../../shared/hooks";
|
|
10
19
|
import { AboutDrawer } from "../../../shared/layouts/BaseTabsLayout/about-drawer/AboutDrawer";
|
|
11
20
|
import { SumaSidebarDrawer } from "../../../shared/layouts/SumaPageLayout/SumaSidebarDrawer";
|
|
21
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
12
22
|
import { doLogout } from "../../../shared/utils";
|
|
13
23
|
|
|
14
24
|
export type OrgUnitDetailsNavbarProps = {
|
|
@@ -34,6 +44,8 @@ export const OrgUnitDetailsNavbar = ({
|
|
|
34
44
|
sidebarVariant,
|
|
35
45
|
showBackLink = false,
|
|
36
46
|
}: OrgUnitDetailsNavbarProps) => {
|
|
47
|
+
const { t } = useLocalization();
|
|
48
|
+
const { resolveLink } = useLink();
|
|
37
49
|
const {
|
|
38
50
|
open: openAboutMenu,
|
|
39
51
|
isOpen: isOpenAboutMenu,
|
|
@@ -57,7 +69,7 @@ export const OrgUnitDetailsNavbar = ({
|
|
|
57
69
|
onClick={openSidebarMenu}
|
|
58
70
|
/>
|
|
59
71
|
)}
|
|
60
|
-
<Link href="/" data-fs-bp-org-unit-details-navbar-link>
|
|
72
|
+
<Link href={resolveLink("/")} data-fs-bp-org-unit-details-navbar-link>
|
|
61
73
|
{storeConfig.seo.title}
|
|
62
74
|
</Link>
|
|
63
75
|
</div>
|
|
@@ -73,12 +85,18 @@ export const OrgUnitDetailsNavbar = ({
|
|
|
73
85
|
</Link>
|
|
74
86
|
*/}
|
|
75
87
|
|
|
88
|
+
<LocalizationButton
|
|
89
|
+
saveLabel={t("shared.buttons.save")}
|
|
90
|
+
currencyLabel={t("layouts.labels.currency")}
|
|
91
|
+
languageLabel={t("layouts.labels.language")}
|
|
92
|
+
icon="Globe"
|
|
93
|
+
/>
|
|
76
94
|
<Link
|
|
77
95
|
target="_blank"
|
|
78
|
-
href="/"
|
|
96
|
+
href={resolveLink("/")}
|
|
79
97
|
data-fs-bp-org-unit-details-navbar-start-shopping-link
|
|
80
98
|
>
|
|
81
|
-
|
|
99
|
+
{t("layouts.navigation.startShopping")}
|
|
82
100
|
</Link>
|
|
83
101
|
|
|
84
102
|
<IconButton
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
@use "~@faststore/ui/src/styles/base/utilities" as u;
|
|
2
|
+
|
|
2
3
|
[data-fs-bp-org-unit-details-navbar] {
|
|
3
|
-
|
|
4
|
+
|
|
4
5
|
display: flex;
|
|
5
6
|
justify-content: space-between;
|
|
6
7
|
align-items: center;
|
|
@@ -20,6 +21,16 @@
|
|
|
20
21
|
gap: var(--fs-bp-gap-2);
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
[data-fs-localization-button] {
|
|
25
|
+
[data-fs-button-wrapper] {
|
|
26
|
+
span {
|
|
27
|
+
display: inline-flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
gap: var(--fs-bp-gap-3);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
23
34
|
[data-fs-bp-org-unit-details-navbar-link] {
|
|
24
35
|
color: var(--fs-bp-color-brand);
|
|
25
36
|
@include text-style('display-6');
|
|
@@ -64,7 +75,7 @@
|
|
|
64
75
|
|
|
65
76
|
[data-fs-bp-org-unit-details-navbar-start-shopping-link] {
|
|
66
77
|
display: none;
|
|
67
|
-
|
|
78
|
+
|
|
68
79
|
padding: 0 var(--fs-bp-padding-5);
|
|
69
80
|
@include text-style('action');
|
|
70
81
|
color: var(--fs-bp-color-neutral-8);
|
|
@@ -101,3 +112,8 @@
|
|
|
101
112
|
min-width: unset;
|
|
102
113
|
background-color: var(--fs-bp-color-white);
|
|
103
114
|
}
|
|
115
|
+
|
|
116
|
+
// !important para vencer a especificidade do CSS module do selector (portal).
|
|
117
|
+
[data-fs-localization-selector] {
|
|
118
|
+
--fs-localization-selector-max-width: 20rem !important;
|
|
119
|
+
}
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import { useGetRolesOptions } from "../../../roles/hooks";
|
|
9
9
|
import { BasicDropdownMenu, Icon } from "../../../shared/components";
|
|
10
10
|
import { useDrawerProps } from "../../../shared/hooks";
|
|
11
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
11
12
|
import { CreateUserDrawerSelector } from "../../../users/components";
|
|
12
13
|
|
|
13
14
|
export type OrgUnitsDropdownMenuProps = {
|
|
@@ -26,6 +27,7 @@ export const OrgUnitsDropdownMenu = ({
|
|
|
26
27
|
pathIds,
|
|
27
28
|
}: OrgUnitsDropdownMenuProps) => {
|
|
28
29
|
const { rolesOptions } = useGetRolesOptions(id);
|
|
30
|
+
const { t } = useLocalization();
|
|
29
31
|
const {
|
|
30
32
|
open: openCreateDrawerProps,
|
|
31
33
|
isOpen: isCreateDrawerOpen,
|
|
@@ -57,18 +59,18 @@ export const OrgUnitsDropdownMenu = ({
|
|
|
57
59
|
<BasicDropdownMenu>
|
|
58
60
|
<DropdownItem onClick={openUpdateDrawerProps}>
|
|
59
61
|
<Icon name="FormatSize" {...sizeProps} />
|
|
60
|
-
|
|
62
|
+
{t("shared.orgUnitDropdown.rename")}
|
|
61
63
|
</DropdownItem>
|
|
62
64
|
<BasicDropdownMenu.Separator />
|
|
63
65
|
{isComplete && (
|
|
64
66
|
<>
|
|
65
67
|
<DropdownItem onClick={openCreateUserDrawerProps}>
|
|
66
68
|
<Icon name="Profile" {...sizeProps} />
|
|
67
|
-
|
|
69
|
+
{t("shared.orgUnitDropdown.addUser")}
|
|
68
70
|
</DropdownItem>
|
|
69
71
|
<DropdownItem onClick={openCreateDrawerProps}>
|
|
70
72
|
<Icon name="Folder" {...sizeProps} />
|
|
71
|
-
|
|
73
|
+
{t("shared.orgUnitDropdown.addOrganizationalUnit")}
|
|
72
74
|
</DropdownItem>
|
|
73
75
|
<BasicDropdownMenu.Separator />
|
|
74
76
|
</>
|
|
@@ -78,7 +80,7 @@ export const OrgUnitsDropdownMenu = ({
|
|
|
78
80
|
data-fs-bp-dropdown-menu-item-mode="danger"
|
|
79
81
|
>
|
|
80
82
|
<Icon name="Delete" {...sizeProps} />
|
|
81
|
-
|
|
83
|
+
{t("shared.buttons.delete")}
|
|
82
84
|
</DropdownItem>
|
|
83
85
|
</BasicDropdownMenu>
|
|
84
86
|
{isCreateDrawerOpen && (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import Link from "next/link";
|
|
2
1
|
import { useRouter } from "next/router";
|
|
3
2
|
|
|
4
|
-
import {
|
|
3
|
+
import { useLink_unstable as useLink } from "@faststore/core/experimental";
|
|
4
|
+
import { Dropdown, Link } from "@faststore/ui";
|
|
5
5
|
|
|
6
6
|
import { OrgUnitsDropdownMenu } from "..";
|
|
7
7
|
import {
|
|
@@ -27,6 +27,7 @@ export const OrgUnitsHierarchyTree = ({
|
|
|
27
27
|
readonly,
|
|
28
28
|
enableChildren = true,
|
|
29
29
|
}: OrgUnitsHierarchyTreeProps) => {
|
|
30
|
+
const { resolveLink } = useLink();
|
|
30
31
|
const { structure, setNode } = useOrgUnitStructure(orgUnitHierarchyData);
|
|
31
32
|
const router = useRouter();
|
|
32
33
|
const { currentContract, currentOrgUnit } = useBuyerPortal();
|
|
@@ -58,10 +59,12 @@ export const OrgUnitsHierarchyTree = ({
|
|
|
58
59
|
{!readonly && (
|
|
59
60
|
<Link
|
|
60
61
|
data-fs-org-unit-item-click-area
|
|
61
|
-
href={
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
href={resolveLink(
|
|
63
|
+
buyerPortalRoutes.orgUnitDetails({
|
|
64
|
+
orgUnitId: id,
|
|
65
|
+
contractId,
|
|
66
|
+
})
|
|
67
|
+
)}
|
|
65
68
|
/>
|
|
66
69
|
)}
|
|
67
70
|
{enableChildren && (
|
package/src/features/org-units/components/OrganizationalUnitsCard/OrganizationalUnitsCard.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { Toggle, Button, Dropdown, DropdownButton } from "@faststore/ui";
|
|
|
3
3
|
import { CreateOrgUnitDrawer, OrgUnitsDropdownMenu } from "..";
|
|
4
4
|
import { BasicCard, Icon } from "../../../shared/components";
|
|
5
5
|
import { useDrawerProps } from "../../../shared/hooks";
|
|
6
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
6
7
|
|
|
7
8
|
import type { OrgUnitData } from "../../types";
|
|
8
9
|
|
|
@@ -15,17 +16,24 @@ type OrganizationalUnitsCardProps = {
|
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
export default function OrganizationalUnitsCard({
|
|
18
|
-
orgUnitData
|
|
19
|
+
orgUnitData,
|
|
19
20
|
organizationalUnits = [],
|
|
20
21
|
}: OrganizationalUnitsCardProps) {
|
|
22
|
+
const { t } = useLocalization();
|
|
23
|
+
const resolvedOrgUnitData = orgUnitData ?? {
|
|
24
|
+
id: null,
|
|
25
|
+
name: t("orgUnits.labels.root"),
|
|
26
|
+
};
|
|
21
27
|
const { open: openCreateDrawer, ...createDrawerProps } = useDrawerProps();
|
|
22
28
|
|
|
23
29
|
return (
|
|
24
30
|
<>
|
|
25
31
|
<BasicCard
|
|
26
|
-
footerLink={`/org-units${
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
footerLink={`/org-units${
|
|
33
|
+
resolvedOrgUnitData?.id ? `/${resolvedOrgUnitData.id}` : ""
|
|
34
|
+
}`}
|
|
35
|
+
footerMessage={t("orgUnits.links.manageOrganizationalUnits")}
|
|
36
|
+
title={t("orgUnits.titles.organizationalUnits")}
|
|
29
37
|
subTitle={organizationalUnits.length ?? 0}
|
|
30
38
|
onPlusIconClick={openCreateDrawer}
|
|
31
39
|
>
|
|
@@ -73,15 +81,15 @@ export default function OrganizationalUnitsCard({
|
|
|
73
81
|
) : (
|
|
74
82
|
<div data-fs-card-body-empty-state>
|
|
75
83
|
<Icon name="FilledFolder" width={40} height={40} />
|
|
76
|
-
<span>
|
|
84
|
+
<span>{t("orgUnits.empty.noChildOrganizationalUnitsYet")}</span>
|
|
77
85
|
<Button variant="primary" onClick={openCreateDrawer}>
|
|
78
|
-
|
|
86
|
+
{t("orgUnits.buttons.addNew")}
|
|
79
87
|
</Button>
|
|
80
88
|
</div>
|
|
81
89
|
)}
|
|
82
90
|
</BasicCard>
|
|
83
91
|
<CreateOrgUnitDrawer
|
|
84
|
-
initialParentOrgUnit={
|
|
92
|
+
initialParentOrgUnit={resolvedOrgUnitData}
|
|
85
93
|
readonly
|
|
86
94
|
{...createDrawerProps}
|
|
87
95
|
/>
|
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
InputText,
|
|
12
12
|
} from "../../../shared/components";
|
|
13
13
|
import { useAnalytics, useBuyerPortal } from "../../../shared/hooks";
|
|
14
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
14
15
|
import { ANALYTICS_EVENTS } from "../../../shared/services/logger/analytics/constants";
|
|
15
16
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
16
|
-
import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
|
|
17
17
|
import { resolveContractId } from "../../../shared/utils/resolveContractId";
|
|
18
18
|
import { useUpdateOrgUnit } from "../../hooks";
|
|
19
19
|
|
|
@@ -40,6 +40,7 @@ export const UpdateOrgUnitDrawer = ({
|
|
|
40
40
|
currentContract,
|
|
41
41
|
currentOrgUnit,
|
|
42
42
|
});
|
|
43
|
+
const { t } = useLocalization();
|
|
43
44
|
const { trackEntityEdited, trackEntityEditError } = useAnalytics({
|
|
44
45
|
entityType: "org_unit",
|
|
45
46
|
entityId: id,
|
|
@@ -58,7 +59,9 @@ export const UpdateOrgUnitDrawer = ({
|
|
|
58
59
|
});
|
|
59
60
|
|
|
60
61
|
pushToast({
|
|
61
|
-
message:
|
|
62
|
+
message: `${t("orgUnits.toasts.updateSuccess")}\n${t(
|
|
63
|
+
"shared.messages.changesTimeout"
|
|
64
|
+
)}`,
|
|
62
65
|
status: "INFO",
|
|
63
66
|
icon: (
|
|
64
67
|
<button
|
|
@@ -73,7 +76,7 @@ export const UpdateOrgUnitDrawer = ({
|
|
|
73
76
|
)
|
|
74
77
|
}
|
|
75
78
|
>
|
|
76
|
-
|
|
79
|
+
{t("shared.buttons.view")}
|
|
77
80
|
</button>
|
|
78
81
|
),
|
|
79
82
|
});
|
|
@@ -97,7 +100,7 @@ export const UpdateOrgUnitDrawer = ({
|
|
|
97
100
|
);
|
|
98
101
|
|
|
99
102
|
pushToast({
|
|
100
|
-
message: "
|
|
103
|
+
message: t("orgUnits.errors.updateFailed"),
|
|
101
104
|
status: "ERROR",
|
|
102
105
|
});
|
|
103
106
|
},
|
|
@@ -120,10 +123,13 @@ export const UpdateOrgUnitDrawer = ({
|
|
|
120
123
|
|
|
121
124
|
return (
|
|
122
125
|
<BasicDrawer data-fs-bp-update-org-unit-drawer close={close} {...props}>
|
|
123
|
-
<BasicDrawer.Heading
|
|
126
|
+
<BasicDrawer.Heading
|
|
127
|
+
title={t("orgUnits.drawers.update.title")}
|
|
128
|
+
onClose={close}
|
|
129
|
+
/>
|
|
124
130
|
<BasicDrawer.Body>
|
|
125
131
|
<InputText
|
|
126
|
-
label="
|
|
132
|
+
label={t("shared.labels.name")}
|
|
127
133
|
value={name}
|
|
128
134
|
wrapperProps={{ style: { marginTop: 16 } }}
|
|
129
135
|
hasError={isTouched && !name?.trim()}
|
|
@@ -132,12 +138,12 @@ export const UpdateOrgUnitDrawer = ({
|
|
|
132
138
|
|
|
133
139
|
<ErrorMessage
|
|
134
140
|
show={isTouched && !name?.trim()}
|
|
135
|
-
message="
|
|
141
|
+
message={t("orgUnits.validation.nameRequired")}
|
|
136
142
|
/>
|
|
137
143
|
</BasicDrawer.Body>
|
|
138
144
|
<BasicDrawer.Footer>
|
|
139
145
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
140
|
-
|
|
146
|
+
{t("shared.buttons.cancel")}
|
|
141
147
|
</BasicDrawer.Button>
|
|
142
148
|
<BasicDrawer.Button
|
|
143
149
|
variant="confirm"
|
|
@@ -145,7 +151,7 @@ export const UpdateOrgUnitDrawer = ({
|
|
|
145
151
|
onClick={handleConfirmClick}
|
|
146
152
|
isLoading={isUpdateOrgUnitLoading}
|
|
147
153
|
>
|
|
148
|
-
|
|
154
|
+
{t("shared.buttons.save")}
|
|
149
155
|
</BasicDrawer.Button>
|
|
150
156
|
</BasicDrawer.Footer>
|
|
151
157
|
</BasicDrawer>
|