From 52881cf3024279b5bc49ee058f039278cc53a183 Mon Sep 17 00:00:00 2001 From: Bivekich Date: Fri, 1 Aug 2025 11:28:28 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=BD=D0=BE=D0=B2=D1=8B=D0=B5=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=B2=20=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB=D1=8C=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B4=D1=83=D0=BA=D1=82=D0=B0=20=D0=B8=20?= =?UTF-8?q?=D1=84=D0=BE=D1=80=D0=BC=D1=83=20=D0=B4=D0=BB=D1=8F=20=D1=83?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=81?= =?UTF-8?q?=D0=BA=D0=BB=D0=B0=D0=B4=D0=BE=D0=BC:=20=D1=86=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=B7=D0=B0=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=BB=D0=B5?= =?UTF-8?q?=D0=BA=D1=82,=20=D0=BA=D0=BE=D0=BB=D0=B8=D1=87=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D0=B2=D0=BE=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=BB=D0=B5=D0=BA?= =?UTF-8?q?=D1=82=D0=BE=D0=B2,=20=D0=B0=20=D1=82=D0=B0=D0=BA=D0=B6=D0=B5?= =?UTF-8?q?=20=D0=BF=D0=BE=D0=BB=D1=8F=20=D0=B4=D0=BB=D1=8F=20=D1=83=D1=87?= =?UTF-8?q?=D0=B5=D1=82=D0=B0=20=D0=B4=D0=B2=D0=B8=D0=B6=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D1=82=D0=BE=D0=B2=D0=B0=D1=80=D0=BE=D0=B2=20(=D0=B7?= =?UTF-8?q?=D0=B0=D0=BA=D0=B0=D0=B7=D0=B0=D0=BD=D0=BE,=20=D0=B2=20=D0=BF?= =?UTF-8?q?=D1=83=D1=82=D0=B8,=20=D0=BE=D1=81=D1=82=D0=B0=D1=82=D0=BE?= =?UTF-8?q?=D0=BA,=20=D0=BF=D1=80=D0=BE=D0=B4=D0=B0=D0=BD=D0=BE).=20=D0=9E?= =?UTF-8?q?=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B=20GraphQL=20?= =?UTF-8?q?=D1=80=D0=B5=D0=B7=D0=BE=D0=BB=D0=B2=D0=B5=D1=80=D1=8B=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=BF=D0=BE=D0=B4=D0=B4=D0=B5=D1=80=D0=B6=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=BD=D0=BE=D0=B2=D1=8B=D1=85=20=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D0=B5=D0=B9.=20=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=20=D0=B8=D0=BD=D1=82=D0=B5?= =?UTF-8?q?=D1=80=D1=84=D0=B5=D0=B9=D1=81=20=D1=84=D0=BE=D1=80=D0=BC=D1=8B?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20=D1=83=D0=BB=D1=83=D1=87=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D1=82=D0=B5=D0=BB=D1=8C=D1=81=D0=BA=D0=BE=D0=B3=D0=BE=20?= =?UTF-8?q?=D0=BE=D0=BF=D1=8B=D1=82=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prisma/schema.prisma | 6 + src/components/warehouse/product-form.tsx | 687 +++++++++--------- .../warehouse/warehouse-dashboard.tsx | 16 +- src/graphql/resolvers.ts | 24 + 4 files changed, 366 insertions(+), 367 deletions(-) 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 && ( -

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

- )} -
-
- -
- -