From 981745e98b465514f7de0a65650174086893a258 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Frane=20Poli=C4=87?=
<16856471+fPolic@users.noreply.github.com>
Date: Mon, 23 Sep 2024 17:59:37 +0200
Subject: [PATCH] fix(dashboard): customer groups fixes (#9258)
**What**
- fix add customer to customer group toast
- move modal actions to footer
---
FIXES CC-514
---
.../dashboard/src/i18n/translations/en.json | 1 +
.../add-customer-groups-form.tsx | 38 ++++++++++++-------
2 files changed, 26 insertions(+), 13 deletions(-)
diff --git a/packages/admin/dashboard/src/i18n/translations/en.json b/packages/admin/dashboard/src/i18n/translations/en.json
index 9e6f766bbd..f3763ea143 100644
--- a/packages/admin/dashboard/src/i18n/translations/en.json
+++ b/packages/admin/dashboard/src/i18n/translations/en.json
@@ -779,6 +779,7 @@
"noRecordsMessage": "This customer doesn't belong to any group."
},
"add": {
+ "success": "Customer added to: {{groups}}.",
"list": {
"noRecordsMessage": "Please create a customer group first."
}
diff --git a/packages/admin/dashboard/src/routes/customers/customers-add-customer-group/components/add-customers-form/add-customer-groups-form.tsx b/packages/admin/dashboard/src/routes/customers/customers-add-customer-group/components/add-customers-form/add-customer-groups-form.tsx
index cbc53a95f8..edcf219e48 100644
--- a/packages/admin/dashboard/src/routes/customers/customers-add-customer-group/components/add-customers-form/add-customer-groups-form.tsx
+++ b/packages/admin/dashboard/src/routes/customers/customers-add-customer-group/components/add-customers-form/add-customer-groups-form.tsx
@@ -126,6 +126,16 @@ export const AddCustomerGroupsForm = ({
await Promise.all(promises)
+ toast.success(t("general.success"), {
+ description: t("customers.groups.add.success", {
+ groups: data.customer_group_ids
+ .map((id) => customer_groups?.find((g) => g.id === id))
+ .filter(Boolean)
+ .map((cg) => cg.name),
+ }),
+ dismissLabel: t("actions.close"),
+ })
+
await queryClient.invalidateQueries({
queryKey: customerGroupsQueryKeys.lists(),
})
@@ -155,19 +165,6 @@ export const AddCustomerGroupsForm = ({
{form.formState.errors.customer_group_ids.message}
)}
-
-
-
-
@@ -187,6 +184,21 @@ export const AddCustomerGroupsForm = ({
}}
/>
+
+
+
+
+
+
)