Implement order data model modernization and license transformation logic
This commit is contained in:
@@ -29,7 +29,7 @@ import { Plus, Trash2, X, PlusCircle } from 'lucide-react'
|
||||
import { createProduct, updateProduct } from '@/lib/actions/products'
|
||||
import { ScrollArea } from '@/components/ui/scroll-area'
|
||||
import { Separator } from '@/components/ui/separator'
|
||||
import { Category } from '@/lib/types'
|
||||
import { Category, Product } from '@/lib/types'
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
@@ -52,7 +52,6 @@ const productSchema = z.object({
|
||||
description: z.string().optional(),
|
||||
base_price: z.coerce.number().min(0, 'Preis darf nicht negativ sein'),
|
||||
category_id: z.string().min(1, 'Bitte wählen Sie eine Kategorie'),
|
||||
is_active: z.boolean().default(true),
|
||||
billing_interval: z.enum(['one_time', 'monthly']).default('monthly'),
|
||||
modules: z.array(moduleSchema).default([]),
|
||||
})
|
||||
@@ -69,13 +68,12 @@ export function CreateProductDialog({ children, categories, product }: { childre
|
||||
description: product?.description || '',
|
||||
base_price: product?.base_price || 0,
|
||||
category_id: product?.category_id || '',
|
||||
is_active: product?.is_active ?? true,
|
||||
billing_interval: product?.billing_interval || 'monthly',
|
||||
modules: product?.modules?.map(m => ({
|
||||
name: m.name,
|
||||
description: m.description || '',
|
||||
price: m.price,
|
||||
is_required: m.is_required,
|
||||
is_required: false,
|
||||
requirements: m.requirements?.join(', ') || '',
|
||||
exclusions: m.exclusions?.join(', ') || '',
|
||||
})) || [],
|
||||
|
||||
Reference in New Issue
Block a user