@extends('admin.layouts.container')

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

    <div class="border-item">
        <form class="form-row" >


            <div class="form-group col-lg-12">
                <h6>{{__('orders.user_info')}}</h6>
            </div>
            <div class="form-group col-lg-6">
                <label>{{ __('orders.phone') }} </label>
                <p class="form-control" style="height: auto">{{$order->user->phone}}</p>
            </div>
            <div class="form-group col-lg-12">
                <hr>
            </div>
            <div class="form-group col-lg-12">
                <h6>{{__('orders.order_info')}}</h6>
            </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.time') }} </label>
                <p class="form-control" style="height: auto">{{$order->start_time .' - '.$order->end_time}}</p>
            </div>
            @if($payment->cobon_id)
                <div class="form-group col-lg-6">
                    <label>{{ __('orders.discount') }} </label>
                    <p class="form-control" style="height: auto">{{$payment->discount .' ( '.$payment->cobon->code.')'}}</p>
                </div>
            @endif
            <div class="form-group col-lg-6">
                <label>{{ __('orders.status') }} </label>
                <p class="form-control" style="height: auto">{{__('orders.'.$order->status)}}</p>
            </div>
            @if($order->status == 'pickup')
                <div class="form-group col-lg-6">
                    <label>{{ __('orders.date') }} </label>
                    <p class="form-control" style="height: auto">{{$order->date . ' : '. $order->start_time . ' - '.$order->end_time}}</p>
                </div>
            @endif
            @if($order->status == 'table')
                <div class="form-group col-lg-6">
                    <label>{{ __('orders.table') }} </label>
                    <p class="form-control" style="height: auto">{{$order->table->number ?? ''}}</p>
                </div>
            @endif
            @if($order->status == 'room')
                <div class="form-group col-lg-6">
                    <label>{{ __('orders.room_id') }} </label>
                    <p class="form-control" style="height: auto">{{$order->room->room_id ?? ''}}</p>
                </div>
            @endif
            <div class="form-group col-lg-6">
                <label>{{ __('orders.created_at') }} </label>
                <p class="form-control" style="height: auto">{{date('Y/m/d',strtotime($order->created_at)) }}</p>
            </div>

            <div class="form-group col-lg-12">
                <hr>
            </div>
            <div class="form-group col-lg-12">
                <h6>{{__('orders.bill_info')}}</h6>
            </div>
            <div class="form-group col-lg-6">
                <label>{{ __('orders.total_products') }} </label>
                <p class="form-control" style="height: auto">{{$payment->total_products}}</p>
            </div>
            @if($payment->discount > 0)
                <div class="form-group col-lg-6">
                    <label>{{ __('orders.discount') }} </label>
                    <p class="form-control" style="height: auto">{{$payment->discount}}</p>
                </div>
            @endif
            <div class="form-group col-lg-6">
                <label>{{ __('orders.tax') }} </label>
                <p class="form-control" style="height: auto">{{$payment->tax}}</p>
            </div>
            <div class="form-group col-lg-6">
                <label>{{ __('orders.total') }} </label>
                <p class="form-control" style="height: auto">{{$payment->total}}</p>
            </div>

            <div class="form-group col-lg-12">
                <hr>
            </div>
            <div class="form-group col-lg-12">
                <h6>{{__('orders.products_info')}}</h6>
            </div>

            <div class="form-group col-lg-12">
                @foreach($products as $i=>$product)
                    <div class="row pricing-list-item  mb-4" >
                        <div class="col-lg-12">
                            <label>{{__('orders.product')}} : {{$i+1}}</label>
                        </div>

                        <div class="form-group col-lg-6">
                            <label>{{  __('orders.code') }}  </label>
                            <input type="text" class="form-control " disabled value='{{  $product->product_id  }}'/>
                        </div>

                        <div class="form-group col-lg-6">
                            <label>{{  __('orders.product_name') }}  </label>
                            <input type="text" class="form-control " disabled value='{{  $product->product->name ?? ''  }}'/>
                        </div>

                        <div class="form-group col-lg-6">
                            <label>{{  __('orders.product_count') }}  </label>
                            <input type="text" class="form-control " disabled value='{{  $product->count  }}'/>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{  __('orders.product_cost') }}  </label>
                            <input type="text" class="form-control " disabled value='{{  $product->product_cost  }}'/>
                        </div>
                        <div class="form-group col-lg-6">
                            <label>{{  __('orders.total') }}  </label>
                            <input type="text" class="form-control " disabled value='{{  $product->total  }}'/>
                        </div>


                    </div>
                @endforeach
            </div>
            {{-- End replies container--}}


        </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
