feat(admin): add allow_update_discount option to category dialog
This commit is contained in:
@@ -49,6 +49,7 @@ const categorySchema = z.object({
|
|||||||
show_in_kauf: z.boolean().default(true),
|
show_in_kauf: z.boolean().default(true),
|
||||||
show_in_abo: z.boolean().default(true),
|
show_in_abo: z.boolean().default(true),
|
||||||
resets_others: z.boolean().default(false),
|
resets_others: z.boolean().default(false),
|
||||||
|
allow_update_discount: z.boolean().default(true),
|
||||||
})
|
})
|
||||||
|
|
||||||
type CategoryFormValues = z.infer<typeof categorySchema>
|
type CategoryFormValues = z.infer<typeof categorySchema>
|
||||||
@@ -77,6 +78,7 @@ export function CategoryDialog({
|
|||||||
show_in_kauf: category?.show_in_kauf ?? true,
|
show_in_kauf: category?.show_in_kauf ?? true,
|
||||||
show_in_abo: category?.show_in_abo ?? true,
|
show_in_abo: category?.show_in_abo ?? true,
|
||||||
resets_others: category?.resets_others ?? false,
|
resets_others: category?.resets_others ?? false,
|
||||||
|
allow_update_discount: category?.allow_update_discount ?? true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -294,6 +296,29 @@ export function CategoryDialog({
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="allow_update_discount"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem className="flex flex-row items-start space-x-3 space-y-0 rounded-lg border border-slate-200 dark:border-white/10 bg-slate-50 dark:bg-white/5 p-4">
|
||||||
|
<FormControl>
|
||||||
|
<Checkbox
|
||||||
|
checked={field.value}
|
||||||
|
onCheckedChange={field.onChange}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
<div className="space-y-1 leading-none">
|
||||||
|
<FormLabel className="text-slate-900 dark:text-white font-semibold cursor-pointer">
|
||||||
|
Update-Rabatt erlauben
|
||||||
|
</FormLabel>
|
||||||
|
<p className="text-xs text-slate-500 dark:text-slate-400">
|
||||||
|
Wenn aktiv, erhalten Kauf-Lizenzen dieser Kategorie den Update-Rabatt.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
<div className="grid grid-cols-2 gap-4">
|
<div className="grid grid-cols-2 gap-4">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ export type Category = {
|
|||||||
show_in_kauf?: boolean
|
show_in_kauf?: boolean
|
||||||
show_in_abo?: boolean
|
show_in_abo?: boolean
|
||||||
resets_others: boolean
|
resets_others: boolean
|
||||||
|
allow_update_discount?: boolean
|
||||||
created_at: string
|
created_at: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user