<?= $this->extend('estructura/header_dashboard'); ?>
<?= $this->section('content'); ?>
<!-- ============================================================== -->
<!-- Start right Content here -->
<!-- ============================================================== -->
<div class="main-content">
	<div class="page-content">
		<div class="container-fluid">
			<!-- start page title -->
			<div class="row">
				<div class="col-12">
					<div class="page-title-box d-sm-flex align-items-center justify-content-between">
						<h4 class="mb-sm-0"><?= $breadcrumb_alias ?></h4>
						<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 active"><?= $breadcrumb_alias ?></li>
							</ol>
						</div>
					</div>
				</div>
			</div>
			<!-- end page title -->
			<div class="row">
				<div class="col-lg-12">
					<div class="card">
						<div class="card-header d-flex align-items-center">
                            <h5 class="card-title mb-0 flex-grow-1"><?= $breadcrumb_alias ?></h5>
                            <div>
								<a href="<?= $baseUrl.'/'.$previo ?>" class="btn px-2 py-0" style="border-radius: 45%; background-color: red;"><i class="mdi mdi-arrow-left-circle" style="font-size: 24px; color: #FFF"></i></a>
                            </div>
                        </div>
						<div class="card-body">
						    <?php
							if (in_array("ASUSGT", $permisos)) 
							{
							?>
							<div class="row col-12 m-0 mb-3 p-3 bg-sistema-25" style="border-radius: 20px;">
                                <div class="col-xxl-9 col-md-12 col-12 mb-3">
                                    <div>
                                        <label for="txtUsuarioAsociarGrupoTrabajo" class="form-label">Usuario</label>
                                        <select class="form-select" aria-label="Delegación" id="txtUsuarioAsociarGrupoTrabajo" name="txtUsuarioAsociarGrupoTrabajo">
                                            <option selected="" value="">Seleccione una opción</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="col-xxl-3 col-md-12 col-12 mb-3 d-flex flex-row-reverse align-items-center">
                                    <div>
                                        <button type="button" class="btn btn-success" id="btnAgregarUsuarioGrupoTrabajo" data-grupotrabajo="<?= $idGrupoTrabajo ?>">
                                        <i class="mdi mdi-plus-circle"></i> Agregar
                                    </button>
                                    </div>
                                </div>
                            </div>
							<?php
							}
							?>
							<table id="tblUsuariosGrupoTrabajo" class="table table-bordered dt-responsive nowrap table-striped align-middle" style="width:100%">
								<thead>
									<tr>
										<th class="text-center align-middle">Matrícula</th>
										<th class="text-center align-middle">Nombres</th>
										<th class="text-center align-middle">Apellidos</th>
										<th class="text-center align-middle">Acciones</th>
									</tr>
								</thead>
								<tbody>
									<?php 
									foreach($listaUsuarios as $items){ ?>
									<tr>
										<td class="text-center align-middle"><?= $items['Matricula'] ?></td>
										<td class="text-center align-middle"><?= $items['Nombres'] ?></td>
										<td class="text-center align-middle"><?= $items['Apellidos'] ?></td>
										<td class="text-center align-middle">
											<?php
											if (in_array("DEUSGT", $permisos)) 
											{
											?>
											<button class="badge bg-danger border-0 p-2 eliminar-usuario-grupo-trabajo" data-usuario="<?= $items['IdUsuario'] ?>" data-grupotrabajo="<?= $idGrupoTrabajo ?>">
												<i class="mdi mdi-trash-can-outline align-bottom" style="font-size: 20px; color: #FFF;"></i>
											</button>
											<?php
											}
											?>
										</td>
									</tr>
									<?php } ?>
								</tbody>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
		<span class="respuesta_global"></span>
		<!-- container-fluid -->
	</div>
	<!-- End Page-content -->
    <footer class="footer">
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-6">
                    <script>document.write(new Date().getFullYear())</script> © Verisure Peru.
                </div>
                <div class="col-sm-6">
                    <div class="text-sm-end d-none d-sm-block">Desarrollado por <a href="https://www.verisure.pe/">Verisure Peru</a>
                    </div>
                </div>
            </div>
        </div>
    </footer>
</div>
<!-- end main content-->
<?php $this->endSection(); ?>