Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Drop voucher name

Krzysztof Bialoglowicz092347cf6796
diff --git a/saleor/static/dashboard-next/discounts/components/VoucherDetailsPage/VoucherDetailsPage.tsx b/saleor/static/dashboard-next/discounts/components/VoucherDetailsPage/VoucherDetailsPage.tsx
index d24463e252..64c1c64f3b 100644
--- a/saleor/static/dashboard-next/discounts/components/VoucherDetailsPage/VoucherDetailsPage.tsx
+++ b/saleor/static/dashboard-next/discounts/components/VoucherDetailsPage/VoucherDetailsPage.tsx
@@ -25,6 +25,7 @@ import DiscountProducts from "../DiscountProducts";
import VoucherInfo from "../VoucherInfo";
import VoucherOptions from "../VoucherOptions";
import VoucherSummary from "../VoucherSummary";
+import VoucherTypes from "../VoucherTypes";
export enum VoucherDetailsPageTab {
categories = "categories",
@@ -45,7 +46,6 @@ export interface FormData {
discountType: VoucherDiscountValueType;
endDate: string;
minAmountSpent: number;
- name: string;
startDate: string;
type: VoucherType;
usageLimit: number;
@@ -125,7 +125,6 @@ const VoucherDetailsPage: React.StatelessComponent<VoucherDetailsPageProps> = ({
),
endDate: maybe(() => voucher.endDate, ""),
minAmountSpent: maybe(() => voucher.minAmountSpent.amount, 0),
- name: maybe(() => voucher.name, ""),
startDate: maybe(() => voucher.startDate, ""),
type: maybe(() => voucher.type, VoucherType.ENTIRE_ORDER),
usageLimit: maybe(() => voucher.usageLimit || 0, 0),
@@ -137,7 +136,7 @@ const VoucherDetailsPage: React.StatelessComponent<VoucherDetailsPageProps> = ({
{({ change, data, errors: formErrors, hasChanged, submit }) => (
<Container>
<AppHeader onBack={onBack}>{i18n.t("Vouchers")}</AppHeader>
- <PageHeader title={maybe(() => voucher.name)} />
+ <PageHeader title={maybe(() => voucher.code)} />
<Grid>
<div>
<VoucherInfo
@@ -148,6 +147,14 @@ const VoucherDetailsPage: React.StatelessComponent<VoucherDetailsPageProps> = ({
onChange={change}
/>
<CardSpacer />
+ <VoucherTypes
+ data={data}
+ disabled={disabled}
+ errors={formErrors}
+ variant="update"
+ onChange={change}
+ />
+ <CardSpacer />
<VoucherOptions
data={data}
disabled={disabled}
diff --git a/saleor/static/dashboard-next/discounts/components/VoucherSummary/VoucherSummary.tsx b/saleor/static/dashboard-next/discounts/components/VoucherSummary/VoucherSummary.tsx
index ec81e3a25c..4ff5d0a3bf 100644
--- a/saleor/static/dashboard-next/discounts/components/VoucherSummary/VoucherSummary.tsx
+++ b/saleor/static/dashboard-next/discounts/components/VoucherSummary/VoucherSummary.tsx
@@ -32,9 +32,9 @@ const VoucherSummary: React.StatelessComponent<VoucherSummaryProps> = ({
<Card>
<CardTitle title={i18n.t("Summary")} />
<CardContent>
- <Typography variant="caption">{i18n.t("Name")}</Typography>
+ <Typography variant="caption">{i18n.t("Code")}</Typography>
<Typography>
- {maybe<React.ReactNode>(() => voucher.name, <Skeleton />)}
+ {maybe<React.ReactNode>(() => voucher.code, <Skeleton />)}
</Typography>
<FormSpacer />
diff --git a/saleor/static/dashboard-next/discounts/queries.ts b/saleor/static/dashboard-next/discounts/queries.ts
index e5905952b7..dcb3a8dd12 100644
--- a/saleor/static/dashboard-next/discounts/queries.ts
+++ b/saleor/static/dashboard-next/discounts/queries.ts
@@ -81,7 +81,6 @@ export const saleDetailsFragment = gql`
export const voucherFragment = gql`
fragment VoucherFragment on Voucher {
id
- name
startDate
endDate
usageLimit