edit.blade.php 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 ?? old('district_id'), 'first_empty' => true, 'required' => true])
  11. @include('partials.select', ['name' => 'area_id', 'title' => 'Район', 'options' => $areas, 'value' => $order?->area_id ?? old('area_id'), 'required' => true, 'first_empty' => true])
  12. @include('partials.input', ['name' => 'object_address', 'title' => 'Адрес объекта', 'value' => $order->object_address ?? old('object_address'), 'required' => true])
  13. @include('partials.select', ['name' => 'object_type_id', 'title' => 'Тип объекта', 'options' => $objectTypes, 'value' => $order->object_type_id ?? old('object_type_id'), 'required' => true, 'first_empty' => true])
  14. @include('partials.select', ['name' => 'order_status_id', 'title' => 'Статус', 'options' => $orderStatuses, 'value' => $order->order_status_id ?? old('order_status_id'), 'required' => true])
  15. @include('partials.input', ['name' => 'contract_date', 'title' => 'Дата договора', 'type' => 'date', 'value' => $order->contract_date ?? old('contract_date')])
  16. @include('partials.input', ['name' => 'contract_number', 'title' => 'Номер договора', 'value' => $order->contract_number ?? old('contract_number')])
  17. @include('partials.textarea', ['name' => 'comment', 'title' => 'Комментарий', 'value' => $order->comment ?? old('comment')])
  18. @include('partials.input', ['name' => 'installation_date', 'title' => 'Дата выхода на монтаж', 'type' => 'date', 'value' => $order->installation_date ?? old('installation_date')])
  19. @include('partials.select', ['name' => 'brigadier_id', 'title' => 'Бригадир', 'options' => $brigadiers, 'value' => $order->brigadier_id ?? old('brigadier_id')])
  20. @include('partials.select', ['name' => 'user_id', 'title' => 'Менеджер', 'options' => $users, 'value' => $order->user_id ?? old('user_id') ?? auth()->user()->id])
  21. @include('partials.input', ['name' => 'tg_group_name', 'title' => 'Название группы в ТГ', 'value' => $order->tg_group_name ?? old('tg_group_name')])
  22. @include('partials.input', ['name' => 'tg_group_link', 'title' => 'Ссылка на группу в ТГ', 'value' => $order->tg_group_link ?? old('tg_group_link')])
  23. @include('partials.submit')
  24. </form>
  25. </div>
  26. </div>
  27. @if($errors->any())
  28. @dump($errors->all())
  29. @endif
  30. @endsection
  31. @push('scripts')
  32. <script type="module">
  33. $('#district_id').on('change', function () {
  34. // load areas of selected district
  35. console.log($(this).val());
  36. $.get('{{ route('area.ajax-get-areas-by-district') }}/'+$(this).val(),
  37. function (data) {
  38. $('#area_id').children().remove();
  39. $.each(data, function (id, name) {
  40. $('#area_id').append('<option value=\'' + id + '\'>' + name + '</option>');
  41. });
  42. console.log(data);
  43. }
  44. );
  45. });
  46. </script>
  47. @endpush