@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
|
@@ -2,6 +2,7 @@ import { DropdownItem, useUI } 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 { useSetDefaultValue, useUnsetDefaultValue } from "../../hooks";
|
|
6
7
|
import { DeleteAccountingValueDrawer } from "../DeleteAccountingValueDrawer/DeleteAccountingValueDrawer";
|
|
7
8
|
import { EditAccountingValueDrawer } from "../EditAccountingValueDrawer/EditAccountingValueDrawer";
|
|
@@ -28,6 +29,7 @@ export const AccountingValueDropdown = ({
|
|
|
28
29
|
refreshList,
|
|
29
30
|
isSyncMode = false,
|
|
30
31
|
}: AccountingValueDropdownProps) => {
|
|
32
|
+
const { t } = useLocalization();
|
|
31
33
|
const { pushToast } = useUI();
|
|
32
34
|
const {
|
|
33
35
|
open: openEditAccountingValueDrawer,
|
|
@@ -51,7 +53,9 @@ export const AccountingValueDropdown = ({
|
|
|
51
53
|
onSuccess: () => {
|
|
52
54
|
pushToast({
|
|
53
55
|
status: "INFO",
|
|
54
|
-
message:
|
|
56
|
+
message: t("accountingFields.toasts.defaultValueSaved", [
|
|
57
|
+
accountingField.name,
|
|
58
|
+
]),
|
|
55
59
|
});
|
|
56
60
|
|
|
57
61
|
refreshList?.();
|
|
@@ -59,7 +63,9 @@ export const AccountingValueDropdown = ({
|
|
|
59
63
|
onError: () =>
|
|
60
64
|
pushToast({
|
|
61
65
|
status: "ERROR",
|
|
62
|
-
message:
|
|
66
|
+
message: t("accountingFields.toasts.defaultValueSaveFailed", [
|
|
67
|
+
accountingField.name,
|
|
68
|
+
]),
|
|
63
69
|
}),
|
|
64
70
|
});
|
|
65
71
|
|
|
@@ -67,7 +73,9 @@ export const AccountingValueDropdown = ({
|
|
|
67
73
|
onSuccess: () => {
|
|
68
74
|
pushToast({
|
|
69
75
|
status: "INFO",
|
|
70
|
-
message:
|
|
76
|
+
message: t("accountingFields.toasts.defaultValueUnset", [
|
|
77
|
+
accountingField.name,
|
|
78
|
+
]),
|
|
71
79
|
});
|
|
72
80
|
|
|
73
81
|
refreshList?.();
|
|
@@ -75,7 +83,9 @@ export const AccountingValueDropdown = ({
|
|
|
75
83
|
onError: () =>
|
|
76
84
|
pushToast({
|
|
77
85
|
status: "ERROR",
|
|
78
|
-
message:
|
|
86
|
+
message: t("accountingFields.toasts.defaultValueUnsetFailed", [
|
|
87
|
+
accountingField.name,
|
|
88
|
+
]),
|
|
79
89
|
}),
|
|
80
90
|
});
|
|
81
91
|
|
|
@@ -84,7 +94,7 @@ export const AccountingValueDropdown = ({
|
|
|
84
94
|
<BasicDropdownMenu>
|
|
85
95
|
<DropdownItem onClick={openEditAccountingValueDrawer}>
|
|
86
96
|
<Icon name="EditSettings" width={ICON_SIZE} height={ICON_SIZE} />
|
|
87
|
-
|
|
97
|
+
{t("accountingFields.dropdown.edit")}
|
|
88
98
|
</DropdownItem>
|
|
89
99
|
{accountingValue.isDefault ? (
|
|
90
100
|
<DropdownItem
|
|
@@ -96,7 +106,7 @@ export const AccountingValueDropdown = ({
|
|
|
96
106
|
}
|
|
97
107
|
>
|
|
98
108
|
<Icon name="BookmarkRemove" width={ICON_SIZE} height={ICON_SIZE} />
|
|
99
|
-
|
|
109
|
+
{t("accountingFields.dropdown.unsetAsDefault")}
|
|
100
110
|
</DropdownItem>
|
|
101
111
|
) : (
|
|
102
112
|
<DropdownItem
|
|
@@ -109,7 +119,7 @@ export const AccountingValueDropdown = ({
|
|
|
109
119
|
}
|
|
110
120
|
>
|
|
111
121
|
<Icon name="BookmarkAdd" width={ICON_SIZE} height={ICON_SIZE} />
|
|
112
|
-
|
|
122
|
+
{t("accountingFields.dropdown.setAsDefault")}
|
|
113
123
|
</DropdownItem>
|
|
114
124
|
)}
|
|
115
125
|
<BasicDropdownMenu.Separator />
|
|
@@ -118,14 +128,14 @@ export const AccountingValueDropdown = ({
|
|
|
118
128
|
data-fs-bp-dropdown-menu-item-disabled={isSyncMode}
|
|
119
129
|
>
|
|
120
130
|
<Icon name="MinusCircle" width={ICON_SIZE} height={ICON_SIZE} />
|
|
121
|
-
|
|
131
|
+
{t("accountingFields.dropdown.removeFromUnit")}
|
|
122
132
|
</DropdownItem>
|
|
123
133
|
<DropdownItem
|
|
124
134
|
data-fs-bp-dropdown-menu-item-mode="danger"
|
|
125
135
|
onClick={openDeleteAccountingValueDrawer}
|
|
126
136
|
>
|
|
127
137
|
<Icon name="Delete" width={ICON_SIZE} height={ICON_SIZE} />
|
|
128
|
-
|
|
138
|
+
{t("shared.buttons.delete")}
|
|
129
139
|
</DropdownItem>
|
|
130
140
|
</BasicDropdownMenu>
|
|
131
141
|
|
package/src/features/accounting-fields/components/AccountingValueForm/AccountingValueForm.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
InputText,
|
|
8
8
|
} from "../../../shared/components";
|
|
9
9
|
import { useDebounce } from "../../../shared/hooks";
|
|
10
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
10
11
|
import { SelectedAccountingValue } from "../SelectedAccountingValue/SelectedAccountingValue";
|
|
11
12
|
|
|
12
13
|
import type { AccountingValueFormData } from "../../types";
|
|
@@ -43,19 +44,25 @@ export function AccountingValueForm({
|
|
|
43
44
|
onSkip,
|
|
44
45
|
description,
|
|
45
46
|
loading = false,
|
|
46
|
-
title
|
|
47
|
-
skipLabel
|
|
48
|
-
confirmLabel
|
|
47
|
+
title,
|
|
48
|
+
skipLabel,
|
|
49
|
+
confirmLabel,
|
|
49
50
|
options = [],
|
|
50
51
|
onSearch,
|
|
51
52
|
onAddToScope,
|
|
52
53
|
}: AccountingValueFormProps) {
|
|
54
|
+
const { t } = useLocalization();
|
|
53
55
|
const [formData, setFormData] =
|
|
54
56
|
useState<AccountingValueFormData>(initialData);
|
|
55
57
|
const [isTouched, setIsTouched] = useState(false);
|
|
56
58
|
const formRef = useRef<HTMLFormElement>(null);
|
|
57
59
|
const [selectedValue, setSelectedValue] = useState<Option | null>(null);
|
|
58
60
|
|
|
61
|
+
const resolvedTitle =
|
|
62
|
+
title ?? t("accountingFields.drawers.addFirstValueTitle");
|
|
63
|
+
const resolvedSkipLabel = skipLabel ?? t("shared.buttons.skip");
|
|
64
|
+
const resolvedConfirmLabel = confirmLabel ?? t("shared.buttons.add");
|
|
65
|
+
|
|
59
66
|
const valueFieldIsValid = formData.value.trim().length > 0;
|
|
60
67
|
useDebounce(formData.value, 500, {
|
|
61
68
|
onDebounce: (value) => onSearch?.(value),
|
|
@@ -84,7 +91,11 @@ export function AccountingValueForm({
|
|
|
84
91
|
|
|
85
92
|
return (
|
|
86
93
|
<>
|
|
87
|
-
<BasicDrawer.Heading
|
|
94
|
+
<BasicDrawer.Heading
|
|
95
|
+
onClose={close}
|
|
96
|
+
onBack={stepBack}
|
|
97
|
+
title={resolvedTitle}
|
|
98
|
+
/>
|
|
88
99
|
<BasicDrawer.Body>
|
|
89
100
|
<form
|
|
90
101
|
data-fs-bp-accounting-value-form
|
|
@@ -99,7 +110,7 @@ export function AccountingValueForm({
|
|
|
99
110
|
<div data-fs-bp-accounting-value-form-item>
|
|
100
111
|
<AutocompleteDropdown
|
|
101
112
|
name="value"
|
|
102
|
-
label="
|
|
113
|
+
label={t("shared.labels.name")}
|
|
103
114
|
value={formData.value}
|
|
104
115
|
hasError={isTouched && !valueFieldIsValid}
|
|
105
116
|
shouldOpenOnFocus={false}
|
|
@@ -107,7 +118,7 @@ export function AccountingValueForm({
|
|
|
107
118
|
shouldShowArrowDown={false}
|
|
108
119
|
helperLabel={
|
|
109
120
|
options.length > 0
|
|
110
|
-
?
|
|
121
|
+
? t("accountingFields.messages.alreadyInList")
|
|
111
122
|
: undefined
|
|
112
123
|
}
|
|
113
124
|
onChange={(e) =>
|
|
@@ -132,7 +143,7 @@ export function AccountingValueForm({
|
|
|
132
143
|
<div data-fs-bp-accounting-form-legend>
|
|
133
144
|
<ErrorMessage
|
|
134
145
|
show={isTouched && !valueFieldIsValid}
|
|
135
|
-
message="
|
|
146
|
+
message={t("accountingFields.validation.nameRequired")}
|
|
136
147
|
/>
|
|
137
148
|
<InputText.Legend>
|
|
138
149
|
{formData.value.length}/{NAME_MAX_LENGTH}
|
|
@@ -142,7 +153,7 @@ export function AccountingValueForm({
|
|
|
142
153
|
<div data-fs-bp-accounting-value-form-item>
|
|
143
154
|
<InputText.Textarea
|
|
144
155
|
name="description"
|
|
145
|
-
label="
|
|
156
|
+
label={t("accountingFields.forms.descriptionOptional")}
|
|
146
157
|
value={formData.description}
|
|
147
158
|
onChange={(e) =>
|
|
148
159
|
setFormData((data) => ({
|
|
@@ -178,7 +189,7 @@ export function AccountingValueForm({
|
|
|
178
189
|
onClick={() => onSkip?.()}
|
|
179
190
|
disabled={loading}
|
|
180
191
|
>
|
|
181
|
-
{
|
|
192
|
+
{resolvedSkipLabel}
|
|
182
193
|
</BasicDrawer.Button>
|
|
183
194
|
<BasicDrawer.Button
|
|
184
195
|
variant="confirm"
|
|
@@ -189,7 +200,7 @@ export function AccountingValueForm({
|
|
|
189
200
|
}
|
|
190
201
|
isLoading={loading}
|
|
191
202
|
>
|
|
192
|
-
{
|
|
203
|
+
{resolvedConfirmLabel}
|
|
193
204
|
</BasicDrawer.Button>
|
|
194
205
|
</BasicDrawer.Footer>
|
|
195
206
|
</>
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
Tab,
|
|
10
10
|
type BasicDrawerProps,
|
|
11
11
|
} from "../../../shared/components";
|
|
12
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
12
13
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
13
|
-
import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
|
|
14
14
|
import {
|
|
15
15
|
useCreateAccountingField,
|
|
16
16
|
useCreateAccountingValue,
|
|
@@ -55,6 +55,7 @@ export const CreateAccountingFieldDrawer = ({
|
|
|
55
55
|
contractId,
|
|
56
56
|
...otherProps
|
|
57
57
|
}: CreateAccountingFieldDrawerProps) => {
|
|
58
|
+
const { t } = useLocalization();
|
|
58
59
|
const createdField = useRef<AccountingField | null>(null);
|
|
59
60
|
const skipCreateValueRef = useRef(false);
|
|
60
61
|
const [fieldFormData, setFieldFormData] =
|
|
@@ -84,7 +85,7 @@ export const CreateAccountingFieldDrawer = ({
|
|
|
84
85
|
onError: () => {
|
|
85
86
|
pushToast({
|
|
86
87
|
status: "ERROR",
|
|
87
|
-
message: "
|
|
88
|
+
message: t("accountingFields.toasts.createFieldFailed"),
|
|
88
89
|
});
|
|
89
90
|
},
|
|
90
91
|
});
|
|
@@ -101,7 +102,7 @@ export const CreateAccountingFieldDrawer = ({
|
|
|
101
102
|
onError: () => {
|
|
102
103
|
pushToast({
|
|
103
104
|
status: "ERROR",
|
|
104
|
-
message: "
|
|
105
|
+
message: t("accountingFields.toasts.createValueFailed"),
|
|
105
106
|
});
|
|
106
107
|
},
|
|
107
108
|
});
|
|
@@ -110,7 +111,9 @@ export const CreateAccountingFieldDrawer = ({
|
|
|
110
111
|
const accountingField = field ?? createdField.current;
|
|
111
112
|
|
|
112
113
|
pushToast({
|
|
113
|
-
message:
|
|
114
|
+
message: `${t("accountingFields.toasts.fieldAdded")}\n${t(
|
|
115
|
+
"shared.messages.changesTimeout"
|
|
116
|
+
)}`,
|
|
114
117
|
status: "INFO",
|
|
115
118
|
icon: accountingField && (
|
|
116
119
|
<button
|
|
@@ -126,7 +129,7 @@ export const CreateAccountingFieldDrawer = ({
|
|
|
126
129
|
)
|
|
127
130
|
}
|
|
128
131
|
>
|
|
129
|
-
|
|
132
|
+
{t("shared.buttons.view")}
|
|
130
133
|
</button>
|
|
131
134
|
),
|
|
132
135
|
});
|
|
@@ -214,9 +217,9 @@ export const CreateAccountingFieldDrawer = ({
|
|
|
214
217
|
loading={
|
|
215
218
|
createAccountingValueLoading || createAccountingFieldLoading
|
|
216
219
|
}
|
|
217
|
-
description=
|
|
218
|
-
|
|
219
|
-
|
|
220
|
+
description={t(
|
|
221
|
+
"accountingFields.messages.requiredValueDescription"
|
|
222
|
+
)}
|
|
220
223
|
/>
|
|
221
224
|
</Tab.Content>
|
|
222
225
|
</Tab>
|
|
@@ -4,8 +4,8 @@ import { useUI } from "@faststore/ui";
|
|
|
4
4
|
|
|
5
5
|
import { BasicDrawer, BasicDrawerProps } from "../../../shared/components";
|
|
6
6
|
import { useAnalytics, useBuyerPortal } from "../../../shared/hooks";
|
|
7
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
7
8
|
import { ANALYTICS_EVENTS } from "../../../shared/services/logger/analytics/constants";
|
|
8
|
-
import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
|
|
9
9
|
import {
|
|
10
10
|
useAddAccountingValueToScope,
|
|
11
11
|
useCreateAccountingValue,
|
|
@@ -29,6 +29,7 @@ export const CreateAccountingValueDrawer = ({
|
|
|
29
29
|
orgUnitId,
|
|
30
30
|
...otherProps
|
|
31
31
|
}: CreateAccountingValueDrawerProps) => {
|
|
32
|
+
const { t } = useLocalization();
|
|
32
33
|
const { pushToast } = useUI();
|
|
33
34
|
const { currentContract: contract } = useBuyerPortal();
|
|
34
35
|
const { trackEntityCreated, trackEntityCreateError } = useAnalytics({
|
|
@@ -62,7 +63,9 @@ export const CreateAccountingValueDrawer = ({
|
|
|
62
63
|
|
|
63
64
|
pushToast({
|
|
64
65
|
status: "INFO",
|
|
65
|
-
message: `${
|
|
66
|
+
message: `${t("accountingFields.toasts.valueAdded", [
|
|
67
|
+
accountingField.name,
|
|
68
|
+
])}\n${t("shared.messages.changesTimeout")}`,
|
|
66
69
|
});
|
|
67
70
|
|
|
68
71
|
onCreateSuccess?.();
|
|
@@ -81,7 +84,9 @@ export const CreateAccountingValueDrawer = ({
|
|
|
81
84
|
|
|
82
85
|
pushToast({
|
|
83
86
|
status: "ERROR",
|
|
84
|
-
message:
|
|
87
|
+
message: t("accountingFields.toasts.addValueFailed", [
|
|
88
|
+
accountingField.name,
|
|
89
|
+
]),
|
|
85
90
|
});
|
|
86
91
|
},
|
|
87
92
|
});
|
|
@@ -106,7 +111,9 @@ export const CreateAccountingValueDrawer = ({
|
|
|
106
111
|
|
|
107
112
|
pushToast({
|
|
108
113
|
status: "INFO",
|
|
109
|
-
message: `${
|
|
114
|
+
message: `${t("accountingFields.toasts.valueAdded", [
|
|
115
|
+
accountingField.name,
|
|
116
|
+
])}\n${t("shared.messages.changesTimeout")}`,
|
|
110
117
|
});
|
|
111
118
|
|
|
112
119
|
onCreateSuccess?.();
|
|
@@ -125,7 +132,9 @@ export const CreateAccountingValueDrawer = ({
|
|
|
125
132
|
|
|
126
133
|
pushToast({
|
|
127
134
|
status: "ERROR",
|
|
128
|
-
message:
|
|
135
|
+
message: t("accountingFields.toasts.addValueFailed", [
|
|
136
|
+
accountingField.name,
|
|
137
|
+
]),
|
|
129
138
|
});
|
|
130
139
|
},
|
|
131
140
|
});
|
|
@@ -173,8 +182,10 @@ export const CreateAccountingValueDrawer = ({
|
|
|
173
182
|
>
|
|
174
183
|
<AccountingValueForm
|
|
175
184
|
initialData={initialAccountingValueData}
|
|
176
|
-
title={
|
|
177
|
-
|
|
185
|
+
title={t("accountingFields.drawers.addValueTitle", [
|
|
186
|
+
accountingField.name,
|
|
187
|
+
])}
|
|
188
|
+
skipLabel={t("shared.buttons.cancel")}
|
|
178
189
|
close={close}
|
|
179
190
|
onCreateValue={handleCreateValue}
|
|
180
191
|
onAddToScope={handleAddToScope}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useUI } from "@faststore/ui";
|
|
2
2
|
|
|
3
3
|
import { BasicDrawer, type BasicDrawerProps } from "../../../shared/components";
|
|
4
|
-
import {
|
|
4
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
5
5
|
import { useRemoveAccountingField } from "../../hooks";
|
|
6
6
|
import { type AccountingField } from "../../types";
|
|
7
7
|
import { AccountingConfirmDelete } from "../AccountingConfirmDelete/AccountingConfirmDelete";
|
|
@@ -19,6 +19,7 @@ export const DeleteAccountingFieldDrawer = ({
|
|
|
19
19
|
close,
|
|
20
20
|
...otherProps
|
|
21
21
|
}: DeleteAccountingFieldDrawerProps) => {
|
|
22
|
+
const { t } = useLocalization();
|
|
22
23
|
const { pushToast } = useUI();
|
|
23
24
|
const { removeAccountingFieldLoading, removeAccountingFieldMutate } =
|
|
24
25
|
useRemoveAccountingField({
|
|
@@ -26,14 +27,18 @@ export const DeleteAccountingFieldDrawer = ({
|
|
|
26
27
|
onSuccess: () => {
|
|
27
28
|
onDeleteSuccess?.();
|
|
28
29
|
pushToast({
|
|
29
|
-
message: `${
|
|
30
|
+
message: `${t("accountingFields.toasts.fieldDeleted", [
|
|
31
|
+
accountingField.name,
|
|
32
|
+
])}\n${t("shared.messages.changesTimeout")}`,
|
|
30
33
|
status: "INFO",
|
|
31
34
|
});
|
|
32
35
|
close();
|
|
33
36
|
},
|
|
34
37
|
onError: () => {
|
|
35
38
|
pushToast({
|
|
36
|
-
message:
|
|
39
|
+
message: t("accountingFields.toasts.fieldDeleteFailed", [
|
|
40
|
+
accountingField.name,
|
|
41
|
+
]),
|
|
37
42
|
status: "ERROR",
|
|
38
43
|
});
|
|
39
44
|
},
|
|
@@ -52,22 +57,19 @@ export const DeleteAccountingFieldDrawer = ({
|
|
|
52
57
|
{...otherProps}
|
|
53
58
|
>
|
|
54
59
|
<AccountingConfirmDelete
|
|
55
|
-
title="
|
|
60
|
+
title={t("accountingFields.drawers.deleteFieldTitle")}
|
|
56
61
|
close={close}
|
|
57
62
|
confirmTerm={accountingField.name}
|
|
58
63
|
loading={removeAccountingFieldLoading}
|
|
59
64
|
onConfirm={handleDeleteConfirm}
|
|
60
65
|
>
|
|
61
66
|
<p>
|
|
62
|
-
|
|
67
|
+
{t("accountingFields.delete.confirmPermanentDelete", [
|
|
68
|
+
accountingField.name,
|
|
69
|
+
])}
|
|
63
70
|
</p>
|
|
64
|
-
<p>
|
|
65
|
-
|
|
66
|
-
Deleting it will permanently remove the field, all its values, and all
|
|
67
|
-
related data from every unit, though usage history will be retained
|
|
68
|
-
for audit purposes. This action can't be undone.
|
|
69
|
-
</p>
|
|
70
|
-
<p>Confirm by typing the field label below:</p>
|
|
71
|
+
<p>{t("accountingFields.delete.fieldDeleteWarning")}</p>
|
|
72
|
+
<p>{t("accountingFields.delete.confirmByTypingFieldLabel")}</p>
|
|
71
73
|
</AccountingConfirmDelete>
|
|
72
74
|
</BasicDrawer>
|
|
73
75
|
);
|
|
@@ -2,8 +2,8 @@ import { useUI } from "@faststore/ui";
|
|
|
2
2
|
|
|
3
3
|
import { BasicDrawer, type BasicDrawerProps } from "../../../shared/components";
|
|
4
4
|
import { useAnalytics, useBuyerPortal } from "../../../shared/hooks";
|
|
5
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
5
6
|
import { ANALYTICS_EVENTS } from "../../../shared/services/logger/analytics/constants";
|
|
6
|
-
import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
|
|
7
7
|
import { useRemoveAccountingValue } from "../../hooks";
|
|
8
8
|
import { AccountingConfirmDelete } from "../AccountingConfirmDelete/AccountingConfirmDelete";
|
|
9
9
|
|
|
@@ -24,6 +24,7 @@ export const DeleteAccountingValueDrawer = ({
|
|
|
24
24
|
orgUnitId,
|
|
25
25
|
...otherProps
|
|
26
26
|
}: DeleteAccountingValueDrawerProps) => {
|
|
27
|
+
const { t } = useLocalization();
|
|
27
28
|
const { pushToast } = useUI();
|
|
28
29
|
const { currentContract: contract } = useBuyerPortal();
|
|
29
30
|
const { trackEvent } = useAnalytics({
|
|
@@ -47,7 +48,9 @@ export const DeleteAccountingValueDrawer = ({
|
|
|
47
48
|
});
|
|
48
49
|
|
|
49
50
|
pushToast({
|
|
50
|
-
message: `${
|
|
51
|
+
message: `${t("accountingFields.toasts.valueDeleted", [
|
|
52
|
+
accountingField.name,
|
|
53
|
+
])}\n${t("shared.messages.changesTimeout")}`,
|
|
51
54
|
status: "INFO",
|
|
52
55
|
});
|
|
53
56
|
|
|
@@ -68,7 +71,9 @@ export const DeleteAccountingValueDrawer = ({
|
|
|
68
71
|
});
|
|
69
72
|
|
|
70
73
|
pushToast({
|
|
71
|
-
message:
|
|
74
|
+
message: t("accountingFields.toasts.valueDeleteFailed", [
|
|
75
|
+
accountingField.name,
|
|
76
|
+
]),
|
|
72
77
|
status: "ERROR",
|
|
73
78
|
});
|
|
74
79
|
},
|
|
@@ -89,21 +94,26 @@ export const DeleteAccountingValueDrawer = ({
|
|
|
89
94
|
>
|
|
90
95
|
<AccountingConfirmDelete
|
|
91
96
|
confirmTerm={accountingValue.value}
|
|
92
|
-
|
|
97
|
+
confirmLabel={t("shared.labels.name")}
|
|
98
|
+
confirmRequiredMessage={t("accountingFields.validation.nameRequired")}
|
|
99
|
+
title={t("accountingFields.drawers.deleteValueTitle", [
|
|
100
|
+
accountingField.name,
|
|
101
|
+
])}
|
|
93
102
|
close={close}
|
|
94
103
|
loading={removeAccountingValueLoading}
|
|
95
104
|
onConfirm={handleDeleteConfirm}
|
|
96
105
|
>
|
|
97
106
|
<p>
|
|
98
|
-
|
|
107
|
+
{t("accountingFields.delete.confirmPermanentDeleteValue", [
|
|
108
|
+
accountingValue.value,
|
|
109
|
+
])}
|
|
99
110
|
</p>
|
|
100
111
|
<p>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
undone.
|
|
112
|
+
{t("accountingFields.delete.valueDeleteWarning", [
|
|
113
|
+
accountingField.name,
|
|
114
|
+
])}
|
|
105
115
|
</p>
|
|
106
|
-
<p>
|
|
116
|
+
<p>{t("accountingFields.delete.confirmByTypingName")}</p>
|
|
107
117
|
</AccountingConfirmDelete>
|
|
108
118
|
</BasicDrawer>
|
|
109
119
|
);
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
type BasicDrawerProps,
|
|
9
9
|
} from "../../../shared/components";
|
|
10
10
|
import { useSetScopeConfig } from "../../../shared/hooks";
|
|
11
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
11
12
|
import { useUpdateAccountingField } from "../../hooks";
|
|
12
13
|
import { AccountingFieldConfirmEdit } from "../AccountingFieldConfirmEdit/AccountingFieldConfirmEdit";
|
|
13
14
|
import { AccountingFieldForm } from "../AccountingFieldForm/AccountingFieldForm";
|
|
@@ -39,6 +40,7 @@ export const EditAccountingFieldDrawer = ({
|
|
|
39
40
|
contractId,
|
|
40
41
|
...otherProps
|
|
41
42
|
}: EditAccountingFieldDrawerProps) => {
|
|
43
|
+
const { t } = useLocalization();
|
|
42
44
|
const { pushToast } = useUI();
|
|
43
45
|
const [listType, setListType] = useState<ListType>("custom");
|
|
44
46
|
const [accountingField, setAccountingField] =
|
|
@@ -62,7 +64,7 @@ export const EditAccountingFieldDrawer = ({
|
|
|
62
64
|
onSuccess: () => {
|
|
63
65
|
onEditSuccess?.();
|
|
64
66
|
pushToast({
|
|
65
|
-
message: "
|
|
67
|
+
message: t("accountingFields.toasts.fieldSettingsEdited"),
|
|
66
68
|
status: "INFO",
|
|
67
69
|
});
|
|
68
70
|
close();
|
|
@@ -70,7 +72,7 @@ export const EditAccountingFieldDrawer = ({
|
|
|
70
72
|
},
|
|
71
73
|
onError: () => {
|
|
72
74
|
pushToast({
|
|
73
|
-
message: "
|
|
75
|
+
message: t("accountingFields.toasts.fieldSettingsEditFailed"),
|
|
74
76
|
status: "ERROR",
|
|
75
77
|
});
|
|
76
78
|
},
|
|
@@ -80,7 +82,7 @@ export const EditAccountingFieldDrawer = ({
|
|
|
80
82
|
onError: () =>
|
|
81
83
|
pushToast({
|
|
82
84
|
status: "ERROR",
|
|
83
|
-
message: "
|
|
85
|
+
message: t("accountingFields.toasts.scopeConfigUpdateFailed"),
|
|
84
86
|
}),
|
|
85
87
|
});
|
|
86
88
|
|
|
@@ -4,8 +4,8 @@ import { useUI } from "@faststore/ui";
|
|
|
4
4
|
|
|
5
5
|
import { BasicDrawer, BasicDrawerProps, Tab } from "../../../shared/components";
|
|
6
6
|
import { useAnalytics, useBuyerPortal } from "../../../shared/hooks";
|
|
7
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
7
8
|
import { ANALYTICS_EVENTS } from "../../../shared/services/logger/analytics/constants";
|
|
8
|
-
import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
|
|
9
9
|
import { useUpdateAccountingValue } from "../../hooks";
|
|
10
10
|
import { AccountingValueConfirmEdit } from "../AccountingValueConfirmEdit/AccountingValueConfirmEdit";
|
|
11
11
|
import { AccountingValueForm } from "../AccountingValueForm/AccountingValueForm";
|
|
@@ -36,6 +36,7 @@ export const EditAccountingValueDrawer = ({
|
|
|
36
36
|
onEditSuccess,
|
|
37
37
|
...otherProps
|
|
38
38
|
}: EditAccountingValueDrawerProps) => {
|
|
39
|
+
const { t } = useLocalization();
|
|
39
40
|
const { pushToast } = useUI();
|
|
40
41
|
const { currentContract: contract } = useBuyerPortal();
|
|
41
42
|
const { trackEntityEdited, trackEntityEditError } = useAnalytics({
|
|
@@ -69,7 +70,9 @@ export const EditAccountingValueDrawer = ({
|
|
|
69
70
|
|
|
70
71
|
pushToast({
|
|
71
72
|
status: "INFO",
|
|
72
|
-
message: `${
|
|
73
|
+
message: `${t("accountingFields.toasts.valueEdited", [
|
|
74
|
+
accountingField.name,
|
|
75
|
+
])}\n${t("shared.messages.changesTimeout")}`,
|
|
73
76
|
});
|
|
74
77
|
onEditSuccess?.();
|
|
75
78
|
close();
|
|
@@ -89,7 +92,9 @@ export const EditAccountingValueDrawer = ({
|
|
|
89
92
|
|
|
90
93
|
pushToast({
|
|
91
94
|
status: "ERROR",
|
|
92
|
-
message:
|
|
95
|
+
message: t("accountingFields.toasts.valueEditFailed", [
|
|
96
|
+
accountingField.name,
|
|
97
|
+
]),
|
|
93
98
|
});
|
|
94
99
|
},
|
|
95
100
|
});
|
|
@@ -123,9 +128,11 @@ export const EditAccountingValueDrawer = ({
|
|
|
123
128
|
<Tab.Content id={ACCOUNTING_VALUE_FORM_STEPS.FORM}>
|
|
124
129
|
<AccountingValueForm
|
|
125
130
|
initialData={accountingValue}
|
|
126
|
-
title={
|
|
127
|
-
|
|
128
|
-
|
|
131
|
+
title={t("accountingFields.drawers.editValueTitle", [
|
|
132
|
+
accountingField.name,
|
|
133
|
+
])}
|
|
134
|
+
skipLabel={t("shared.buttons.cancel")}
|
|
135
|
+
confirmLabel={t("shared.buttons.save")}
|
|
129
136
|
close={close}
|
|
130
137
|
onCreateValue={handleNextStep}
|
|
131
138
|
onSkip={close}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useUI } from "@faststore/ui";
|
|
2
2
|
|
|
3
3
|
import { BasicDrawer, type BasicDrawerProps } from "../../../shared/components";
|
|
4
|
-
import {
|
|
4
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
5
5
|
import { useRemoveAccountingValueFromScope } from "../../hooks";
|
|
6
6
|
import { AccountingConfirmDelete } from "../AccountingConfirmDelete/AccountingConfirmDelete";
|
|
7
7
|
|
|
@@ -24,6 +24,7 @@ export const RemoveValueFromUnitDrawer = ({
|
|
|
24
24
|
orgUnitId,
|
|
25
25
|
...otherProps
|
|
26
26
|
}: RemoveValueFromUnitDrawerProps) => {
|
|
27
|
+
const { t } = useLocalization();
|
|
27
28
|
const { pushToast } = useUI();
|
|
28
29
|
|
|
29
30
|
const {
|
|
@@ -33,7 +34,9 @@ export const RemoveValueFromUnitDrawer = ({
|
|
|
33
34
|
lazy: true,
|
|
34
35
|
onSuccess: () => {
|
|
35
36
|
pushToast({
|
|
36
|
-
message: `${
|
|
37
|
+
message: `${t("accountingFields.toasts.valueDeleted", [
|
|
38
|
+
accountingField.name,
|
|
39
|
+
])}\n${t("shared.messages.changesTimeout")}`,
|
|
37
40
|
status: "INFO",
|
|
38
41
|
});
|
|
39
42
|
|
|
@@ -42,7 +45,9 @@ export const RemoveValueFromUnitDrawer = ({
|
|
|
42
45
|
},
|
|
43
46
|
onError: () => {
|
|
44
47
|
pushToast({
|
|
45
|
-
message:
|
|
48
|
+
message: t("accountingFields.toasts.valueDeleteFailed", [
|
|
49
|
+
accountingField.name,
|
|
50
|
+
]),
|
|
46
51
|
status: "ERROR",
|
|
47
52
|
});
|
|
48
53
|
},
|
|
@@ -62,18 +67,24 @@ export const RemoveValueFromUnitDrawer = ({
|
|
|
62
67
|
data-fs-bp-remove-value-from-unit-drawer
|
|
63
68
|
>
|
|
64
69
|
<AccountingConfirmDelete
|
|
65
|
-
title={
|
|
70
|
+
title={t("accountingFields.drawers.removeFromUnitTitle", [
|
|
71
|
+
accountingField.name,
|
|
72
|
+
])}
|
|
66
73
|
close={close}
|
|
67
74
|
loading={removeAccountingValueFromScopeLoading}
|
|
68
75
|
onConfirm={handleDeleteConfirm}
|
|
69
76
|
>
|
|
70
77
|
<p>
|
|
71
|
-
|
|
72
|
-
|
|
78
|
+
{t("accountingFields.delete.removeFromUnitConfirm", [
|
|
79
|
+
accountingValue.value,
|
|
80
|
+
accountingField.name,
|
|
81
|
+
orgUnitName,
|
|
82
|
+
])}
|
|
73
83
|
</p>
|
|
74
84
|
<p>
|
|
75
|
-
|
|
76
|
-
|
|
85
|
+
{t("accountingFields.delete.removeFromUnitWarning", [
|
|
86
|
+
accountingField.name,
|
|
87
|
+
])}
|
|
77
88
|
</p>
|
|
78
89
|
</AccountingConfirmDelete>
|
|
79
90
|
</BasicDrawer>
|