Commit c206fa00 by Billy Larru

mostrando roles en la proyeccion, se agrega boton guardar cambios

parent c422a8ee
......@@ -94,13 +94,13 @@ function listarRolesPolicias(objParams = {}) {
makeDatatable({
data: response.data,
columns: columns,
columnDefs: columnDefs,
wrapsNameDatatable: wrapsNameDatatable,
classNameForDatatable: classNameForDatatable,
footer: footer
columns,
columnDefs,
wrapsNameDatatable,
classNameForDatatable,
footer
}).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();
console.log(data);
......@@ -136,10 +136,10 @@ function listarRolesPolicias(objParams = {}) {
}
function listarTipoRoles() {
ajaxWebService.get(URI_TIPOROL_POLICIA).then((result) => {
let roles = result.data;
ajaxWebService.get(URI_TIPOROL_POLICIA).then((response) => {
let tipoRoles = response.data;
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);
});
}
......@@ -205,16 +205,30 @@ function registrarRolPolicia() {
let sede_descripcion = $("#cboSedesModal option:selected").text();
let estado = 1;
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
let fechas = generarFechas(fecha_inicio, fecha_fin);
let detalles_rol = [];
let numero = 1;
fechas.forEach((f) => {
fechas
.map((f) => {
let obj = {
fecha_entrada: `${f} ${hora_entrada}`,
fecha_salida: `${f} ${hora_salida}`
}
return obj;
})
.forEach((f) => {
debugger
let detalle_rol = {
id: numero++,
fecha_entrada: f,
fecha_salida: f,
fecha_entrada: f.fecha_entrada,
fecha_salida: f.fecha_salida,
estado: 1
};
detalles_rol.push(detalle_rol);
......
......@@ -53,17 +53,17 @@ function defaultConfigHandsonTable() {
function mostrarVistaPrevia() {
ajaxWebService.get(URI_ROL_POLICIA).then((response) => {
debugger
if (response.data.status) {
if (response.status) {
handsonTable.destroy();
let container = document.getElementById("tblProyectado");
let filas = [];
debugger
response.data.data.forEach(d => {
response.data.forEach(d => {
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_salida = dr.fecha_salida.split(" ")[0];
debugger
let objFila = {
policia_dni: d.policia_dni,
policia_nombres: d.policia_nombres,
......@@ -71,7 +71,8 @@ function mostrarVistaPrevia() {
fecha_salida: dr.fecha_salida,
sede_id: d.sede_id,
sede_descripcion: d.sede_descripcion,
horario: dr.horario,
tiporol_descripcion: d.tiporol_descripcion
};
filas.push(objFila);
});
......@@ -110,7 +111,7 @@ function mostrarVistaPrevia() {
readOnly: true
},
{
"data": "tipo_horario",
"data": "tiporol_descripcion",
"className": "text-center",
readOnly: true
},
......
......@@ -52,7 +52,7 @@
</div>
<div class="panel-footer">
<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>-->
</div>
</div>
......@@ -64,6 +64,9 @@
<div class="panel panel-primary card-3">
<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>
<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 id="tblProyectado">
<!-- <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