Commit bed0d075 by Billy Larru

mostrando mensaje de registro de asistencia de policias

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