@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>Kupon Listesi</h4>
                            <a href="{{route('kupon.veriekle')}}" class="btn btn-primary text-white">Kupon Ekle</a>
                            <br>

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

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


                                        <th>Kupon Şifre</th>
                                        <th>İndirim Oranı</th>
                                        <th>Durum</th>


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

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

                                            <td>{{$veri->kupon_sifre}}</td>

                                            @if(!$veri->indirim_orani=="")
                                                <td>%{{100*$veri->indirim_orani}}</td>

                                            @else
                                                <td>-{{$veri->indirim_miktar}}₺</td>

                                            @endif





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

                                                @endif
                                            </td>




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

                                                <a onclick="return confirm('Kuponu Silmek istediğinizden emin misiniz?')" href="{{ route('kupon.verisil',$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
