mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
cargando presupuesto datos generales
This commit is contained in:
@ -39,7 +39,7 @@ class PresupuestoCliente {
|
||||
this.ajax_calcular = new Ajax('/presupuestocliente/calcular',
|
||||
{}, this.datos,
|
||||
this.#procesarPresupuesto.bind(this),
|
||||
() => { $('#loader').hide(); });
|
||||
() => { $('#loader').modal('hide'); });
|
||||
|
||||
this.actualizarTiradasEnvio = false;
|
||||
}
|
||||
@ -66,12 +66,10 @@ class PresupuestoCliente {
|
||||
this.btnPrev.on('click', this.#prevtStep.bind(this));
|
||||
this.btnSave.on('click', this.#savePresupuesto.bind(this));
|
||||
|
||||
$(".calcular-presupuesto").on('change', this.checkForm.bind(this));
|
||||
|
||||
//this.RELLENAR_PRESUPUESTO(true);
|
||||
|
||||
if (window.location.href.includes("edit")) {
|
||||
$(".calcular-presupuesto").off('change');
|
||||
$(".calcular-presupuesto").on('change', ()=>{});
|
||||
this.#cargarPresupuesto();
|
||||
const successMessage = sessionStorage.getItem('message');
|
||||
if (successMessage) {
|
||||
@ -79,6 +77,10 @@ class PresupuestoCliente {
|
||||
sessionStorage.removeItem('message');
|
||||
}
|
||||
}
|
||||
else{
|
||||
$(".calcular-presupuesto").on('change', this.checkForm.bind(this));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -87,7 +89,7 @@ class PresupuestoCliente {
|
||||
if (event.target.id === 'divDirecciones') {
|
||||
if (!this.direcciones.calcularPresupuesto) {
|
||||
this.actualizarTiradasEnvio = false;
|
||||
$('#loader').hide();
|
||||
$('#loader').modal('hide');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -108,7 +110,7 @@ class PresupuestoCliente {
|
||||
|
||||
if (Object.values(datos_to_check).every(this.#isValidDataForm)) {
|
||||
try {
|
||||
$('#loader').show();
|
||||
$('#loader').modal('show');
|
||||
|
||||
// Si se está ejecutando la petición, abortar la petición anterior
|
||||
this.ajax_calcular.abort();
|
||||
@ -119,7 +121,7 @@ class PresupuestoCliente {
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
$('#loader').hide();
|
||||
$('#loader').modal('hide');
|
||||
}
|
||||
|
||||
}
|
||||
@ -225,7 +227,7 @@ class PresupuestoCliente {
|
||||
this.#getDatos(true);
|
||||
|
||||
try {
|
||||
$('#loader').show();
|
||||
$('#loader').modal('show');
|
||||
|
||||
if (window.location.href.includes("edit")) {
|
||||
this.datos["id"] = window.location.href.split("/").pop();
|
||||
@ -234,7 +236,7 @@ class PresupuestoCliente {
|
||||
this.datos,
|
||||
{},
|
||||
(response) => {
|
||||
$('#loader').hide();
|
||||
$('#loader').modal('hide');
|
||||
console.log(response);
|
||||
if (this.datos["confirmar"] || window.location.href.includes("add")) {
|
||||
sessionStorage.setItem('message', response.message);
|
||||
@ -244,20 +246,20 @@ class PresupuestoCliente {
|
||||
popSuccessAlert(response.message);
|
||||
}
|
||||
},
|
||||
() => { $('#loader').hide(); }
|
||||
() => { $('#loader').modal('hide'); }
|
||||
).post();
|
||||
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
$('#loader').hide();
|
||||
$('#loader').modal('hide');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#procesarPresupuesto(response) {
|
||||
|
||||
$('#loader').hide();
|
||||
$('#loader').modal('hide');
|
||||
|
||||
if (Object.values(response.errors).some((value) => value !== "")) {
|
||||
popErrorAlert("No se ha podido calcular el presupuesto para los datos proporcionados. Por favor, póngase en contacto con el departamento comercial."
|
||||
@ -336,8 +338,11 @@ class PresupuestoCliente {
|
||||
tirada: this.datosGenerales.getTiradas(),
|
||||
paginas: this.datosGenerales.paginas.val(),
|
||||
paginasColor: this.datosGenerales.paginasColor.val(),
|
||||
paginasCuadernillo: this.datosGenerales.paginasCuadernillo.val(),
|
||||
posPaginasColor: this.datosGenerales.posPaginasColor.val(),
|
||||
paginasColorConsecutivas: this.datosGenerales.paginasColorConsecutivas.is(':checked') ? 1 : 0,
|
||||
papelInteriorDiferente: this.datosGenerales.papelDiferente.is(':checked') ? 1 : 0,
|
||||
$prototipo: this.datosGenerales.prototipo.is(':checked') ? 1 : 0,
|
||||
paginasCuadernillo: this.datosGenerales.paginasCuadernillo.val(),
|
||||
|
||||
tipo: this.datosGenerales.tiposLibro.filter('.selected').attr('id'),
|
||||
|
||||
@ -409,7 +414,7 @@ class PresupuestoCliente {
|
||||
|
||||
#cargarPresupuesto() {
|
||||
|
||||
$('#loader').show();
|
||||
$('#loader').modal('show');
|
||||
let id = window.location.href.split("/").pop()
|
||||
new Ajax('/presupuestocliente/cargar/' + id,
|
||||
{},
|
||||
@ -423,11 +428,11 @@ class PresupuestoCliente {
|
||||
*/
|
||||
}
|
||||
console.log(response);
|
||||
$('#loader').hide();
|
||||
$('#loader').modal('hide');
|
||||
$(".calcular-presupuesto").on('change', this.checkForm.bind(this));
|
||||
},
|
||||
() => {
|
||||
$('#loader').hide();
|
||||
$('#loader').modal('hide');
|
||||
$(".calcular-presupuesto").on('change', this.checkForm.bind(this));
|
||||
}
|
||||
).get();
|
||||
|
||||
Reference in New Issue
Block a user