index.blade.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. @extends('layouts.app')
  2. @section('content')
  3. <div class="row mb-3 catalog">
  4. <div class="col-md-6">
  5. <h3>Каталог</h3>
  6. </div>
  7. <div class="col-md-6 text-end">
  8. @if(hasRole('admin'))
  9. <button type="button" class="btn btn-sm mb-1 btn-primary" data-bs-toggle="modal" data-bs-target="#importModal">
  10. Импорт
  11. </button>
  12. <button type="button" class="btn btn-sm mb-1 btn-primary" data-bs-toggle="modal" data-bs-target="#exportModal">
  13. Экспорт
  14. </button>
  15. <a href="{{ route('catalog.create') }}" class="btn btn-sm mb-1 btn-primary">Добавить</a>
  16. @endif
  17. </div>
  18. </div>
  19. @include('partials.table', [
  20. 'id' => $id,
  21. 'header' => $header,
  22. 'strings' => $products,
  23. 'routeName' => 'catalog.show',
  24. 'routeParam' => 'product',
  25. ])
  26. @include('partials.pagination', ['items' => $products])
  27. <!-- Модальное окно импорта-->
  28. <div class="modal fade" id="importModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  29. <div class="modal-dialog modal-fullscreen-sm-down">
  30. <div class="modal-content">
  31. <div class="modal-header">
  32. <h1 class="modal-title fs-5" id="exampleModalLabel">Выберите файл для импорта</h1>
  33. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
  34. </div>
  35. <div class="modal-body">
  36. <form action="{{ route('catalog.import') }}" method="post" enctype="multipart/form-data">
  37. @csrf
  38. @include('partials.input', ['title' => 'XLSX файл', 'name' => 'import_file', 'type' => 'file', 'required' => true])
  39. @include('partials.submit', ['name' => 'Импорт'])
  40. </form>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. <!-- Модальное окно экспорта-->
  46. <div class="modal fade" id="exportModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  47. <div class="modal-dialog modal-fullscreen-sm-down modal-lg">
  48. <div class="modal-content">
  49. <div class="modal-header">
  50. <h1 class="modal-title fs-5" id="exampleModalLabel">Экспорт</h1>
  51. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
  52. </div>
  53. <div class="modal-body">
  54. <form action="{{ route('catalog.export') }}" method="post" enctype="multipart/form-data">
  55. @csrf
  56. @include('partials.checkbox', ['title' => 'С учётом текущего фильтра и поиска', 'name' => 'withFilter', 'type' => 'checkbox', 'value' => 'yes', 'checked' => false])
  57. <div class="d-none">
  58. @if(request()->s)
  59. @include('partials.input', ['name' => 'filters[s]', 'title' => 'поиск', 'value' => request()->s])
  60. @endif
  61. @if(request()->filters)
  62. @foreach(request()->filters as $filterName => $filterValue)
  63. @include('partials.input', ['name' => 'filters[' . $filterName .']', 'title' => $filterName, 'value' => $filterValue])
  64. @endforeach
  65. @endif
  66. </div>
  67. @include('partials.submit', ['name' => 'Экспорт'])
  68. </form>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. @if($errors->count())
  74. @dump($errors)
  75. @endif
  76. @endsection