<div>
    @component('common.breadcrumb', ['addBtn' => false, 'permission_create' => 'Employee_payment_voucher_index',
        'breadcrumb_show' => $breadcrumb_show])
        @slot('breadcrumb_title')
            <h3>{{ $componentName }} | {{ $pageTitle }}</h3>
        @endslot
        <li class="breadcrumb-item">Empleado</li>
        <li class="breadcrumb-item active">Desprendibles de pago</li>
    @endcomponent
    <div class="container-fluid">
        <div class="row layout-top-spacing">
            <div class="col-sm-12">
                <div class="card">
                    <div class="card-body">
                        <div class="card-header">
                            <h4>Desprendibles de pago <b> | {{ $first_name }} {{ $last_name }}</b></h4>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row justify-content-center">
            <div class="col-lg-4 col-md-4 col-sm-12">
                <div class="form-group">
                    <select class="form-select" wire:model="month">
                        <option value="">Todos los Meses</option>
                        @foreach (DataTypeMonth() as $key => $value)
                            <option value="{{ $key }}">{{ $value }}</option>
                        @endforeach
                    </select>
                </div>
            </div>
            <div class="col-lg-4 col-md-4 col-sm-12">
                <div class="form-group">
                    <select class="form-select" wire:model="year">
                        <option value="">Todos los Años</option>
                        @for ($i = $this->min_year; $i <= $this->max_year; $i++)
                            <option value="{{ $i }}">{{ $i }}</option>
                        @endfor
                    </select>
                </div>
            </div>
        </div><!-- row -->
        <div class="row justify-content-between file-content mb-2">
            @if (isset($count_reg))
                <div class="col-lg-4 col-md-4 col-sm-12">
                    <p class="p-l-20">Total Desprendibles de pago: {{ $count_reg }}</p>
                </div>
            @endif

        </div>
    </div><!-- container-fluid -->
    <div class="container-fluid">
        <div class="card">
            <div class="card-body">
                <div class="row layout-top-spacing">
                    <table class="table table-hover table-responsive-md table-fixed table-striped">
                    @if ($count_reg > 0)
                        <thead>
                            <tr>
                                <th>Fecha publicación</th>
                                <th>Año</th>
                                <th>Mes</th>
                                <th>Acciones</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach ($vouchers_user as $item)
                            <tr>
                                <td>{{ $item->created_at }}</td>
                                <td>
                                    {{ $item->year }}
                                </td>
                                <td>
                                    {{ DataTypeMonth($item->month) }}
                                </td>
                                <td>
                                    <a href="{{ asset('storage/users/'.$user_id.'/payment_vouchers/' . $item->support_document) }}" target="_blank"
                                        class="btn btn-outline-primary" title="Ver">
                                        <i class="fas fa-eye"></i>
                                    </a>
                                </td>
                            </tr>
                            @endforeach
                        </tbody>
                    @else
                        <tbody>
                            <tr>
                            <td colspan="3" class="text-center">
                                <h5 class="text-danger">No hay Desprendibles de pago registrados</h5>
                            </div>
                        </div>
                    @endif
                    </table>
                        {{ $vouchers_user->links() }}
                </div><!-- row -->
        </div><!-- card-body -->
        </div><!-- card -->
    </div><!-- container-fluid -->

</div>
