edit.blade.php 5.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. <div class="row mb-2">
  43. <label for="note" class="col-form-label my-1">
  44. Примечание <sup>*</sup>
  45. </label>
  46. <div>
  47. <textarea name="note" id="note" rows="15" class="form-control @error('note') is-invalid @enderror" required>{{ old('note', $product->note ?? '') }}</textarea>
  48. @error('note')
  49. <span class="invalid-feedback" role="alert"><strong>{{ $message }}</strong></span>
  50. @enderror
  51. </div>
  52. </div>
  53. </div>
  54. <div class="col-12">
  55. @include('partials.submit', ['deleteDisabled' => (!isset($product) || $product->hasRelations()), 'offset' => 6, 'delete' => ['form_id' => 'deleteProduct']])
  56. </div>
  57. </div>
  58. </form>
  59. @if($product)
  60. <div class="visually-hidden">
  61. <form action="{{ route('catalog.delete', $product) }}" method="POST" id="deleteProduct">
  62. @csrf
  63. @method('DELETE')
  64. </form>
  65. </div>
  66. @endif
  67. </div>
  68. </div>
  69. @if($errors->any())
  70. @dump($errors)
  71. @endif
  72. @endsection