Skip to content

Commit 295c158

Browse files
authored
Merge branch 'develop' into fix/workflow-cancellation
2 parents 4d4cf09 + 1438b39 commit 295c158

3 files changed

Lines changed: 41 additions & 18 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@medusajs/dashboard": patch
3+
---
4+
5+
fix(dashboard): show TIP flag only for fixed promotions

packages/admin/dashboard/src/routes/promotions/promotion-create/components/create-promotion-form/templates.ts

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,31 @@ const commonHiddenFields = [
44
"application_method.allocation",
55
]
66

7+
const amountOfOrderHiddenFields = [...commonHiddenFields]
8+
const amountOfProductHiddenFields = [...commonHiddenFields]
9+
10+
const percentageOfOrderHiddenFields = [
11+
...commonHiddenFields,
12+
"is_tax_inclusive",
13+
]
14+
const percentageOfProductHiddenFields = [
15+
...commonHiddenFields,
16+
"is_tax_inclusive",
17+
]
18+
19+
const buyGetHiddenFields = [
20+
...commonHiddenFields,
21+
"application_method.value",
22+
"is_tax_inclusive",
23+
]
24+
725
export const templates = [
826
{
927
id: "amount_off_products",
1028
type: "standard",
1129
title: "Amount off products",
1230
description: "Discount specific products or collection of products",
13-
hiddenFields: [...commonHiddenFields],
31+
hiddenFields: amountOfProductHiddenFields,
1432
defaults: {
1533
is_automatic: "false",
1634
type: "standard",
@@ -26,7 +44,7 @@ export const templates = [
2644
type: "standard",
2745
title: "Amount off order",
2846
description: "Discounts the total order amount",
29-
hiddenFields: [...commonHiddenFields],
47+
hiddenFields: amountOfOrderHiddenFields,
3048
defaults: {
3149
is_automatic: "false",
3250
type: "standard",
@@ -42,7 +60,7 @@ export const templates = [
4260
type: "standard",
4361
title: "Percentage off product",
4462
description: "Discounts a percentage off selected products",
45-
hiddenFields: [...commonHiddenFields],
63+
hiddenFields: percentageOfProductHiddenFields,
4664
defaults: {
4765
is_automatic: "false",
4866
type: "standard",
@@ -58,7 +76,7 @@ export const templates = [
5876
type: "standard",
5977
title: "Percentage off order",
6078
description: "Discounts a percentage of the total order amount",
61-
hiddenFields: [...commonHiddenFields],
79+
hiddenFields: percentageOfOrderHiddenFields,
6280
defaults: {
6381
is_automatic: "false",
6482
type: "standard",
@@ -74,11 +92,7 @@ export const templates = [
7492
type: "buy_get",
7593
title: "Buy X Get Y",
7694
description: "Buy X product(s), get Y product(s)",
77-
hiddenFields: [
78-
...commonHiddenFields,
79-
"application_method.value",
80-
"is_tax_inclusive",
81-
],
95+
hiddenFields: buyGetHiddenFields,
8296
defaults: {
8397
is_automatic: "false",
8498
type: "buyget",

packages/admin/dashboard/src/routes/promotions/promotion-detail/components/promotion-general-section/promotion-general-section.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,17 +181,21 @@ export const PromotionGeneralSection = ({
181181
</Text>
182182
</div>
183183

184-
<div className="text-ui-fg-subtle grid grid-cols-2 items-start px-6 py-4">
185-
<Text size="small" weight="plus" leading="compact">
186-
{t("promotions.fields.taxInclusive")}
187-
</Text>
188-
189-
<div className="flex items-center gap-x-2">
190-
<Text className="inline" size="small" leading="compact">
191-
{promotion.is_tax_inclusive ? t("fields.true") : t("fields.false")}
184+
{promotion.application_method?.type === "fixed" && (
185+
<div className="text-ui-fg-subtle grid grid-cols-2 items-start px-6 py-4">
186+
<Text size="small" weight="plus" leading="compact">
187+
{t("promotions.fields.taxInclusive")}
192188
</Text>
189+
190+
<div className="flex items-center gap-x-2">
191+
<Text className="inline" size="small" leading="compact">
192+
{promotion.is_tax_inclusive
193+
? t("fields.true")
194+
: t("fields.false")}
195+
</Text>
196+
</div>
193197
</div>
194-
</div>
198+
)}
195199
</Container>
196200
)
197201
}

0 commit comments

Comments
 (0)