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:
5
.changeset/empty-apricots-confess.md
Normal file
5
.changeset/empty-apricots-confess.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/dashboard": patch
|
||||
---
|
||||
|
||||
fix(dashboard): show TIP flag only for fixed promotions
|
||||
@@ -4,13 +4,31 @@ const commonHiddenFields = [
|
||||
"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 = [
|
||||
{
|
||||
id: "amount_off_products",
|
||||
type: "standard",
|
||||
title: "Amount off products",
|
||||
description: "Discount specific products or collection of products",
|
||||
hiddenFields: [...commonHiddenFields],
|
||||
hiddenFields: amountOfProductHiddenFields,
|
||||
defaults: {
|
||||
is_automatic: "false",
|
||||
type: "standard",
|
||||
@@ -26,7 +44,7 @@ export const templates = [
|
||||
type: "standard",
|
||||
title: "Amount off order",
|
||||
description: "Discounts the total order amount",
|
||||
hiddenFields: [...commonHiddenFields],
|
||||
hiddenFields: amountOfOrderHiddenFields,
|
||||
defaults: {
|
||||
is_automatic: "false",
|
||||
type: "standard",
|
||||
@@ -42,7 +60,7 @@ export const templates = [
|
||||
type: "standard",
|
||||
title: "Percentage off product",
|
||||
description: "Discounts a percentage off selected products",
|
||||
hiddenFields: [...commonHiddenFields],
|
||||
hiddenFields: percentageOfProductHiddenFields,
|
||||
defaults: {
|
||||
is_automatic: "false",
|
||||
type: "standard",
|
||||
@@ -58,7 +76,7 @@ export const templates = [
|
||||
type: "standard",
|
||||
title: "Percentage off order",
|
||||
description: "Discounts a percentage of the total order amount",
|
||||
hiddenFields: [...commonHiddenFields],
|
||||
hiddenFields: percentageOfOrderHiddenFields,
|
||||
defaults: {
|
||||
is_automatic: "false",
|
||||
type: "standard",
|
||||
@@ -74,11 +92,7 @@ export const templates = [
|
||||
type: "buy_get",
|
||||
title: "Buy X Get Y",
|
||||
description: "Buy X product(s), get Y product(s)",
|
||||
hiddenFields: [
|
||||
...commonHiddenFields,
|
||||
"application_method.value",
|
||||
"is_tax_inclusive",
|
||||
],
|
||||
hiddenFields: buyGetHiddenFields,
|
||||
defaults: {
|
||||
is_automatic: "false",
|
||||
type: "buyget",
|
||||
|
||||
@@ -181,17 +181,21 @@ export const PromotionGeneralSection = ({
|
||||
</Text>
|
||||
</div>
|
||||
|
||||
<div className="text-ui-fg-subtle grid grid-cols-2 items-start px-6 py-4">
|
||||
<Text size="small" weight="plus" leading="compact">
|
||||
{t("promotions.fields.taxInclusive")}
|
||||
</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")}
|
||||
{promotion.application_method?.type === "fixed" && (
|
||||
<div className="text-ui-fg-subtle grid grid-cols-2 items-start px-6 py-4">
|
||||
<Text size="small" weight="plus" leading="compact">
|
||||
{t("promotions.fields.taxInclusive")}
|
||||
</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>
|
||||
)}
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user