Commit 982d50c6 by Billy Larru

usando map en proyeccion de asistencias

parent c206fa00
let data = [];
let listaSedes = []; let listaSedes = [];
let handsonTable; let handsonTable;
function initializeData() {
data.push({"dni": "12345678", "nombres": "DELGADO CHOZO JUAN FRANCISCO", "sede": "CANTA CALLAO 2", "horario": "07:00 - 17:00", "tipo_horario": "REGULAR",
"fecha_entrada": "15/06/2018", "marcacion_entrada": "06:59", "marcacion_salida": "00:00", "fecha_salida": "15/06/2018"});
data.push({"dni": "12345678", "nombres": "DELGADO CHOZO JUAN FRANCISCO", "sede": "CANTA CALLAO 2", "horario": "07:00 - 17:00", "tipo_horario": "REGULAR",
"fecha_entrada": "16/06/2018", "marcacion_entrada": "06:59", "marcacion_salida": "00:00", "fecha_salida": "16/06/2018"});
data.push({"dni": "12345678", "nombres": "DELGADO CHOZO JUAN FRANCISCO", "sede": "CANTA CALLAO 2", "horario": "07:00 - 07:00", "tipo_horario": "AMANECIDA 24h",
"fecha_entrada": "17/06/2018", "marcacion_entrada": "06:59", "marcacion_salida": "00:00", "fecha_salida": "18/06/2018"});
}
function listarSedes(selectorName) { function listarSedes(selectorName) {
...@@ -57,31 +46,34 @@ function mostrarVistaPrevia() { ...@@ -57,31 +46,34 @@ function mostrarVistaPrevia() {
handsonTable.destroy(); handsonTable.destroy();
let container = document.getElementById("tblProyectado"); let container = document.getElementById("tblProyectado");
let filas = []; let data = [];
response.data.forEach(d => { response.data.forEach(rol => {
d.detalles_rol.forEach(dr => { rol.detalles_rol
.map(dr => {
dr.horario = `${dr.fecha_entrada.split(" ")[1]} - ${dr.fecha_salida.split(" ")[1]}`; dr.horario = `${dr.fecha_entrada.split(" ")[1]} - ${dr.fecha_salida.split(" ")[1]}`;
dr.fecha_entrada = dr.fecha_entrada.split(" ")[0]; dr.fecha_entrada = dr.fecha_entrada.split(" ")[0];
dr.fecha_salida = dr.fecha_salida.split(" ")[0]; dr.fecha_salida = dr.fecha_salida.split(" ")[0];
debugger return dr;
let objFila = { })
policia_dni: d.policia_dni, .forEach(dr => {
policia_nombres: d.policia_nombres, let obj = {
policia_dni: rol.policia_dni,
policia_nombres: rol.policia_nombres,
fecha_entrada: dr.fecha_entrada, fecha_entrada: dr.fecha_entrada,
fecha_salida: dr.fecha_salida, fecha_salida: dr.fecha_salida,
sede_id: d.sede_id, sede_id: rol.sede_id,
sede_descripcion: d.sede_descripcion, sede_descripcion: rol.sede_descripcion,
horario: dr.horario, horario: dr.horario,
tiporol_descripcion: d.tiporol_descripcion tiporol_descripcion: rol.tiporol_descripcion
}; };
filas.push(objFila); data.push(obj);
}); });
}); });
handsonTable = new Handsontable(container, { handsonTable = new Handsontable(container, {
data: filas, data: data,
stretchH: 'all', stretchH: 'all',
rowHeaders: true, rowHeaders: true,
colHeaders: ['DNI', 'Apellidos y Nombres', 'Sede', 'Horario', 'Rol', 'Fecha Entrada', 'Hora entrada', 'Hora Salida', 'Fecha Salida'], colHeaders: ['DNI', 'Apellidos y Nombres', 'Sede', 'Horario', 'Rol', 'Fecha Entrada', 'Hora entrada', 'Hora Salida', 'Fecha Salida'],
...@@ -249,6 +241,5 @@ $().ready(function () { ...@@ -249,6 +241,5 @@ $().ready(function () {
$("#dpFechaFin").datepicker('setDate', 'now'); $("#dpFechaFin").datepicker('setDate', 'now');
// defaultConfigDataTable(); // defaultConfigDataTable();
defaultConfigHandsonTable(); defaultConfigHandsonTable();
initializeData();
$("#btnVistaPrevia").click(mostrarVistaPrevia); $("#btnVistaPrevia").click(mostrarVistaPrevia);
}); });
\ No newline at end of file
...@@ -68,26 +68,7 @@ ...@@ -68,26 +68,7 @@
<button type="button" id="btnGuardarCambios" class="btn bg-slate border-slate-600 btn-xs"><i class="glyphicon glyphicon-plus"></i>&nbsp; Guardar cambios</button> <button type="button" id="btnGuardarCambios" class="btn bg-slate border-slate-600 btn-xs"><i class="glyphicon glyphicon-plus"></i>&nbsp; Guardar cambios</button>
</div> </div>
</div> </div>
<div id="tblProyectado"> <div id="tblProyectado"></div>
<!-- <table class="table table-responsive dataTable table-striped table-sm table-bordered" id="tblAsistenciaPolicias">
<thead>
<tr>
<th class="text-center">N°</th>
<th class="text-center">Apellidos y Nombres</th>
<th class="text-center">Sede</th>
<th class="text-center">Horario</th>
<th class="text-center">Tipo de horario</th>
<th class="text-center">Fecha de Entrada</th>
<th class="text-center">Marcación de entrada</th>
<th class="text-center">Marcación de salida</th>
<th class="text-center">Fecha de salida</th>
</tr>
</thead>
<tbody>
</tbody>
</table>-->
</div>
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment