fix(dashboard): product create discountable flag (#12073)
* fix(dashboard): product create discountable flag * chore: changeset
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/dashboard": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(dashboard): product create discountable flag
|
||||||
@@ -6,13 +6,13 @@ import { Form } from "../../common/form"
|
|||||||
|
|
||||||
interface HeadlessControllerProps<
|
interface HeadlessControllerProps<
|
||||||
TFieldValues extends FieldValues = FieldValues,
|
TFieldValues extends FieldValues = FieldValues,
|
||||||
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
|
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
||||||
> extends Omit<ControllerProps<TFieldValues, TName>, "render"> {}
|
> extends Omit<ControllerProps<TFieldValues, TName>, "render"> {}
|
||||||
|
|
||||||
interface SwitchBoxProps<
|
interface SwitchBoxProps<
|
||||||
TFieldValues extends FieldValues = FieldValues,
|
TFieldValues extends FieldValues = FieldValues,
|
||||||
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
|
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
||||||
> extends HeadlessControllerProps<TFieldValues, TName>{
|
> extends HeadlessControllerProps<TFieldValues, TName> {
|
||||||
label: string
|
label: string
|
||||||
description: string
|
description: string
|
||||||
optional?: boolean
|
optional?: boolean
|
||||||
@@ -32,7 +32,7 @@ interface SwitchBoxProps<
|
|||||||
*/
|
*/
|
||||||
export const SwitchBox = <
|
export const SwitchBox = <
|
||||||
TFieldValues extends FieldValues = FieldValues,
|
TFieldValues extends FieldValues = FieldValues,
|
||||||
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
|
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
||||||
>({
|
>({
|
||||||
label,
|
label,
|
||||||
description,
|
description,
|
||||||
@@ -49,10 +49,14 @@ export const SwitchBox = <
|
|||||||
<Form.Item>
|
<Form.Item>
|
||||||
<div className="bg-ui-bg-component shadow-elevation-card-rest flex items-start gap-x-3 rounded-lg p-3">
|
<div className="bg-ui-bg-component shadow-elevation-card-rest flex items-start gap-x-3 rounded-lg p-3">
|
||||||
<Form.Control>
|
<Form.Control>
|
||||||
<Switch {...field} checked={value} onCheckedChange={(e) => {
|
<Switch
|
||||||
onCheckedChange?.(e)
|
{...field}
|
||||||
onChange(e)
|
checked={value}
|
||||||
}} />
|
onCheckedChange={(e) => {
|
||||||
|
onCheckedChange?.(e)
|
||||||
|
onChange(e)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</Form.Control>
|
</Form.Control>
|
||||||
<div>
|
<div>
|
||||||
<Form.Label optional={optional} tooltip={tooltip}>
|
<Form.Label optional={optional} tooltip={tooltip}>
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export const normalizeProductFormValues = (
|
|||||||
title: values.title.trim(),
|
title: values.title.trim(),
|
||||||
subtitle: values.subtitle?.trim(),
|
subtitle: values.subtitle?.trim(),
|
||||||
description: values.description?.trim(),
|
description: values.description?.trim(),
|
||||||
discountable: values.discountable || undefined,
|
discountable: values.discountable,
|
||||||
width: values.width ? parseFloat(values.width) : undefined,
|
width: values.width ? parseFloat(values.width) : undefined,
|
||||||
length: values.length ? parseFloat(values.length) : undefined,
|
length: values.length ? parseFloat(values.length) : undefined,
|
||||||
height: values.height ? parseFloat(values.height) : undefined,
|
height: values.height ? parseFloat(values.height) : undefined,
|
||||||
|
|||||||
Reference in New Issue
Block a user