index.blade.php 4.8 KB

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