feat: support product quantity and separate steps
All checks were successful
Staging Build / build (push) Successful in 6m17s

This commit is contained in:
DanielS
2026-07-09 15:10:21 +02:00
parent 071e669b71
commit 4ef21ea144
6 changed files with 396 additions and 259 deletions

View File

@@ -58,6 +58,7 @@ const productSchema = z.object({
billing_interval: z.enum(['one_time', 'monthly']).default('monthly'),
show_in_kauf: z.boolean().default(true),
show_in_abo: z.boolean().default(true),
has_quantity: z.boolean().default(false),
requirements: z.array(z.string()).default([]),
exclusions: z.array(z.string()).default([]),
modules: z.array(moduleSchema).default([]),
@@ -91,6 +92,7 @@ export function CreateProductDialog({
billing_interval: product?.billing_interval || 'monthly',
show_in_kauf: product ? (product.show_in_kauf ?? true) : true,
show_in_abo: product ? (product.show_in_abo ?? true) : true,
has_quantity: product ? (product.has_quantity ?? false) : false,
requirements: product?.requirements || [],
exclusions: product?.exclusions || [],
modules: product?.modules?.map(m => ({
@@ -238,7 +240,7 @@ export function CreateProductDialog({
)}
/>
<div className="grid grid-cols-2 gap-4">
<div className="grid grid-cols-3 gap-4">
<FormField
control={form.control}
name="show_in_kauf"
@@ -251,8 +253,8 @@ export function CreateProductDialog({
/>
</FormControl>
<div className="space-y-1 leading-none">
<FormLabel className="text-slate-900 dark:text-white font-medium cursor-pointer">In Kauf-Auswahl anzeigen</FormLabel>
<FormDescription className="text-xs text-slate-500">Produkt im Kauf-Zweig anzeigen</FormDescription>
<FormLabel className="text-slate-900 dark:text-white font-medium cursor-pointer text-xs">In Kauf anzeigen</FormLabel>
<FormDescription className="text-[10px] text-slate-500">Produkt im Kauf anzeigen</FormDescription>
</div>
</FormItem>
)}
@@ -269,8 +271,26 @@ export function CreateProductDialog({
/>
</FormControl>
<div className="space-y-1 leading-none">
<FormLabel className="text-slate-900 dark:text-white font-medium cursor-pointer">In Abo-Auswahl anzeigen</FormLabel>
<FormDescription className="text-xs text-slate-500">Produkt im Abo-Zweig anzeigen</FormDescription>
<FormLabel className="text-slate-900 dark:text-white font-medium cursor-pointer text-xs">In Abo anzeigen</FormLabel>
<FormDescription className="text-[10px] text-slate-500">Produkt im Abo anzeigen</FormDescription>
</div>
</FormItem>
)}
/>
<FormField
control={form.control}
name="has_quantity"
render={({ field }) => (
<FormItem className="flex flex-row items-start space-x-3 space-y-0 rounded-md border p-4 bg-slate-50 dark:bg-white/5 border-slate-200 dark:border-white/10">
<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-medium cursor-pointer text-xs">Mengeneingabe</FormLabel>
<FormDescription className="text-[10px] text-slate-500">Mengeneingabe erlauben</FormDescription>
</div>
</FormItem>
)}