@extends('layouts.admin')
@section('title')
    Gicre | Centro Médicos
@endsection
@section('contenido')
    <div class="row">
        <div class="col-12">
            <div class="page-title-box">
                <div class="page-title-right">
                    <ol class="breadcrumb m-0">
                        <li class="breadcrumb-item"><a href="javascript: void(0);">Inicio</a></li>
                        <li class="breadcrumb-item"><a href="javascript: void(0);">Configuración</a></li>
                        <li class="breadcrumb-item active">Centros Médicos</li>
                    </ol>
                </div>
                <h4 class="page-title">Administración de Centros Médicos</h4>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-body">
                    <div class="row mb-2">
                        <div class="col-sm-4">
                            @can('articulo-create')
                                <a href="{{ route('empresa.create') }}" class="btn btn-success mb-2"><i
                                        class="mdi mdi-plus-circle me-2"></i> Nuevo Centro</a>
                            @endcan
                        </div>
                        <div class="col-sm-8">
                            <div class="text-sm-end">
                                <a href="{{ url('reportecentro') }}" target="__blank" class="btn btn-danger mb-2"><i
                                        class="mdi mdi-printer"></i> Reporte</a>
                            </div>
                        </div><!-- end col-->
                        @include('almacen.empresa.search')
                    </div>
                    <div class="table-responsive">
                        <table
                            class="table table-centered w-100 dt-responsive nowrap table-bordered table-condensed table-hover">
                            <thead class="table-light">
                                <tr>
                                    <th class="text-center">Id</th>
                                    <th>Nombre</th>
                                    <th>Logo</th>
                                    <th>Rnc</th>
                                    <th>Tipo</th>
                                    <th>Primer Teléfono</th>
                                    <th>Segundo Teléfono</th>
                                    <th>Correo Electrónico</th>
                                    <th>Fax</th>
                                    <th>Especialidades</th>
                                    <th>Provincia</th>
                                    <th>Municipio</th>
                                    <th>Barrio</th>
                                    <th>Calle</th>
                                    <th>Sitio web</th>
                                    <th>Sitio</th>
                                    <th>Estado</th>
                                    <th style="width: 240px;">Acciones</th>
                                </tr>
                            </thead>

                            <tbody>
                                @foreach ($empresas as $centros)
                                    <tr>
                                        <td>{{ $centros->id_centro_medico }}</td>
                                        <td style="width: 170px; display:flex; gap:10px;">{{ $centros->nombre }}</td>
                                        <td><img src="{{ asset('imagenes/empresa/' . $centros->logo) }}"
                                                alt="{{ $centros->logo }}" height="100px" width="100px"
                                                class="img-thumbnail"></td>
                                        <td>{{ $centros->rnc }}</td>
                                        <td>{{ $centros->tipo }}</td>
                                        <td style="width: 170px; display:flex;">{{ $centros->primer_telefono }}</td>
                                        <td>{{ $centros->segundo_telefono }}</td>
                                        <td style="width: 170px; display:flex;">{{ $centros->correo }}</td>
                                        <td>{{ $centros->fax }}</td>
                                        <td>{{ $centros->especialidades }}</td>
                                        <td>{{ $centros->provincia }}</td>
                                        <td>{{ $centros->municipio }}</td>
                                        <td>{{ $centros->barrio }}</td>
                                        <td>{{ $centros->calle }}</td>
                                        <td>{{ $centros->pagina_web }}</td>
                                        <td>{{ $centros->seguro_medico }}</td>


                                        <td>{{ $centros->estado }}</td>
                                        <td style="width: 240px; display:flex; gap:10px;" align="center">
                                            @can('articulo-edit')
                                                <a href="{{ route('empresa.edit', $centros->id_centro_medico) }}"><button
                                                        class="btn btn-info"><i class="mdi mdi-square-edit-outline"></i>
                                                        Editar</button></a>
                                            @endcan
                                            @can('articulo-delete')
                                                <button type="button" class="btn btn-danger" data-bs-toggle="modal"
                                                    data-bs-target="#modal-delete-{{ $centros->id_centro_medico }}"><i
                                                        class="mdi mdi-delete"></i> Eliminar</button>
                                            @endcan
                                        </td>
                                    </tr>
                                    @include('almacen.empresa.modal')
                                @endforeach
                            </tbody>

                        </table>
                        {{$empresas->render()}}
                    </div>
                </div> <!-- end card-body-->
            </div> <!-- end card-->
        </div> <!-- end col -->
    </div>

    @push('scripts')
        <script>
            $('#liAlmacen').addClass("sub active");
            $('#aAlmacen').addClass("active");
            $('#liArticulos').addClass("active");
        </script>
    @endpush
@endsection
