index.blade.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. @extends('layouts.app')
  2. @section('content')
  3. <div class="row mb-2 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,assistant_head'))
  12. <button type="button" class="btn btn-sm btn-outline-primary page-action-btn" data-bs-toggle="modal" data-bs-target="#setOrderInStockModal" aria-label="Весь заказ на складе">
  13. <i class="bi bi-box-seam page-action-btn__icon"></i>
  14. <span class="page-action-btn__label">Весь заказ на складе</span>
  15. </button>
  16. @endif
  17. <button type="button" class="btn btn-sm btn-primary page-action-btn" data-bs-toggle="modal" data-bs-target="#addModal" aria-label="Добавить">
  18. <i class="bi bi-plus-lg page-action-btn__icon"></i>
  19. <span class="page-action-btn__label">Добавить</span>
  20. </button>
  21. </div>
  22. </div>
  23. @include('partials.table', [
  24. 'id' => $id,
  25. 'header' => $header,
  26. 'strings' => $maf_orders,
  27. 'routeName' => 'maf_order.show',
  28. ])
  29. @include('partials.pagination', ['items' => $maf_orders])
  30. <!-- Модальное окно добавления-->
  31. <div class="modal fade" id="addModal" tabindex="-1" aria-labelledby="addModalLabel" aria-hidden="true">
  32. <div class="modal-dialog modal-fullscreen-sm-down modal-lg">
  33. <div class="modal-content">
  34. <div class="modal-header">
  35. <h1 class="modal-title fs-5" id="addModalLabel">Добавить заказ МАФ</h1>
  36. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
  37. </div>
  38. <div class="modal-body">
  39. <form action="{{ route('maf_order.store') }}" method="post">
  40. @csrf
  41. <div id="select_maf_form">
  42. <input type="text" class="form-control mb-2" placeholder="Поиск номенклатуры" id="search_maf">
  43. <select id="select_maf" class="form-select mb-3" multiple></select>
  44. </div>
  45. <div class="is-hidden" id="sku_form">
  46. <a href="#" onclick="$('#sku_form').slideUp(); $('#select_maf_form').slideDown()">назад</a>
  47. <input type="hidden" id="product_id" name="product_id" value="">
  48. @include('partials.input', ['name' => 'product_name', 'title' => 'МАФ', 'disabled' => true])
  49. @include('partials.input', ['name' => 'order_number', 'title' => 'Номер заказа', 'required' => false])
  50. @include('partials.input', ['name' => 'quantity', 'title' => 'Количество', 'required' => true, 'min' => 1])
  51. @include('partials.submit', ['name' => 'Добавить'])
  52. </div>
  53. </form>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. @if(hasRole('admin,assistant_head'))
  59. <div class="modal fade" id="setOrderInStockModal" tabindex="-1" aria-labelledby="setOrderInStockModalLabel" aria-hidden="true">
  60. <div class="modal-dialog">
  61. <div class="modal-content">
  62. <form action="{{ route('maf_order.set_order_in_stock') }}" method="post">
  63. @csrf
  64. <div class="modal-header">
  65. <h1 class="modal-title fs-5" id="setOrderInStockModalLabel">Отметить заказ как "На складе"</h1>
  66. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
  67. </div>
  68. <div class="modal-body">
  69. <label for="bulk_order_number" class="form-label">Номер заказа</label>
  70. <select class="form-select @error('bulk_order_number') is-invalid @enderror" id="bulk_order_number" name="bulk_order_number" required>
  71. <option value="">Выберите номер заказа</option>
  72. @foreach($order_numbers as $order_number)
  73. <option value="{{ $order_number }}" @selected(old('bulk_order_number') === $order_number)>{{ $order_number }}</option>
  74. @endforeach
  75. </select>
  76. @error('bulk_order_number')
  77. <div class="invalid-feedback d-block">{{ $message }}</div>
  78. @enderror
  79. </div>
  80. <div class="modal-footer">
  81. <button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">Отмена</button>
  82. <button type="submit" class="btn btn-primary btn-sm">Сменить статус на складе</button>
  83. </div>
  84. </form>
  85. </div>
  86. </div>
  87. </div>
  88. @endif
  89. @endsection
  90. @push('scripts')
  91. <script type="module">
  92. $('#select_maf').on('change', function () {
  93. $('#product_id').val($(this).val());
  94. $('#product_name').val($('#select_maf option:selected').text()).slideDown();
  95. $('#select_maf_form').slideUp();
  96. $('#sku_form').slideDown();
  97. });
  98. @if($errors->has('bulk_order_number') && hasRole('admin,assistant_head'))
  99. const setOrderInStockModalElement = document.getElementById('setOrderInStockModal');
  100. if (setOrderInStockModalElement) {
  101. const setOrderInStockModal = new bootstrap.Modal(setOrderInStockModalElement);
  102. setOrderInStockModal.show();
  103. }
  104. @endif
  105. </script>
  106. @endpush