@extends('admin.layouts.container')

@section('content')

    <div class="dashbord_home">
        <div class="row">

            <div class="row col-12  mb-5">
                <div class="col-12">
                    <div class="row">
                        <div class="col-lg-8">
                            <h5 class="text-uppercase font-weight-bold">{{__('dashboard.all_visits')}}</h5>
                        </div>
                        <div class="col-lg-4">
                            <select name="state_year" id="state_year" class="state_year form-control">
                                @for ($i = date('Y'); $i >= 2024; $i--)
                                    <option value="{{ $i }}"> {{ $i }} </option>
                                @endfor
                            </select>
                        </div>
                    </div>
                    <br />
                    <canvas class="border-item lineChart" width="400" height="150"></canvas>
                </div>
            </div>

            <div class="row col-12  mb-5">
                <div class="col-lg-6">
                    <div class="new-users border-item">
                        <div class="datatitle">
                            <h6 class="text-uppercase font-weight-bold">{{__('dashboard.website_visits')}}</h6>
                        </div>

                        <div class="items">
                            <span class="number text-primary">
                                {{$allUsersCounts}}
                            </span>
                        </div>
                    </div>
                </div>
                <div class="col-lg-6">
                    <div class="new-users border-item">
                        <div class="datatitle">
                            <h6 class="text-uppercase font-weight-bold">{{__('dashboard.visits_this_year')}} ({{date('Y')}})</h6>
                        </div>

                        <div class="items">
                            <span class="number text-primary">
                                {{$yearUsers}}
                            </span>
                        </div>
                    </div>
                </div>
                <div class="col-lg-6">
                    <div class="new-users border-item">
                        <div class="datatitle">
                            <h6 class="text-uppercase font-weight-bold"> {{__('dashboard.month_visits')}} ({{ __('web.'.date('F')) }}) </h6>
                        </div>

                        <div class="items">
                            <span class="number text-primary">
                                {{$monthUsers}}
                            </span>
                        </div>
                    </div>
                </div>
                <div class="col-lg-6">
                    <div class="new-users border-item">
                        <div class="datatitle">
                            <h6 class="text-uppercase font-weight-bold">{{__('dashboard.day_visits')}} ({{ __('web.'.date('l')) }}) </h6>
                        </div>

                        <div class="items">
                            <span class="number text-primary">
                                {{!empty($dayUsers) ? $dayUsers : 0}}
                            </span>
                        </div>
                    </div>
                </div>


                <div class="col-lg-6">
                    <div class="new-users border-item">
                        <div class="datatitle">
                            <h6 class="text-uppercase font-weight-bold">{{__('dashboard.orders')}} </h6>
                        </div>

                        <div class="items">
                            <span class="number text-primary">
                                {{!empty($orders) ? $orders : 0}}
                            </span>
                        </div>
                    </div>
                </div>
                
                <div class="col-lg-6">
                    <div class="new-users border-item">
                        <div class="datatitle">
                            <h6 class="text-uppercase font-weight-bold">{{__('dashboard.orders_total')}} </h6>
                        </div>

                        <div class="items">
                            <span class="number text-primary">
                                {{!empty($orders_total) ? $orders_total : 0}}
                            </span>
                        </div>
                    </div>
                </div>
                
                <div class="col-lg-6">
                    <div class="new-users border-item">
                        <div class="datatitle">
                            <h6 class="text-uppercase font-weight-bold">{{__('dashboard.reservations')}} </h6>
                        </div>

                        <div class="items">
                            <span class="number text-primary">
                                {{!empty($reservations) ? $reservations : 0}}
                            </span>
                        </div>
                    </div>
                </div>
                
                <div class="col-lg-6">
                    <div class="new-users border-item">
                        <div class="datatitle">
                            <h6 class="text-uppercase font-weight-bold">{{__('dashboard.reservations_total')}} </h6>
                        </div>

                        <div class="items">
                            <span class="number text-primary">
                                {{!empty($reservations_total) ? $reservations_total : 0}}
                            </span>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
@endsection

@section('inner_js')

<script>
    const state_route= '{{ route("dashboard.stats") }}'
</script>
<script src="{{asset('assets/admin/js/lib/Chart.min.js')}}"></script>
<script src="{{ asset('assets/admin/js/charts.js') }}"></script>

@endsection
