index.blade.php 3.9 KB

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