fix(dashboard): show TIP flag only for fixed promotions (#12897)
* fix(dashboard): show TIP flag only for fixed promotions * fix: refactor changes
This commit is contained in:
1 parent
e9a33d0700
commit
1438b394ae
3 files changed
+41
-18
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/dashboard": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(dashboard): show TIP flag only for fixed promotions
|
||||||
+23
-9
@@ -4,13 +4,31 @@ const commonHiddenFields = [
|
|||||||
"application_method.allocation",
|
"application_method.allocation",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const amountOfOrderHiddenFields = [...commonHiddenFields]
|
||||||
|
const amountOfProductHiddenFields = [...commonHiddenFields]
|
||||||
|
|
||||||
|
const percentageOfOrderHiddenFields = [
|
||||||
|
...commonHiddenFields,
|
||||||
|
"is_tax_inclusive",
|
||||||
|
]
|
||||||
|
const percentageOfProductHiddenFields = [
|
||||||
|
...commonHiddenFields,
|
||||||
|
"is_tax_inclusive",
|
||||||
|
]
|
||||||
|
|
||||||
|
const buyGetHiddenFields = [
|
||||||
|
...commonHiddenFields,
|
||||||
|
"application_method.value",
|
||||||
|
"is_tax_inclusive",
|
||||||
|
]
|
||||||
|
|
||||||
export const templates = [
|
export const templates = [
|
||||||
{
|
{
|
||||||
id: "amount_off_products",
|
id: "amount_off_products",
|
||||||
type: "standard",
|
type: "standard",
|
||||||
title: "Amount off products",
|
title: "Amount off products",
|
||||||
description: "Discount specific products or collection of products",
|
description: "Discount specific products or collection of products",
|
||||||
hiddenFields: [...commonHiddenFields],
|
hiddenFields: amountOfProductHiddenFields,
|
||||||
defaults: {
|
defaults: {
|
||||||
is_automatic: "false",
|
is_automatic: "false",
|
||||||
type: "standard",
|
type: "standard",
|
||||||
@@ -26,7 +44,7 @@ export const templates = [
|
|||||||
type: "standard",
|
type: "standard",
|
||||||
title: "Amount off order",
|
title: "Amount off order",
|
||||||
description: "Discounts the total order amount",
|
description: "Discounts the total order amount",
|
||||||
hiddenFields: [...commonHiddenFields],
|
hiddenFields: amountOfOrderHiddenFields,
|
||||||
defaults: {
|
defaults: {
|
||||||
is_automatic: "false",
|
is_automatic: "false",
|
||||||
type: "standard",
|
type: "standard",
|
||||||
@@ -42,7 +60,7 @@ export const templates = [
|
|||||||
type: "standard",
|
type: "standard",
|
||||||
title: "Percentage off product",
|
title: "Percentage off product",
|
||||||
description: "Discounts a percentage off selected products",
|
description: "Discounts a percentage off selected products",
|
||||||
hiddenFields: [...commonHiddenFields],
|
hiddenFields: percentageOfProductHiddenFields,
|
||||||
defaults: {
|
defaults: {
|
||||||
is_automatic: "false",
|
is_automatic: "false",
|
||||||
type: "standard",
|
type: "standard",
|
||||||
@@ -58,7 +76,7 @@ export const templates = [
|
|||||||
type: "standard",
|
type: "standard",
|
||||||
title: "Percentage off order",
|
title: "Percentage off order",
|
||||||
description: "Discounts a percentage of the total order amount",
|
description: "Discounts a percentage of the total order amount",
|
||||||
hiddenFields: [...commonHiddenFields],
|
hiddenFields: percentageOfOrderHiddenFields,
|
||||||
defaults: {
|
defaults: {
|
||||||
is_automatic: "false",
|
is_automatic: "false",
|
||||||
type: "standard",
|
type: "standard",
|
||||||
@@ -74,11 +92,7 @@ export const templates = [
|
|||||||
type: "buy_get",
|
type: "buy_get",
|
||||||
title: "Buy X Get Y",
|
title: "Buy X Get Y",
|
||||||
description: "Buy X product(s), get Y product(s)",
|
description: "Buy X product(s), get Y product(s)",
|
||||||
hiddenFields: [
|
hiddenFields: buyGetHiddenFields,
|
||||||
...commonHiddenFields,
|
|
||||||
"application_method.value",
|
|
||||||
"is_tax_inclusive",
|
|
||||||
],
|
|
||||||
defaults: {
|
defaults: {
|
||||||
is_automatic: "false",
|
is_automatic: "false",
|
||||||
type: "buyget",
|
type: "buyget",
|
||||||
|
|||||||
+13
-9
@@ -181,17 +181,21 @@ export const PromotionGeneralSection = ({
|
|||||||
</Text>
|
</Text>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="text-ui-fg-subtle grid grid-cols-2 items-start px-6 py-4">
|
{promotion.application_method?.type === "fixed" && (
|
||||||
<Text size="small" weight="plus" leading="compact">
|
<div className="text-ui-fg-subtle grid grid-cols-2 items-start px-6 py-4">
|
||||||
{t("promotions.fields.taxInclusive")}
|
<Text size="small" weight="plus" leading="compact">
|
||||||
</Text>
|
{t("promotions.fields.taxInclusive")}
|
||||||
|
|
||||||
<div className="flex items-center gap-x-2">
|
|
||||||
<Text className="inline" size="small" leading="compact">
|
|
||||||
{promotion.is_tax_inclusive ? t("fields.true") : t("fields.false")}
|
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
|
<div className="flex items-center gap-x-2">
|
||||||
|
<Text className="inline" size="small" leading="compact">
|
||||||
|
{promotion.is_tax_inclusive
|
||||||
|
? t("fields.true")
|
||||||
|
: t("fields.false")}
|
||||||
|
</Text>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
)}
|
||||||
</Container>
|
</Container>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user