@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
|
@@ -14,6 +14,7 @@ import { TabContent } from "../../../shared/components/Tab/TabContent";
|
|
|
14
14
|
import { TabOption } from "../../../shared/components/Tab/TabOption";
|
|
15
15
|
import { useBuyerPortal, useDrawerProps } from "../../../shared/hooks";
|
|
16
16
|
import { ContractTabsLayout, GlobalLayout } from "../../../shared/layouts";
|
|
17
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
17
18
|
import { addressLabelToPropMapping } from "../../../shared/utils";
|
|
18
19
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
19
20
|
import {
|
|
@@ -50,6 +51,7 @@ export const AddressDetailsLayout = ({
|
|
|
50
51
|
}: AddressDetailsLayoutProps) => {
|
|
51
52
|
const router = useRouter();
|
|
52
53
|
const { pushToast } = useUI();
|
|
54
|
+
const { t } = useLocalization();
|
|
53
55
|
|
|
54
56
|
// TODO: Implement the AddressDetailsLayout Fallback component
|
|
55
57
|
if (!addressDetails) {
|
|
@@ -106,7 +108,7 @@ export const AddressDetailsLayout = ({
|
|
|
106
108
|
{
|
|
107
109
|
onError: () => {
|
|
108
110
|
pushToast({
|
|
109
|
-
message: "
|
|
111
|
+
message: t("addresses.errors.locationNameFetch"),
|
|
110
112
|
status: "ERROR",
|
|
111
113
|
});
|
|
112
114
|
},
|
|
@@ -148,7 +150,7 @@ export const AddressDetailsLayout = ({
|
|
|
148
150
|
data-fs-address-details-button
|
|
149
151
|
onClick={openEditDrawer}
|
|
150
152
|
>
|
|
151
|
-
|
|
153
|
+
{t("shared.buttons.edit")}
|
|
152
154
|
</button>
|
|
153
155
|
),
|
|
154
156
|
["location-tab"]: (
|
|
@@ -157,7 +159,7 @@ export const AddressDetailsLayout = ({
|
|
|
157
159
|
data-fs-address-details-button
|
|
158
160
|
onClick={openLocationsDrawer}
|
|
159
161
|
>
|
|
160
|
-
|
|
162
|
+
{t("shared.buttons.add")}
|
|
161
163
|
</button>
|
|
162
164
|
),
|
|
163
165
|
["recipient-tab"]: (
|
|
@@ -166,7 +168,7 @@ export const AddressDetailsLayout = ({
|
|
|
166
168
|
data-fs-address-details-button
|
|
167
169
|
onClick={openRecipientsDrawer}
|
|
168
170
|
>
|
|
169
|
-
|
|
171
|
+
{t("shared.buttons.add")}
|
|
170
172
|
</button>
|
|
171
173
|
),
|
|
172
174
|
}[activeTabId]);
|
|
@@ -178,7 +180,7 @@ export const AddressDetailsLayout = ({
|
|
|
178
180
|
orgUnitId={orgUnit?.id ?? ""}
|
|
179
181
|
contractName={contract?.name ?? ""}
|
|
180
182
|
contractId={contract?.id ?? ""}
|
|
181
|
-
pageName="
|
|
183
|
+
pageName={t("shared.labels.contract")}
|
|
182
184
|
>
|
|
183
185
|
<section data-fs-address-details-section>
|
|
184
186
|
<HeaderInside
|
|
@@ -210,11 +212,16 @@ export const AddressDetailsLayout = ({
|
|
|
210
212
|
/>
|
|
211
213
|
) : (
|
|
212
214
|
<TabBar>
|
|
213
|
-
<TabOption id="address-tab">
|
|
215
|
+
<TabOption id="address-tab">
|
|
216
|
+
{t("addresses.tabs.details")}
|
|
217
|
+
</TabOption>
|
|
214
218
|
<TabOption id="location-tab">
|
|
215
|
-
{locationSettingsData?.name ??
|
|
219
|
+
{locationSettingsData?.name ??
|
|
220
|
+
t("addresses.labels.locations")}
|
|
221
|
+
</TabOption>
|
|
222
|
+
<TabOption id="recipient-tab">
|
|
223
|
+
{t("addresses.tabs.recipients")}
|
|
216
224
|
</TabOption>
|
|
217
|
-
<TabOption id="recipient-tab">Recipients</TabOption>
|
|
218
225
|
</TabBar>
|
|
219
226
|
)}
|
|
220
227
|
|
|
@@ -240,7 +247,7 @@ export const AddressDetailsLayout = ({
|
|
|
240
247
|
data-fs-address-details-info-line-first={index === 0}
|
|
241
248
|
>
|
|
242
249
|
<span data-fs-address-details-info-line-label>
|
|
243
|
-
{addressLabelToPropMapping[prop]}
|
|
250
|
+
{t(addressLabelToPropMapping[prop])}
|
|
244
251
|
</span>
|
|
245
252
|
<span data-fs-address-details-info-line-value>
|
|
246
253
|
{displayValue}
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
SCOPE_KEYS,
|
|
22
22
|
} from "../../../shared/hooks";
|
|
23
23
|
import { ContractTabsLayout, GlobalLayout } from "../../../shared/layouts";
|
|
24
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
24
25
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
25
26
|
import { AddressDropdownMenu, CreateAddressDrawer } from "../../components";
|
|
26
27
|
import { CreateAddressSettingsDrawer } from "../../components/CreateAddressSettingsDrawer/CreateAddressSettingsDrawer";
|
|
@@ -33,6 +34,7 @@ export const AddressLayout = () => {
|
|
|
33
34
|
const router = useRouter();
|
|
34
35
|
const { currentOrgUnit } = useBuyerPortal();
|
|
35
36
|
const { pushToast } = useUI();
|
|
37
|
+
const { t } = useLocalization();
|
|
36
38
|
|
|
37
39
|
const {
|
|
38
40
|
page,
|
|
@@ -53,7 +55,7 @@ export const AddressLayout = () => {
|
|
|
53
55
|
{
|
|
54
56
|
onError: () => {
|
|
55
57
|
pushToast({
|
|
56
|
-
message: "
|
|
58
|
+
message: t("addresses.errors.locationSettingsFetchLayout"),
|
|
57
59
|
status: "ERROR",
|
|
58
60
|
});
|
|
59
61
|
},
|
|
@@ -105,10 +107,11 @@ export const AddressLayout = () => {
|
|
|
105
107
|
const columns = getTableColumns({
|
|
106
108
|
nameColumnSize: "18.125rem",
|
|
107
109
|
actionsLength: 2,
|
|
110
|
+
nameColumnLabel: t("shared.labels.name"),
|
|
108
111
|
extraColumns: [
|
|
109
112
|
{
|
|
110
113
|
key: "type",
|
|
111
|
-
label: "
|
|
114
|
+
label: t("addresses.table.type"),
|
|
112
115
|
align: "left",
|
|
113
116
|
hideOnScreenSize: "phonemid",
|
|
114
117
|
size: "100%",
|
|
@@ -143,7 +146,7 @@ export const AddressLayout = () => {
|
|
|
143
146
|
pageName=""
|
|
144
147
|
>
|
|
145
148
|
<section data-fs-addresses-section>
|
|
146
|
-
<HeaderInside title="
|
|
149
|
+
<HeaderInside title={t("addresses.titles.addresses")}>
|
|
147
150
|
{isLocationSettingsLoading ? (
|
|
148
151
|
<>
|
|
149
152
|
<Skeleton
|
|
@@ -177,12 +180,12 @@ export const AddressLayout = () => {
|
|
|
177
180
|
<EmptyState
|
|
178
181
|
title={
|
|
179
182
|
committedSearch.length > 0
|
|
180
|
-
? "
|
|
181
|
-
: "
|
|
183
|
+
? t("addresses.empty.noResults")
|
|
184
|
+
: t("addresses.empty.noAddressesYet")
|
|
182
185
|
}
|
|
183
186
|
description={
|
|
184
187
|
committedSearch.length > 0
|
|
185
|
-
? "
|
|
188
|
+
? t("addresses.empty.tryDifferentTerms")
|
|
186
189
|
: undefined
|
|
187
190
|
}
|
|
188
191
|
iconName={
|
|
@@ -247,14 +250,14 @@ export const AddressLayout = () => {
|
|
|
247
250
|
onClick={previousPage}
|
|
248
251
|
disabled={page <= 1}
|
|
249
252
|
>
|
|
250
|
-
|
|
253
|
+
{t("shared.pagination.previousPage")}
|
|
251
254
|
</Paginator.NextPageButton>
|
|
252
255
|
<Paginator.NextPageButton
|
|
253
256
|
data-fs-bp-addresses-next-page
|
|
254
257
|
onClick={nextPage}
|
|
255
258
|
disabled={page >= totalPages}
|
|
256
259
|
>
|
|
257
|
-
|
|
260
|
+
{t("shared.pagination.nextPage")}
|
|
258
261
|
</Paginator.NextPageButton>
|
|
259
262
|
<Paginator.Interval {...intervalData} />
|
|
260
263
|
</div>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo, useRef } from "react";
|
|
2
2
|
|
|
3
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
3
4
|
import { isDevelopment } from "../../../shared/utils/environment";
|
|
4
5
|
|
|
5
6
|
const B2B_AGENT_URL = isDevelopment()
|
|
@@ -36,6 +37,7 @@ export const B2BAgentLayout = ({
|
|
|
36
37
|
customerId,
|
|
37
38
|
userId,
|
|
38
39
|
}: B2BAgentLayoutProps) => {
|
|
40
|
+
const { t } = useLocalization();
|
|
39
41
|
const iframeRef = useRef<HTMLIFrameElement>(null);
|
|
40
42
|
|
|
41
43
|
const agentOrigin = useMemo(() => new URL(B2B_AGENT_URL).origin, []);
|
|
@@ -107,7 +109,7 @@ export const B2BAgentLayout = ({
|
|
|
107
109
|
style={iframeStyle}
|
|
108
110
|
data-fs-bp-b2b-agent-iframe
|
|
109
111
|
src={B2B_AGENT_URL}
|
|
110
|
-
title="
|
|
112
|
+
title={t("b2bAgent.titles.b2bAgent")}
|
|
111
113
|
allow="clipboard-read; clipboard-write"
|
|
112
114
|
sandbox="allow-scripts allow-same-origin allow-forms allow-popups allow-modals"
|
|
113
115
|
/>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Toggle, Tooltip } from "@faststore/ui";
|
|
2
2
|
|
|
3
3
|
import { ErrorMessage, Icon, InputText } from "../../../shared/components";
|
|
4
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
4
5
|
import { transformToDecimalMoney } from "../../../shared/utils";
|
|
5
6
|
|
|
6
7
|
import type { BudgetInput } from "../../types";
|
|
@@ -22,6 +23,7 @@ export const BudgetAddForm = ({
|
|
|
22
23
|
handleBlur,
|
|
23
24
|
readonly = false,
|
|
24
25
|
}: BudgetAddFormProps) => {
|
|
26
|
+
const { t } = useLocalization();
|
|
25
27
|
const sizeProps = { width: 15, height: 15 };
|
|
26
28
|
const today = new Date().toISOString().split("T")[0];
|
|
27
29
|
|
|
@@ -38,12 +40,12 @@ export const BudgetAddForm = ({
|
|
|
38
40
|
return (
|
|
39
41
|
<div data-fs-bp-add-budget-drawer>
|
|
40
42
|
<div data-fs-bp-create-budget-drawer-section-label>
|
|
41
|
-
<span>
|
|
43
|
+
<span>{t("budgets.forms.settings")}</span>
|
|
42
44
|
</div>
|
|
43
45
|
|
|
44
46
|
<InputText
|
|
45
47
|
data-fs-bp-budget-name
|
|
46
|
-
label="
|
|
48
|
+
label={t("budgets.forms.name")}
|
|
47
49
|
value={budget.name}
|
|
48
50
|
wrapperProps={{ style: { marginTop: 16 } }}
|
|
49
51
|
onChange={(e) => handleChange("name", e.target.value)}
|
|
@@ -53,12 +55,12 @@ export const BudgetAddForm = ({
|
|
|
53
55
|
/>
|
|
54
56
|
<ErrorMessage
|
|
55
57
|
show={touched.name && !budget.name.trim()}
|
|
56
|
-
message="
|
|
58
|
+
message={t("budgets.validation.nameRequired")}
|
|
57
59
|
/>
|
|
58
60
|
|
|
59
61
|
<InputText
|
|
60
62
|
data-fs-bp-budget-amount
|
|
61
|
-
label="
|
|
63
|
+
label={t("budgets.forms.amount")}
|
|
62
64
|
value={
|
|
63
65
|
typeof budget.amount === "number"
|
|
64
66
|
? Number(budget.amount).toFixed(2)
|
|
@@ -68,13 +70,13 @@ export const BudgetAddForm = ({
|
|
|
68
70
|
onChange={handleAmountChange}
|
|
69
71
|
onBlur={() => handleBlur("amount")}
|
|
70
72
|
variant="withPrefix"
|
|
71
|
-
prefix="
|
|
73
|
+
prefix={t("budgets.currencies.usd")}
|
|
72
74
|
disabled={readonly}
|
|
73
75
|
hasError={touched.amount && !String(budget.amount).trim()}
|
|
74
76
|
/>
|
|
75
77
|
<ErrorMessage
|
|
76
78
|
show={touched.amount && !String(budget.amount).trim()}
|
|
77
|
-
message="
|
|
79
|
+
message={t("budgets.validation.amountRequired")}
|
|
78
80
|
/>
|
|
79
81
|
|
|
80
82
|
<div
|
|
@@ -83,7 +85,7 @@ export const BudgetAddForm = ({
|
|
|
83
85
|
>
|
|
84
86
|
<div>
|
|
85
87
|
<InputText
|
|
86
|
-
label="
|
|
88
|
+
label={t("budgets.forms.startDate")}
|
|
87
89
|
type="date"
|
|
88
90
|
data-fs-bp-budget-start-date
|
|
89
91
|
value={budget.startDate?.split("T")[0] ?? ""}
|
|
@@ -98,14 +100,14 @@ export const BudgetAddForm = ({
|
|
|
98
100
|
<div data-fs-bp-error-wrapper>
|
|
99
101
|
<ErrorMessage
|
|
100
102
|
show={touched.startDate && !budget.startDate}
|
|
101
|
-
message="
|
|
103
|
+
message={t("budgets.validation.startDateRequired")}
|
|
102
104
|
/>
|
|
103
105
|
</div>
|
|
104
106
|
</div>
|
|
105
107
|
|
|
106
108
|
<div>
|
|
107
109
|
<InputText
|
|
108
|
-
label="
|
|
110
|
+
label={t("budgets.forms.endDate")}
|
|
109
111
|
type="date"
|
|
110
112
|
data-fs-bp-budget-end-date
|
|
111
113
|
value={endDate ? endDate.split("T")[0] : ""}
|
|
@@ -120,7 +122,7 @@ export const BudgetAddForm = ({
|
|
|
120
122
|
<div data-fs-bp-error-wrapper>
|
|
121
123
|
<ErrorMessage
|
|
122
124
|
show={touched.endDate && !endDate}
|
|
123
|
-
message="
|
|
125
|
+
message={t("budgets.validation.endDateRequired")}
|
|
124
126
|
/>
|
|
125
127
|
</div>
|
|
126
128
|
</div>
|
|
@@ -131,12 +133,12 @@ export const BudgetAddForm = ({
|
|
|
131
133
|
data-fs-bp-create-budget-renew
|
|
132
134
|
>
|
|
133
135
|
<span data-fs-bp-create-budget-renew-label>
|
|
134
|
-
|
|
136
|
+
{t("budgets.forms.renewBudgetLabel")}
|
|
135
137
|
</span>
|
|
136
138
|
<div data-fs-bp-create-budget-drawer-row-section-action>
|
|
137
139
|
<Tooltip
|
|
138
140
|
placement="top-end"
|
|
139
|
-
content="
|
|
141
|
+
content={t("budgets.tooltips.renewBudget")}
|
|
140
142
|
>
|
|
141
143
|
<Icon name="Information" {...sizeProps} />
|
|
142
144
|
</Tooltip>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Checkbox, Link, Toggle, Tooltip } from "@faststore/ui";
|
|
2
2
|
|
|
3
3
|
import { Icon } from "../../../shared/components";
|
|
4
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
4
5
|
|
|
5
6
|
export type BudgetAddSuccessProps = {
|
|
6
7
|
enforcePolicy: boolean;
|
|
@@ -19,23 +20,25 @@ export const BudgetAddSuccess = ({
|
|
|
19
20
|
blockOnExpiration,
|
|
20
21
|
setBlockOnExpiration,
|
|
21
22
|
}: BudgetAddSuccessProps) => {
|
|
23
|
+
const { t } = useLocalization();
|
|
24
|
+
|
|
22
25
|
return (
|
|
23
26
|
<div data-fs-bp-budget-add-success>
|
|
24
27
|
<Icon name="CheckSuccess" width={60} height={60} />
|
|
25
28
|
<h1 data-fs-bp-budget-add-success-header>
|
|
26
|
-
|
|
29
|
+
{t("budgets.create.budgetCreated")}
|
|
27
30
|
</h1>
|
|
28
31
|
|
|
29
32
|
<div data-fs-bp-budget-add-success-description-wrapper>
|
|
30
33
|
<span data-fs-bp-budget-add-success-description>
|
|
31
|
-
|
|
32
|
-
budget-related buying policies exist yet, you have the option to
|
|
33
|
-
create a default policy now. This policy will apply to all budgets at
|
|
34
|
-
the same organization level where this budget was created.
|
|
34
|
+
{t("budgets.create.firstBudgetPolicyDescription")}
|
|
35
35
|
</span>
|
|
36
36
|
<span data-fs-bp-budget-add-success-description>
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
{t("budgets.create.buyingPoliciesLink", [
|
|
38
|
+
<Link key="buying-policies">
|
|
39
|
+
{t("budgets.create.buyingPolicies")}
|
|
40
|
+
</Link>,
|
|
41
|
+
])}
|
|
39
42
|
</span>
|
|
40
43
|
</div>
|
|
41
44
|
|
|
@@ -45,12 +48,12 @@ export const BudgetAddSuccess = ({
|
|
|
45
48
|
>
|
|
46
49
|
<div data-fs-bp-budget-add-success-section>
|
|
47
50
|
<span data-fs-bp-budget-add-success-label>
|
|
48
|
-
|
|
51
|
+
{t("budgets.create.enforcementPolicyLabel")}
|
|
49
52
|
</span>
|
|
50
53
|
<div data-fs-bp-budget-add-success-row-section-action>
|
|
51
54
|
<Tooltip
|
|
52
55
|
placement="top-end"
|
|
53
|
-
content="
|
|
56
|
+
content={t("budgets.tooltips.enforcementPolicy")}
|
|
54
57
|
>
|
|
55
58
|
<Icon name="Information" width={20} height={20} />
|
|
56
59
|
</Tooltip>
|
|
@@ -70,11 +73,11 @@ export const BudgetAddSuccess = ({
|
|
|
70
73
|
onChange={(e) => setBlockOnExceed(e.target.checked)}
|
|
71
74
|
/>
|
|
72
75
|
<div data-fs-bp-budget-add-success-section-checkbox-action-option>
|
|
73
|
-
<span>
|
|
76
|
+
<span>{t("budgets.create.preventCheckoutExceeded")}</span>
|
|
74
77
|
<span
|
|
75
78
|
data-fs-bp-budget-add-success-section-checkbox-action-suboption
|
|
76
79
|
>
|
|
77
|
-
|
|
80
|
+
{t("budgets.create.preventCheckoutExceededDescription")}
|
|
78
81
|
</span>
|
|
79
82
|
</div>
|
|
80
83
|
</div>
|
|
@@ -86,12 +89,11 @@ export const BudgetAddSuccess = ({
|
|
|
86
89
|
onChange={(e) => setBlockOnExpiration(e.target.checked)}
|
|
87
90
|
/>
|
|
88
91
|
<div data-fs-bp-budget-add-success-section-checkbox-action-option>
|
|
89
|
-
<span>
|
|
92
|
+
<span>{t("budgets.create.preventCheckoutExpired")}</span>
|
|
90
93
|
<span
|
|
91
94
|
data-fs-bp-budget-add-success-section-checkbox-action-suboption
|
|
92
95
|
>
|
|
93
|
-
|
|
94
|
-
expiration date
|
|
96
|
+
{t("budgets.create.preventCheckoutExpiredDescription")}
|
|
95
97
|
</span>
|
|
96
98
|
</div>
|
|
97
99
|
</div>
|
package/src/features/budgets/components/BudgetAllocationsSelection/BudgetAllocationsSelection.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import { Pagination } from "../../../shared/components/Pagination/Pagination";
|
|
|
15
15
|
import { type TableColumn } from "../../../shared/components/Table/TableHead/TableHead";
|
|
16
16
|
import { getTableColumns } from "../../../shared/components/Table/utils/tableColumns";
|
|
17
17
|
import { useBuyerPortal } from "../../../shared/hooks";
|
|
18
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
18
19
|
import { IPagination } from "../../../shared/types";
|
|
19
20
|
import { Dictionary } from "../../../shared/utils";
|
|
20
21
|
import { useClickOutside } from "../../hooks";
|
|
@@ -52,6 +53,7 @@ export const BudgetAllocationsSelection = ({
|
|
|
52
53
|
onSortChange,
|
|
53
54
|
setFilter,
|
|
54
55
|
}: BudgetAllocationsSelectionProps) => {
|
|
56
|
+
const { t } = useLocalization();
|
|
55
57
|
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
|
56
58
|
|
|
57
59
|
const { currentContract: contract } = useBuyerPortal();
|
|
@@ -151,10 +153,11 @@ export const BudgetAllocationsSelection = ({
|
|
|
151
153
|
},
|
|
152
154
|
...getTableColumns({
|
|
153
155
|
nameColumnSize: "14rem",
|
|
156
|
+
nameColumnLabel: t("shared.labels.name"),
|
|
154
157
|
extraColumns: [
|
|
155
158
|
{
|
|
156
159
|
key: "contract",
|
|
157
|
-
label: "
|
|
160
|
+
label: t("budgets.table.contract"),
|
|
158
161
|
align: "left",
|
|
159
162
|
size: "100%",
|
|
160
163
|
hideOnScreenSize: "phonemid",
|
|
@@ -174,7 +177,7 @@ export const BudgetAllocationsSelection = ({
|
|
|
174
177
|
data-fs-bp-budget-allocation-select-current
|
|
175
178
|
onClick={() => setIsDropdownOpen((prev) => !prev)}
|
|
176
179
|
>
|
|
177
|
-
{currentSort}
|
|
180
|
+
{t(currentSort)}
|
|
178
181
|
<Icon
|
|
179
182
|
name="CaretRight"
|
|
180
183
|
width={16}
|
|
@@ -198,7 +201,7 @@ export const BudgetAllocationsSelection = ({
|
|
|
198
201
|
}
|
|
199
202
|
>
|
|
200
203
|
<div data-fs-bp-budget-allocation-selected-wrapper>
|
|
201
|
-
<span>{option}</span>
|
|
204
|
+
<span>{t(option)}</span>
|
|
202
205
|
{currentSort === option && (
|
|
203
206
|
<Icon name="Check" width={16} height={16} />
|
|
204
207
|
)}
|
|
@@ -212,7 +215,7 @@ export const BudgetAllocationsSelection = ({
|
|
|
212
215
|
|
|
213
216
|
<Tooltip
|
|
214
217
|
placement="bottom-center"
|
|
215
|
-
content="
|
|
218
|
+
content={t("budgets.tooltips.allocationsInfo")}
|
|
216
219
|
>
|
|
217
220
|
<Icon name="InfoFilled" width={16} height={16} />
|
|
218
221
|
</Tooltip>
|
|
@@ -239,7 +242,7 @@ export const BudgetAllocationsSelection = ({
|
|
|
239
242
|
>
|
|
240
243
|
<Icon name="Close" {...svgProps} color="#ADADAD" />
|
|
241
244
|
</button>
|
|
242
|
-
{
|
|
245
|
+
{t("budgets.pagination.selectedCount", [selected.length])}
|
|
243
246
|
</div>
|
|
244
247
|
</Tag>
|
|
245
248
|
)}
|
|
@@ -9,6 +9,7 @@ import { EmptyState } from "../../../shared/components/EmptyState/EmptyState";
|
|
|
9
9
|
import { Pagination } from "../../../shared/components/Pagination/Pagination";
|
|
10
10
|
import { getTableColumns } from "../../../shared/components/Table/utils/tableColumns";
|
|
11
11
|
import { useDrawerProps, useQueryParams } from "../../../shared/hooks";
|
|
12
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
12
13
|
import { IPagination } from "../../../shared/types";
|
|
13
14
|
import { CreateBudgetAllocationDrawer } from "../CreateBudgetAllocationDrawer/CreateBudgetAllocationDrawer";
|
|
14
15
|
import { DeleteBudgetAllocationDrawer } from "../DeleteBudgetAllocationDrawer/DeleteBudgetAllocationDrawer";
|
|
@@ -36,6 +37,7 @@ export const BudgetAllocationsTable = ({
|
|
|
36
37
|
pagination,
|
|
37
38
|
onSearch,
|
|
38
39
|
}: BudgetAllocationsTableProps) => {
|
|
40
|
+
const { t } = useLocalization();
|
|
39
41
|
const { setQueryString, removeQueryString } = useQueryParams();
|
|
40
42
|
const searchParams = useSearchParams();
|
|
41
43
|
const searchTerm = searchParams.get("search");
|
|
@@ -61,16 +63,17 @@ export const BudgetAllocationsTable = ({
|
|
|
61
63
|
const columns = getTableColumns({
|
|
62
64
|
nameColumnSize: "14rem",
|
|
63
65
|
actionsLength: 1,
|
|
66
|
+
nameColumnLabel: t("shared.labels.name"),
|
|
64
67
|
extraColumns: [
|
|
65
68
|
{
|
|
66
|
-
label: "
|
|
69
|
+
label: t("budgets.table.type"),
|
|
67
70
|
key: "type",
|
|
68
71
|
size: "8.25rem",
|
|
69
72
|
align: "left",
|
|
70
73
|
hideOnScreenSize: "tablet",
|
|
71
74
|
},
|
|
72
75
|
{
|
|
73
|
-
label: "
|
|
76
|
+
label: t("budgets.table.contract"),
|
|
74
77
|
key: "contract",
|
|
75
78
|
size: "100%",
|
|
76
79
|
align: "left",
|
|
@@ -105,8 +108,8 @@ export const BudgetAllocationsTable = ({
|
|
|
105
108
|
|
|
106
109
|
const renderEmptyState = () => (
|
|
107
110
|
<EmptyState
|
|
108
|
-
title="
|
|
109
|
-
description="
|
|
111
|
+
title={t("budgets.empty.noAllocations")}
|
|
112
|
+
description={t("budgets.empty.noAllocationsDescription")}
|
|
110
113
|
/>
|
|
111
114
|
);
|
|
112
115
|
|
|
@@ -161,14 +164,14 @@ export const BudgetAllocationsTable = ({
|
|
|
161
164
|
<div data-fs-bp-budget-details-allocation-table>
|
|
162
165
|
<div data-fs-budget-details-allocation-table-edit-line>
|
|
163
166
|
<span data-fs-budget-details-allocation-table-edit-title>
|
|
164
|
-
|
|
167
|
+
{t("budgets.allocationsTable.title")}
|
|
165
168
|
</span>
|
|
166
169
|
<button
|
|
167
170
|
type="button"
|
|
168
171
|
data-fs-budget-details-allocation-table-edit-button
|
|
169
172
|
onClick={openAddAllocationDrawerProps}
|
|
170
173
|
>
|
|
171
|
-
|
|
174
|
+
{t("shared.buttons.add")}
|
|
172
175
|
</button>
|
|
173
176
|
</div>
|
|
174
177
|
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
InputText,
|
|
12
12
|
} from "../../../shared/components";
|
|
13
13
|
import { useAnalytics, useDebounce } from "../../../shared/hooks";
|
|
14
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
14
15
|
import { ANALYTICS_EVENTS } from "../../../shared/services/logger/analytics/constants";
|
|
15
|
-
import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
|
|
16
16
|
import { useDeleteBudget } from "../../hooks/useDeleteBudget";
|
|
17
17
|
|
|
18
18
|
export interface BudgetDeleteDrawerProps
|
|
@@ -33,6 +33,7 @@ export function BudgetDeleteDrawer({
|
|
|
33
33
|
redirect,
|
|
34
34
|
...props
|
|
35
35
|
}: BudgetDeleteDrawerProps) {
|
|
36
|
+
const { t } = useLocalization();
|
|
36
37
|
const { pushToast } = useUI();
|
|
37
38
|
const router = useRouter();
|
|
38
39
|
const { trackEvent } = useAnalytics({
|
|
@@ -49,13 +50,13 @@ export function BudgetDeleteDrawer({
|
|
|
49
50
|
|
|
50
51
|
const errorMessage = useMemo(() => {
|
|
51
52
|
if (isTouched && !inputValue) {
|
|
52
|
-
return "
|
|
53
|
+
return t("budgets.validation.budgetNameRequired");
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
return debouncedValue && debouncedValue !== budgetName
|
|
56
|
-
? "
|
|
57
|
+
? t("budgets.validation.budgetNameInvalid")
|
|
57
58
|
: null;
|
|
58
|
-
}, [debouncedValue, isTouched, inputValue, budgetName]);
|
|
59
|
+
}, [debouncedValue, isTouched, inputValue, budgetName, t]);
|
|
59
60
|
|
|
60
61
|
const { mutate: deleteBudget, isLoading: isLoadingDeleteBudget } =
|
|
61
62
|
useDeleteBudget({
|
|
@@ -76,7 +77,7 @@ export function BudgetDeleteDrawer({
|
|
|
76
77
|
|
|
77
78
|
pushToast({
|
|
78
79
|
status: "ERROR",
|
|
79
|
-
message: "
|
|
80
|
+
message: t("budgets.errors.budgetRemoveFailed"),
|
|
80
81
|
});
|
|
81
82
|
},
|
|
82
83
|
},
|
|
@@ -93,7 +94,9 @@ export function BudgetDeleteDrawer({
|
|
|
93
94
|
|
|
94
95
|
pushToast({
|
|
95
96
|
status: "INFO",
|
|
96
|
-
message:
|
|
97
|
+
message: `${t("budgets.toasts.budgetDeleted")}\n${t(
|
|
98
|
+
"shared.messages.changesTimeout"
|
|
99
|
+
)}`,
|
|
97
100
|
});
|
|
98
101
|
|
|
99
102
|
if (redirect) {
|
|
@@ -118,25 +121,28 @@ export function BudgetDeleteDrawer({
|
|
|
118
121
|
|
|
119
122
|
return (
|
|
120
123
|
<BasicDrawer data-fs-bp-budget-delete-drawer close={close} {...props}>
|
|
121
|
-
<BasicDrawer.Heading
|
|
124
|
+
<BasicDrawer.Heading
|
|
125
|
+
title={t("budgets.delete.budgetTitle")}
|
|
126
|
+
onClose={close}
|
|
127
|
+
/>
|
|
122
128
|
<BasicDrawer.Body>
|
|
123
129
|
<div>
|
|
124
130
|
<p>
|
|
125
|
-
|
|
126
|
-
|
|
131
|
+
{t("budgets.delete.permanentlyDeleteBudget", [
|
|
132
|
+
<span key="budget-name" data-fs-bp-budget-delete-drawer-name>
|
|
133
|
+
{budgetName}
|
|
134
|
+
</span>,
|
|
135
|
+
])}
|
|
127
136
|
</p>
|
|
128
137
|
<br />
|
|
129
|
-
<p>
|
|
130
|
-
Deleting this budget will permanently remove all its data, but usage
|
|
131
|
-
history will be kept for audit. This action can't be undone.
|
|
132
|
-
</p>
|
|
138
|
+
<p>{t("budgets.delete.budgetWarning")}</p>
|
|
133
139
|
<br />
|
|
134
|
-
<p>
|
|
140
|
+
<p>{t("budgets.delete.confirmBudgetName")}</p>
|
|
135
141
|
</div>
|
|
136
142
|
|
|
137
143
|
<br />
|
|
138
144
|
<InputText
|
|
139
|
-
label="
|
|
145
|
+
label={t("budgets.forms.budgetName")}
|
|
140
146
|
value={inputValue}
|
|
141
147
|
onBlur={() => setIsTouched(true)}
|
|
142
148
|
onChange={(e) => setInputValue(e.target.value)}
|
|
@@ -150,7 +156,7 @@ export function BudgetDeleteDrawer({
|
|
|
150
156
|
|
|
151
157
|
<BasicDrawer.Footer>
|
|
152
158
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
153
|
-
|
|
159
|
+
{t("shared.buttons.cancel")}
|
|
154
160
|
</BasicDrawer.Button>
|
|
155
161
|
<BasicDrawer.Button
|
|
156
162
|
variant="danger"
|
|
@@ -158,7 +164,7 @@ export function BudgetDeleteDrawer({
|
|
|
158
164
|
onClick={handleDelete}
|
|
159
165
|
disabled={debouncedValue !== budgetName}
|
|
160
166
|
>
|
|
161
|
-
|
|
167
|
+
{t("shared.buttons.remove")}
|
|
162
168
|
</BasicDrawer.Button>
|
|
163
169
|
</BasicDrawer.Footer>
|
|
164
170
|
</BasicDrawer>
|