@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
|
@@ -6,8 +6,8 @@ import { useUI } from "@faststore/ui";
|
|
|
6
6
|
|
|
7
7
|
import { BasicDrawer, type BasicDrawerProps } from "../../../shared/components";
|
|
8
8
|
import { useBuyerPortal } from "../../../shared/hooks";
|
|
9
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
9
10
|
import { parseAmount } from "../../../shared/utils/budgetAmountParse";
|
|
10
|
-
import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
|
|
11
11
|
import { useUpdateBudget } from "../../hooks";
|
|
12
12
|
import { BUDGET_NOTIFICATION_BLOCK_MESSAGES } from "../../messages/budgetNotifications";
|
|
13
13
|
import { handleBudgetError } from "../../utils";
|
|
@@ -37,6 +37,7 @@ export function BudgetEditNotificationDrawer({
|
|
|
37
37
|
contractId,
|
|
38
38
|
...props
|
|
39
39
|
}: BudgetEditNotificationDrawerProps) {
|
|
40
|
+
const { t } = useLocalization();
|
|
40
41
|
const { pushToast } = useUI();
|
|
41
42
|
const { clientContext } = useBuyerPortal();
|
|
42
43
|
const router = useRouter();
|
|
@@ -59,7 +60,9 @@ export function BudgetEditNotificationDrawer({
|
|
|
59
60
|
options: {
|
|
60
61
|
onSuccess: () => {
|
|
61
62
|
pushToast({
|
|
62
|
-
message:
|
|
63
|
+
message: `${t("budgets.toasts.budgetUpdated")}\n${t(
|
|
64
|
+
"shared.messages.changesTimeout"
|
|
65
|
+
)}`,
|
|
63
66
|
status: "INFO",
|
|
64
67
|
});
|
|
65
68
|
close();
|
|
@@ -70,6 +73,7 @@ export function BudgetEditNotificationDrawer({
|
|
|
70
73
|
error,
|
|
71
74
|
orgUnitId,
|
|
72
75
|
onNavigateToUser: (path) => router.push(path),
|
|
76
|
+
t,
|
|
73
77
|
});
|
|
74
78
|
|
|
75
79
|
pushToast(toastConfig);
|
|
@@ -98,7 +102,7 @@ export function BudgetEditNotificationDrawer({
|
|
|
98
102
|
setShowNotificationsEmailError(true);
|
|
99
103
|
}
|
|
100
104
|
pushToast({
|
|
101
|
-
message: BUDGET_NOTIFICATION_BLOCK_MESSAGES[notifState.reason],
|
|
105
|
+
message: t(BUDGET_NOTIFICATION_BLOCK_MESSAGES[notifState.reason]),
|
|
102
106
|
status: "ERROR",
|
|
103
107
|
});
|
|
104
108
|
return;
|
|
@@ -130,7 +134,10 @@ export function BudgetEditNotificationDrawer({
|
|
|
130
134
|
size="large"
|
|
131
135
|
{...props}
|
|
132
136
|
>
|
|
133
|
-
<BasicDrawer.Heading
|
|
137
|
+
<BasicDrawer.Heading
|
|
138
|
+
title={t("budgets.edit.notificationsTitle")}
|
|
139
|
+
onClose={close}
|
|
140
|
+
/>
|
|
134
141
|
|
|
135
142
|
<BasicDrawer.Body>
|
|
136
143
|
<BudgetNotificationForm
|
|
@@ -148,7 +155,7 @@ export function BudgetEditNotificationDrawer({
|
|
|
148
155
|
|
|
149
156
|
<BasicDrawer.Footer data-fs-bp-budget-notifications-drawer-footer>
|
|
150
157
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
151
|
-
|
|
158
|
+
{t("shared.buttons.cancel")}
|
|
152
159
|
</BasicDrawer.Button>
|
|
153
160
|
<BasicDrawer.Button
|
|
154
161
|
variant="confirm"
|
|
@@ -156,7 +163,7 @@ export function BudgetEditNotificationDrawer({
|
|
|
156
163
|
disabled={isLoading}
|
|
157
164
|
isLoading={isLoading}
|
|
158
165
|
>
|
|
159
|
-
|
|
166
|
+
{t("shared.buttons.save")}
|
|
160
167
|
</BasicDrawer.Button>
|
|
161
168
|
</BasicDrawer.Footer>
|
|
162
169
|
</BasicDrawer>
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
Table,
|
|
9
9
|
} from "../../../shared/components";
|
|
10
10
|
import { useBuyerPortal } from "../../../shared/hooks";
|
|
11
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
11
12
|
import { CurrencyType, LocaleType } from "../../../shared/types";
|
|
12
13
|
import { useDebouncedSearchBudgetNotification } from "../../hooks/useDebouncedSearchBudgetNotification";
|
|
13
14
|
import {
|
|
@@ -59,6 +60,7 @@ export const BudgetNotificationForm = ({
|
|
|
59
60
|
showUsersError = false,
|
|
60
61
|
showInvalidEmailError = false,
|
|
61
62
|
}: BudgetNotificationFormProps) => {
|
|
63
|
+
const { t } = useLocalization();
|
|
62
64
|
const { currentUser } = useBuyerPortal();
|
|
63
65
|
const { pushToast } = useUI();
|
|
64
66
|
|
|
@@ -161,12 +163,15 @@ export const BudgetNotificationForm = ({
|
|
|
161
163
|
unitId,
|
|
162
164
|
search: inputValue,
|
|
163
165
|
});
|
|
164
|
-
const loadingObject: UserOption = {
|
|
166
|
+
const loadingObject: UserOption = {
|
|
167
|
+
id: "loading",
|
|
168
|
+
name: t("shared.labels.loading"),
|
|
169
|
+
};
|
|
165
170
|
|
|
166
171
|
useEffect(() => {
|
|
167
172
|
const mapped: UserOption[] = (usersResponse?.users ?? []).map((u) => ({
|
|
168
173
|
id: String(u.userId),
|
|
169
|
-
name: String(u.name ?? "
|
|
174
|
+
name: String(u.name ?? t("budgets.labels.defaultUserName")),
|
|
170
175
|
email: u.email,
|
|
171
176
|
}));
|
|
172
177
|
|
|
@@ -176,7 +181,9 @@ export const BudgetNotificationForm = ({
|
|
|
176
181
|
? {
|
|
177
182
|
id: String(currentUser.id),
|
|
178
183
|
email: currentUser.email ?? "",
|
|
179
|
-
name: currentUser.name
|
|
184
|
+
name: currentUser.name
|
|
185
|
+
? `${currentUser.name} ${t("budgets.labels.youSuffix")}`
|
|
186
|
+
: t("budgets.labels.you"),
|
|
180
187
|
}
|
|
181
188
|
: null;
|
|
182
189
|
|
|
@@ -185,7 +192,7 @@ export const BudgetNotificationForm = ({
|
|
|
185
192
|
);
|
|
186
193
|
|
|
187
194
|
setOptions(selfOption ? [selfOption, ...withEmail] : withEmail);
|
|
188
|
-
}, [usersResponse, currentUser]);
|
|
195
|
+
}, [usersResponse, currentUser, t]);
|
|
189
196
|
|
|
190
197
|
const addUserIfNotExists = (opt: UserOption) => {
|
|
191
198
|
const exists = selectedUsers.some((u) => u.userId === opt.id);
|
|
@@ -193,8 +200,7 @@ export const BudgetNotificationForm = ({
|
|
|
193
200
|
|
|
194
201
|
if (!isValidNotificationUserEmail(opt.email)) {
|
|
195
202
|
pushToast({
|
|
196
|
-
message:
|
|
197
|
-
"This user has no valid email on file and cannot receive budget notifications.",
|
|
203
|
+
message: t("budgets.errors.userNoValidEmail"),
|
|
198
204
|
status: "ERROR",
|
|
199
205
|
});
|
|
200
206
|
return;
|
|
@@ -229,6 +235,7 @@ export const BudgetNotificationForm = ({
|
|
|
229
235
|
);
|
|
230
236
|
};
|
|
231
237
|
|
|
238
|
+
const removeThresholdLabel = t("budgets.actions.removeThreshold");
|
|
232
239
|
const sizeProps = { width: 20, height: 20 };
|
|
233
240
|
const disableRows = readonly || !enabled;
|
|
234
241
|
const isLoading = isLoadingUsers || isDebouncing;
|
|
@@ -242,9 +249,9 @@ export const BudgetNotificationForm = ({
|
|
|
242
249
|
selectedUsers.some((u) => !isValidNotificationUserEmail(u.userEmail));
|
|
243
250
|
|
|
244
251
|
const addUsersAutocompleteHelperLabel = showNoUsersError
|
|
245
|
-
? BUDGET_NOTIFICATION_FORM_HELPER_NO_USERS
|
|
252
|
+
? t(BUDGET_NOTIFICATION_FORM_HELPER_NO_USERS)
|
|
246
253
|
: showEmailFieldError
|
|
247
|
-
? BUDGET_NOTIFICATION_FORM_HELPER_INVALID_EMAIL
|
|
254
|
+
? t(BUDGET_NOTIFICATION_FORM_HELPER_INVALID_EMAIL)
|
|
248
255
|
: undefined;
|
|
249
256
|
|
|
250
257
|
return (
|
|
@@ -253,7 +260,9 @@ export const BudgetNotificationForm = ({
|
|
|
253
260
|
data-fs-bp-budget-notification-row-section
|
|
254
261
|
data-fs-bp-budget-notification-renew
|
|
255
262
|
>
|
|
256
|
-
<span data-fs-bp-budget-notification-renew-label>
|
|
263
|
+
<span data-fs-bp-budget-notification-renew-label>
|
|
264
|
+
{t("budgets.notificationsForm.title")}
|
|
265
|
+
</span>
|
|
257
266
|
<div data-fs-bp-budget-notification-row-section-action>
|
|
258
267
|
<Toggle
|
|
259
268
|
id="notificationsToggle"
|
|
@@ -265,10 +274,7 @@ export const BudgetNotificationForm = ({
|
|
|
265
274
|
</div>
|
|
266
275
|
|
|
267
276
|
<div data-fs-bp-budget-notification-section-label>
|
|
268
|
-
<span>
|
|
269
|
-
Set up to {MAX_THRESHOLDS} thresholds and notify users when the total
|
|
270
|
-
amount reaches specific percentages
|
|
271
|
-
</span>
|
|
277
|
+
<span>{t("budgets.notificationsForm.thresholdsDescription")}</span>
|
|
272
278
|
</div>
|
|
273
279
|
|
|
274
280
|
{enabled && (
|
|
@@ -278,16 +284,20 @@ export const BudgetNotificationForm = ({
|
|
|
278
284
|
<Table layoutFixed>
|
|
279
285
|
<Table.Head
|
|
280
286
|
columns={[
|
|
281
|
-
{
|
|
287
|
+
{
|
|
288
|
+
key: "threshold",
|
|
289
|
+
label: t("budgets.table.threshold"),
|
|
290
|
+
size: "medium",
|
|
291
|
+
},
|
|
282
292
|
{
|
|
283
293
|
key: "consumed",
|
|
284
|
-
label: "
|
|
294
|
+
label: t("budgets.table.consumed"),
|
|
285
295
|
size: "medium",
|
|
286
296
|
align: "right",
|
|
287
297
|
},
|
|
288
298
|
{
|
|
289
299
|
key: "remaining",
|
|
290
|
-
label: "
|
|
300
|
+
label: t("budgets.table.remaining"),
|
|
291
301
|
size: "large",
|
|
292
302
|
align: "right",
|
|
293
303
|
},
|
|
@@ -325,8 +335,8 @@ export const BudgetNotificationForm = ({
|
|
|
325
335
|
data-fs-bp-budget-notification-remove-button
|
|
326
336
|
type="button"
|
|
327
337
|
onClick={() => removeThreshold(idx)}
|
|
328
|
-
aria-label=
|
|
329
|
-
title=
|
|
338
|
+
aria-label={removeThresholdLabel}
|
|
339
|
+
title={removeThresholdLabel}
|
|
330
340
|
disabled={disableRows}
|
|
331
341
|
>
|
|
332
342
|
<Icon
|
|
@@ -364,21 +374,18 @@ export const BudgetNotificationForm = ({
|
|
|
364
374
|
thresholds.length >= MAX_THRESHOLDS
|
|
365
375
|
}
|
|
366
376
|
>
|
|
367
|
-
|
|
377
|
+
{t("budgets.notificationsForm.addThreshold")}
|
|
368
378
|
</button>
|
|
369
379
|
</div>
|
|
370
380
|
</div>
|
|
371
381
|
|
|
372
382
|
<div data-fs-bp-budget-notification-section-user>
|
|
373
383
|
<div data-fs-bp-budget-notification-section-label>
|
|
374
|
-
<span>
|
|
375
|
-
Add users to be notified by email. At least one user must be
|
|
376
|
-
added
|
|
377
|
-
</span>
|
|
384
|
+
<span>{t("budgets.notificationsForm.addUsersDescription")}</span>
|
|
378
385
|
</div>
|
|
379
386
|
|
|
380
387
|
<AutocompleteDropdown
|
|
381
|
-
label="
|
|
388
|
+
label={t("budgets.forms.addUsers")}
|
|
382
389
|
value={inputValue}
|
|
383
390
|
shouldOpenOnFocus={false}
|
|
384
391
|
autoComplete="off"
|
|
@@ -2,6 +2,7 @@ import { Badge } from "@faststore/ui";
|
|
|
2
2
|
|
|
3
3
|
import { EmptyState } from "../../../shared/components";
|
|
4
4
|
import { useDrawerProps } from "../../../shared/hooks";
|
|
5
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
5
6
|
import { BudgetEditNotificationDrawer } from "../BudgetEditNotificationDrawer/BudgetEditNotificationDrawer";
|
|
6
7
|
|
|
7
8
|
import type {
|
|
@@ -21,12 +22,13 @@ type BudgetNotificationsInfoProps = {
|
|
|
21
22
|
const DetailRow = ({
|
|
22
23
|
label,
|
|
23
24
|
notifications,
|
|
25
|
+
isUsers,
|
|
24
26
|
}: {
|
|
25
27
|
label: string;
|
|
26
28
|
notifications: BudgetNotification;
|
|
29
|
+
isUsers?: boolean;
|
|
27
30
|
}) => {
|
|
28
|
-
const
|
|
29
|
-
const list = isUserLabel
|
|
31
|
+
const list = isUsers
|
|
30
32
|
? (notifications.users as NotificationUsers[])
|
|
31
33
|
: (notifications.thresholds as NotificationThresholds[]);
|
|
32
34
|
|
|
@@ -37,7 +39,7 @@ const DetailRow = ({
|
|
|
37
39
|
<span data-fs-bp-budget-notifications-details-row-value>
|
|
38
40
|
{list.map((item, index) => (
|
|
39
41
|
<Badge key={index} size="big">
|
|
40
|
-
{
|
|
42
|
+
{isUsers
|
|
41
43
|
? (item as NotificationUsers).userName
|
|
42
44
|
: `${(item as NotificationThresholds).value}%`}
|
|
43
45
|
</Badge>
|
|
@@ -55,6 +57,7 @@ export const BudgetNotificationsInfo = ({
|
|
|
55
57
|
orgUnitId,
|
|
56
58
|
contractId,
|
|
57
59
|
}: BudgetNotificationsInfoProps) => {
|
|
60
|
+
const { t } = useLocalization();
|
|
58
61
|
const {
|
|
59
62
|
open: openNotificationsDrawerProps,
|
|
60
63
|
isOpen: isEditDrawerOpen,
|
|
@@ -66,13 +69,15 @@ export const BudgetNotificationsInfo = ({
|
|
|
66
69
|
<div data-fs-bp-budget-notifications>
|
|
67
70
|
<div data-fs-bp-budget-notifications-details>
|
|
68
71
|
<div data-fs-budget-notifications-edit-line>
|
|
69
|
-
<span data-fs-budget-notifications-edit-title>
|
|
72
|
+
<span data-fs-budget-notifications-edit-title>
|
|
73
|
+
{t("budgets.notificationsForm.title")}
|
|
74
|
+
</span>
|
|
70
75
|
<button
|
|
71
76
|
type="button"
|
|
72
77
|
data-fs-budget-notifications-edit-button
|
|
73
78
|
onClick={openNotificationsDrawerProps}
|
|
74
79
|
>
|
|
75
|
-
|
|
80
|
+
{t("shared.buttons.edit")}
|
|
76
81
|
</button>
|
|
77
82
|
</div>
|
|
78
83
|
|
|
@@ -81,20 +86,21 @@ export const BudgetNotificationsInfo = ({
|
|
|
81
86
|
<hr data-fs-bp-budget-notifications-divider />
|
|
82
87
|
<DetailRow
|
|
83
88
|
key="Thresholds"
|
|
84
|
-
label="
|
|
89
|
+
label={t("budgets.notificationsForm.thresholds")}
|
|
85
90
|
notifications={initialBudget.notifications}
|
|
86
91
|
/>
|
|
87
92
|
<DetailRow
|
|
88
93
|
key="Users"
|
|
89
|
-
label="
|
|
94
|
+
label={t("budgets.notificationsForm.users")}
|
|
90
95
|
notifications={initialBudget.notifications}
|
|
96
|
+
isUsers
|
|
91
97
|
/>
|
|
92
98
|
</>
|
|
93
99
|
) : (
|
|
94
100
|
<div data-fs-bp-budget-notifications-empty>
|
|
95
101
|
<EmptyState
|
|
96
|
-
title="
|
|
97
|
-
description="
|
|
102
|
+
title={t("budgets.empty.noNotifications")}
|
|
103
|
+
description={t("budgets.empty.noNotificationsDescription")}
|
|
98
104
|
/>
|
|
99
105
|
</div>
|
|
100
106
|
)}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
1
2
|
import { formatCurrency } from "../../../shared/utils";
|
|
2
3
|
import { BudgetProgressBar } from "../BudgetProgressBar/BudgetProgressBar";
|
|
3
4
|
|
|
@@ -10,11 +11,14 @@ export const BudgetRemainingBalance = ({
|
|
|
10
11
|
remaining,
|
|
11
12
|
total,
|
|
12
13
|
}: BudgetRemainingBalanceFormProps) => {
|
|
14
|
+
const { t } = useLocalization();
|
|
13
15
|
const used = total - remaining;
|
|
14
16
|
|
|
15
17
|
return (
|
|
16
18
|
<div data-fs-bp-budget-remaining-balance>
|
|
17
|
-
<p data-fs-bp-budget-remaining-balance-header>
|
|
19
|
+
<p data-fs-bp-budget-remaining-balance-header>
|
|
20
|
+
{t("budgets.labels.remainingBalance")}
|
|
21
|
+
</p>
|
|
18
22
|
<div data-fs-bp-budget-remaining-balance-header-content>
|
|
19
23
|
<span data-fs-bp-budget-remaining-balance-label-remaining>
|
|
20
24
|
{formatCurrency(remaining)}
|
|
@@ -22,7 +26,7 @@ export const BudgetRemainingBalance = ({
|
|
|
22
26
|
<span data-fs-bp-budget-remaining-balance-label-used>
|
|
23
27
|
{formatCurrency(Math.abs(used))}{" "}
|
|
24
28
|
<span data-fs-bp-budget-remaining-balance-label-used-total>
|
|
25
|
-
|
|
29
|
+
{t("budgets.labels.ofTotalUsed", [formatCurrency(total)])}
|
|
26
30
|
</span>
|
|
27
31
|
</span>
|
|
28
32
|
<BudgetProgressBar
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useDrawerProps } from "../../../shared/hooks";
|
|
2
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
2
3
|
import { formatCurrency } from "../../../shared/utils";
|
|
3
4
|
import { formatDateToWET } from "../../../shared/utils/formatDateToWet";
|
|
4
5
|
import { EditBudgetDrawer } from "../EditBudgetDrawer/EditBudgetDrawer";
|
|
@@ -28,11 +29,12 @@ export const BudgetSettingsInfoBalance = ({
|
|
|
28
29
|
orgUnitId,
|
|
29
30
|
budgetId,
|
|
30
31
|
}: BudgetSettingsInfoProps) => {
|
|
32
|
+
const { t } = useLocalization();
|
|
31
33
|
const formattedAmount = `${formatCurrency(Number(initialBudget?.amount))}`;
|
|
32
34
|
|
|
33
|
-
const formattedPeriod = `${formatDateToWET(
|
|
34
|
-
|
|
35
|
-
)}
|
|
35
|
+
const formattedPeriod = `${formatDateToWET(initialBudget.startDate)}${t(
|
|
36
|
+
"budgets.labels.dateRangeSeparator"
|
|
37
|
+
)}${formatDateToWET(initialBudget.expirationDate ?? "")}`;
|
|
36
38
|
|
|
37
39
|
const {
|
|
38
40
|
open: openEditDrawerProps,
|
|
@@ -45,23 +47,38 @@ export const BudgetSettingsInfoBalance = ({
|
|
|
45
47
|
<div data-fs-bp-budget-settings>
|
|
46
48
|
<div data-fs-bp-budget-settings-details>
|
|
47
49
|
<div data-fs-budget-settings-edit-line>
|
|
48
|
-
<span data-fs-budget-settings-edit-title>
|
|
50
|
+
<span data-fs-budget-settings-edit-title>
|
|
51
|
+
{t("budgets.settingsInfo.title")}
|
|
52
|
+
</span>
|
|
49
53
|
<button
|
|
50
54
|
type="button"
|
|
51
55
|
data-fs-budget-settings-edit-button
|
|
52
56
|
onClick={openEditDrawerProps}
|
|
53
57
|
>
|
|
54
|
-
|
|
58
|
+
{t("shared.buttons.edit")}
|
|
55
59
|
</button>
|
|
56
60
|
</div>
|
|
57
61
|
<hr data-fs-bp-budget-settings-divider />
|
|
58
62
|
|
|
59
|
-
<DetailRow label="Name" value={initialBudget.name} />
|
|
60
|
-
<DetailRow label="Amount" value={formattedAmount} />
|
|
61
|
-
<DetailRow label="Period" value={formattedPeriod} />
|
|
62
63
|
<DetailRow
|
|
63
|
-
label="
|
|
64
|
-
value={initialBudget.
|
|
64
|
+
label={t("budgets.settingsInfo.name")}
|
|
65
|
+
value={initialBudget.name}
|
|
66
|
+
/>
|
|
67
|
+
<DetailRow
|
|
68
|
+
label={t("budgets.settingsInfo.amount")}
|
|
69
|
+
value={formattedAmount}
|
|
70
|
+
/>
|
|
71
|
+
<DetailRow
|
|
72
|
+
label={t("budgets.settingsInfo.period")}
|
|
73
|
+
value={formattedPeriod}
|
|
74
|
+
/>
|
|
75
|
+
<DetailRow
|
|
76
|
+
label={t("budgets.settingsInfo.automaticRenewal")}
|
|
77
|
+
value={
|
|
78
|
+
initialBudget.autoResetOnPeriodEnd
|
|
79
|
+
? t("budgets.labels.active")
|
|
80
|
+
: t("budgets.labels.inactive")
|
|
81
|
+
}
|
|
65
82
|
/>
|
|
66
83
|
</div>
|
|
67
84
|
</div>
|
|
@@ -4,6 +4,7 @@ import { Icon, Tooltip } 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
|
|
|
8
9
|
type UserRow = {
|
|
9
10
|
userId: string;
|
|
@@ -23,19 +24,21 @@ type BudgetUsersTableProps = {
|
|
|
23
24
|
function BudgetUsersTableBase({
|
|
24
25
|
users,
|
|
25
26
|
onRemove,
|
|
26
|
-
emptyMessage
|
|
27
|
+
emptyMessage,
|
|
27
28
|
className,
|
|
28
29
|
disabled = false,
|
|
29
30
|
}: BudgetUsersTableProps) {
|
|
31
|
+
const { t } = useLocalization();
|
|
32
|
+
const resolvedEmptyMessage = emptyMessage ?? t("budgets.empty.noUsersFound");
|
|
30
33
|
const columns = getTableColumns({
|
|
31
34
|
actionsLength: onRemove ? 1 : 0,
|
|
32
|
-
nameColumnLabel: "
|
|
35
|
+
nameColumnLabel: t("budgets.table.userName"),
|
|
33
36
|
nameColumnKey: "name",
|
|
34
37
|
nameColumnSize: "medium",
|
|
35
38
|
extraColumns: [
|
|
36
39
|
{
|
|
37
40
|
key: "email",
|
|
38
|
-
label: "
|
|
41
|
+
label: t("budgets.table.email"),
|
|
39
42
|
align: "left",
|
|
40
43
|
size: "100%",
|
|
41
44
|
hideOnScreenSize: "phonemid",
|
|
@@ -54,7 +57,7 @@ function BudgetUsersTableBase({
|
|
|
54
57
|
|
|
55
58
|
<Table.Body>
|
|
56
59
|
{users.length === 0 ? (
|
|
57
|
-
<Table.Row title={
|
|
60
|
+
<Table.Row title={resolvedEmptyMessage} enabled={false}>
|
|
58
61
|
<Table.Cell />
|
|
59
62
|
</Table.Row>
|
|
60
63
|
) : (
|
|
@@ -70,10 +73,14 @@ function BudgetUsersTableBase({
|
|
|
70
73
|
<button
|
|
71
74
|
type="button"
|
|
72
75
|
data-fs-bp-users-remove
|
|
73
|
-
aria-label={
|
|
76
|
+
aria-label={t("budgets.actions.removeUser", [u.userName])}
|
|
74
77
|
disabled={rowDisabled}
|
|
75
78
|
onClick={() => onRemove?.(u.userId)}
|
|
76
|
-
title={
|
|
79
|
+
title={
|
|
80
|
+
rowDisabled
|
|
81
|
+
? undefined
|
|
82
|
+
: t("budgets.actions.removeUser", [u.userName])
|
|
83
|
+
}
|
|
77
84
|
>
|
|
78
85
|
<Icon name="MinusCircle" width={20} height={20} />
|
|
79
86
|
</button>
|
|
@@ -82,7 +89,7 @@ function BudgetUsersTableBase({
|
|
|
82
89
|
return rowDisabled && users.length === 1 ? (
|
|
83
90
|
<Tooltip
|
|
84
91
|
placement="left-center"
|
|
85
|
-
content="
|
|
92
|
+
content={t("budgets.tooltips.atLeastOneUserRequired")}
|
|
86
93
|
>
|
|
87
94
|
{button}
|
|
88
95
|
</Tooltip>
|
|
@@ -6,6 +6,7 @@ import { Icon, Table } from "../../../shared/components";
|
|
|
6
6
|
import { BasicDropdownMenu } from "../../../shared/components/BasicDropdownMenu/BasicDropdownMenu";
|
|
7
7
|
import { getTableColumns } from "../../../shared/components/Table/utils/tableColumns";
|
|
8
8
|
import { useBuyerPortal } from "../../../shared/hooks";
|
|
9
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
9
10
|
import { formatCurrency } from "../../../shared/utils";
|
|
10
11
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
11
12
|
import { BudgetProgressBar } from "../BudgetProgressBar/BudgetProgressBar";
|
|
@@ -31,6 +32,7 @@ export function BudgetsTable({
|
|
|
31
32
|
loading,
|
|
32
33
|
onClickCreateNotification,
|
|
33
34
|
}: IBudgetsTable) {
|
|
35
|
+
const { t } = useLocalization();
|
|
34
36
|
const budgets = data;
|
|
35
37
|
const route = useRouter();
|
|
36
38
|
const { currentOrgUnit: orgUnit, currentContract: contract } =
|
|
@@ -46,23 +48,24 @@ export function BudgetsTable({
|
|
|
46
48
|
const columns = getTableColumns({
|
|
47
49
|
nameColumnSize: "18.625rem",
|
|
48
50
|
actionsLength: 1.75,
|
|
51
|
+
nameColumnLabel: t("shared.labels.name"),
|
|
49
52
|
extraColumns: [
|
|
50
53
|
{
|
|
51
|
-
label: "
|
|
54
|
+
label: t("budgets.table.remaining"),
|
|
52
55
|
key: "remaining",
|
|
53
56
|
size: "100%",
|
|
54
57
|
hideOnScreenSize: "phonemid",
|
|
55
58
|
align: "left",
|
|
56
59
|
},
|
|
57
60
|
{
|
|
58
|
-
label: "
|
|
61
|
+
label: t("budgets.table.expirationDate"),
|
|
59
62
|
key: "date",
|
|
60
63
|
size: "8.75rem",
|
|
61
64
|
hideOnScreenSize: "phonemid",
|
|
62
65
|
align: "right",
|
|
63
66
|
},
|
|
64
67
|
{
|
|
65
|
-
label: "
|
|
68
|
+
label: t("budgets.table.totalUsd"),
|
|
66
69
|
key: "total",
|
|
67
70
|
size: "8.75rem",
|
|
68
71
|
hideOnScreenSize: "tablet",
|
|
@@ -92,21 +95,21 @@ export function BudgetsTable({
|
|
|
92
95
|
onClick={() => route.push(detailsRoute(item.id))}
|
|
93
96
|
>
|
|
94
97
|
<Icon name="OpenInNew" width={20} height={20} />
|
|
95
|
-
<span>
|
|
98
|
+
<span>{t("shared.buttons.open")}</span>
|
|
96
99
|
</DropdownItem>
|
|
97
100
|
<DropdownItem
|
|
98
101
|
data-fs-bp-testid="dropdown-budget-edit"
|
|
99
102
|
onClick={() => onClickEditBudget(item.id)}
|
|
100
103
|
>
|
|
101
104
|
<Icon name="Edit" width={20} height={20} />
|
|
102
|
-
<span>
|
|
105
|
+
<span>{t("budgets.dropdown.editSettings")}</span>
|
|
103
106
|
</DropdownItem>
|
|
104
107
|
{onClickCreateNotification && (
|
|
105
108
|
<DropdownItem
|
|
106
109
|
onClick={() => onClickCreateNotification(item.id)}
|
|
107
110
|
>
|
|
108
111
|
<Icon name="Edit" width={20} height={20} />
|
|
109
|
-
<span>
|
|
112
|
+
<span>{t("budgets.dropdown.editNotifications")}</span>
|
|
110
113
|
</DropdownItem>
|
|
111
114
|
)}
|
|
112
115
|
<DropdownItem
|
|
@@ -114,7 +117,7 @@ export function BudgetsTable({
|
|
|
114
117
|
onClick={() => onClickAllocationPage(item.id)}
|
|
115
118
|
>
|
|
116
119
|
<Icon name="Add" width={20} height={20} />
|
|
117
|
-
<span>
|
|
120
|
+
<span>{t("budgets.dropdown.addAllocations")}</span>
|
|
118
121
|
</DropdownItem>
|
|
119
122
|
<BasicDropdownMenu.Separator />
|
|
120
123
|
<DropdownItem
|
|
@@ -123,7 +126,7 @@ export function BudgetsTable({
|
|
|
123
126
|
onClick={() => openDeleteDrawer(item.id)}
|
|
124
127
|
>
|
|
125
128
|
<Icon name="Delete" width={20} height={20} />
|
|
126
|
-
<span>
|
|
129
|
+
<span>{t("shared.buttons.delete")}</span>
|
|
127
130
|
</DropdownItem>
|
|
128
131
|
</BasicDropdownMenu>
|
|
129
132
|
}
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
Icon,
|
|
11
11
|
type BasicDrawerProps,
|
|
12
12
|
} from "../../../shared/components";
|
|
13
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
13
14
|
import {
|
|
14
15
|
sortingOptionsAllocations,
|
|
15
16
|
type Dictionary,
|
|
16
17
|
} from "../../../shared/utils";
|
|
17
|
-
import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
|
|
18
18
|
import { getKeyByValue } from "../../../shared/utils/getKeyByValue";
|
|
19
19
|
import { useAddAllocations } from "../../hooks/useAddAllocations";
|
|
20
20
|
import { useGetAllocations } from "../../hooks/useGetAllocations";
|
|
@@ -38,6 +38,7 @@ export const CreateBudgetAllocationDrawer = ({
|
|
|
38
38
|
budgetId,
|
|
39
39
|
...props
|
|
40
40
|
}: CreateBudgetAllocationDrawerProps) => {
|
|
41
|
+
const { t } = useLocalization();
|
|
41
42
|
const router = useRouter();
|
|
42
43
|
const { pushToast } = useUI();
|
|
43
44
|
|
|
@@ -90,7 +91,9 @@ export const CreateBudgetAllocationDrawer = ({
|
|
|
90
91
|
options: {
|
|
91
92
|
onSuccess: () => {
|
|
92
93
|
pushToast({
|
|
93
|
-
message:
|
|
94
|
+
message: `${t("budgets.toasts.allocationAdded")}\n${t(
|
|
95
|
+
"shared.messages.changesTimeout"
|
|
96
|
+
)}`,
|
|
94
97
|
status: "INFO",
|
|
95
98
|
});
|
|
96
99
|
close();
|
|
@@ -135,7 +138,7 @@ export const CreateBudgetAllocationDrawer = ({
|
|
|
135
138
|
title={
|
|
136
139
|
<div data-fs-bp-create-budget-drawer-header-arrow>
|
|
137
140
|
<Icon name="ArrowPointLeft" onClick={close} />
|
|
138
|
-
<span>
|
|
141
|
+
<span>{t("budgets.create.addBudgetAllocations")}</span>
|
|
139
142
|
</div>
|
|
140
143
|
}
|
|
141
144
|
onClose={close}
|
|
@@ -166,14 +169,14 @@ export const CreateBudgetAllocationDrawer = ({
|
|
|
166
169
|
|
|
167
170
|
<BasicDrawer.Footer>
|
|
168
171
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
169
|
-
|
|
172
|
+
{t("shared.buttons.cancel")}
|
|
170
173
|
</BasicDrawer.Button>
|
|
171
174
|
<BasicDrawer.Button
|
|
172
175
|
variant="confirm"
|
|
173
176
|
onClick={handleSave}
|
|
174
177
|
isLoading={isFetchLoading || isLoadingAddAllocationsToBudget}
|
|
175
178
|
>
|
|
176
|
-
|
|
179
|
+
{t("shared.buttons.save")}
|
|
177
180
|
</BasicDrawer.Button>
|
|
178
181
|
</BasicDrawer.Footer>
|
|
179
182
|
</BasicDrawer>
|