diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 6cbcbba..9475f65 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -236,7 +236,13 @@ model Product { article String description String? price Decimal @db.Decimal(12, 2) + pricePerSet Decimal? @db.Decimal(12, 2) quantity Int @default(0) + setQuantity Int? + ordered Int? + inTransit Int? + stock Int? + sold Int? type ProductType @default(PRODUCT) categoryId String? brand String? diff --git a/src/components/warehouse/product-form.tsx b/src/components/warehouse/product-form.tsx index dc3c395..ce6c007 100644 --- a/src/components/warehouse/product-form.tsx +++ b/src/components/warehouse/product-form.tsx @@ -25,7 +25,13 @@ interface Product { article: string; description: string; price: number; + pricePerSet?: number; quantity: number; + setQuantity?: number; + ordered?: number; + inTransit?: number; + stock?: number; + sold?: number; type: "PRODUCT" | "CONSUMABLE"; category: { id: string; name: string } | null; brand: string; @@ -226,6 +232,8 @@ export function ProductForm({ product, onSave, onCancel }: ProductFormProps) { return; } + console.log("📝 ФОРМА ДАННЫЕ ПЕРЕД ОТПРАВКОЙ:", formData); + try { const input = { name: formData.name, @@ -256,10 +264,12 @@ export function ProductForm({ product, onSave, onCancel }: ProductFormProps) { }; if (product) { - await updateProduct({ + console.log("📝 ОБНОВЛЕНИЕ ТОВАРА - ОТПРАВКА ЗАПРОСА:", input); + const result = await updateProduct({ variables: { id: product.id, input }, refetchQueries: ["GetMyProducts"], }); + console.log("📝 РЕЗУЛЬТАТ ОБНОВЛЕНИЯ ТОВАРА:", result); toast.success("Товар успешно обновлен"); } else { console.log("📝 СОЗДАНИЕ ТОВАРА - ОТПРАВКА ЗАПРОСА:", input); @@ -279,380 +289,341 @@ export function ProductForm({ product, onSave, onCancel }: ProductFormProps) { }; return ( -
- {/* Основная информация */} - -

Основная информация

-
-
- - handleInputChange("name", e.target.value)} - placeholder="iPhone 15 Pro Max" - className="glass-input text-white placeholder:text-white/40 h-10" - required - /> -
+ + {/* Верхняя часть - 2 колонки */} +
+ {/* Левая колонка */} +
+ {/* Основная информация */} + +

Основная информация

+
+
+ + handleInputChange("name", e.target.value)} + placeholder="iPhone 15 Pro Max" + className="glass-input text-white placeholder:text-white/40 h-8 text-sm" + required + /> +
-
- -
- { - handleInputChange("article", e.target.value); - handleInputChange("autoGenerateArticle", false); // Отключаем автогенерацию при ручном вводе - }} - placeholder="SF-T-123456-001" - className="glass-input text-white placeholder:text-white/40 h-10 flex-1" - required - readOnly={formData.autoGenerateArticle} - /> - {!product && ( - - )} -
- {formData.autoGenerateArticle && ( -

- Артикул генерируется автоматически -

- )} -
-
- -
- -