index.blade.php 4.6 KB

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