Commit 5f36ddb0 by Billy Larru

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

parent 9a0af8e0
...@@ -74,7 +74,7 @@ ajaxWebService.interceptors.response.use(function (response) { ...@@ -74,7 +74,7 @@ ajaxWebService.interceptors.response.use(function (response) {
message: response.data.message || `Operación exitosa`, message: response.data.message || `Operación exitosa`,
data: response.data.data || response.data data: response.data.data || response.data
}; };
console.log(respuesta) console.log(respuesta, moment().format("YYYY/DD/MM HH:MM:SS s"))
return respuesta; return respuesta;
}, function (error) { }, function (error) {
// Do something with response error // Do something with response error
...@@ -303,7 +303,7 @@ data: [], ...@@ -303,7 +303,7 @@ data: [],
classNameForDatatable: ``, classNameForDatatable: ``,
footerFilter: false, footerFilter: false,
highlighting: true highlighting: true
}) => { }) => {
let data = jsonForDatatable.data; let data = jsonForDatatable.data;
let columns = jsonForDatatable.columns; let columns = jsonForDatatable.columns;
let columnDefs = jsonForDatatable.columns; let columnDefs = jsonForDatatable.columns;
......
...@@ -64,7 +64,6 @@ function defaultConfigHandsonTable() { ...@@ -64,7 +64,6 @@ function defaultConfigHandsonTable() {
function mostrarVistaPrevia() { function mostrarVistaPrevia() {
ajaxWebService.get(URI_POLICIA_PROYECCION).then((response) => { ajaxWebService.get(URI_POLICIA_PROYECCION).then((response) => {
debugger
if (response.status) { if (response.status) {
handsonTable.destroy(); handsonTable.destroy();
let container = document.getElementById("tblProyectado"); let container = document.getElementById("tblProyectado");
...@@ -194,15 +193,85 @@ function guardarCambios() { ...@@ -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 = [] let promises = []
dataRequest.forEach(d => {
promises.push(ajaxWebService.patch(`${URI_POLICIA_PROYECCION}/${d.id}`, d))
});
axios.all(promises) swal({
.then(axios.spread(function (acct, perms) { title: 'Está seguro de guardar los cambios?',
debugger 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) => { // ajaxWebService.patch(URI_POLICIA_PROYECCION, dataRequest).then((response) => {
// //
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<%@include file="templates/header.jsp" %> <%@include file="templates/header.jsp" %>
<!--template-core--> <!--template-core-->
<!--css de la pagina--> <!--css de la pagina-->
<link href="../css/lib/sweetalert2.min.css" rel="stylesheet" type="text/css"/>
<!--css--> <!--css-->
</head> </head>
<body> <body>
...@@ -89,6 +89,7 @@ ...@@ -89,6 +89,7 @@
<script src="../plantilla/assets/js/plugins/tables/handsontable/handsontable.min.js"></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/jquery.inputmask.bundle.min.js" type="text/javascript"></script>
<script src="../js/lib/lodash.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="../js/lib/axios.min.js" type="text/javascript"></script>
<script src="../plantilla/assets/js/plugins/forms/selects/select2.min.js"></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> <script src="../js/pages/proyectar_asistencia_policias.js" type="text/javascript"></script>
......
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