Commit 75aff2ae by Billy Larru

listado de asignacion de montos por amanecidas

parent cec395e8
function getColumns() {
let columns = [
{
title: `N°`,
data: `id`,
className: 'text-center'
},
{
title: `CONCEPTO`,
data: `descripcion`,
className: `text-center`,
},
{
title: `MONTO AMANECIDA 12h`,
data: `monto12h`,
className: 'text-center'
},
{
title: `MONTO AMANECIDA 24h`,
data: `monto24h`,
className: 'text-center'
},
{
title: 'ESTADO',
data: `estado`,
className: "text-center",
render: (data) => {
let label = "";
let contenido = "";
if (data === 1) {
label = `label label-success`;
contenido = "ACTIVO";
} else if (data === 0) {
label = `label label-danger`;
contenido = "PASIVO";
}
return `<span class="${label}">${contenido}</span>`;
}
},
{
title: `ACCIONES`,
data: null,
className: 'text-center',
render: (data) => {
let acciones = `<span data-placement="left" title="Editar" style="cursor: pointer"> <i class="editar icon-pencil text-slate-800"></i>&nbsp;&nbsp; </span>
<span data-placement="left" title="Eliminar" style="cursor: pointer"> <i class="eliminar icon-cancel-circle2 text-danger-700"></i>&nbsp;&nbsp; </span>`;
return acciones;
}
}
];
return columns;
}
function getColumnDefs() {
let columnDefs = [
{orderable: false, width: '3%', targets: 0, className: "text-center"},
{orderable: false, width: '10%', targets: 1, className: "text-center"},
{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"},
];
return columnDefs;
}
function cambiarFormatoDecimal(selectorName) { function cambiarFormatoDecimal(selectorName) {
$(selectorName).formatter({ $(selectorName).formatter({
...@@ -9,14 +77,14 @@ function registrar() { ...@@ -9,14 +77,14 @@ function registrar() {
let descripcion = $("#txtDescripcion").val(); let descripcion = $("#txtDescripcion").val();
let monto24h = parseFloat($("#txtMonto12h").val()); let monto24h = parseFloat($("#txtMonto12h").val());
let monto12h = parseFloat($("#txtMonto24h").val()); let monto12h = parseFloat($("#txtMonto24h").val());
let estado_registro = 1; let estado = 1;
let params = { let params = {
descripcion, descripcion,
monto12h, monto12h,
monto24h, monto24h,
estado_registro estado
} };
axios.post(URI_POLICIA_MONTOS_AMANECIDAS, params).then((response) => { axios.post(URI_POLICIA_MONTOS_AMANECIDAS, params).then((response) => {
response.data = formatResponse(response); response.data = formatResponse(response);
...@@ -27,21 +95,39 @@ function registrar() { ...@@ -27,21 +95,39 @@ function registrar() {
title: '¡Se registró correctamente!', title: '¡Se registró correctamente!',
showConfirmButton: false, showConfirmButton: false,
timer: 1500 timer: 1500
}) });
} }
}); });
} }
function listarMontos() { function listarMontos(objParams = {}) {
axios.get(URI_POLICIA_MONTOS_AMANECIDAS).then((response) => {
response.data = formatResponse(response.data);
if (response.data.status) { axios.get(URI_POLICIA_MONTOS_AMANECIDAS, objParams).then((response) => {
response.data = formatResponse(response);
let columns = getColumns();
let columnDefs = getColumnDefs();
} let wrapsNameDatatable = `divDatatable`;
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);
// });
});
}); });
} }
...@@ -49,6 +135,7 @@ function listarMontos() { ...@@ -49,6 +135,7 @@ function listarMontos() {
$().ready(function () { $().ready(function () {
// cambiarFormatoDecimal("#txtMonto12h"); // cambiarFormatoDecimal("#txtMonto12h");
// cambiarFormatoDecimal("#txtMonto24h"); // cambiarFormatoDecimal("#txtMonto24h");
defaultConfigDataTable();
listarMontos(); listarMontos();
$("#btnRegistrar").click(registrar); $("#btnRegistrar").click(registrar);
}); });
\ No newline at end of file
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<div class="panel-body"> <div class="panel-body">
<div class="row"> <div class="row">
<div class="col-md-12 form-group"> <div class="col-md-12 form-group">
<label>Descripcion</label> <label>Concepto</label>
<input type="text" class="form-control" id="txtDescripcion"> <input type="text" class="form-control" id="txtDescripcion">
</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