<?= $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 class="d-flex">
                                <button type="button" class="btn bg-warning d-flex align-items-center mx-1 color-white" id="btnExportarTotalCesados">
    								<i class="mdi mdi-file-download" style="font-size: 14px;"></i> Exportar Cesados
    							</button>
                            </div>
                        </div>
						<div class="card-body">
							<table id="tblReporteAsignaciones" class="table table-bordered dt-responsive nowrap table-striped align-middle" style="width:100%">
								
							</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-->

<?= $this->section('js'); ?>
<script>
	$(function () {
		/***SERVERSIDE REPORTE***/
		assetListVM = {
			dt: null,
			init: function () {
				dt = $('#tblReporteAsignaciones').DataTable({
					"serverSide": true,
					"processing": true,
					"ajax": {
						"url": baseUrl + "/reporte-asignaciones-serverside",
						type: 'POST',
						data: function(d) {
						    let rutavista = window.location.href;
						    let arrayrutavista = rutavista.split("/");
						    d.url_vista = arrayrutavista[arrayrutavista.length-1];
						}
					},
					"columns": [
						{"title": "Matrícula", "data": "Matricula", "class": "text-center", "searchable": true },
						{"title": "Usuario", "data": "Usuario", "class": "text-center", "searchable": true },
						{"title": "Nombre y Apellidos", "data": "NOMBRE", "class": "text-center", "searchable": true },
						{"title": "Subárea", "data": "Subarea", "class": "text-center", "searchable": true },
						{"title": "Área", "data": "Area", "class": "text-center", "searchable": true, "orderable": true },
						{"title": "Dirección", "data": "Direccion", "class": "text-center", "searchable": true },
						{"title": "CC", "data": "CC", "class": "text-center", "searchable": true },
						{"title": "LN", "data": "LN", "class": "text-center", "searchable": true, "orderable": true },
						{"title": "Elemento", "data": "ELEMENTO", "class": "text-center", "searchable": true, "orderable": true },
						{"title": "Tipo", "data": "TIPO", "class": "text-center", "searchable": true, "orderable": true },
						{"title": "Marca", "data": "MARCA", "class": "text-center", "searchable": true, "orderable": true },
						{"title": "Modelo", "data": "MODELO", "class": "text-center", "searchable": true, "orderable": true },
						{"title": "Serie", "data": "SERIE", "class": "text-center", "searchable": true, "orderable": true },
						{"title": "Tipo de Asignación", "data": "Tipo de Asignación", "class": "text-center", "searchable": true, "orderable": true },
						{"title": "Código Asignación", "data": "IDAsignacion", "class": "text-center", "searchable": true, "orderable": true },
						{"title": "Fecha Asignación", "data": "Fecha de Asignación", "class": "text-center", "searchable": true, "orderable": true },
					],
					"lengthMenu": [[10, 25, 50], [10, 25, 50]],
					responsive: true,
					autoWidth: false,
					"pageLength": 25,
					"paging": true,
					"aaSorting": [[0, 'desc']],
				});
			}
		}

		assetListVM.init();
		/****FIN SERVERSIDE REPORTE****/
		
	});
</script>
<?php $this->endSection(); ?>


<?php $this->endSection(); ?>