@extends('admin.layouts.container')

@section('content')
    <div class="side-title">
        <h3>{{ $head }}</h3>

    </div>
    <div class="border-item">
        <form class="form-row" method="post" onsubmit="saveForm(this)" action="{{ $action }}" enctype="multipart/form-data">
            @method('PUT')
            @csrf 
           <div class="form-group col-lg-6">
                <label>{{  __('chip_orders.status') }}  </label>
                <select name="status"  class="form-control ">
                    @foreach($statuses as $row)
                        <option value="{{$row}}">{{ __('orders.statuses.'.$row) }}</option>
                    @endforeach
                </select>
            </div>
            <div class="text-center mt-5 col-6">
                <button class="butn"><span>{{ __('dashboard.save') }}</span></button>
            </div>
            <div class="form-group col-lg-6">
                <label>{{  __('chip_orders.id') }}  </label>
                <input type="text" class="form-control " disabled value='{{ $order->id }}'/>
            </div>
            
            
            
            <div class="form-group col-lg-6">
                <label>{{  __('chip_orders.date') }}  </label>
                <input type="text" class="form-control " disabled
                       value='{{  date("Y/m/d g:i a",strtotime($order->created_at))  }}'/>
            </div>
            
            <div class="form-group col-lg-6">
                <label>{{  __('chip_orders.user') }}  </label>
                <input type="text" class="form-control " disabled value='{{ $order->user->name }}'/>
            </div>
            
            <div class="form-group col-lg-6">
                <label>{{  __('chip_orders.phone') }}  </label>
                <input type="text" class="form-control " disabled value='{{ $order->user->phone }}'/>
            </div>
            
            <div class="form-group col-lg-6">
                <label>{{  __('chip_orders.count_childs') }}  </label>
                <input type="text" class="form-control " disabled value='{{ $order->user->childs->count() }}'/>
            </div>
            <div class="form-group col-lg-6">
                <label>{{  __('chip_orders.address_description') }}  </label>
                <input type="text" class="form-control " disabled
                       value='{{ $order->address?->description ?? "" }}'/>
            </div>
            <div class="form-group col-lg-6">
                <label>{{  __('chip_orders.address_city') }}  </label>
                <input type="text" class="form-control " disabled
                       value='{{ $order->address?->city->currentDescription->title ?? "" }}'/>
            </div>
            <div class="form-group col-lg-12">
                <iframe
                    style='width:100%'
                    height="250"
                    frameborder="0"
                    scrolling="no"
                    marginheight="0"
                    marginwidth="0"
                    src="https://maps.google.com/maps?q={{$order->address->latitude.', '.$order->address->longitude}}&z=15&output=embed"
                >
                </iframe>
            </div>
            <div class="form-group col-lg-6">
                <label>{{  __('chip_orders.count_products') }}  </label>
                <input type="text" class="form-control " disabled value='{{  $order->products->count()  }}'/>
            </div>
            <div class="form-group col-lg-6">
                <label>{{  __('chip_orders.total_products') }}  </label>
                <input type="text" class="form-control " disabled value='{{  $order->total - $order->shipping_cost - $order->tax_cost  }}'/>
            </div>
            <div class="form-group col-lg-6">
                <label>{{  __('chip_orders.tax_cost') }}  </label>
                <input type="text" class="form-control " disabled value='{{  $order->tax_cost  }}'/>
            </div>
            <div class="form-group col-lg-6">
                <label>{{  __('chip_orders.shipping_cost') }}  </label>
                <input type="text" class="form-control " disabled value='{{  $order->shipping_cost  }}'/>
            </div>
            <div class="form-group col-lg-6">
                <label>{{  __('chip_orders.total') }}  </label>
                <input type="text" class="form-control " disabled value='{{  $order->total  }}'/>
            </div>

            <div class="col-lg-12">
                <h3>
                    {{__('chip_orders.products')}}
                </h3>
                <hr>
            </div>
            <div class="col-lg-12">
                @foreach($order->products as $key=>$row)
                    <div class="col-lg-12 pricing-list-item border-item mb-4"  style="background-color: rgba(21,97,203,0.1);height:auto">
                        <div class="row">
                            <div class="form-group col-lg-6">
                                <label>{{  __('chip_orders.product_name') }} </label>
                                <p class="form-control" style="height: auto">{{ $row->chip->currentDescription->title }} </p>
                            </div>
                            <div class="form-group col-lg-6">
                                <img src="{{asset($row->chip->image)}}" style="height:200px">
                            </div>
                            <div class="form-group col-lg-6">
                                <label>{{  __('chip_orders.count') }} </label>
                                <p class="form-control" style="height: auto">{{ $row->count}}</p>
                            </div>
                            <div class="form-group col-lg-6">
                                <label>{{  __('chip_orders.price') }} </label>
                                <p class="form-control" style="height: auto">{{ $row->price}}</p>
                            </div>
                        </div>
                    </div>
                @endforeach
            </div>
        </form>
    </div>

@endsection
@section('inner_js')
    <!-- Editor JS files -->
    {{--    <script src="{{ asset('/assets/admin/js/lib/tinymce.min.js') }}"></script>--}}
    <script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
    <script>
        let route_prefix = "{{ url(config('lfm.prefix')) }}",
            url = "{{url('/')}}/",
            currentLanguage = "{{getCurrentLocale()}}",
            imagePath = "{{asset('')}}";
    </script>
    <script src="{{ asset('assets/admin/js/editor.js') }}"></script>
    <script src="{{ asset('assets/admin/js/lfm.js') }}"></script>
    <script src="{{ asset('assets/admin/js/articles.js') }}"></script>
@endsection
