Commit dfd67559 by Billy Larru

[EDIT evaluacion justificacion, seleccionar fechas de asistencias]

parent 0d39c60c
...@@ -55,6 +55,7 @@ const URI_ESTADOJUSTIFICACION = "estadoJustificaciones" ...@@ -55,6 +55,7 @@ const URI_ESTADOJUSTIFICACION = "estadoJustificaciones"
const URI_TIPOPERSONAL = "tipoPersonales" const URI_TIPOPERSONAL = "tipoPersonales"
const URI_MESESCIERRE = "mesesCierre" const URI_MESESCIERRE = "mesesCierre"
const URI_PERIODOCIERRE = "periodoCierreAsistencia" const URI_PERIODOCIERRE = "periodoCierreAsistencia"
const URI_JUSTIFICACION_ASISTENCIAS = "asistenciaJustificacion"
//</editor-fold> //</editor-fold>
const swalWithBootstrapButtons = swal.mixin({ const swalWithBootstrapButtons = swal.mixin({
......
...@@ -197,17 +197,6 @@ const listarPersonal = (selectorName) => { ...@@ -197,17 +197,6 @@ const listarPersonal = (selectorName) => {
initSelect2(selectorName, baseURLRest + URI_TRABAJADORES, {title: "nombresapellidos", subtitle: "documentoidentidad"}); initSelect2(selectorName, baseURLRest + URI_TRABAJADORES, {title: "nombresapellidos", subtitle: "documentoidentidad"});
}; };
const listarSedes = (selectorName) => {
ajaxWebService.get(URI_SEDES).then((result) => {
let sedes = result.data;
sedes = _.orderBy(sedes, s => s.descripcion);
let html = `<option value="">[TODOS]</option>`;
sedes.forEach(sede => html += `<option value="${sede.codigo}">${sede.descripcion}</option>`);
$(`${selectorName}`).html(html);
$(selectorName).select2();
});
};
const listarEstadoAsistencia = (nodeIdentifier) => { const listarEstadoAsistencia = (nodeIdentifier) => {
ajaxWebService.get(URI_ESTADO_ASISTENCIA).then((response) => { ajaxWebService.get(URI_ESTADO_ASISTENCIA).then((response) => {
......
let justificacion; let justificacion;
const seleccionarCheckBoxTodo = (tr) => {
if (tr.prop('checked')) {
$('.chkAsistencia').prop('checked', true).uniform()
} else {
$('.chkAsistencia').prop('checked', false).uniform()
}
}
const seleccionarCheckBox = () => {
if ($('.chkAsistencia:checked').length === $('.chkAsistencia').length) {
$('#chkTodo').prop('checked', true).uniform()
} else {
$('#chkTodo').prop('checked', false).uniform()
}
}
function getColumns() {
let columns = [
{
title: `<input type="checkbox" id="chkTodo">`,
data: null,
className: 'text-center',
render: (data) => {
return `<input type="checkbox" class="chkAsistencia">`
}
},
{
title: `FECHA<br>ASISTENCIA`,
data: "fecha_asistencia",
className: `text-center`
},
{
title: "HORA",
data: "hora_asistencia",
className: "text-center"
},
{
title: `DESCUENTO`,
data: `descuento`,
className: 'text-center',
render: (data) => {
let texto = ""
if (data.includes("min")) {
texto = data
} else {
texto = `S/${parseFloat(data).toFixed(2)}`
}
return `<span class="text-danger">${texto}</span>`
}
},
{
title: `OBSERVACIÓN`,
data: `observacion`,
className: 'text-center'
},
{
title: `SEDE<br>MARCACIÓN`,
data: `sede_marcacion`,
className: 'text-center'
},
{
title: `TIPO<br>REGISTRO`,
data: `huella`,
className: 'text-center',
render: (data) => {
let label = "", contenido = ""
if (data === 1) {
label = "label label-success"
contenido = "HUELLA"
} else if (data === 0) {
label = "label bg-teal"
contenido = "MANUAL"
}
return `<span class="${label}">${contenido}</span>`
}
},
{
title: "TIPO TRABAJADOR",
data: "tipo_trabajador",
className: "text-center"
}
];
return columns;
}
const listarAsistencias = (objParams = {}) => {
ajaxWebService.get(URI_JUSTIFICACION_ASISTENCIAS, objParams).then((response) => {
let columns = getColumns();
let wrapsNameDatatable = `divDatatable`;
let classNameForDatatable = `display table table-bordered`;
makeDatatable(
wrapsNameDatatable,
{
data: response.data,
columns,
},
classNameForDatatable,
).then((nodes) => {
$("#chkTodo, .chkAsistencia").uniform()
nodes.container
.off()
.on("click", ".verdetalle", function () {
// let data = nodes.datatable.DataTable().row($(this).parents("tr")).data();
// mostrarModalVerDetalleJustificacion(data);
})
.on("click", "#chkTodo", (e) => seleccionarCheckBoxTodo($(e.currentTarget)))
.on("click", ".chkAsistencia", (e) => seleccionarCheckBox());
});
});
};
const cargarDatos = () => { const cargarDatos = () => {
justificacion = JSON.parse(localStorage.getItem('data')); justificacion = JSON.parse(localStorage.getItem('data'));
...@@ -17,7 +138,7 @@ const cargarDatos = () => { ...@@ -17,7 +138,7 @@ const cargarDatos = () => {
$("#txtObservacion").text(`${justificacion.observacion}`) $("#txtObservacion").text(`${justificacion.observacion}`)
$("#spanNumeroDocumentosAdjuntos").text(`${justificacion.numero_documentos_adjuntos}`) $("#spanNumeroDocumentosAdjuntos").text(`${justificacion.numero_documentos_adjuntos}`)
let documentos = justificacion.documentos; let documentos = justificacion.documentos;
debugger
// let urlDocumento = documentos[0].url // let urlDocumento = documentos[0].url
// $("#imgDocumento").attr('height', '200px') // $("#imgDocumento").attr('height', '200px')
// $("#imgDocumento").attr('width', '200px') // $("#imgDocumento").attr('width', '200px')
...@@ -40,7 +161,6 @@ const cargarDatos = () => { ...@@ -40,7 +161,6 @@ const cargarDatos = () => {
.join("") .join("")
$("#divDocumentos").html(html) $("#divDocumentos").html(html)
} }
const justificar = (estadoJustificacion = 1) => { const justificar = (estadoJustificacion = 1) => {
let titulo = ""; let titulo = "";
...@@ -92,7 +212,6 @@ const justificar = (estadoJustificacion = 1) => { ...@@ -92,7 +212,6 @@ const justificar = (estadoJustificacion = 1) => {
} }
const aceptarJustificacion = () => { const aceptarJustificacion = () => {
justificar() justificar()
} }
...@@ -100,9 +219,9 @@ const rechazarJustificacion = () => { ...@@ -100,9 +219,9 @@ const rechazarJustificacion = () => {
justificar(2) justificar(2)
} }
$(document).ready(function () { $(document).ready(function () {
cargarDatos() cargarDatos()
$("#btnAceptar").click(aceptarJustificacion) $("#btnAceptar").click(aceptarJustificacion)
$("#btnRechazar").click(rechazarJustificacion) $("#btnRechazar").click(rechazarJustificacion)
listarAsistencias()
}) })
\ No newline at end of file
...@@ -71,7 +71,6 @@ function getColumns() { ...@@ -71,7 +71,6 @@ function getColumns() {
return columns; return columns;
} }
const mostrarModalVerDetalleJustificacion = (data) => { const mostrarModalVerDetalleJustificacion = (data) => {
// let filtros = { // let filtros = {
// fecha_inicio: $("#dpFechaInicioFiltro").val(), // fecha_inicio: $("#dpFechaInicioFiltro").val(),
...@@ -83,9 +82,6 @@ const mostrarModalVerDetalleJustificacion = (data) => { ...@@ -83,9 +82,6 @@ const mostrarModalVerDetalleJustificacion = (data) => {
// localStorage.setItem('filtros', JSON.stringify(filtros)) // localStorage.setItem('filtros', JSON.stringify(filtros))
location.href = `${baseURLModals}justificaciones/evaluarJustificacion.jsp` location.href = `${baseURLModals}justificaciones/evaluarJustificacion.jsp`
} }
const listarJustificaciones = (objParams = {}) => { const listarJustificaciones = (objParams = {}) => {
ajaxWebService.get(URI_JUSTIFICACION, objParams).then((response) => { ajaxWebService.get(URI_JUSTIFICACION, objParams).then((response) => {
let columns = getColumns(); let columns = getColumns();
...@@ -111,12 +107,9 @@ const listarJustificaciones = (objParams = {}) => { ...@@ -111,12 +107,9 @@ const listarJustificaciones = (objParams = {}) => {
}); });
}); });
}; };
const listarPersonal = (selectorName) => { const listarPersonal = (selectorName) => {
initSelect2(selectorName, baseURLRest + URI_TRABAJADORES, {title: "nombresapellidos", subtitle: "documentoidentidad"}); initSelect2(selectorName, baseURLRest + URI_TRABAJADORES, {title: "nombresapellidos", subtitle: "documentoidentidad"});
}; };
const listarEstadoJustificaciones = (nodeIdentifier) => { const listarEstadoJustificaciones = (nodeIdentifier) => {
ajaxWebService.get(URI_ESTADOJUSTIFICACION).then((response) => { ajaxWebService.get(URI_ESTADOJUSTIFICACION).then((response) => {
let estadoJusticaciones = response.data; let estadoJusticaciones = response.data;
...@@ -128,7 +121,6 @@ const listarEstadoJustificaciones = (nodeIdentifier) => { ...@@ -128,7 +121,6 @@ const listarEstadoJustificaciones = (nodeIdentifier) => {
$(nodeIdentifier).selectpicker('refresh') $(nodeIdentifier).selectpicker('refresh')
}); });
} }
const formControls = { const formControls = {
init() { init() {
this.initPersonal() this.initPersonal()
...@@ -151,7 +143,6 @@ const formControls = { ...@@ -151,7 +143,6 @@ const formControls = {
listarEstadoJustificaciones("#cboEstadoJustificacionFiltro") listarEstadoJustificaciones("#cboEstadoJustificacionFiltro")
} }
} }
//
const aplicarFiltro = () => { const aplicarFiltro = () => {
let personal = $("#cboPersonalFiltro").select2('data')[0]; let personal = $("#cboPersonalFiltro").select2('data')[0];
let {id: trabajador_id} = personal ? personal : {id: ""} let {id: trabajador_id} = personal ? personal : {id: ""}
...@@ -170,8 +161,6 @@ const aplicarFiltro = () => { ...@@ -170,8 +161,6 @@ const aplicarFiltro = () => {
}) })
listarJustificaciones({params}) listarJustificaciones({params})
} }
$(document).ready(function () { $(document).ready(function () {
formControls.init() formControls.init()
$("#btnMostrarTodo").click(listarJustificaciones) $("#btnMostrarTodo").click(listarJustificaciones)
......
...@@ -78,10 +78,21 @@ ...@@ -78,10 +78,21 @@
</div> </div>
</div>
</div>
<div class="col-md-12">
<div class="panel panel-primary card-3" style="margin-top: 30px">
<div class="panel-heading" style="padding: 8px 15px">
<h6 class="panel-title" style="font-size: 15px; font-family: inherit">ASIGNACIÓN DE ASISTENCIAS</h6>
</div>
<div id="divDatatable"></div>
<div class="panel-footer"> <div class="panel-footer">
<div class="text-center"> <div class="text-center">
<button class="btn btn-success" id="btnAceptar"><i class="fa fa-check"></i> Aceptar</button>&nbsp; <button class="btn btn-success" id="btnAceptar"><i class="fa fa-check"></i> Aprobar</button>&nbsp;
<button class="btn btn-danger" id="btnRechazar"><i class="fa fa-cross"></i> Rechazar</button>&nbsp; <button class="btn btn-danger" id="btnRechazar"><i class="fa fa-close"></i> Rechazar</button>&nbsp;
</div> </div>
</div> </div>
</div> </div>
......
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