@extends('yonetim.yonetim_master')

@section('main')
    <section class="section">
        <div class="section-body">
            <div class="row">
                <div class="col-12">
                    <div class="card">
                        <div class="card-header">
                            <h4>Yöneticiler Listesi</h4>
                            <a href="{{route('admin.yonekle')}}" class="btn btn-primary text-white">Yönetici Ekle</a>
                            <br>

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

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

                                        <th>Başlık</th>
                                        <th>Açıklama</th>
                                        <th>Yetki Seviyesi</th>
                                        <th>Son İşlem</th>
                                        <th>İşlemler</th>
                                    </tr>
                                    </thead>
                                    <tbody>

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

                                            <td>{{$veri->name}}</td>
                                            <td class="align-middle">
                                                {{$veri->email}}...
                                            </td>
                                            <td>
                                                    @if($veri->yetki==2)
                                                    <div class="badge badge-success">
                                                        Kurucu Admin

                                                    </div>
                                                    @elseif($veri->yetki==1)
                                                    <div class="badge badge-primary">
                                                        Yönetici
                                                    </div>
                                                    @elseif($veri->yetki==0)
                                                    <div class="badge badge-danger">
                                                        Yetkisiz
                                                    </div>
                                                    @else
                                                    <div class="badge badge-warning">
                                                        Bilinmiyor
                                                    </div>
                                                    @endif

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


                                            <td>
                                                <a href="{{ route('admin.yonupdate',$veri->id)}}" class="btn btn-warning"><i class="fa fa-edit"></i> Düzenle</a>

                                                <a onclick="return confirm('Silmek istediğinizden emin misiniz?')" href="{{ route('admin.yonsilson',array($veri->id,$veri->yetki))}}" 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
