diff --git a/prisma/schema.prisma b/prisma/schema.prisma index ab75f3c..00c9328 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -232,6 +232,7 @@ model Product { description String? price Decimal @db.Decimal(12, 2) quantity Int @default(0) + type ProductType @default(PRODUCT) categoryId String? brand String? color String? @@ -438,6 +439,11 @@ enum WildberriesSupplyStatus { CANCELLED } +enum ProductType { + PRODUCT + CONSUMABLE +} + model Logistics { id String @id @default(cuid()) fromLocation String diff --git a/src/components/warehouse/product-card.tsx b/src/components/warehouse/product-card.tsx index f27d5a4..0a1b23d 100644 --- a/src/components/warehouse/product-card.tsx +++ b/src/components/warehouse/product-card.tsx @@ -18,6 +18,7 @@ interface Product { description: string price: number quantity: number + type: 'PRODUCT' | 'CONSUMABLE' category: { id: string; name: string } | null brand: string color: string @@ -180,13 +181,26 @@ export function ProductCard({ product, onEdit, onDeleted }: ProductCardProps) { {/* Дополнительная информация */}
- {product.category && ( -
+
+ {/* Тип товара */} + + {product.type === 'PRODUCT' ? 'Товар' : 'Расходник'} + + + {/* Категория */} + {product.category && ( {product.category.name} -
- )} + )} +
{product.brand && ( diff --git a/src/components/warehouse/product-form.tsx b/src/components/warehouse/product-form.tsx index dfb874d..fef8b52 100644 --- a/src/components/warehouse/product-form.tsx +++ b/src/components/warehouse/product-form.tsx @@ -20,6 +20,7 @@ interface Product { description: string price: number quantity: number + type: 'PRODUCT' | 'CONSUMABLE' category: { id: string; name: string } | null brand: string color: string @@ -45,6 +46,7 @@ export function ProductForm({ product, onSave, onCancel }: ProductFormProps) { description: product?.description || '', price: product?.price || 0, quantity: product?.quantity || 0, + type: product?.type || 'PRODUCT' as 'PRODUCT' | 'CONSUMABLE', categoryId: product?.category?.id || 'none', brand: product?.brand || '', color: product?.color || '', @@ -183,6 +185,7 @@ export function ProductForm({ product, onSave, onCancel }: ProductFormProps) { description: formData.description || undefined, price: formData.price, quantity: formData.quantity, + type: formData.type, categoryId: formData.categoryId && formData.categoryId !== 'none' ? formData.categoryId : undefined, brand: formData.brand || undefined, color: formData.color || undefined, @@ -258,6 +261,28 @@ export function ProductForm({ product, onSave, onCancel }: ProductFormProps) { />
+
+ + +
+