Commit 5f36ddb0 by Billy Larru

commit de borrador para no quitar el ejemplo de prueba de arreglo de promesas

parent 9a0af8e0
......@@ -64,7 +64,6 @@ function defaultConfigHandsonTable() {
function mostrarVistaPrevia() {
ajaxWebService.get(URI_POLICIA_PROYECCION).then((response) => {
debugger
if (response.status) {
handsonTable.destroy();
let container = document.getElementById("tblProyectado");
......@@ -194,15 +193,85 @@ function guardarCambios() {
});
// let mrd = {
// id: 1,
// sede_descripcion: "ARENALES",
// asistencia_entrada: "10:00",
// asistencia_salida: "22:22"
// };
//
// ajaxWebService.patch("http://sistem16:666/proyeccion/1", mrd)
// setInterval(() => {
// console.log(moment().format("YYYY/DD/MM HH:MM:SS s"))
// }, 500)
// let timer1 = () => {
// return new Promise((resolve, reject) => {
// resolve(ajaxWebService.get("https://yts.am/api/v2/list_movies.json"))
// });
// }
//
// let timer2 = () => {
// return new Promise((resolve, reject) => {
// let mrd = {
// id: 2,
// sede_descripcion: "ARENALES",
// asistencia_entrada: "10:00",
// asistencia_salida: "22:22"
// };
//
// resolve(ajaxWebService.get("https://yts.am/api/v2/list_movies.json?sort=seeds&limit=15"))
// })
// }
// Promise.all([ajaxWebService.get("https://yts.am/api/v2/list_movies.json"), ajaxWebService.get("https://yts.am/api/v2/list_movies.json?sort=seeds&limit=15")])
// .then((value) => {
// console.log(`FIN`, moment().format("YYYY/DD/MM HH:MM:SS s"))
// debugger;
// })
Promise.all(dataRequest.map(p => ajaxWebService.patch(`${URI_POLICIA_PROYECCION}/${p.id}`, p)))
.then(axios.spread(function (...pms) {
console.log("POR FIN")
}))
let promises = []
dataRequest.forEach(d => {
promises.push(ajaxWebService.patch(`${URI_POLICIA_PROYECCION}/${d.id}`, d))
});
axios.all(promises)
.then(axios.spread(function (acct, perms) {
debugger
}));
swal({
title: 'Está seguro de guardar los cambios?',
text: "",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Sí, guardar!'
}).then((result) => {
if (result.value) {
// dataRequest.forEach(d => {
// promises.push(ajaxWebService.patch(`${URI_POLICIA_PROYECCION}/${d.id}`, d))
// });
// Promise.all([get1(), get2()])
// .then(function ([acct, perms]) {
// swal(
// {
// type: 'success',
// title: '¡Se guardaron los cambios correctamente!',
// showConfirmButton: false,
// timer: 1500
// }
// );
// });
}
})
// ajaxWebService.patch(URI_POLICIA_PROYECCION, dataRequest).then((response) => {
//
......
......@@ -2,97 +2,98 @@
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@include file="templates/header.jsp" %>
<!--template-core-->
<!--css de la pagina-->
<head>
<%@include file="templates/header.jsp" %>
<!--template-core-->
<!--css de la pagina-->
<link href="../css/lib/sweetalert2.min.css" rel="stylesheet" type="text/css"/>
<!--css-->
</head>
<body>
<%@include file="templates/header-body.jsp" %>
<!-- content -->
<div class="col-md-6 col-md-offset-3">
<div class="panel panel-primary">
<div class="panel-heading">
<h5 class="panel-title">Proyección de Asistencias</h5>
</div>
<!--css-->
</head>
<body>
<%@include file="templates/header-body.jsp" %>
<!-- content -->
<div class="col-md-6 col-md-offset-3">
<div class="panel panel-primary">
<div class="panel-heading">
<h5 class="panel-title">Proyección de Asistencias</h5>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-6 form-group">
<label>Policia</label>
<select class="select-search form-control" id="cboPoliciasFiltro">
</select>
</div>
<div class="col-md-6 form-group">
<label>Sede</label>
<select id="cboSedesFiltro" class="select-search form-control">
<div class="panel-body">
<div class="row">
<div class="col-md-6 form-group">
<label>Policia</label>
<select class="select-search form-control" id="cboPoliciasFiltro">
</select>
</div>
<div class="col-md-6 form-group">
<label>Sede</label>
<select id="cboSedesFiltro" class="select-search form-control">
</select>
</div>
</div>
</select>
</div>
</div>
<div class="row">
<div class="col-md-6 form-group">
<label>Fecha Inicio</label>
<div class="input-group">
<span class="input-group-addon"><i class="icon-calendar"></i></span>
<input type="text" class="form-control" name="dpFechaInicio" id="dpFechaInicio">
</div>
</div>
<div class="col-md-6 form-group">
<label>Fecha Fin</label>
<div class="input-group">
<span class="input-group-addon"><i class="icon-calendar"></i></span>
<input type="text" class="form-control" name="dpFechaFin" id="dpFechaFin">
</div>
</div>
</div>
</div>
<div class="panel-footer">
<div class="text-center">
<button class="btn btn-primary" id="btnVistaPrevia"><i class="icon-eye4"></i> Ver</button>&nbsp;
<!--<button class="btn btn-warning" id="btnLimpiar"><i class="fa fa-eraser"></i> Limpiar</button>-->
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 form-group">
<label>Fecha Inicio</label>
<div class="input-group">
<span class="input-group-addon"><i class="icon-calendar"></i></span>
<input type="text" class="form-control" name="dpFechaInicio" id="dpFechaInicio">
</div>
</div>
<div class="col-md-6 form-group">
<label>Fecha Fin</label>
<div class="input-group">
<span class="input-group-addon"><i class="icon-calendar"></i></span>
<input type="text" class="form-control" name="dpFechaFin" id="dpFechaFin">
</div>
</div>
</div>
</div>
<div class="panel-footer">
<div class="text-center">
<button class="btn btn-primary" id="btnVistaPrevia"><i class="icon-eye4"></i> Ver</button>&nbsp;
<!--<button class="btn btn-warning" id="btnLimpiar"><i class="fa fa-eraser"></i> Limpiar</button>-->
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="panel panel-primary card-3">
<div class="panel-heading">
<h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="icon icon-search4"></i>&nbsp;ASISTENCIAS PROYECTADAS</h6>
<div class="heading-elements">
<button type="button" id="btnGuardarCambios" class="btn bg-slate border-slate-600 btn-xs"><i class="glyphicon glyphicon-plus"></i>&nbsp; Guardar cambios</button>
</div>
</div>
<div id="tblProyectado"></div>
</div>
</div>
<div class="col-md-12">
<div class="panel panel-primary card-3">
<div class="panel-heading">
<h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="icon icon-search4"></i>&nbsp;ASISTENCIAS PROYECTADAS</h6>
<div class="heading-elements">
<button type="button" id="btnGuardarCambios" class="btn bg-slate border-slate-600 btn-xs"><i class="glyphicon glyphicon-plus"></i>&nbsp; Guardar cambios</button>
</div>
</div>
<div id="tblProyectado"></div>
</div>
</div>
<!-- / content -->
<!-- / content -->
<%@include file="templates/footer-body.jsp"%>
<!--js de la pagina-->
<%@include file="templates/footer-body.jsp"%>
<!--js de la pagina-->
<script src="../plantilla/assets/js/plugins/ui/moment/moment.min.js" type="text/javascript"></script>
<script src="../plantilla/assets/js/plugins/pickers/daterangepicker.js"></script>
<script src="../plantilla/assets/js/core/libraries/jquery_ui/widgets.min.js"></script>
<script src="../plantilla/assets/js/plugins/tables/datatables/datatables.min.js" type="text/javascript"></script>
<script src="../js/lib/dataTables.rowsGroup.js" type="text/javascript"></script>
<script src="../plantilla/assets/js/plugins/tables/handsontable/handsontable.min.js"></script>
<script src="../js/lib/jquery.inputmask.bundle.min.js" type="text/javascript"></script>
<script src="../js/lib/lodash.js" type="text/javascript"></script>
<script src="../js/lib/sweetalert2.min.js" type="text/javascript"></script>
<script src="../js/lib/axios.min.js" type="text/javascript"></script>
<script src="../plantilla/assets/js/plugins/forms/selects/select2.min.js"></script>
<script src="../js/pages/proyectar_asistencia_policias.js" type="text/javascript"></script>
<!--js-->
<script src="../plantilla/assets/js/plugins/ui/moment/moment.min.js" type="text/javascript"></script>
<script src="../plantilla/assets/js/plugins/pickers/daterangepicker.js"></script>
<script src="../plantilla/assets/js/core/libraries/jquery_ui/widgets.min.js"></script>
<script src="../plantilla/assets/js/plugins/tables/datatables/datatables.min.js" type="text/javascript"></script>
<script src="../js/lib/dataTables.rowsGroup.js" type="text/javascript"></script>
<script src="../plantilla/assets/js/plugins/tables/handsontable/handsontable.min.js"></script>
<script src="../js/lib/jquery.inputmask.bundle.min.js" type="text/javascript"></script>
<script src="../js/lib/lodash.js" type="text/javascript"></script>
<script src="../js/lib/axios.min.js" type="text/javascript"></script>
<script src="../plantilla/assets/js/plugins/forms/selects/select2.min.js"></script>
<script src="../js/pages/proyectar_asistencia_policias.js" type="text/javascript"></script>
<!--js-->
</body>
</body>
</html>
\ No newline at end of file
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