a punto de guardar

This commit is contained in:
2024-10-19 14:32:49 +02:00
parent 09e5149090
commit 1914cb01fe
7 changed files with 2346 additions and 85 deletions

View File

@ -47,8 +47,6 @@ class PresupuestoCliente {
init() {
this.RELLENAR_PRESUPUESTO(false);
// Fuerza el foco en el campo de búsqueda de select2
$(document).on('select2:open', () => {
document.querySelector('.select2-search__field').focus();
@ -66,8 +64,6 @@ class PresupuestoCliente {
this.btnPrev.on('click', this.#prevtStep.bind(this));
this.btnSave.on('click', this.#savePresupuesto.bind(this));
//this.RELLENAR_PRESUPUESTO(true);
if (window.location.href.includes("edit")) {
$(".calcular-presupuesto").on('change', ()=>{});
this.#cargarPresupuesto();
@ -113,8 +109,9 @@ class PresupuestoCliente {
if (Object.values(datos_to_check).every(this.#isValidDataForm)) {
try {
$('#loader').modal('show');
$('#loader').modal('show');
setTimeout(function() {
$('#loader').modal('show');
}, 0);
// Si se está ejecutando la petición, abortar la petición anterior
this.ajax_calcular.abort();
@ -132,7 +129,7 @@ class PresupuestoCliente {
}
RELLENAR_PRESUPUESTO(finalizar) {
/*RELLENAR_PRESUPUESTO(finalizar) {
if (finalizar) {
@ -185,7 +182,7 @@ class PresupuestoCliente {
else {
$("#titulo").trigger('change');
}
}
}*/
stepperHandler() {
@ -243,8 +240,13 @@ class PresupuestoCliente {
$('#loader').modal('hide');
console.log(response);
if (this.datos["confirmar"] || window.location.href.includes("add")) {
sessionStorage.setItem('message', response.message);
window.location.href = response.url + '/' + response.status;
if(response.status){
sessionStorage.setItem('message', response.message);
window.location.href = response.url + '/' + response.status;
}
else{
popErrorAlert("No se ha podido guardar el presupuesto. Por favor, póngase en contacto con el departamento comercial.");
}
}
else {
popSuccessAlert(response.message);