Current File : //home/tradevaly/public_html/resources/views/backend/pages/advertisment/pending.blade.php
@extends('backend.ayaan.master')

@push('title') Banner Pending @endpush
@section('css')
    <!-- DataTables -->
    <link href="{{ asset('/assets/libs/datatables/datatables.min.css') }}" rel="stylesheet" type="text/css"/>
@endsection
@section('content')

    @component('components.breadcrumb')
        @slot('li_1') Dashboard @endslot
        @slot('title')Pending Advertisment @endslot
    @endcomponent
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-body">
                    <div class="table-responsive">
                        <table class="table" id="datatable-buttons">
                            <thead>
                            <tr>
                                <th class="text-center">#</th>
                                <th>User</th>
                                <th>Advertisment Position</th>
                                <th>Photo</th>
                                <th>Link</th>
                                <th>Status</th>
                                <th>Action</th>
                            </tr>
                            </thead>
                            <tbody>

                            @foreach ($advertisments as $advertisment)
                            <!--@if(file_exists(public_path('storage/images/admin/banner/'.$advertisment->image)))-->
                            
                                <tr>
                                    <td class="text-center">{{$loop->iteration}}</td>
                                    <td class="text-center">{{$advertisment->user? $advertisment->user->name:'not found'}}</td>
                                    <td>
                                        {{$advertisment->position}} 
                                    </td>
                                    <td>
                                        <img width="100" src="{{asset('storage/images/admin/banner/'.$advertisment->image)}}" alt="" class='img-fluid'>
                                    </td>
                                    <td>
                                        <a href="{{ $advertisment->link }}" class="btn btn-info btn-sm" target="_blank">Url</a>
                                    </td>
                                    <td>
                                        @if($advertisment->isActive == 1)
                                        <span class="badge bg-success">Active</span>
                                        @else
                                        <span class="badge bg-warning">Pending</span>
                                        @endif
                                    </td>
                                    <td>
                                       <div class="btn-group" role="group" aria-label="Basic example">
                                          <a href="{{ route('admin.advertisment.status',['active',$advertisment->id]) }}" class="btn btn-sm btn-info">Active</a>
                                          <a href="{{ route('admin.advertisment.details',$advertisment->id) }}" class="btn btn-sm btn-primary">Details</a>
                                        </div>
                                    </td>
                                    
                                </tr>
                             <!--@endif-->
                            @endforeach
                            </tbody>
                        </table>
                    </div>

                </div>
            </div>
        </div>
    </div>
    <!-- end row -->
@endsection
@section('script')
    <!-- Required datatable js -->
    <script src="{{ asset('/assets/libs/datatables/datatables.min.js') }}"></script>
    <script src="{{ asset('/assets/libs/jszip/jszip.min.js') }}"></script>
    <script src="{{ asset('/assets/libs/pdfmake/pdfmake.min.js') }}"></script>
    <!-- Datatable init js -->
    <!--<script>-->
    <!--    let advertiser_buttons = document.querySelectorAll('.advertiser_buttons');-->

    <!--    advertiser_buttons.addEventListener("click", updateFunction);-->

        
    <!--</script>-->
    <!--
    <script type="text/javascript">
        $(function () {


            $(document).ready(function () {

                var table = $('#datatable-buttons').DataTable({
                    lengthChange: false,
                    processing: true,
                    dom: 'Bfrtip',

                    buttons: ['copy', 'excel', 'pdf', 'colvis']
                });
                table.buttons().container().appendTo('#datatable-buttons_wrapper .col-md-6:eq(0)');
                $(".dataTables_length select").addClass('form-select form-select-sm');
            });
        });
    </script>
    -->
@endsection