edit.blade.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. @extends('layouts.app')
  2. @section('content')
  3. <div class="px-3">
  4. <div class="col-xxl-6 offset-xxl-2">
  5. <form action="{{ route('order.store') }}" method="post">
  6. @csrf
  7. @if(isset($order))
  8. <input type="hidden" name="id" value="{{ $order->id }}">
  9. @endif
  10. @include('partials.select', ['name' => 'district_id', 'title' => 'Округ', 'options' => $districts, 'value' => $order?->$district_id ?? null, 'first_empty' => true, 'required' => true])
  11. @include('partials.select', ['name' => 'area_id', 'title' => 'Район', 'options' => [] /* $areas */, 'value' => $order?->area_id ?? null, 'required' => true])
  12. @include('partials.input', ['name' => 'object_address', 'title' => 'Адрес объекта', 'value' => $order->object_address ?? '', 'required' => true])
  13. @include('partials.select', ['name' => 'object_type', 'title' => 'Тип объекта', 'options' => $objectTypes, 'value' => $order->object_type ?? null, 'required' => true, 'first_empty' => true])
  14. @include('partials.input', ['name' => 'contract_date', 'title' => 'Дата договора', 'type' => 'date', 'value' => $order->contract_date ?? ''])
  15. @include('partials.input', ['name' => 'contract_number', 'title' => 'Номер договора', 'value' => $order->contract_number ?? ''])
  16. @include('partials.textarea', ['name' => 'comment', 'title' => 'Комментарий', 'value' => $order->comment ?? ''])
  17. @include('partials.input', ['name' => 'installation_date', 'title' => 'Дата выхода на монтаж', 'type' => 'date', 'value' => $order->installation_date ?? ''])
  18. @include('partials.select', ['name' => 'brigadier', 'title' => 'Бригадир', 'options' => $brigadiers, 'value' => $order->brigadier ?? ''])
  19. @include('partials.input', ['name' => 'tg_group_name', 'title' => 'Группа в ТГ', 'value' => $order->tg_group_name ?? ''])
  20. @include('partials.submit')
  21. </form>
  22. </div>
  23. </div>
  24. @endsection
  25. @push('scripts')
  26. <script type="module">
  27. $('#district_id').on('change', function () {
  28. // load areas of selected district
  29. console.log($(this).val());
  30. $.get('{{ route('area.ajax-get-areas-by-district') }}/'+$(this).val(),
  31. function (data) {
  32. $('#area_id').children().remove();
  33. $.each(data, function (id, name) {
  34. $('#area_id').append('<option value=\'' + id + '\'>' + name + '</option>');
  35. });
  36. console.log(data);
  37. }
  38. );
  39. });
  40. </script>
  41. @endpush