<?php $__env->startSection("content"); ?>
    <div class="content-header row">
        <div class="content-header-left col-md-6 col-12 mb-2 breadcrumb-new">
            <h3 class="content-header-title mb-0 d-block">Reklamlar</h3>
            <div class="row breadcrumbs-top d-inline-block">
                <div class="breadcrumb-wrapper col-12">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="<?php echo e(url('panel')); ?>">Anasayfa</a>
                        </li>
                        <li class="breadcrumb-item active">Reklamlar
                        </li>
                    </ol>
                </div>
            </div>
        </div>
        <div class="content-header-right col-md-6 col-12">
            <div class="float-md-right">
                <a href="<?php echo e(url('panel/reklamlar-yeni/ekle')); ?>" class="btn btn-success">+ Yeni Reklam Ekle</a>
            </div>
        </div>
    </div>
    <div class="content-body">
        <div class="row">
            <div id="recent-sales" class="col-12 col-md-12">
                <div class="card">
                    <div class="card-content">
                        <div class="table-responsive mt-1 pb-1">
                            <table class="table table-striped table-bordered mb-0 datatable" >
                                <thead>
                                <tr>
                                    <th class="border-top-0 px-1">ID</th>
                                    <th class="border-top-0 px-1">Yer</th>
                                    <th class="border-top-0 px-1">Başlık</th>
                                    <th class="border-top-0 px-1">Bitiş</th>
                                    <th class="border-top-0 px-1">Durum</th>
                                    <th class="border-top-0 px-1">İşlemler</th>
                                </tr>
                                </thead>

                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--/ Kategoriler  -->
    </div>
<?php $__env->stopSection(); ?>
<?php $__env->startPush("customJs"); ?>
    <script src="<?php echo e(asset('assets/backend/app-assets/vendors/js/tables/datatable/datatables.min.js')); ?>" type="text/javascript"></script>
    <script>
        let oTable = $('.datatable').DataTable( {
            "order": [[ 0, "desc" ]],
            "displayLength": 25,
            "language": {
                "url": "//cdn.datatables.net/plug-ins/1.10.16/i18n/Turkish.json"
            },
            processing : true,
            serverSide: true,
            columnDefs: [
                {
                    "targets": [4,5],
                    "orderable": false
                }
            ],
            ajax:{
                type: 'POST',
                headers: {'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>'},
                url: '<?php echo e(url('panel/reklamlar-yeni/listele')); ?>',
                data:function(data){
                    data.status = $('#status').val();
                }
            },
            columns: [
                {data: 'id', name: 'id', class:'px-1 text-center', searchable: false},
                {data: 'yer_id', name: 'yer_id', class:'px-1'},
                {data: 'baslik', name: 'baslik', class:'px-1'},
                {data: 'bitis', name: 'bitis', class:'px-1'},
                {data: 'durum', name: 'durum', class:'px-1 text-center', searchable: false},
                {data: 'islemler', name: 'islemler', class:'px-1', orderable: false, searchable: false}
            ]
        } );

        $('table').on('draw.dt', function() {
            $('[data-toggle="tooltip"]').tooltip();

            $(".btn-outline-danger").on("click",function () {
                let id = $(this).data('id');
                let catTitle = $(this).data('title');
                //let Data = "id:"+id;
                swal({
                        title: "Emin misiniz?",
                        text: "<strong>" + catTitle + " silinecektir!</strong>",
                        type: "warning",
                        html: true,
                        showCancelButton: true,
                        confirmButtonColor: "#DD6B55",
                        confirmButtonText: "Evet, silinsin!",
                        cancelButtonText: "Hayır, vazgeç!",
                        closeOnConfirm: false,
                        closeOnCancel: true
                    },
                    function(isConfirm){
                        if (isConfirm) {
                            $.ajax({
                                headers: {
                                    'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>'
                                },
                                type: "POST",
                                url: "/panel/reklamlar-yeni/sil/"+id,
                                data: {
                                    "id": id
                                },
                            });
                            swal({
                                    title: "Silindi!",
                                    text: "<strong>Reklam Başarıyla Silindi.</strong>",
                                    type: "success",
                                    html: true,
                                    timer: 1000},
                                function(){
                                    //location.reload();
                                    swal.close();
                                    oTable.ajax.reload();
                                }
                            );
                        }
                    });
            })

        });
    </script>
<?php $__env->stopPush(); ?>

<?php $__env->startPush("customCss"); ?>
    <link rel="stylesheet" type="text/css" href="<?php echo e(asset('assets/backend/app-assets/vendors/css/tables/datatable/datatables.min.css')); ?>">
    <style>
        .px-1 {
            padding-left: 0.5rem !important;
            padding-right: 0.5rem !important;
        }
        .table td {
            padding: 0.5rem 2rem;
        }
    </style>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('backend.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/yeniistik/public_html/resources/views/backend/reklamlar/index.blade.php ENDPATH**/ ?>