@extends('adminlte::page')
@section('title','Kuponi')

@section('content_header')
<h1 class="m-0 text-dark">Kuponi</h1>
<a href="{{ URL::route('admin/cupon-create') }}" class="btn btn-default">{{ Lang::get('Dodaj novi kupon') }}</a>
@stop

@section('content')
    <table id="data-table" class="display" cellspacing="0" width="100%">
        <thead>
            <tr>
                <th>{!! Lang::get('common.id') !!}</th>
                <th>{!! Lang::get('common.kupon') !!}</th>
                <th>{!! Lang::get('common.max_usage') !!}</th>
                <th>{!! Lang::get('common.times_used') !!}</th>
                <th>{!! Lang::get('common.expires_at') !!}</th>
                <th>{!! Lang::get('common.actions') !!}</th>
            </tr>
        </thead>

        <tbody>
            @foreach($coupons as $item)
            <tr>
                <td>{!! $item->id !!}</td>
                <td>{!! $item->coupon !!}</a></td>
                <td>{!! $item->usage_limit !!}</td>
                <td>{!! $item->times_used !!}</td>
                <td>{!! $item->expired_at !!}</td>
                <td>
                    <div class="btn-group post-category">
                        <button id="action-secondary-btn" data-toggle="dropdown" class="btn btn-warning dropdown-toggle"
                            data-original-title="" title="">
                            {{ Lang::get('Izaberi') }} <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu">
                            <li>
                                <a href="{{ URL::route('admin.product.edit', [$item->id]) }}">{{ Lang::get('Izmijeni') }}</a>
                            </li>
                            <li>
                                <a class='erase-action' data-href="{!! URL::route('admin.product.destroy', [$item->id]) !!}">{!!
                                    Lang::get('Obriši') !!}</a>
                            </li>
                        </ul>
                    </div>
                </td>
            </tr>
            @endforeach
        </tbody>
    </table>
    {{ $products->links() }}
    @endsection
    @section('js')
    @section('plugins.Datatables', true)
    <script>
        $(document).ready(function() {

            $('#data-table').DataTable({
                "paging": false,
                "lengthChange": false,
                "searching": true,
                "ordering": true,
                "info": false,
                "autoWidth": false
            });
    } );


    </script>
    @endsection
@endsection


