Commit bed0d075 by Billy Larru

mostrando mensaje de registro de asistencia de policias

parent ded43277
let asistencias = [], sedes = []; let asistencias = [], sedes = [];
let htmlSedes; let htmlSedes;
function getColumns() {
function listarAsistencias(objParams = {}) {
axios.get(URI_POLICIAS_ASISTENCIA, objParams).then((response) => {
response.data = formatResponse(response);
let columns = [ let columns = [
{ {
title: `N°`, title: `N°`,
...@@ -164,7 +161,10 @@ function listarAsistencias(objParams = {}) { ...@@ -164,7 +161,10 @@ function listarAsistencias(objParams = {}) {
} }
]; ];
return columns;
}
function getColumnDefs() {
let columnDefs = [ let columnDefs = [
{orderable: false, width: '5%', targets: 0, className: "text-center"}, {orderable: false, width: '5%', targets: 0, className: "text-center"},
{orderable: false, width: '5%', targets: 1}, {orderable: false, width: '5%', targets: 1},
...@@ -180,28 +180,39 @@ function listarAsistencias(objParams = {}) { ...@@ -180,28 +180,39 @@ function listarAsistencias(objParams = {}) {
{orderable: false, width: '8%', targets: 11, className: "text-center"}, {orderable: false, width: '8%', targets: 11, className: "text-center"},
{orderable: false, width: '8%', targets: 12, className: "text-center"} {orderable: false, width: '8%', targets: 12, className: "text-center"}
]; ];
return columnDefs;
let wrapsNameDatatable = `divAsistencias`; }
let classNameForDatatable = `display table table-bordered`;
let footer = false;
makeDatatable( function inicializarInputsModal(data = {}){
{ $("#spanNombres").html(data.policia_nombres);
data: response.data.data, $("#dpAsistencia").datepicker({
columns: columns, minDate: new Date(2000, 1 - 1, 1), maxDate: new Date(),
columnDefs: columnDefs, dateFormat: 'dd/mm/yy',
wrapsNameDatatable: wrapsNameDatatable, setDate: 'now',
classNameForDatatable: classNameForDatatable, changeMonth: true,
footer: footer changeYear: true,
yearRange: '-18:+0',
onSelect: function () {
// $(this).valid();
} }
).then((datatable) => { });
$("#dpAsistencia").datepicker('setDate', data.fecha_entrada);
$("#cboTipoRegistro").change(cambioTipoRegistro);
}
$(datatable).on("click", ".registrar", function () { function mostrarMensajeResultadoModal(result = {}) {
let data = $(datatable).DataTable().row($(this).parents("tr")).data(); if (result.value) {
console.log(data); swal({
type: 'success',
title: '¡Asistencia registrada!',
showConfirmButton: false,
timer: 1500
})
}
}
function mostrarModalRegistroAsistencia(data = {}) {
axios.get("modals/policias/controlAsistencia/registrarAsistencia.jsp").then((response) => { axios.get("modals/policias/controlAsistencia/registrarAsistencia.jsp").then((response) => {
swal({ swal({
title: '<strong>Registrar Asistencia</strong>', title: '<strong>Registrar Asistencia</strong>',
...@@ -215,26 +226,37 @@ function listarAsistencias(objParams = {}) { ...@@ -215,26 +226,37 @@ function listarAsistencias(objParams = {}) {
cancelButtonAriaLabel: 'Thumbs down', cancelButtonAriaLabel: 'Thumbs down',
width: '30%', width: '30%',
onOpen: () => { onOpen: () => {
$("#spanNombres").html(data.policia_nombres); inicializarInputsModal(data);
$("#dpAsistencia").datepicker({
minDate: new Date(2000, 1 - 1, 1), maxDate: new Date(),
dateFormat: 'dd/mm/yy',
setDate: 'now',
changeMonth: true,
changeYear: true,
yearRange: '-18:+0',
onSelect: function () {
// $(this).valid();
}
});
$("#dpAsistencia").datepicker('setDate', data.fecha_entrada);
$("#cboTipoRegistro").change(cambioTipoRegistro);
} }
}).then((result) => {
mostrarMensajeResultadoModal(result);
}); });
}); });
}
function listarAsistencias(objParams = {}) {
axios.get(URI_POLICIAS_ASISTENCIA, objParams).then((response) => {
response.data = formatResponse(response);
let columns = getColumns();
let columnDefs = getColumnDefs();
}); let wrapsNameDatatable = `divAsistencias`;
let classNameForDatatable = `display table table-bordered`;
let footer = false;
makeDatatable(
{
data: response.data.data,
columns,
columnDefs,
wrapsNameDatatable,
classNameForDatatable,
footer
}
).then((datatable) => {
$(datatable).on("click", ".registrar", function () {
let data = $(datatable).DataTable().row($(this).parents("tr")).data();
mostrarModalRegistroAsistencia(data);
});
}); });
}); });
} }
......
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