@extends('store.layouts.container')

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


    <div class="border-item">
        <ul class="nav nav-pills bg-nav-pills nav-justified mb-3">
            <li class="nav-item">
                <a href="#details" data-toggle="tab" aria-expanded="false" class="nav-link rounded-0 active">
                    <i class="mdi mdi-home-variant d-lg-none d-block mr-1"></i>
                    <span class="d-none d-lg-block">{{__('orders.details')}}</span>
                </a>
            </li>
            {{--
            <li class="nav-item">
                <a href="#payment_info" data-toggle="tab" aria-expanded="false" class="nav-link rounded-0">
                    <i class="mdi mdi-home-variant d-lg-none d-block mr-1"></i>
                    <span class="d-none d-lg-block">{{__('orders.payment_info')}}</span>
                </a>
            </li>
            --}}
            <li class="nav-item">
                <a href="#user_info" data-toggle="tab" aria-expanded="false" class="nav-link rounded-0">
                    <i class="mdi mdi-home-variant d-lg-none d-block mr-1"></i>
                    <span class="d-none d-lg-block">{{__('orders.user_info')}}</span>
                </a>
            </li>
            <li class="nav-item">
                <a href="#address" data-toggle="tab" aria-expanded="false" class="nav-link rounded-0">
                    <i class="mdi mdi-home-variant d-lg-none d-block mr-1"></i>
                    <span class="d-none d-lg-block">{{__('orders.address_details')}}</span>
                </a>
            </li>
            <li class="nav-item">
                <a href="#products" data-toggle="tab" aria-expanded="false" class="nav-link rounded-0">
                    <i class="mdi mdi-home-variant d-lg-none d-block mr-1"></i>
                    <span class="d-none d-lg-block">{{__('orders.products')}}</span>
                </a>
            </li>

        </ul>
        <form class="form-row" method="post" onsubmit="saveForm(this)" action="{{ $action }}" enctype="multipart/form-data">
            @method('PUT')
            @csrf

            <div class="tab-content col-lg-12">
                <div class="tab-pane active" id="details">
                    <div class="row">
                        <div class="col-lg-12">
                            <h3>
                                {{__('orders.details')}}
                            </h3>
                            <hr>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{  __('orders.status') }} </label>
                            <select name="status" class="form-control">
                                @foreach($statuses as $row)
                                    <option {{$order->status == $row ? 'selected' : ''}} value="{{$row}}">{{__('orders.statuses.'.$row)}}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{  __('orders.id') }} </label>
                            <p class="form-control" style="height: auto">{{$order->id}}</p>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{ __('orders.date') }} </label>
                            <p class="form-control" style="height: auto">{{$order->date}}</p>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{ __('orders.recieve_date') }} </label>
                            <p class="form-control" style="height: auto">{{$order->recieve_date}}</p>
                        </div>

                        <div class="form-group col-lg-6">
                            <label>{{ __('orders.way_id') }} </label>
                            <p class="form-control" style="height: auto">{{$order->way->currentDescription->title}}</p>
                        </div>

                        <div class="text-center mt-5 col-12">
                            <button class="butn"><span>{{ __('dashboard.save') }}</span></button>
                        </div>

                    </div>

                </div>
                {{--
                <div class="tab-pane " id="payment_info">
                    <div class="row">
                        <div class="col-lg-12">
                            <h3>
                                {{__('orders.payment_info')}}
                            </h3>
                            <hr>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{ __('orders.total_tax') }} </label>
                            <p class="form-control" style="height: auto">{{$order->total_tax ?? '0'}}</p>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{ __('orders.shipping_cost') }} </label>
                            <p class="form-control" style="height: auto">{{$order->shipping_cost ?? '0'}}</p>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{ __('orders.on_hand_cost') }} </label>
                            <p class="form-control" style="height: auto">{{$order->on_hand_cost ?? '0'}}</p>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{ __('orders.total_products') }} </label>
                            <p class="form-control" style="height: auto">{{$order->total_products ?? '0'}}</p>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{ __('orders.discount') }} </label>
                            <p class="form-control" style="height: auto">{{$order->discount ?? '0'}}</p>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{ __('orders.discount_offer') }} </label>
                            <p class="form-control" style="height: auto">{{$order->discount_offer ?? '0'}}</p>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{ __('orders.total') }} </label>
                            <p class="form-control" style="height: auto">{{$order->total ?? '0'}}</p>
                        </div>

                    </div>
                </div>
                --}}
                <div class="tab-pane " id="user_info">
                    <div class="row">
                        <div class="col-lg-12">
                            <h3>
                                {{__('orders.user_info')}}
                            </h3>
                            <hr>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{ __('orders.user_status') }} </label>
                            <p class="form-control" style="height: auto">{{__('orders.roles.'.$order->user_status)}}</p>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{  __('orders.user_name') }} </label>
                            <p class="form-control" style="height: auto">{{$order->user->name ?? ''}}</p>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{  __('orders.user_email') }} </label>
                            <p class="form-control" style="height: auto">{{$order->user->email ?? ''}}</p>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{  __('orders.user_phone') }} </label>
                            <p class="form-control" style="height: auto">{{$order->user->phone ?? ''}}</p>
                        </div>

                    </div>
                </div>
                <div class="tab-pane" id="address">
                    <div class="row">
                        <div class="col-lg-12">
                            <h3>
                                {{__('orders.address_details')}}
                            </h3>
                            <hr>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{ __('web.address_name') }} </label>
                            <p class="form-control" style="height: auto">{{$order->address->user_name}}</p>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{ __('web.phone') }} </label>
                            <p class="form-control" style="height: auto">{{$order->address->phone}}</p>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{ __('orders.address') }} </label>
                            <p class="form-control" style="height: auto">{{$order->address->address}}</p>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{ __('orders.country') }} </label>
                            <p class="form-control" style="height: auto">{{ $order->address->country->currentDescription->title }}</p>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{ __('orders.region') }} </label>
                            <p class="form-control" style="height: auto">{{ $order->address->region->currentDescription->title }}</p>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{ __('orders.city') }} </label>
                            <p class="form-control" style="height: auto">{{ $order->address->city->currentDescription->title }}</p>
                        </div>
                        @if($order->address->latitude && $order->address->longitude)
                        <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>
                        @endif

                    </div>
                </div>
                <div class="tab-pane" id="products">
                    <div class="row">
                        <div class="col-lg-12">
                            <h3>
                                {{__('orders.products')}}
                            </h3>
                            <hr>
                        </div>
                        <div class="col-lg-12">
                            @foreach($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>{{  __('orders.product_name') }} </label>
                                            <p class="form-control" style="height: auto">{{ $row->product->currentDescription->title }} {{$row->option_id ? (' - '.$row->option->currentDescription->title ) : '' }}</p>
                                        </div>
                                        <div class="form-group col-lg-6">
                                            <label>{{  __('orders.product_main_category') }} </label>
                                            <p class="form-control" style="height: auto">{{ $row->product->category->currentDescription->title }}</p>
                                        </div>
                                        <div class="form-group col-lg-6">
                                            <label>{{  __('orders.product_sub_category') }} </label>
                                            <p class="form-control" style="height: auto">{{ $row->product->subCategory->currentDescription->title }}</p>
                                        </div>
                                        <div class="form-group col-lg-6">
                                            <label>{{  __('orders.count') }} </label>
                                            <p class="form-control" style="height: auto">{{ $row->count}}</p>
                                        </div>
                                        <div class="form-group col-lg-6">
                                            <label>{{  __('orders.product_cost') }} </label>
                                            <p class="form-control" style="height: auto">{{ $row->total}}</p>
                                        </div>
                                    </div>
                                </div>
                            @endforeach
                        </div>

                    </div>
                </div>



            </div>

        </form>
    </div>

@endsection

@section('inner_js')
    <!-- Editor JS orders -->
    <script src="{{ asset('/assets/admin/js/lib/tinymce.min.js') }}"></script>-
    <script>
        var route_prefix = "{{ url(config('lfm.prefix')) }}";
        var url = "{{url('/')}}/";
    </script>
    <script src="{{ asset('assets/admin/js/editor.js') }}"></script>
    <script src="{{ asset('assets/admin/js/lfm.js') }}"></script>

@endsection
