Commit 76d737e0 by Billy Larru

agregando iconos de acciones

parent 380a1e61
let asistencias = [], sedes = []; let asistencias = [], sedes = [];
let htmlSedes; let htmlSedes;
function init() {
listarEstadoAsistencia();
}
function listarAsistencias(objParams = {}) { function listarAsistencias(objParams = {}) {
debugger debugger
axios.get(URI_POLICIAS_ASISTENCIA, objParams).then((response) => { axios.get(URI_POLICIAS_ASISTENCIA, objParams).then((response) => {
...@@ -13,7 +9,8 @@ function listarAsistencias(objParams = {}) { ...@@ -13,7 +9,8 @@ function listarAsistencias(objParams = {}) {
let columns = [ let columns = [
{ {
title: `N°`, title: `N°`,
data: `id` data: `id`,
className: 'text-center'
}, },
{ {
title: `APELLIDOS Y NOMBRES`, title: `APELLIDOS Y NOMBRES`,
...@@ -21,63 +18,87 @@ function listarAsistencias(objParams = {}) { ...@@ -21,63 +18,87 @@ function listarAsistencias(objParams = {}) {
}, },
{ {
title: `SEDE`, title: `SEDE`,
data: `sede_descripcion` data: `sede_descripcion`,
className: 'text-center'
}, },
{ {
title: `HORARIO`, title: `HORARIO`,
data: `horario` data: `horario`,
className: 'text-center'
}, },
{ {
title: `TIPO`, title: `TIPO`,
data: `tiporol_descripcion` data: `tiporol_descripcion`,
className: 'text-center'
}, },
{ {
title: `FRECUENCIA`, title: `FRECUENCIA`,
data: `frecuencia_descripcion` data: `frecuencia_descripcion`,
className: 'text-center'
}, },
{ {
title: `FECHA ENTRADA`, title: `FECHA ENTRADA`,
data: `fecha_entrada` data: `fecha_entrada`,
className: 'text-center'
}, },
{ {
title: `MARC. ENTRADA`, title: `MARC. ENTRADA`,
data: null, data: null,
className: 'text-center',
render: data => { render: data => {
let clase = ""; let label = "";
if (data.estado == 3 || data.estado == 4 || data.estado == 9) {
return `-`;
}
if (data.marcacion_entrada === null) { if (data.marcacion_entrada === null) {
return null; return null;
} }
if (data.huella_entrada === 1) { if (data.huella_entrada === 1) {
clase = "text-migration font-weight-bold"; label = "text-migration font-weight-bold";
} else if (data.huella_entrada === 0) { } else if (data.huella_entrada === 0) {
clase = "text-default"; label = "text-default";
} }
return `<span class="${clase}">${data.marcacion_entrada}</span>`; return `<span class="${label}">${data.marcacion_entrada}</span>`;
} }
}, },
{ {
title: `MARC. SALIDA`, title: `MARC. SALIDA`,
data: `marcacion_salida` data: null,
className: 'text-center',
render: (data) => {
let label = "";
if (data.estado == 3 || data.estado == 4 || data.estado == 9) {
return `-`;
}
if (data.marcacion_salida === null) {
return null;
}
if (data.huella_salida === 1) {
label = "text-migration font-weight-bold";
} else if (data.huella_salida === 0) {
label = "text-default";
}
return `<span class="${label}">${data.marcacion_salida}</span>`;
}
}, },
{ {
title: `FECHA SALIDA`, title: `FECHA SALIDA`,
data: `fecha_salida` data: `fecha_salida`,
className: 'text-center'
}, },
{ {
title: `ESTADO`, title: `ESTADO`,
data: null, data: null,
className: 'text-center',
render: (data) => { 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 label = "";
let estado = ""; let estado = "";
...@@ -127,7 +148,20 @@ function listarAsistencias(objParams = {}) { ...@@ -127,7 +148,20 @@ function listarAsistencias(objParams = {}) {
title: `ACCIONES`, title: `ACCIONES`,
data: null, data: null,
render: (data) => { render: (data) => {
return null; let acciones = "";
switch (data.estado) {
case 10:
case 11:
case null:
acciones = `<span data-toggle="tooltip" data-placement="left" title="Editar" style="cursor: pointer"> <i class='registrar icon-plus-circle2 text-success-700'></i>&nbsp;&nbsp; </span>
<span data-toggle="tooltip" data-placement="left" title="Editar" style="cursor: pointer"> <i class='editar icon-pencil text-slate-800'></i>&nbsp;&nbsp; </span>
<span data-toggle="tooltip" data-placement="left" title="Aprobar" style="cursor: pointer"> <i class='aprobar icon-checkmark-circle text-success-700'></i>&nbsp;&nbsp; </span>
<span data-toggle="tooltip" data-placement="left" title="Anular" style="cursor: pointer"> <i class='anular icon-cancel-circle2 text-danger-700'></i>&nbsp;&nbsp; </span>`;
break;
}
return acciones;
} }
} }
]; ];
...@@ -155,14 +189,20 @@ function listarAsistencias(objParams = {}) { ...@@ -155,14 +189,20 @@ function listarAsistencias(objParams = {}) {
makeDatatable({ makeDatatable(
{
data: response.data.data, data: response.data.data,
columns: columns, columns: columns,
columnDefs: columnDefs, columnDefs: columnDefs,
wrapsNameDatatable: wrapsNameDatatable, wrapsNameDatatable: wrapsNameDatatable,
classNameForDatatable: classNameForDatatable, classNameForDatatable: classNameForDatatable,
footer: footer footer: footer
}).then((response) => { }
).then((datatable) => {
$(datatable).on("click", ".registrar", function () {
let data = $(datatable).DataTable().row($(this).parents("tr")).data();
});
}); });
}); });
...@@ -298,24 +338,6 @@ function buscar() { ...@@ -298,24 +338,6 @@ function buscar() {
} }
//$("#dp").datepicker({
// minDate: new Date(1900, 1 - 1, 1), maxDate: '-18Y',
// dateFormat: 'dd/mm/yy',
// defaultDate: new Date(1970, 1 - 1, 1),
// changeMonth: true,
// changeYear: true,
// yearRange: '-110:-18',
// onSelect: function () {
// $(this).valid();
// }
//});
//$("#dtpFechaInicio").datepicker('setDate', 'now');
function seleccionCriterio() { function seleccionCriterio() {
$("#cboCriterio").change(function () { $("#cboCriterio").change(function () {
let criterio = $(this).val(); let criterio = $(this).val();
...@@ -417,9 +439,9 @@ function buscarAsistencias() { ...@@ -417,9 +439,9 @@ function buscarAsistencias() {
} }
$().ready(function () { $().ready(function () {
listarEstadoAsistencia();
listarPolicias("#cboPoliciasFiltro"); listarPolicias("#cboPoliciasFiltro");
listarSedes("#cboSedesFiltro"); listarSedes("#cboSedesFiltro");
init();
defaultConfigDataTable(); defaultConfigDataTable();
$('.selectpicker').selectpicker({ $('.selectpicker').selectpicker({
style: 'btn-info', style: 'btn-info',
......
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