@extends('yonetim.yonetim_master')

@section('cssler')
    <link rel="stylesheet" href="https://cdn.datatables.net/1.12.1/css/jquery.dataTables.min.css">

@endsection

@section('main')
    <section class="section">
        <div class="section-body">
            <div class="row">
                <div class="col-12">
                    <div class="card">
                        <div class="card-header">
                            <h4>Yorum Listesi</h4>

                        </div>
                        <div class="card-body">

                            <div class="table-responsive">
                                <table class="table table-striped" id="table-1">
                                    <thead>
                                    <tr>

                                        <th>Yazar</th>
                                        <th>Cinsiyet</th>
                                        <th>Durum</th>


                                        <th>Tarihi</th>

                                        <th>İşlemler</th>
                                    </tr>
                                    </thead>
                                    <tbody>

                                    @foreach($veriler as $veri)
                                        <tr>

                                            <td>{{$veri->isim}}</td>
                                            <td>{{$veri->cinsiyet}}</td>

                                            <td>
                                                @if($veri->durum==1)
                                                    <span  class="badge badge-success">Aktif</span>
                                                @else
                                                    <span  class="badge badge-danger">Pasif</span>

                                                @endif
                                            </td>

                                            <td>
                                                {{ Carbon\Carbon::parse($veri->created_at)->diffForHumans() }}
                                            </td>



                                            <td>
                                                <a href="{{ route('blog.blogyorumlaredit',$veri->id)}}" class="btn btn-warning"><i class="fa fa-edit"></i> Detay</a>
                                                <a onclick="return confirm('Silmek istediğinizden emin misiniz?')" href="{{ route('blog.blogyorumsil',$veri->id)}}" class="btn btn-danger"><i class="fa fa-trash"></i> Sil</a>
                                            </td>
                                        </tr>
                                    @endforeach






                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </section>
@endsection

@section('datatables')
    <script src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.min.js"></script>

    <script>
        $(document).ready( function () {
            $('#table-1').DataTable();
        } );


    </script>

    <script>
        $('#table-1').DataTable({
            language: {
                info: "_TOTAL_ kayıttan _START_ - _END_ kayıt gösteriliyor.",
                infoEmpty:      "Gösterilecek hiç kayıt yok.",
                loadingRecords: "Kayıtlar yükleniyor.",
                lengthMenu: "Sayfada _MENU_ kayıt göster",
                zeroRecords: "Tablo boş",
                search: "Arama:",
                infoFiltered:   "(toplam _MAX_ kayıttan filtrelenenler)",
                buttons: {
                    copyTitle: "Panoya kopyalandı.",
                    copySuccess:"Panoya %d satır kopyalandı",
                    copy: "Kopyala",
                    print: "Yazdır",
                },

                paginate: {
                    first: "İlk",
                    previous: "Önceki",
                    next: "Sonraki",
                    last: "Son"
                },
            }
        });
    </script>
@endsection
