edit.blade.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. @extends('layouts.app')
  2. @section('content')
  3. <div class="px-3">
  4. <div class="row mb-2">
  5. <div class="col-6">
  6. <h3>МАФ {{ $product->common_name ?? 'Новый МАФ' }}</h3>
  7. </div>
  8. <div class="col-6 text-end">
  9. @if(isset($product))
  10. <button class="btn btn-sm text-success" onclick="$('#upl-cert').trigger('click');"><i class="bi bi-plus-circle-fill"></i> Загрузить сертификат</button>
  11. <form action="{{ route('catalog.upload-certificate', $product) }}" class="visually-hidden" method="POST" enctype="multipart/form-data">
  12. @csrf
  13. <input type="file" name="certificate" onchange="$(this).parent().submit()" required id="upl-cert" />
  14. </form>
  15. @endif
  16. </div>
  17. </div>
  18. <div class="">
  19. <form action="{{ ($product) ? route('catalog.update', $product) : route('catalog.store') }}" method="post">
  20. @csrf
  21. <div class="row">
  22. <div class="col-xl-6">
  23. @include('partials.input', ['name' => 'article', 'title' => 'Артикул', 'required' => true, 'value' => $product->article ?? ''])
  24. @include('partials.input', ['name' => 'nomenclature_number', 'title' => 'Номер номенклатуры', 'required' => true, 'value' => $product->nomenclature_number ?? ''])
  25. @include('partials.input', ['name' => 'name_tz', 'title' => 'Наименование по ТЗ', 'required' => true, 'value' => $product->name_tz ?? ''])
  26. @include('partials.input', ['name' => 'type_tz', 'title' => 'Тип по ТЗ', 'required' => true, 'value' => $product->type_tz ?? ''])
  27. @include('partials.input', ['name' => 'unit', 'title' => 'Ед. изм.', 'required' => true, 'value' => $product->unit ?? ''])
  28. @include('partials.input', ['name' => 'manufacturer', 'title' => 'Производитель', 'required' => true, 'value' => $product->manufacturer ?? ''])
  29. @include('partials.input', ['name' => 'type', 'title' => 'Тип', 'required' => true, 'value' => $product->type ?? ''])
  30. @include('partials.input', ['name' => 'manufacturer_name', 'title' => 'Наименование производителя', 'required' => true, 'value' => $product->manufacturer_name ?? ''])
  31. @include('partials.input', ['name' => 'sizes', 'title' => 'Размеры', 'required' => true, 'value' => $product->sizes ?? ''])
  32. @include('partials.input', ['name' => 'product_price', 'type' => 'number', 'title' => 'Цена товара', 'required' => true, 'value' => $product->product_price ?? ''])
  33. @include('partials.input', ['name' => 'installation_price', 'type' => 'number', 'title' => 'Цена установки', 'required' => true, 'value' => $product->installation_price ?? ''])
  34. @include('partials.input', ['name' => 'total_price', 'type' => 'number', 'title' => 'Итоговая цена', 'required' => true, 'value' => $product->total_price ?? ''])
  35. </div>
  36. <div class="col-xl-6">
  37. @if($product->certificate)
  38. @include('partials.input', ['name' => 'cert', 'title' => 'Сертификат', 'value' => $product->certificate->original_name, 'disabled' => true])
  39. @endif
  40. <div class="row mb-2">
  41. <label for="note" class="col-form-label my-1">
  42. Примечание <sup>*</sup>
  43. </label>
  44. <div>
  45. <textarea name="note" id="note" rows="15" class="form-control @error('note') is-invalid @enderror" required>{{ old('note', $product->note ?? '') }}</textarea>
  46. @error('note')
  47. <span class="invalid-feedback" role="alert"><strong>{{ $message }}</strong></span>
  48. @enderror
  49. </div>
  50. </div>
  51. </div>
  52. <div class="col-12">
  53. @include('partials.submit', ['deleteDisabled' => (!isset($product) || $product->hasRelations()), 'offset' => 6, 'delete' => ['form_id' => 'deleteProduct']])
  54. </div>
  55. </div>
  56. </form>
  57. @if($product)
  58. <div class="visually-hidden">
  59. <form action="{{ route('catalog.delete', $product) }}" method="POST" id="deleteProduct">
  60. @csrf
  61. @method('DELETE')
  62. </form>
  63. </div>
  64. @endif
  65. </div>
  66. </div>
  67. @if($errors->any())
  68. @dump($errors)
  69. @endif
  70. @endsection