fix(dashboard): Set correct method value on promotion (#9610)

<img width="1441" alt="Screenshot 2024-10-16 at 14 17 05" src="https://github.com/user-attachments/assets/7a2e2196-5ca6-4532-9bf0-a4b693c6babc">

RESOLVES CC-601
This commit is contained in:
Riqwan Thamir
2024-10-16 12:31:39 +00:00
committed by GitHub
parent ea5bff9034
commit 449168578d
3 changed files with 8 additions and 5 deletions
@@ -28,11 +28,11 @@ export const usePromotionTableColumns = () => {
columnHelper.display({ columnHelper.display({
id: "method", id: "method",
header: () => <TextHeader text={t("promotions.fields.campaign")} />, header: () => <TextHeader text={t("promotions.fields.method")} />,
cell: ({ row }) => { cell: ({ row }) => {
const text = row.original.is_automatic const text = row.original.is_automatic
? "Automatic" ? t("promotions.form.method.automatic.title")
: "Promotion Code" : t("promotions.form.method.code.title")
return <TextCell text={text} /> return <TextCell text={text} />
}, },
@@ -1716,6 +1716,7 @@
"value_type": "Value Type", "value_type": "Value Type",
"value": "Value", "value": "Value",
"campaign": "Campaign", "campaign": "Campaign",
"method": "Method",
"allocation": "Allocation", "allocation": "Allocation",
"addCondition": "Add condition", "addCondition": "Add condition",
"clearAll": "Clear all", "clearAll": "Clear all",
@@ -85,7 +85,7 @@ export const PromotionGeneralSection = ({
[PromotionStatus.EXPIRED]: ["red", t("statuses.expired")], [PromotionStatus.EXPIRED]: ["red", t("statuses.expired")],
}[getPromotionStatus(promotion)] as [ }[getPromotionStatus(promotion)] as [
"grey" | "orange" | "green" | "red", "grey" | "orange" | "green" | "red",
string string,
] ]
const displayValue = getDisplayValue(promotion) const displayValue = getDisplayValue(promotion)
@@ -130,7 +130,9 @@ export const PromotionGeneralSection = ({
</Text> </Text>
<Text size="small" leading="compact" className="text-pretty"> <Text size="small" leading="compact" className="text-pretty">
{promotion.is_automatic ? "Promotion code" : "Automatic"} {promotion.is_automatic
? t("promotions.form.method.automatic.title")
: t("promotions.form.method.code.title")}
</Text> </Text>
</div> </div>