From 82b620c488bb0f95343037e9e72c1c0512c716ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Frane=20Poli=C4=87?=
<16856471+fPolic@users.noreply.github.com>
Date: Fri, 12 Jul 2024 16:10:05 +0200
Subject: [PATCH] fix(dashboard): promotions disable conditions (#8104)
---
.../src/routes/products/common/variant-pricing-form.tsx | 4 +++-
.../rule-value-form-field/rule-value-form-field.tsx | 4 ++++
.../components/rules-form-field/rules-form-field.tsx | 6 +++++-
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/packages/admin-next/dashboard/src/routes/products/common/variant-pricing-form.tsx b/packages/admin-next/dashboard/src/routes/products/common/variant-pricing-form.tsx
index 19380c6044..b6ab0d98fb 100644
--- a/packages/admin-next/dashboard/src/routes/products/common/variant-pricing-form.tsx
+++ b/packages/admin-next/dashboard/src/routes/products/common/variant-pricing-form.tsx
@@ -78,7 +78,9 @@ export const useVariantPriceGridColumns = ({
return (
- {entity.title}
+
+ {entity.title}
+
)
diff --git a/packages/admin-next/dashboard/src/routes/promotions/common/edit-rules/components/rule-value-form-field/rule-value-form-field.tsx b/packages/admin-next/dashboard/src/routes/promotions/common/edit-rules/components/rule-value-form-field/rule-value-form-field.tsx
index b4ebb6d65f..530fb5732b 100644
--- a/packages/admin-next/dashboard/src/routes/promotions/common/edit-rules/components/rule-value-form-field/rule-value-form-field.tsx
+++ b/packages/admin-next/dashboard/src/routes/promotions/common/edit-rules/components/rule-value-form-field/rule-value-form-field.tsx
@@ -84,6 +84,7 @@ export const RuleValueFormField = ({
className="bg-ui-bg-base"
ref={valuesRef}
min={1}
+ disabled={!fieldRule.attribute}
/>
@@ -97,6 +98,7 @@ export const RuleValueFormField = ({
{...field}
onChange={onChange}
className="bg-ui-bg-base"
+ disabled={!fieldRule.attribute}
/>
@@ -112,6 +114,7 @@ export const RuleValueFormField = ({
Array.isArray(field.value) ? field.value[0] : field.value
}
onValueChange={onChange}
+ disabled={!fieldRule.attribute}
>
@@ -144,6 +147,7 @@ export const RuleValueFormField = ({
options={options}
onChange={onChange}
className="bg-ui-bg-base"
+ disabled={!fieldRule.attribute}
/>
diff --git a/packages/admin-next/dashboard/src/routes/promotions/common/edit-rules/components/rules-form-field/rules-form-field.tsx b/packages/admin-next/dashboard/src/routes/promotions/common/edit-rules/components/rules-form-field/rules-form-field.tsx
index 4d34b82c5c..24fdacdaf1 100644
--- a/packages/admin-next/dashboard/src/routes/promotions/common/edit-rules/components/rules-form-field/rules-form-field.tsx
+++ b/packages/admin-next/dashboard/src/routes/promotions/common/edit-rules/components/rules-form-field/rules-form-field.tsx
@@ -213,7 +213,11 @@ export const RulesFormField = ({
return (
-