Commit 8971d075 by Billy Larru

listando asistencia de policias

parent b893705d
......@@ -17,6 +17,7 @@ const URI_SEDES = "http://172.16.2.91:666/sedes";
const URI_ESTADO_ASISTENCIA = "http://172.16.2.91:666/estadoAsistencia";
const URI_POLICIAS = "http://172.16.2.91:666/policias";
const URI_ROL_POLICIA = "http://172.16.2.91:666/rolesPolicias";
const URI_POLICIAS_ASISTENCIA = "http://sistem16:666/asistenciaPolicias";
//</editor-fold>
......
......@@ -5,49 +5,168 @@ function init() {
listarEstadoAsistencia();
}
//function listarSedes() {
//
// if (Object.is(htmlSedes, undefined)) {
// axios.get(URI_LISTAR_SEDES).then((result) => {
// debugger
// let sedes = result.data;
// htmlSedes = `<label>Sede</label>
// <select class="selectpicker form-control" name="busqueda" id="busqueda" multiple>`;
// sedes.forEach((s) => {
// htmlSedes += `<option value="${s.codigo}">${s.descripcion}</option>`;
// });
// htmlSedes += `</select>`;
// debugger
// $('#divCriterio').html(htmlSedes);
// $('.selectpicker').selectpicker({
// style: 'btn-info',
// size: 4
// });
//
// $(".btn.dropdown-toggle.bs-placeholder").removeClass("btn-info");
// $(".btn.dropdown-toggle.bs-placeholder").css({
// border: "1px solid #ddd",
// backgroundColor: "#fff"
// });
//
// }).catch((error) => {
// console.log(error);
// });
// } else {
// $('#divCriterio').html(htmlSedes);
// $('.selectpicker').selectpicker({
// style: 'btn-info',
// size: 4
// });
// $(".btn.dropdown-toggle.bs-placeholder").removeClass("btn-info");
// $(".btn.dropdown-toggle.bs-placeholder").css({
// border: "1px solid #ddd",
// backgroundColor: "#fff"
// });
// }
//
//}
function listarAsistencias(objParams = {}) {
axios.get(URI_POLICIAS_ASISTENCIA, objParams).then((response) => {
response.data = formatResponse(response);
debugger
let columns = [
{
title: `N°`,
data: `id`
},
{
title: `APELLIDOS Y NOMBRES`,
data: `policia_nombres`
},
{
title: `SEDE`,
data: `sede_descripcion`
},
{
title: `HORARIO`,
data: `horario`
},
{
title: `TIPO`,
data: `tiporol_descripcion`
},
{
title: `FRECUENCIA`,
data: `frecuencia_descripcion`
},
{
title: `FECHA ENTRADA`,
data: `fecha_entrada`
},
{
title: `MARC. ENTRADA`,
data: null,
render: data => {
let clase = "";
if (data.marcacion_entrada === null) {
return null;
}
if (data.huella_entrada === 1) {
clase = "text-migration font-weight-bold";
} else if (data.huella_entrada === 0) {
clase = "text-default";
}
return `<span class="${clase}">${data.marcacion_entrada}</span>`;
}
},
{
title: `MARC. SALIDA`,
data: `marcacion_salida`
},
{
title: `FECHA SALIDA`,
data: `fecha_salida`
},
{
title: `ESTADO`,
data: null,
render: (data) => {
// if (data.marcacion_entrada == null && data.marcacion_salida == null) {
// return `<span class="label bg-purple">PENDIENTE</span>`;
// }
// else if (data.marcacion_entrada == null) {
// return `<span class="label bg-purple">ENTRADA PENDIENTE</span>`;
// } else if (data.marcacion_salida == null) {
// return `<span class="label bg-purple">SALIDA PENDIENTE</span>`;
// }
let label = "";
let estado = "";
switch (data.estado) {
case 1:
label = "label label-success";
estado = "TEMPRANO";
break;
case 2:
label = "label label-warning";
estado = "TARDANZA";
break;
case 3:
label = "label label-danger";
estado = "FCA";
break;
case 4:
label = "label label-danger";
estado = "FSA";
break;
case 5:
label = "label label-default";
estado = "NO MARCÓ";
break;
case 9:
label = "label label-info";
estado = "LSGH";
break;
case 10:
label = "label bg-purple";
estado = "ENTRADA PENDIENTE";
break;
case 11:
label = "label bg-purple";
estado = "SALIDA PENDIENTE";
break;
case null:
label = "label bg-purple";
estado = "PENDIENTE";
break;
}
return `<span class="${label}">${estado}</span>`;
}
},
{
title: `ACCIONES`,
data: null,
render: (data) => {
return null;
}
}
];
let columnDefs = [
{orderable: false, width: '5%', targets: 0, className: "text-center"},
{orderable: false, width: '5%', targets: 1},
{orderable: false, width: '30%', targets: 2, className: "text-center"},
{orderable: false, width: '7%', targets: 3, className: "text-center"},
{orderable: false, width: '7%', targets: 4, className: "text-center"},
{orderable: false, width: '10%', targets: 5, className: "text-center"},
{orderable: false, width: '8%', targets: 6, className: "text-center"},
{orderable: false, width: '8%', targets: 7, className: "text-center"},
{orderable: false, width: '8%', targets: 8, className: "text-center"},
{orderable: false, width: '8%', targets: 9, className: "text-center"},
{orderable: false, width: '8%', targets: 10, className: "text-center"},
{orderable: false, width: '8%', targets: 11, className: "text-center"},
{orderable: false, width: '8%', targets: 12, className: "text-center"}
];
let wrapsNameDatatable = `divAsistencias`;
let classNameForDatatable = `display table table-bordered`;
let footer = false;
makeDatatable({
data: response.data.data,
columns: columns,
columnDefs: columnDefs,
wrapsNameDatatable: wrapsNameDatatable,
classNameForDatatable: classNameForDatatable,
footer: footer
}).then((response) => {
});
});
}
function listarSedes(selectorName) {
axios.get(URI_SEDES).then((result) => {
......@@ -287,11 +406,6 @@ function evtChange() {
}
$().ready(function () {
listarPolicias("#cboPoliciasFiltro");
listarSedes("#cboSedesFiltro");
......@@ -341,7 +455,7 @@ $().ready(function () {
defaultConfigDatePicker();
seleccionCriterio();
$("#btnVerTodos").click(listarAsistencias);
});
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