index.blade.php 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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="#addModal">
  9. Добавить
  10. </button>
  11. </div>
  12. </div>
  13. @include('partials.table', [
  14. 'id' => $id,
  15. 'header' => $header,
  16. 'strings' => $maf_orders,
  17. 'routeName' => 'maf_order.show',
  18. 'routeParam' => 'maf_order',
  19. ])
  20. <div class="row pt-3 px-3">
  21. <div class="col-12 pagination">
  22. {{ $maf_orders->links() }}
  23. </div>
  24. </div>
  25. <!-- Модальное окно добавления-->
  26. <div class="modal fade" id="addModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  27. <div class="modal-dialog modal-fullscreen-sm-down modal-lg">
  28. <div class="modal-content">
  29. <div class="modal-header">
  30. <h1 class="modal-title fs-5" id="addModalLabel">Добавить заказ МАФ</h1>
  31. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
  32. </div>
  33. <div class="modal-body">
  34. <form action="{{ route('maf_order.store') }}" method="post">
  35. @csrf
  36. <div id="select_maf_form">
  37. <input type="text" class="form-control mb-2" placeholder="Поиск номенклатуры" id="search_maf">
  38. <select id="select_maf" class="form-select mb-3" multiple></select>
  39. </div>
  40. <div style="display:none;" id="sku_form">
  41. <a href="#" onclick="$('#sku_form').slideUp(); $('#select_maf_form').slideDown()">назад</a>
  42. <input type="hidden" id="product_id" name="product_id" value="">
  43. @include('partials.input', ['name' => 'product_name', 'title' => 'МАФ', 'disabled' => true])
  44. @include('partials.input', ['name' => 'order_number', 'title' => 'Номер заказа', 'required' => false])
  45. @include('partials.input', ['name' => 'quantity', 'title' => 'Количество', 'required' => true, 'min' => 1])
  46. @include('partials.submit', ['name' => 'Добавить'])
  47. </div>
  48. </form>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. @if($errors->count())
  54. @dump($errors)
  55. @endif
  56. @endsection
  57. @push('scripts')
  58. <script type="module">
  59. $('#select_maf').on('change', function () {
  60. $('#product_id').val($(this).val());
  61. $('#product_name').val($('#select_maf option:selected').text()).slideDown();
  62. $('#select_maf_form').slideUp();
  63. $('#sku_form').slideDown();
  64. });
  65. </script>
  66. @endpush