Alexander Musikhin 7 mēneši atpakaļ
vecāks
revīzija
8de7eb3779

+ 1 - 0
app/Http/Controllers/ProductController.php

@@ -23,6 +23,7 @@ class ProductController extends Controller
             'article'                   => 'Артикул',
             'nomenclature_number'       => 'Номер номенклатуры',
             'manufacturer'              => 'Производитель',
+            'unit'                      => 'Ед. изм.',
             'name_tz'                   => 'Наименование ТЗ',
             'type_tz'                   => 'Тип по ТЗ',
             'type'                      => 'Тип',

+ 2 - 0
app/Http/Requests/StoreProductRequest.php

@@ -27,6 +27,8 @@ class StoreProductRequest extends FormRequest
             'type_tz'               => 'required|string',
             'nomenclature_number'   => 'required|string',
             'sizes'                 => 'required|string',
+            'manufacturer'          => 'required|string',
+            'unit'                  => 'required|string',
             'type'                  => 'required|string',
             'product_price'         => 'required|numeric',
             'installation_price'    => 'required|numeric',

+ 2 - 0
app/Models/Product.php

@@ -25,6 +25,8 @@ class Product extends Model
         'type_tz',
         'nomenclature_number',
         'sizes',
+        'manufacturer',
+        'unit',
         'type',
         'product_price',
         'installation_price',

+ 33 - 14
resources/views/catalog/edit.blade.php

@@ -2,25 +2,44 @@
 
 @section('content')
     <div class="px-3">
-        <div class="col-xxl-6 offset-xxl-2">
+        <div class="">
             <form action="{{ ($product) ? route('catalog.update', $product) : route('catalog.store') }}" method="post">
 
                 @csrf
+                <div class="row">
+                    <div class="col-xl-6">
+                        @include('partials.input', ['name' => 'article', 'title' => 'Артикул', 'required' => true, 'value' => $product->article ?? ''])
+                        @include('partials.input', ['name' => 'nomenclature_number', 'title' => 'Номер номенклатуры', 'required' => true, 'value' => $product->nomenclature_number ?? ''])
+                        @include('partials.input', ['name' => 'name_tz', 'title' => 'Наименование по ТЗ', 'required' => true, 'value' => $product->name_tz ?? ''])
+                        @include('partials.input', ['name' => 'type_tz', 'title' => 'Тип по ТЗ', 'required' => true, 'value' => $product->type_tz ?? ''])
+                        @include('partials.input', ['name' => 'unit', 'title' => 'Ед. изм.', 'required' => true, 'value' => $product->unit ?? ''])
+                        @include('partials.input', ['name' => 'manufacturer', 'title' => 'Производитель', 'required' => true, 'value' => $product->manufacturer ?? ''])
+                        @include('partials.input', ['name' => 'type', 'title' => 'Тип', 'required' => true, 'value' => $product->type ?? ''])
+                        @include('partials.input', ['name' => 'manufacturer_name', 'title' => 'Наименование производителя', 'required' => true, 'value' => $product->manufacturer_name ?? ''])
+                        @include('partials.input', ['name' => 'sizes', 'title' => 'Размеры', 'required' => true, 'value' => $product->sizes ?? ''])
+                        @include('partials.input', ['name' => 'product_price', 'type' => 'number', 'title' => 'Цена товара', 'required' => true, 'value' => $product->product_price ?? ''])
+                        @include('partials.input', ['name' => 'installation_price', 'type' => 'number', 'title' => 'Цена установки', 'required' => true, 'value' => $product->installation_price ?? ''])
+                        @include('partials.input', ['name' => 'total_price', 'type' => 'number', 'title' => 'Итоговая цена', 'required' => true, 'value' => $product->total_price ?? ''])
 
-                @include('partials.input', ['name' => 'article', 'title' => 'Артикул', 'required' => true, 'value' => $product->article ?? ''])
-                @include('partials.input', ['name' => 'nomenclature_number', 'title' => 'Номер номенклатуры', 'required' => true, 'value' => $product->nomenclature_number ?? ''])
-                @include('partials.input', ['name' => 'name_tz', 'title' => 'Наименование по ТЗ', 'required' => true, 'value' => $product->name_tz ?? ''])
-                @include('partials.input', ['name' => 'type_tz', 'title' => 'Тип по ТЗ', 'required' => true, 'value' => $product->type_tz ?? ''])
-                @include('partials.input', ['name' => 'type', 'title' => 'Тип', 'required' => true, 'value' => $product->type ?? ''])
-                @include('partials.input', ['name' => 'manufacturer_name', 'title' => 'Наименование производителя', 'required' => true, 'value' => $product->manufacturer_name ?? ''])
-                @include('partials.input', ['name' => 'sizes', 'title' => 'Размеры', 'required' => true, 'value' => $product->sizes ?? ''])
-                @include('partials.input', ['name' => 'product_price', 'type' => 'number', 'title' => 'Цена товара', 'required' => true, 'value' => $product->product_price ?? ''])
-                @include('partials.input', ['name' => 'installation_price', 'type' => 'number', 'title' => 'Цена установки', 'required' => true, 'value' => $product->installation_price ?? ''])
-                @include('partials.input', ['name' => 'total_price', 'type' => 'number', 'title' => 'Итоговая цена', 'required' => true, 'value' => $product->total_price ?? ''])
-                @include('partials.textarea', ['name' => 'note', 'size' => 10, 'title' => 'Примечания', 'required' => true, 'value' => $product->note ?? ''])
-
+                    </div>
+                    <div class="col-xl-6">
+                        <div class="row mb-2">
+                            <label for="note" class="col-form-label my-1">
+                                Примечание <sup>*</sup>
+                            </label>
+                            <div>
+                                <textarea name="note" id="note" rows="15" class="form-control @error('note') is-invalid @enderror" required>{{ old('note', $product->note ?? '') }}</textarea>
+                                @error('note')
+                                    <span class="invalid-feedback" role="alert"><strong>{{ $message }}</strong></span>
+                                @enderror
+                            </div>
+                        </div>
+                    </div>
+                    <div class="col-12">
+                        @include('partials.submit', ['deleteDisabled' => (!isset($product)), 'offset' => 6, 'delete' => ['form_id' => 'deleteProduct']])
+                    </div>
+                </div>
 
-                @include('partials.submit', ['deleteDisabled' => (!isset($product)), 'delete' => ['form_id' => 'deleteProduct']])
             </form>
             @if($product)
                 <div class="visually-hidden">

+ 2 - 2
routes/web.php

@@ -62,8 +62,8 @@ Route::middleware('auth:web')->group(function () {
     Route::post('catalog/{product}', [ProductController::class, 'update'])->name('catalog.update');
     Route::delete('catalog/{product}', [ProductController::class, 'delete'])->name('catalog.delete');
 
-    Route::post('catalog/import', [ProductController::class, 'import'])->name('catalog.import');
-    Route::post('catalog/export', [ProductController::class, 'export'])->name('catalog.export');
+    Route::post('catalog-import', [ProductController::class, 'import'])->name('catalog.import');
+    Route::post('catalog-export', [ProductController::class, 'export'])->name('catalog.export');
 
     // contracts
     Route::get('contract', [ContractController::class, 'index'])->name('contract.index');