edit.blade.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. @include('partials.input', ['name' => 'passport_name', 'title' => 'Наименование по паспорту', 'value' => $product->passport_name ?? ''])
  36. @include('partials.input', ['name' => 'statement_name', 'title' => 'Наименование в ведомости', 'value' => $product->statement_name ?? ''])
  37. </div>
  38. <div class="col-xl-6">
  39. @if($product->certificate)
  40. @include('partials.input', ['name' => 'cert', 'title' => 'Сертификат', 'value' => $product->certificate->original_name, 'disabled' => true])
  41. @endif
  42. @include('partials.input', ['name' => 'service_life', 'title' => 'Срок службы', 'type' => 'number', 'value' => $product->service_life])
  43. @include('partials.input', ['name' => 'certificate_number', 'title' => 'Номер сертификата', 'value' => $product->certificate_number])
  44. @include('partials.input', ['name' => 'certificate_date', 'title' => 'Дата сертификата', 'type' => 'date', 'value' => $product->certificate_date])
  45. @include('partials.input', ['name' => 'certificate_issuer', 'title' => 'Орган сертификации', 'value' => $product->certificate_issuer])
  46. @include('partials.input', ['name' => 'certificate_type', 'title' => 'Вид сертификации', 'value' => $product->certificate_type])
  47. <div class="row mb-2">
  48. <label for="note" class="col-form-label my-1">
  49. Примечание <sup>*</sup>
  50. </label>
  51. <div>
  52. <textarea name="note" id="note" rows="15" class="form-control @error('note') is-invalid @enderror" required>{{ old('note', $product->note ?? '') }}</textarea>
  53. @error('note')
  54. <span class="invalid-feedback" role="alert"><strong>{{ $message }}</strong></span>
  55. @enderror
  56. </div>
  57. </div>
  58. </div>
  59. <div class="col-12">
  60. @include('partials.submit', ['deleteDisabled' => (!isset($product) || $product->hasRelations()), 'offset' => 6, 'delete' => ['form_id' => 'deleteProduct']])
  61. </div>
  62. </div>
  63. </form>
  64. @if($product)
  65. <div class="visually-hidden">
  66. <form action="{{ route('catalog.delete', $product) }}" method="POST" id="deleteProduct">
  67. @csrf
  68. @method('DELETE')
  69. </form>
  70. </div>
  71. @endif
  72. </div>
  73. </div>
  74. @if($errors->any())
  75. @dump($errors)
  76. @endif
  77. @endsection