index.blade.php 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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('import.create') }}" method="post" enctype="multipart/form-data">
  37. @csrf
  38. <input type="hidden" name="type" value="catalog">
  39. @include('partials.input', ['title' => 'XLSX файл', 'name' => 'import_file', 'type' => 'file', 'required' => true])
  40. @include('partials.submit', ['name' => 'Импорт'])
  41. </form>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. <!-- Модальное окно экспорта-->
  47. <div class="modal fade" id="exportModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  48. <div class="modal-dialog modal-fullscreen-sm-down modal-lg">
  49. <div class="modal-content">
  50. <div class="modal-header">
  51. <h1 class="modal-title fs-5" id="exampleModalLabel">Экспорт</h1>
  52. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
  53. </div>
  54. <div class="modal-body">
  55. <form action="{{ route('catalog.export') }}" method="post" enctype="multipart/form-data">
  56. @csrf
  57. @include('partials.checkbox', ['title' => 'С учётом текущего фильтра и поиска', 'name' => 'withFilter', 'type' => 'checkbox', 'value' => 'yes', 'checked' => false])
  58. <div class="d-none">
  59. @if(request()->s)
  60. @include('partials.input', ['name' => 'filters[s]', 'title' => 'поиск', 'value' => request()->s])
  61. @endif
  62. @if(request()->filters)
  63. @foreach(request()->filters as $filterName => $filterValue)
  64. @include('partials.input', ['name' => 'filters[' . $filterName .']', 'title' => $filterName, 'value' => $filterValue])
  65. @endforeach
  66. @endif
  67. </div>
  68. @include('partials.submit', ['name' => 'Экспорт'])
  69. </form>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. @if($errors->count())
  75. @dump($errors)
  76. @endif
  77. @endsection