@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
|
@@ -26,6 +26,7 @@ import { BasicDropdownMenuTrigger } from "../../../shared/components/BasicDropdo
|
|
|
26
26
|
import { useDrawerProps } from "../../../shared/hooks";
|
|
27
27
|
import { useMediaQuery } from "../../../shared/hooks/useMediaQuery";
|
|
28
28
|
import { GlobalLayout } from "../../../shared/layouts";
|
|
29
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
29
30
|
import {
|
|
30
31
|
getContractSettingsLinks,
|
|
31
32
|
getFinanceSettingsLinks,
|
|
@@ -76,6 +77,7 @@ export const OrgUnitsDetailsLayout = ({
|
|
|
76
77
|
loading = false,
|
|
77
78
|
}: OrgUnitsDetailsLayoutProps) => {
|
|
78
79
|
const isMobile = useMediaQuery(QUERY_TABLET);
|
|
80
|
+
const { t } = useLocalization();
|
|
79
81
|
|
|
80
82
|
const isSingleContract = contracts.length <= 1;
|
|
81
83
|
|
|
@@ -110,14 +112,16 @@ export const OrgUnitsDetailsLayout = ({
|
|
|
110
112
|
const organizationMenu = getOrganizationSettingsLinks({
|
|
111
113
|
orgUnitId: orgUnit.id,
|
|
112
114
|
contractId: linkParams.contractId,
|
|
115
|
+
t,
|
|
113
116
|
});
|
|
114
117
|
|
|
115
|
-
const financeMenu = getFinanceSettingsLinks(linkParams);
|
|
118
|
+
const financeMenu = getFinanceSettingsLinks(linkParams, t);
|
|
116
119
|
|
|
117
|
-
const contractMenu =
|
|
118
|
-
|
|
120
|
+
const contractMenu = getContractSettingsLinks(linkParams, t).map(
|
|
121
|
+
mapLinksHandler
|
|
122
|
+
);
|
|
119
123
|
contractMenu.push({
|
|
120
|
-
name: "
|
|
124
|
+
name: t("orgUnitDetails.settings.accountingFields"),
|
|
121
125
|
loading: listAccountingFieldLoading,
|
|
122
126
|
submenu: {
|
|
123
127
|
items: (listAccountingFieldData ?? []).map((item) => ({
|
|
@@ -233,27 +237,20 @@ export const OrgUnitsDetailsLayout = ({
|
|
|
233
237
|
onClose={handleCloseAlert}
|
|
234
238
|
>
|
|
235
239
|
<span data-fs-bp-accounting-field-empty-alert-message>
|
|
236
|
-
{onlyOneFieldIsEmpty
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
) : (
|
|
244
|
-
<>
|
|
245
|
-
Buyers won't be able to place orders until all required
|
|
246
|
-
information is provided. Complete the accounting field
|
|
247
|
-
settings.
|
|
248
|
-
</>
|
|
249
|
-
)}
|
|
240
|
+
{onlyOneFieldIsEmpty
|
|
241
|
+
? t("orgUnitDetails.messages.accountingFieldEmptySingle", [
|
|
242
|
+
<strong key="field-name">
|
|
243
|
+
{emptyAccountingFields[0].name}
|
|
244
|
+
</strong>,
|
|
245
|
+
])
|
|
246
|
+
: t("orgUnitDetails.messages.accountingFieldEmptyMultiple")}
|
|
250
247
|
</span>
|
|
251
248
|
{onlyOneFieldIsEmpty && (
|
|
252
249
|
<button
|
|
253
250
|
data-fs-bp-accounting-field-empty-alert-btn
|
|
254
251
|
onClick={openAccountingValueDrawer}
|
|
255
252
|
>
|
|
256
|
-
|
|
253
|
+
{t("orgUnitDetails.buttons.addValue")}
|
|
257
254
|
</button>
|
|
258
255
|
)}
|
|
259
256
|
</AccountingFieldEmptyAlert>
|
|
@@ -262,7 +259,7 @@ export const OrgUnitsDetailsLayout = ({
|
|
|
262
259
|
{isSingleContract ? (
|
|
263
260
|
<BasicCard
|
|
264
261
|
data-fs-bp-contracts-settings-card
|
|
265
|
-
footerMessage="
|
|
262
|
+
footerMessage={t("orgUnitDetails.links.manageContractSettings")}
|
|
266
263
|
footerLink={buyerPortalRoutes.profileDetails({
|
|
267
264
|
orgUnitId: orgUnit.id,
|
|
268
265
|
contractId: contracts[0]?.id ?? "",
|
|
@@ -292,7 +289,7 @@ export const OrgUnitsDetailsLayout = ({
|
|
|
292
289
|
) : (
|
|
293
290
|
<BasicCard
|
|
294
291
|
enableHeader
|
|
295
|
-
title="
|
|
292
|
+
title={t("orgUnitDetails.titles.contracts")}
|
|
296
293
|
subTitle={contracts.length}
|
|
297
294
|
data-fs-bp-contracts-list-card
|
|
298
295
|
>
|
|
@@ -318,7 +315,7 @@ export const OrgUnitsDetailsLayout = ({
|
|
|
318
315
|
width={ICON_SIZE}
|
|
319
316
|
height={ICON_SIZE}
|
|
320
317
|
/>
|
|
321
|
-
|
|
318
|
+
{t("orgUnitDetails.actions.edit")}
|
|
322
319
|
</DropdownItem>
|
|
323
320
|
</BasicDropdownMenu>
|
|
324
321
|
}
|
|
@@ -328,26 +325,30 @@ export const OrgUnitsDetailsLayout = ({
|
|
|
328
325
|
)}
|
|
329
326
|
<BasicCard
|
|
330
327
|
data-fs-bp-organizations-settings-card
|
|
331
|
-
footerMessage="
|
|
328
|
+
footerMessage={t("orgUnitDetails.links.manageOrganizationSettings")}
|
|
332
329
|
footerLink={buyerPortalRoutes.users({
|
|
333
330
|
orgUnitId: orgUnit.id,
|
|
334
331
|
})}
|
|
335
332
|
enableFooter
|
|
336
333
|
>
|
|
337
|
-
<VerticalNav.Menu title="
|
|
334
|
+
<VerticalNav.Menu title={t("orgUnitDetails.titles.organization")}>
|
|
338
335
|
<VerticalNav.Tree items={organizationMenu} />
|
|
339
336
|
</VerticalNav.Menu>
|
|
340
337
|
</BasicCard>
|
|
341
338
|
<BasicCard
|
|
342
339
|
data-fs-bp-compliance-settings-card
|
|
343
|
-
footerMessage=
|
|
340
|
+
footerMessage={t(
|
|
341
|
+
"orgUnitDetails.links.manageFinanceAndComplianceSettings"
|
|
342
|
+
)}
|
|
344
343
|
footerLink={buyerPortalRoutes.buyingPolicies({
|
|
345
344
|
orgUnitId: orgUnit.id,
|
|
346
345
|
contractId: contracts[0]?.id,
|
|
347
346
|
})}
|
|
348
347
|
enableFooter
|
|
349
348
|
>
|
|
350
|
-
<VerticalNav.Menu
|
|
349
|
+
<VerticalNav.Menu
|
|
350
|
+
title={t("orgUnitDetails.titles.financeAndCompliance")}
|
|
351
|
+
>
|
|
351
352
|
<VerticalNav.Tree items={financeMenu} />
|
|
352
353
|
</VerticalNav.Menu>
|
|
353
354
|
</BasicCard>
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
import { GlobalLayout } from "../../../shared/layouts";
|
|
15
15
|
import { OrgUnitTabsLayout } from "../../../shared/layouts/OrgUnitTabsLayout/OrgUnitTabLayout";
|
|
16
16
|
import { SumaPageLayout } from "../../../shared/layouts/SumaPageLayout/SumaPageLayout";
|
|
17
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
17
18
|
import { CreateOrgUnitDrawer, OrgUnitsHierarchyTree } from "../../components";
|
|
18
19
|
import { useChildrenOrgUnits } from "../../hooks";
|
|
19
20
|
|
|
@@ -27,6 +28,7 @@ export type OrgUnitsLayoutProps = {
|
|
|
27
28
|
export const OrgUnitsLayout = ({ data, search }: OrgUnitsLayoutProps) => {
|
|
28
29
|
const { setQueryString, removeQueryString } = useQueryParams();
|
|
29
30
|
const { currentOrgUnit, featureFlags } = useBuyerPortal();
|
|
31
|
+
const { t } = useLocalization();
|
|
30
32
|
|
|
31
33
|
const { open, ...drawerProps } = useDrawerProps();
|
|
32
34
|
|
|
@@ -55,7 +57,7 @@ export const OrgUnitsLayout = ({ data, search }: OrgUnitsLayoutProps) => {
|
|
|
55
57
|
|
|
56
58
|
const orgUnitsSection = (
|
|
57
59
|
<section data-fs-org-units-section>
|
|
58
|
-
<HeaderInside title="
|
|
60
|
+
<HeaderInside title={t("orgUnits.titles.organizationalUnits")}>
|
|
59
61
|
<HeaderInside.Button onClick={open} />
|
|
60
62
|
</HeaderInside>
|
|
61
63
|
|
|
@@ -76,7 +78,10 @@ export const OrgUnitsLayout = ({ data, search }: OrgUnitsLayoutProps) => {
|
|
|
76
78
|
|
|
77
79
|
<section data-fs-hierarchy-tree-wrapper>
|
|
78
80
|
{childrenOrgUnits?.length === 0 ? (
|
|
79
|
-
<EmptyState
|
|
81
|
+
<EmptyState
|
|
82
|
+
title={t("orgUnits.empty.noOrganizationalUnitsYet")}
|
|
83
|
+
iconName="Group"
|
|
84
|
+
/>
|
|
80
85
|
) : (
|
|
81
86
|
<>
|
|
82
87
|
{childrenOrgUnits?.map((orgUnit) => (
|
|
@@ -106,7 +111,7 @@ export const OrgUnitsLayout = ({ data, search }: OrgUnitsLayoutProps) => {
|
|
|
106
111
|
{featureFlags?.suma ? (
|
|
107
112
|
<SumaPageLayout>{orgUnitsSection}</SumaPageLayout>
|
|
108
113
|
) : (
|
|
109
|
-
<OrgUnitTabsLayout pageName="
|
|
114
|
+
<OrgUnitTabsLayout pageName={t("orgUnits.titles.organization")}>
|
|
110
115
|
{orgUnitsSection}
|
|
111
116
|
</OrgUnitTabsLayout>
|
|
112
117
|
)}
|
package/src/features/payment-methods/components/AddPaymentMethodsDrawer/AddPaymentMethodsDrawer.tsx
CHANGED
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
Table,
|
|
14
14
|
} from "../../../shared/components";
|
|
15
15
|
import { useBuyerPortal, useDebounce } from "../../../shared/hooks";
|
|
16
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
16
17
|
import { DEBOUNCE_TIMEOUT } from "../../../shared/utils";
|
|
17
|
-
import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
|
|
18
18
|
import { useAddPaymentMethodsToUnit } from "../../hooks";
|
|
19
19
|
import { useDebouncedSearchPaymentMethods } from "../../hooks/useDebouncedSearchPaymentMethods";
|
|
20
20
|
|
|
@@ -42,6 +42,7 @@ export const AddPaymentMethodsDrawer = ({
|
|
|
42
42
|
|
|
43
43
|
const { pushToast } = useUI();
|
|
44
44
|
const router = useRouter();
|
|
45
|
+
const { t } = useLocalization();
|
|
45
46
|
const selectAllRef = useRef<HTMLInputElement>(null);
|
|
46
47
|
|
|
47
48
|
const { currentOrgUnit: orgUnit, currentContract: contract } =
|
|
@@ -79,7 +80,9 @@ export const AddPaymentMethodsDrawer = ({
|
|
|
79
80
|
|
|
80
81
|
const handleSuccess = () => {
|
|
81
82
|
pushToast({
|
|
82
|
-
message:
|
|
83
|
+
message: `${t("paymentMethods.toasts.methodsAdded")}\n${t(
|
|
84
|
+
"shared.messages.changesTimeout"
|
|
85
|
+
)}`,
|
|
83
86
|
status: "INFO",
|
|
84
87
|
});
|
|
85
88
|
router.reload();
|
|
@@ -91,9 +94,7 @@ export const AddPaymentMethodsDrawer = ({
|
|
|
91
94
|
onSuccess: handleSuccess,
|
|
92
95
|
onError: (err) => {
|
|
93
96
|
pushToast({
|
|
94
|
-
message:
|
|
95
|
-
err?.message ??
|
|
96
|
-
"An error occurred while adding the payment methods",
|
|
97
|
+
message: err?.message ?? t("paymentMethods.toasts.addMethodsFailed"),
|
|
97
98
|
status: "ERROR",
|
|
98
99
|
});
|
|
99
100
|
},
|
|
@@ -155,7 +156,7 @@ export const AddPaymentMethodsDrawer = ({
|
|
|
155
156
|
},
|
|
156
157
|
{
|
|
157
158
|
key: "name",
|
|
158
|
-
label: "
|
|
159
|
+
label: t("paymentMethods.table.columnName"),
|
|
159
160
|
align: "left",
|
|
160
161
|
size: "100%",
|
|
161
162
|
},
|
|
@@ -200,11 +201,11 @@ export const AddPaymentMethodsDrawer = ({
|
|
|
200
201
|
|
|
201
202
|
const renderEmpty = () => (
|
|
202
203
|
<EmptyState
|
|
203
|
-
title="
|
|
204
|
+
title={t("paymentMethods.empty.noResultsTitle")}
|
|
204
205
|
description={
|
|
205
206
|
querySearch.length > 0
|
|
206
|
-
? "
|
|
207
|
-
: "
|
|
207
|
+
? t("paymentMethods.empty.tryDifferentTerms")
|
|
208
|
+
: t("paymentMethods.empty.noPaymentMethodsFound")
|
|
208
209
|
}
|
|
209
210
|
/>
|
|
210
211
|
);
|
|
@@ -218,8 +219,8 @@ export const AddPaymentMethodsDrawer = ({
|
|
|
218
219
|
|
|
219
220
|
return (
|
|
220
221
|
<EmptyState
|
|
221
|
-
title="
|
|
222
|
-
description="
|
|
222
|
+
title={t("paymentMethods.empty.allMethodsAlreadyAddedTitle")}
|
|
223
|
+
description={t("paymentMethods.empty.noAdditionalMethods")}
|
|
223
224
|
/>
|
|
224
225
|
);
|
|
225
226
|
};
|
|
@@ -231,13 +232,19 @@ export const AddPaymentMethodsDrawer = ({
|
|
|
231
232
|
size="large"
|
|
232
233
|
{...props}
|
|
233
234
|
>
|
|
234
|
-
<BasicDrawer.Heading
|
|
235
|
+
<BasicDrawer.Heading
|
|
236
|
+
title={t("paymentMethods.drawers.addTitle")}
|
|
237
|
+
onClose={close}
|
|
238
|
+
/>
|
|
235
239
|
|
|
236
240
|
<BasicDrawer.Body>
|
|
237
241
|
<section data-fs-payment-methods-drawer>
|
|
238
242
|
<p data-fs-bp-add-payment-methods-drawer-description>
|
|
239
|
-
|
|
240
|
-
|
|
243
|
+
{orgUnit?.name
|
|
244
|
+
? t("paymentMethods.drawers.addDescription", [
|
|
245
|
+
<span>{orgUnit.name}</span>,
|
|
246
|
+
])
|
|
247
|
+
: t("paymentMethods.drawers.addTitle")}
|
|
241
248
|
</p>
|
|
242
249
|
|
|
243
250
|
{paymentMethods && (
|
|
@@ -270,7 +277,9 @@ export const AddPaymentMethodsDrawer = ({
|
|
|
270
277
|
onClick={() => setDrawerPage(drawerPage - 1)}
|
|
271
278
|
disabled={isLoadingPaymentMethods}
|
|
272
279
|
>
|
|
273
|
-
{isLoadingPaymentMethods
|
|
280
|
+
{isLoadingPaymentMethods
|
|
281
|
+
? t("shared.labels.loading")
|
|
282
|
+
: t("shared.pagination.previousPage")}
|
|
274
283
|
</Paginator.NextPageButton>
|
|
275
284
|
) : (
|
|
276
285
|
<></>
|
|
@@ -281,7 +290,9 @@ export const AddPaymentMethodsDrawer = ({
|
|
|
281
290
|
onClick={() => setDrawerPage(drawerPage + 1)}
|
|
282
291
|
disabled={isLoadingPaymentMethods}
|
|
283
292
|
>
|
|
284
|
-
{isLoadingPaymentMethods
|
|
293
|
+
{isLoadingPaymentMethods
|
|
294
|
+
? t("shared.labels.loading")
|
|
295
|
+
: t("shared.pagination.nextPage")}
|
|
285
296
|
</Paginator.NextPageButton>
|
|
286
297
|
)}
|
|
287
298
|
|
|
@@ -300,7 +311,7 @@ export const AddPaymentMethodsDrawer = ({
|
|
|
300
311
|
|
|
301
312
|
<BasicDrawer.Footer data-fs-bp-add-payment-methods-drawer-footer>
|
|
302
313
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
303
|
-
|
|
314
|
+
{t("shared.buttons.cancel")}
|
|
304
315
|
</BasicDrawer.Button>
|
|
305
316
|
|
|
306
317
|
<BasicDrawer.Button
|
|
@@ -309,7 +320,7 @@ export const AddPaymentMethodsDrawer = ({
|
|
|
309
320
|
onClick={handleSubmit}
|
|
310
321
|
disabled={isAddPaymentMethodsLoading || selectedMethods.size === 0}
|
|
311
322
|
>
|
|
312
|
-
|
|
323
|
+
{t("shared.buttons.add")}
|
|
313
324
|
</BasicDrawer.Button>
|
|
314
325
|
</BasicDrawer.Footer>
|
|
315
326
|
</BasicDrawer>
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
createListTypeOptions,
|
|
11
11
|
} from "../../../shared/components";
|
|
12
12
|
import { useSetScopeConfig, SCOPE_KEYS } from "../../../shared/hooks";
|
|
13
|
-
import {
|
|
13
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
14
14
|
|
|
15
15
|
export type PaymentMethodSettingsDrawerProps = Omit<
|
|
16
16
|
BasicDrawerProps,
|
|
@@ -20,9 +20,6 @@ export type PaymentMethodSettingsDrawerProps = Omit<
|
|
|
20
20
|
onUpdate?: () => void;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
const PAYMENT_METHOD_LIST_TYPE_OPTIONS =
|
|
24
|
-
createListTypeOptions("payment methods");
|
|
25
|
-
|
|
26
23
|
export const PaymentMethodSettingsDrawer = ({
|
|
27
24
|
close,
|
|
28
25
|
onUpdate,
|
|
@@ -30,13 +27,20 @@ export const PaymentMethodSettingsDrawer = ({
|
|
|
30
27
|
}: PaymentMethodSettingsDrawerProps) => {
|
|
31
28
|
const { pushToast } = useUI();
|
|
32
29
|
const router = useRouter();
|
|
30
|
+
const { t } = useLocalization();
|
|
31
|
+
const paymentMethodListTypeOptions = createListTypeOptions(
|
|
32
|
+
"payment methods",
|
|
33
|
+
t
|
|
34
|
+
);
|
|
33
35
|
|
|
34
36
|
const [listType, setListType] = useState<"sync" | "custom">("custom");
|
|
35
37
|
|
|
36
38
|
const { setScopeConfig, isSetScopeConfigLoading } = useSetScopeConfig({
|
|
37
39
|
onSuccess: () => {
|
|
38
40
|
pushToast({
|
|
39
|
-
message:
|
|
41
|
+
message: `${t("paymentMethods.toasts.scopeConfigUpdated")}\n${t(
|
|
42
|
+
"shared.messages.changesTimeout"
|
|
43
|
+
)}`,
|
|
40
44
|
status: "INFO",
|
|
41
45
|
});
|
|
42
46
|
onUpdate?.();
|
|
@@ -44,7 +48,7 @@ export const PaymentMethodSettingsDrawer = ({
|
|
|
44
48
|
},
|
|
45
49
|
onError: () => {
|
|
46
50
|
pushToast({
|
|
47
|
-
message: "
|
|
51
|
+
message: t("paymentMethods.toasts.scopeConfigUpdateFailed"),
|
|
48
52
|
status: "ERROR",
|
|
49
53
|
});
|
|
50
54
|
},
|
|
@@ -61,7 +65,7 @@ export const PaymentMethodSettingsDrawer = ({
|
|
|
61
65
|
|
|
62
66
|
return (
|
|
63
67
|
<SettingsDrawer
|
|
64
|
-
title="
|
|
68
|
+
title={t("paymentMethods.settings.drawerTitle")}
|
|
65
69
|
{...otherProps}
|
|
66
70
|
close={close}
|
|
67
71
|
onPrimaryAction={handleConfirmClick}
|
|
@@ -71,11 +75,11 @@ export const PaymentMethodSettingsDrawer = ({
|
|
|
71
75
|
data-fs-bp-payment-method-settings-drawer
|
|
72
76
|
>
|
|
73
77
|
<SettingsDrawer.ListType
|
|
74
|
-
title="
|
|
78
|
+
title={t("paymentMethods.settings.listTypeTitle")}
|
|
75
79
|
name="payment-method-list-type"
|
|
76
80
|
value={listType}
|
|
77
81
|
onChange={setListType}
|
|
78
|
-
options={
|
|
82
|
+
options={paymentMethodListTypeOptions}
|
|
79
83
|
/>
|
|
80
84
|
</SettingsDrawer>
|
|
81
85
|
);
|
|
@@ -3,6 +3,7 @@ import type { ComponentProps } from "react";
|
|
|
3
3
|
import { Tooltip } from "@faststore/ui";
|
|
4
4
|
|
|
5
5
|
import { Icon } from "../../../shared/components";
|
|
6
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
6
7
|
|
|
7
8
|
export type RemoveMethodButtonProps = {
|
|
8
9
|
isLoading: boolean;
|
|
@@ -18,6 +19,8 @@ export const RemoveMethodButton = ({
|
|
|
18
19
|
onClick,
|
|
19
20
|
...props
|
|
20
21
|
}: RemoveMethodButtonProps) => {
|
|
22
|
+
const { t } = useLocalization();
|
|
23
|
+
|
|
21
24
|
return (
|
|
22
25
|
<Tooltip
|
|
23
26
|
data-fs-payment-methods-tooltip
|
|
@@ -25,8 +28,8 @@ export const RemoveMethodButton = ({
|
|
|
25
28
|
content={
|
|
26
29
|
disabled
|
|
27
30
|
? disabledTooltipContent ??
|
|
28
|
-
"
|
|
29
|
-
: "
|
|
31
|
+
t("paymentMethods.tooltips.cannotRemoveLastMethod")
|
|
32
|
+
: t("paymentMethods.tooltips.removeFromUnit")
|
|
30
33
|
}
|
|
31
34
|
>
|
|
32
35
|
<button
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type BasicDrawerProps, BasicDrawer } from "../../../shared/components";
|
|
2
2
|
import { useBuyerPortal } from "../../../shared/hooks";
|
|
3
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
3
4
|
import { useRemovePaymentMethod } from "../../hooks/useRemovePaymentMethodSubmit";
|
|
4
5
|
|
|
5
6
|
import type { PaymentMethodId } from "../../../shared/types";
|
|
@@ -20,6 +21,7 @@ export const RemovePaymentMethodsDrawer = ({
|
|
|
20
21
|
...props
|
|
21
22
|
}: RemovePaymentMethodsDrawerProps) => {
|
|
22
23
|
const { currentOrgUnit: orgUnit } = useBuyerPortal();
|
|
24
|
+
const { t } = useLocalization();
|
|
23
25
|
|
|
24
26
|
const handleSuccess = () => {
|
|
25
27
|
close();
|
|
@@ -43,25 +45,26 @@ export const RemovePaymentMethodsDrawer = ({
|
|
|
43
45
|
{...props}
|
|
44
46
|
>
|
|
45
47
|
<BasicDrawer.Heading
|
|
46
|
-
title="
|
|
48
|
+
title={t("paymentMethods.drawers.removeTitle")}
|
|
47
49
|
onClose={close}
|
|
48
50
|
/>
|
|
49
51
|
<BasicDrawer.Body>
|
|
50
52
|
<section data-fs-payment-methods-drawer>
|
|
51
53
|
<p data-fs-bp-remove-payment-methods-drawer-description>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
{t("paymentMethods.delete.removeConfirm", [
|
|
55
|
+
<span key="method">{paymentMethod?.name}</span>,
|
|
56
|
+
<span key="unit">{orgUnit?.name}</span>,
|
|
57
|
+
])}
|
|
54
58
|
</p>
|
|
55
59
|
<p data-fs-bp-remove-payment-methods-drawer-description>
|
|
56
|
-
|
|
57
|
-
payment method during checkout.
|
|
60
|
+
{t("paymentMethods.delete.removeWarning")}
|
|
58
61
|
</p>
|
|
59
62
|
</section>
|
|
60
63
|
</BasicDrawer.Body>
|
|
61
64
|
|
|
62
65
|
<BasicDrawer.Footer data-fs-bp-add-payment-methods-drawer-footer>
|
|
63
66
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
64
|
-
|
|
67
|
+
{t("shared.buttons.cancel")}
|
|
65
68
|
</BasicDrawer.Button>
|
|
66
69
|
<BasicDrawer.Button
|
|
67
70
|
variant="confirm"
|
|
@@ -69,7 +72,7 @@ export const RemovePaymentMethodsDrawer = ({
|
|
|
69
72
|
onClick={() => handleSubmit(paymentMethod.id)}
|
|
70
73
|
disabled={readonly}
|
|
71
74
|
>
|
|
72
|
-
|
|
75
|
+
{t("shared.buttons.remove")}
|
|
73
76
|
</BasicDrawer.Button>
|
|
74
77
|
</BasicDrawer.Footer>
|
|
75
78
|
</BasicDrawer>
|
|
@@ -3,7 +3,7 @@ import { useRouter } from "next/router";
|
|
|
3
3
|
import { useUI } from "@faststore/ui";
|
|
4
4
|
|
|
5
5
|
import { useBuyerPortal } from "../../shared/hooks";
|
|
6
|
-
import {
|
|
6
|
+
import { useLocalization } from "../../shared/localization/LocalizationContext";
|
|
7
7
|
|
|
8
8
|
import { useRemovePaymentMethodFromUnit } from "./useRemovePaymentMethodsFromUnit";
|
|
9
9
|
|
|
@@ -13,6 +13,7 @@ import type { PaymentMethodData } from "../types";
|
|
|
13
13
|
export function useRemovePaymentMethod(onAfterSuccess?: () => void) {
|
|
14
14
|
const router = useRouter();
|
|
15
15
|
const { pushToast } = useUI();
|
|
16
|
+
const { t } = useLocalization();
|
|
16
17
|
const { currentOrgUnit: orgUnit, currentContract: contract } =
|
|
17
18
|
useBuyerPortal();
|
|
18
19
|
|
|
@@ -24,7 +25,9 @@ export function useRemovePaymentMethod(onAfterSuccess?: () => void) {
|
|
|
24
25
|
onSuccess: () => {
|
|
25
26
|
onAfterSuccess?.();
|
|
26
27
|
pushToast({
|
|
27
|
-
message:
|
|
28
|
+
message: `${t("paymentMethods.toasts.methodRemoved")}\n${t(
|
|
29
|
+
"shared.messages.changesTimeout"
|
|
30
|
+
)}`,
|
|
28
31
|
status: "INFO",
|
|
29
32
|
});
|
|
30
33
|
router.reload();
|
|
@@ -32,8 +35,7 @@ export function useRemovePaymentMethod(onAfterSuccess?: () => void) {
|
|
|
32
35
|
onError: (err) => {
|
|
33
36
|
pushToast({
|
|
34
37
|
message:
|
|
35
|
-
err?.message ??
|
|
36
|
-
"An error occurred while removing the payment method",
|
|
38
|
+
err?.message ?? t("paymentMethods.toasts.removeMethodFailed"),
|
|
37
39
|
status: "ERROR",
|
|
38
40
|
});
|
|
39
41
|
},
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
SCOPE_KEYS,
|
|
20
20
|
} from "../../../shared/hooks";
|
|
21
21
|
import { ContractTabsLayout, GlobalLayout } from "../../../shared/layouts";
|
|
22
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
22
23
|
import {
|
|
23
24
|
AddPaymentMethodsDrawer,
|
|
24
25
|
RemoveMethodButton,
|
|
@@ -43,6 +44,7 @@ export const PaymentMethodsLayout = ({
|
|
|
43
44
|
page = 1,
|
|
44
45
|
}: PaymentMethodsLayoutProps) => {
|
|
45
46
|
const router = useRouter();
|
|
47
|
+
const { t } = useLocalization();
|
|
46
48
|
const [selectedMethod, setSelectedMethod] = useState<
|
|
47
49
|
PaymentMethodData | undefined
|
|
48
50
|
>(undefined);
|
|
@@ -110,15 +112,18 @@ export const PaymentMethodsLayout = ({
|
|
|
110
112
|
openRemoveDrawer();
|
|
111
113
|
};
|
|
112
114
|
|
|
113
|
-
const columns = getTableColumns({
|
|
115
|
+
const columns = getTableColumns({
|
|
116
|
+
actionsLength: 1,
|
|
117
|
+
nameColumnLabel: t("shared.labels.name"),
|
|
118
|
+
});
|
|
114
119
|
|
|
115
120
|
const renderEmpty = () => (
|
|
116
121
|
<EmptyState
|
|
117
|
-
title="
|
|
122
|
+
title={t("paymentMethods.empty.noResultsTitle")}
|
|
118
123
|
description={
|
|
119
124
|
searchTerm.length > 0
|
|
120
|
-
? "
|
|
121
|
-
: "
|
|
125
|
+
? t("paymentMethods.empty.tryDifferentTerms")
|
|
126
|
+
: t("paymentMethods.empty.noPaymentMethodsFound")
|
|
122
127
|
}
|
|
123
128
|
/>
|
|
124
129
|
);
|
|
@@ -136,12 +141,11 @@ export const PaymentMethodsLayout = ({
|
|
|
136
141
|
let tooltipMessage = "";
|
|
137
142
|
|
|
138
143
|
if (allPaymentMethodsSelected) {
|
|
139
|
-
tooltipMessage =
|
|
140
|
-
"All available payment methods have already been added to this organizational unit";
|
|
144
|
+
tooltipMessage = t("paymentMethods.tooltips.allMethodsAdded");
|
|
141
145
|
}
|
|
142
146
|
|
|
143
147
|
if (isSyncMode) {
|
|
144
|
-
tooltipMessage = "
|
|
148
|
+
tooltipMessage = t("paymentMethods.tooltips.cannotAddSharedList");
|
|
145
149
|
}
|
|
146
150
|
|
|
147
151
|
return (
|
|
@@ -187,7 +191,7 @@ export const PaymentMethodsLayout = ({
|
|
|
187
191
|
disabled={isRemoveDisabled}
|
|
188
192
|
disabledTooltipContent={
|
|
189
193
|
isSyncMode
|
|
190
|
-
? "
|
|
194
|
+
? t("paymentMethods.tooltips.cannotRemoveSharedList")
|
|
191
195
|
: undefined
|
|
192
196
|
}
|
|
193
197
|
/>
|
|
@@ -206,21 +210,23 @@ export const PaymentMethodsLayout = ({
|
|
|
206
210
|
orgUnitId={orgUnit?.id ?? ""}
|
|
207
211
|
contractName={contract?.name ?? ""}
|
|
208
212
|
contractId={contract?.id ?? ""}
|
|
209
|
-
pageName="
|
|
213
|
+
pageName={t("shared.labels.contract")}
|
|
210
214
|
>
|
|
211
215
|
<section data-fs-payment-methods-section>
|
|
212
|
-
<HeaderInside title="
|
|
216
|
+
<HeaderInside title={t("paymentMethods.titles.paymentMethods")}>
|
|
217
|
+
{renderActions()}
|
|
218
|
+
</HeaderInside>
|
|
213
219
|
|
|
214
220
|
{!isLoading && isContractEmpty ? (
|
|
215
221
|
<EmptyState
|
|
216
222
|
iconName="WarningCircle"
|
|
217
|
-
title="
|
|
223
|
+
title={t("paymentMethods.empty.noPaymentMethodsAvailableTitle")}
|
|
218
224
|
>
|
|
219
225
|
<p data-fs-bp-payment-empty-message>
|
|
220
|
-
|
|
226
|
+
{t("paymentMethods.empty.noPaymentMethodsConfigured")}
|
|
221
227
|
</p>
|
|
222
228
|
<p data-fs-bp-payment-empty-message>
|
|
223
|
-
|
|
229
|
+
{t("paymentMethods.empty.ordersCannotBePlaced")}
|
|
224
230
|
</p>
|
|
225
231
|
</EmptyState>
|
|
226
232
|
) : (
|
|
@@ -250,13 +256,13 @@ export const PaymentMethodsLayout = ({
|
|
|
250
256
|
onClick={decreasePage}
|
|
251
257
|
disabled={page <= 1 || isLoading}
|
|
252
258
|
>
|
|
253
|
-
|
|
259
|
+
{t("shared.pagination.previousPage")}
|
|
254
260
|
</Paginator.NextPageButton>
|
|
255
261
|
<Paginator.NextPageButton
|
|
256
262
|
onClick={increasePage}
|
|
257
263
|
disabled={isLastPage || isLoading}
|
|
258
264
|
>
|
|
259
|
-
|
|
265
|
+
{t("shared.pagination.nextPage")}
|
|
260
266
|
</Paginator.NextPageButton>
|
|
261
267
|
|
|
262
268
|
<Paginator.Counter
|
package/src/features/product-assortment/components/ProductAssortmentTable/ProductAssortmentTable.tsx
CHANGED
|
@@ -4,15 +4,11 @@ import { useUI } from "@faststore/ui";
|
|
|
4
4
|
|
|
5
5
|
import { Table } from "../../../shared/components";
|
|
6
6
|
import { getTableColumns } from "../../../shared/components/Table/utils/tableColumns";
|
|
7
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
7
8
|
import { useSetAssortment } from "../../hooks/useSetAssortment";
|
|
8
9
|
|
|
9
10
|
import type { ProductAssortmentWithAdditionalInformation } from "../../types";
|
|
10
11
|
|
|
11
|
-
const columns = [
|
|
12
|
-
{ key: "radio", label: "", size: "3rem" as const },
|
|
13
|
-
...getTableColumns({}),
|
|
14
|
-
];
|
|
15
|
-
|
|
16
12
|
export function ProductAssortmentTable({
|
|
17
13
|
productAssortment,
|
|
18
14
|
contractId,
|
|
@@ -24,9 +20,17 @@ export function ProductAssortmentTable({
|
|
|
24
20
|
orgUnitId: string;
|
|
25
21
|
isLoadingList?: boolean;
|
|
26
22
|
}) {
|
|
23
|
+
const { t } = useLocalization();
|
|
27
24
|
const { pushToast } = useUI();
|
|
28
25
|
const [selectedId, setSelectedId] = useState<string | null>(null);
|
|
29
26
|
|
|
27
|
+
const columns = [
|
|
28
|
+
{ key: "radio", label: "", size: "3rem" as const },
|
|
29
|
+
...getTableColumns({
|
|
30
|
+
nameColumnLabel: t("productAssortment.table.columnName"),
|
|
31
|
+
}),
|
|
32
|
+
];
|
|
33
|
+
|
|
30
34
|
useEffect(() => {
|
|
31
35
|
const enabledItem = productAssortment.find((item) => item.enabled);
|
|
32
36
|
if (enabledItem) {
|
|
@@ -51,12 +55,12 @@ export function ProductAssortmentTable({
|
|
|
51
55
|
if (result === null) {
|
|
52
56
|
setSelectedId(previousId);
|
|
53
57
|
pushToast({
|
|
54
|
-
message: "
|
|
58
|
+
message: t("productAssortment.toasts.saveFailed"),
|
|
55
59
|
status: "ERROR",
|
|
56
60
|
});
|
|
57
61
|
} else {
|
|
58
62
|
pushToast({
|
|
59
|
-
message: "
|
|
63
|
+
message: t("productAssortment.toasts.saveSuccess"),
|
|
60
64
|
status: "INFO",
|
|
61
65
|
});
|
|
62
66
|
}
|