<div>
    @component('common.breadcrumb',['addBtn' => false,
                'permission_create' => 'Company_work_certificate_view',
                'breadcrumb_show' => $breadcrumb_show]
                )   <!-- componente de breadcrumb -->
        @slot('breadcrumb_title')
            <h3>{{ $componentName }} | {{ $pageTitle }}</h3>
        @endslot
        <li class="breadcrumb-item">Empleado</li>
        <li class="breadcrumb-item active">Certificados laborales</li>
        @slot('content_extra')
        <div class="card">
            <div class="card-body">
                <div class="card-header">
                    <h4>Empleado: <b>  {{ $first_name }} {{ $last_name }}</b></h4>
                </div>
                <a href={{ route('certificados-laborales')}} class="btn btn-sm btn-outline-primary"> <i class="fas fa-arrow-left"></i> Todas las solicitudes</a>
            </div>
        </div>
        @endslot
    @endcomponent
    @include('common.searchbox')
    <div class="container-fluid">
        @livewire('company_-work-certificate-detail-controller',['work_certificate_id' => $work_certificate_id])
        <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="status_work_permit">
                        <option value="">Todos los estados de Certificado de Trabajo</option>
                        @foreach (DataTypeStatusStandard() as $key => $value)
                            <option value="{{ $key }}">{{ $value }}</option>
                        @endforeach
                    </select>
                </div>
            </div>

        </div><!-- row -->

        <div class="row justify-content-between file-content mb-2">
            <div class="col-sm-12">
                <div class="card">
                    <div class="table-responsive">
                        <table class="table">
                            <thead class="bg-primary">
                                <tr>
                                    <th scope="col" class="text-center">ESTADO SOLICITUD</th>
                                    <th scope="col" class="text-center">FECHA SOLICITUD</th>
                                    <th scope="col" class="text-center">DIRIGIDO A</th>
                                    <th scope="col" class="text-center">ACCIONES</th>
                                </tr>
                            </thead>
                            <tbody>
                                @if ($work_certificates_users->count() > 0)
                                    @foreach ($work_certificates_users as $item)
                                    <tr>
                                        <td class="text-center">
                                            <span class="py-1 px-2  {{ $item->status_work_certificate == 0 ? 'bg-warning' : ($item->status_work_certificate == 1 ? 'bg-success' : 'bg-danger') }}">
                                                {{ DataTypeStatusStandard($item->status_work_certificate) }}
                                                <i class="fas {{ $item->status_work_certificate == 0 ? 'fa-clock' : ($item->status_work_certificate == 1 ? 'fa-check' : 'fa-times') }}"></i>
                                            </span>
                                        </td>
                                        <td class="text-center">{{ \Carbon\Carbon::parse($item->solicitation_date)->format('d/m/Y') }}</td>
                                        <td class="text-center">
                                            {{ Request_to_Default($item->request_to) }}
                                        </td>
                                        <td class="text-center">
                                            @can('Company_work_certificate_view')
                                                <a href="javascript:void(0)" wire:click.prevent="openWC({{ $item->work_certificate_id }})" class="btn btn-sm btn-outline-primary">
                                                    <i class="fas fa-eye"></i>
                                                </a>
                                            @endcan
                                        </td>
                                    </tr>
                                @endforeach
                            @else
                                <tr>
                                    <td colspan="9" class="text-center">
                                        No hay registros disponibles
                                    </td>
                                </tr>
                            @endif
                        </tbody>
                        </table>
                        {{ $work_certificates_users->links() }}
                    </div>

                </div><!-- card -->
            </div><!-- col-sm-12 -->
        </div><!-- row -->
    </div><!-- container-fluid -->
</div>
@include('common.scriptsCompStandar')

