index.blade.php 3.0 KB

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