Commit c206fa00 by Billy Larru

mostrando roles en la proyeccion, se agrega boton guardar cambios

parent c422a8ee
...@@ -94,13 +94,13 @@ function listarRolesPolicias(objParams = {}) { ...@@ -94,13 +94,13 @@ function listarRolesPolicias(objParams = {}) {
makeDatatable({ makeDatatable({
data: response.data, data: response.data,
columns: columns, columns,
columnDefs: columnDefs, columnDefs,
wrapsNameDatatable: wrapsNameDatatable, wrapsNameDatatable,
classNameForDatatable: classNameForDatatable, classNameForDatatable,
footer: footer footer
}).then((nodes) => { }).then((nodes) => {
nodes.container.on("click", ".ver-detalle", function () { nodes.container.off().on("click", ".ver-detalle", function () {
let data = nodes.datatable.DataTable().row($(this).parents("tr")).data(); let data = nodes.datatable.DataTable().row($(this).parents("tr")).data();
console.log(data); console.log(data);
...@@ -136,10 +136,10 @@ function listarRolesPolicias(objParams = {}) { ...@@ -136,10 +136,10 @@ function listarRolesPolicias(objParams = {}) {
} }
function listarTipoRoles() { function listarTipoRoles() {
ajaxWebService.get(URI_TIPOROL_POLICIA).then((result) => { ajaxWebService.get(URI_TIPOROL_POLICIA).then((response) => {
let roles = result.data; let tipoRoles = response.data;
let html = "<option>[SELECCIONE]</option>"; let html = "<option>[SELECCIONE]</option>";
roles.forEach(rol => html += `<option value="${rol.codigo}">${rol.descripcion}</option>`); tipoRoles.forEach(tp => html += `<option data-hora-entrada="${tp.hora_entrada}" data-hora-salida="${tp.hora_salida}" value="${tp.codigo}">${tp.descripcion}</option>`);
$("#cboTipoRol").html(html); $("#cboTipoRol").html(html);
}); });
} }
...@@ -205,20 +205,34 @@ function registrarRolPolicia() { ...@@ -205,20 +205,34 @@ function registrarRolPolicia() {
let sede_descripcion = $("#cboSedesModal option:selected").text(); let sede_descripcion = $("#cboSedesModal option:selected").text();
let estado = 1; let estado = 1;
let policia_dni = $("#cboPolicias option:selected").attr("documento_identidad"); let policia_dni = $("#cboPolicias option:selected").attr("documento_identidad");
let hora_entrada = $("#cboTipoRol option:selected").data('hora-entrada');
let hora_salida = $("#cboTipoRol option:selected").data('hora-salida');
debugger debugger
let fechas = generarFechas(fecha_inicio, fecha_fin); let fechas = generarFechas(fecha_inicio, fecha_fin);
let detalles_rol = []; let detalles_rol = [];
let numero = 1; let numero = 1;
fechas.forEach((f) => {
let detalle_rol = { fechas
id: numero++, .map((f) => {
fecha_entrada: f, let obj = {
fecha_salida: f, fecha_entrada: `${f} ${hora_entrada}`,
estado: 1 fecha_salida: `${f} ${hora_salida}`
}; }
detalles_rol.push(detalle_rol);
}); return obj;
})
.forEach((f) => {
debugger
let detalle_rol = {
id: numero++,
fecha_entrada: f.fecha_entrada,
fecha_salida: f.fecha_salida,
estado: 1
};
detalles_rol.push(detalle_rol);
});
let params = { let params = {
numeroFila: policia_id, numeroFila: policia_id,
......
...@@ -53,17 +53,17 @@ function defaultConfigHandsonTable() { ...@@ -53,17 +53,17 @@ function defaultConfigHandsonTable() {
function mostrarVistaPrevia() { function mostrarVistaPrevia() {
ajaxWebService.get(URI_ROL_POLICIA).then((response) => { ajaxWebService.get(URI_ROL_POLICIA).then((response) => {
debugger debugger
if (response.data.status) { if (response.status) {
handsonTable.destroy(); handsonTable.destroy();
let container = document.getElementById("tblProyectado"); let container = document.getElementById("tblProyectado");
let filas = []; let filas = [];
debugger response.data.forEach(d => {
response.data.data.forEach(d => {
d.detalles_rol.forEach(dr => { d.detalles_rol.forEach(dr => {
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
let objFila = { let objFila = {
policia_dni: d.policia_dni, policia_dni: d.policia_dni,
policia_nombres: d.policia_nombres, policia_nombres: d.policia_nombres,
...@@ -71,7 +71,8 @@ function mostrarVistaPrevia() { ...@@ -71,7 +71,8 @@ function mostrarVistaPrevia() {
fecha_salida: dr.fecha_salida, fecha_salida: dr.fecha_salida,
sede_id: d.sede_id, sede_id: d.sede_id,
sede_descripcion: d.sede_descripcion, sede_descripcion: d.sede_descripcion,
horario: dr.horario,
tiporol_descripcion: d.tiporol_descripcion
}; };
filas.push(objFila); filas.push(objFila);
}); });
...@@ -110,7 +111,7 @@ function mostrarVistaPrevia() { ...@@ -110,7 +111,7 @@ function mostrarVistaPrevia() {
readOnly: true readOnly: true
}, },
{ {
"data": "tipo_horario", "data": "tiporol_descripcion",
"className": "text-center", "className": "text-center",
readOnly: true readOnly: true
}, },
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
<div class="text-center"> <div class="text-center">
<button class="btn btn-primary" id="btnVistaPrevia"><i class="icon-eye4"></i> Vista previa</button>&nbsp; <button class="btn btn-primary" id="btnVistaPrevia"><i class="icon-eye4"></i> Ver</button>&nbsp;
<!--<button class="btn btn-warning" id="btnLimpiar"><i class="fa fa-eraser"></i> Limpiar</button>--> <!--<button class="btn btn-warning" id="btnLimpiar"><i class="fa fa-eraser"></i> Limpiar</button>-->
</div> </div>
</div> </div>
...@@ -64,6 +64,9 @@ ...@@ -64,6 +64,9 @@
<div class="panel panel-primary card-3"> <div class="panel panel-primary card-3">
<div class="panel-heading"> <div class="panel-heading">
<h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="icon icon-search4"></i>&nbsp;ASISTENCIAS PROYECTADAS</h6> <h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="icon icon-search4"></i>&nbsp;ASISTENCIAS PROYECTADAS</h6>
<div class="heading-elements">
<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 id="tblProyectado"> <div id="tblProyectado">
<!-- <table class="table table-responsive dataTable table-striped table-sm table-bordered" id="tblAsistenciaPolicias"> <!-- <table class="table table-responsive dataTable table-striped table-sm table-bordered" id="tblAsistenciaPolicias">
......
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