@extends('admin.layouts.app')

@push('libraries_top')

@endpush

@section('content')
    <section class="section">
        <div class="section-header">
            <h1>البطاقات</h1>
            <div class="section-header-breadcrumb">
                <div class="breadcrumb-item active"><a href="/admin/">{{trans('admin/main.dashboard')}}</a>
                </div>
                <div class="breadcrumb-item">البطاقات</div>
            </div>
        </div>

        <div class="section-body">

            <div class="row">
                <div class="col-12 col-md-12">
                    <div class="card">
                        <div class="card-body">
                            <div class="table-responsive">
                                <table class="table table-striped font-14">
                                    <tr>
                                        <th>العنوان</th>
                                        <th>العنوان الفرعي</th>
                                        <th>الإحصاء</th>
                                        <th>الصورة</th>
                                        <th>URL</th>
                                    </tr>
                                    @foreach($stats as$key => $stat)

                                        <tr>
                                            <td>{{$stat->title}}</td>
                                            @if(isset($stat->description))
                                                <td>
                                                    {{$stat->description}}
                                                </td>
                                            @endif
                                            @if(isset($stat->subtitle))
                                                <td>
                                                    {{$stat->subtitle}}
                                                </td>
                                            @endif
                                            @if(isset($stat->image))
                                                <td>
                                                    <img src="{{asset('assets/default/img/stats/'.$stat->image)}}" alt="{{$stat->image}}" style="width: 100px;">
                                                </td>
                                            @endif
                                            @if(isset($stat->url))
                                                <td>
                                                    <a href="{{$stat->url}}" target="_blank">{{$stat->url}}</a>
                                                </td>
                                            @endif

                                            <td>
                                                    <a href="/admin/stats/{{ $stat->id }}/edit"
                                                       class="btn-transparent btn-sm text-primary">
                                                        <i class="fa fa-edit"></i>
                                                    </a>
                                                    @include('admin.includes.delete_button',['url' => '/admin/stats/'.$stat->id.'/delete'])
                                            </td>
                                        </tr>
                                    @endforeach
                                </table>
                            </div>
                        </div>

                        <div class="card-footer text-center">
{{--                            {{ $stats->appends(request()->input())->links() }}--}}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
@endsection
