edit.blade.php 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. @extends('layouts.app')
  2. @section('content')
  3. <div class="px-3">
  4. <form class="row" action="{{ route('order.store') }}" method="post">
  5. <div class="col-xxl-6">
  6. <h4>Общая информация об объекте</h4>
  7. @csrf
  8. @if(isset($order))
  9. <input type="hidden" name="id" value="{{ $order->id }}">
  10. @endif
  11. @include('partials.select', ['name' => 'district_id', 'title' => 'Округ', 'options' => $districts, 'value' => $order?->district_id ?? old('district_id'), 'first_empty' => true, 'required' => true])
  12. @include('partials.select', ['name' => 'area_id', 'title' => 'Район', 'options' => $areas, 'value' => $order?->area_id ?? old('area_id'), 'required' => true, 'first_empty' => true])
  13. @include('partials.input', ['name' => 'object_address', 'title' => 'Адрес объекта', 'value' => $order->object_address ?? old('object_address'), 'required' => true])
  14. @include('partials.select', ['name' => 'object_type_id', 'title' => 'Тип объекта', 'options' => $objectTypes, 'value' => $order->object_type_id ?? old('object_type_id'), 'required' => true, 'first_empty' => true])
  15. @include('partials.select', ['name' => 'order_status_id', 'title' => 'Статус', 'options' => $orderStatuses, 'value' => $order->order_status_id ?? old('order_status_id'), 'required' => true])
  16. @include('partials.input', ['name' => 'contract_date', 'title' => 'Дата договора', 'type' => 'date', 'value' => $order->contract_date ?? old('contract_date')])
  17. @include('partials.input', ['name' => 'contract_number', 'title' => 'Номер договора', 'value' => $order->contract_number ?? old('contract_number')])
  18. @include('partials.textarea', ['name' => 'comment', 'title' => 'Комментарий', 'value' => $order->comment ?? old('comment')])
  19. @include('partials.input', ['name' => 'installation_date', 'title' => 'Дата выхода на монтаж', 'type' => 'date', 'value' => $order->installation_date ?? old('installation_date')])
  20. @include('partials.select', ['name' => 'brigadier_id', 'title' => 'Бригадир', 'options' => $brigadiers, 'value' => $order->brigadier_id ?? old('brigadier_id')])
  21. @include('partials.select', ['name' => 'user_id', 'title' => 'Менеджер', 'options' => $users, 'value' => $order->user_id ?? old('user_id') ?? auth()->user()->id])
  22. @include('partials.input', ['name' => 'tg_group_name', 'title' => 'Название группы в ТГ', 'value' => $order->tg_group_name ?? old('tg_group_name')])
  23. @include('partials.input', ['name' => 'tg_group_link', 'title' => 'Ссылка на группу в ТГ', 'value' => $order->tg_group_link ?? old('tg_group_link')])
  24. </div>
  25. <div class="col-xxl-6">
  26. <h4>МАФ</h4>
  27. @include('partials.input', ['name' => 'search_maf', 'title' => 'Поиск МАФ', 'value' => '', 'placeholder' => 'Артикул или номер номенклатуры', 'datalist' => []])
  28. </div>
  29. <div class="col-12 text-end">
  30. @include('partials.submit')
  31. </div>
  32. </form>
  33. </div>
  34. @if($errors->any())
  35. @dump($errors->all())
  36. @endif
  37. @endsection
  38. @push('scripts')
  39. <script type="module">
  40. $('#search_maf').on('keyup', function () {
  41. // search products on backend
  42. $.get('{{ route('product.search') }}?s=' + $(this).val(),
  43. function (data) {
  44. $('#dl-search_maf').children().remove();
  45. $.each(data, function (id, name) {
  46. $('#dl-search_maf').append('<option value=\'' + name + '\'>' + id + '</option>');
  47. });
  48. console.log(data);
  49. }
  50. );
  51. })
  52. $('#district_id').on('change', function () {
  53. // load areas of selected district
  54. console.log($(this).val());
  55. $.get('{{ route('area.ajax-get-areas-by-district') }}/' + $(this).val(),
  56. function (data) {
  57. $('#area_id').children().remove();
  58. $.each(data, function (id, name) {
  59. $('#area_id').append('<option value=\'' + id + '\'>' + name + '</option>');
  60. });
  61. console.log(data);
  62. }
  63. );
  64. });
  65. </script>
  66. @endpush