mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
cargando datos
This commit is contained in:
@ -68,12 +68,13 @@ class PresupuestoCliente {
|
||||
|
||||
$(".calcular-presupuesto").on('change', this.checkForm.bind(this));
|
||||
|
||||
this.RELLENAR_PRESUPUESTO(true);
|
||||
//this.RELLENAR_PRESUPUESTO(true);
|
||||
|
||||
if(window.location.href.includes("edit")){
|
||||
//load
|
||||
if (window.location.href.includes("edit")) {
|
||||
$(".calcular-presupuesto").off('change');
|
||||
this.#cargarPresupuesto();
|
||||
const successMessage = sessionStorage.getItem('message');
|
||||
if(successMessage){
|
||||
if (successMessage) {
|
||||
popSuccessAlert(successMessage);
|
||||
sessionStorage.removeItem('message');
|
||||
}
|
||||
@ -226,7 +227,7 @@ class PresupuestoCliente {
|
||||
try {
|
||||
$('#loader').show();
|
||||
|
||||
if(window.location.href.includes("edit")){
|
||||
if (window.location.href.includes("edit")) {
|
||||
this.datos["id"] = window.location.href.split("/").pop();
|
||||
}
|
||||
new Ajax('/presupuestocliente/guardar',
|
||||
@ -235,12 +236,12 @@ class PresupuestoCliente {
|
||||
(response) => {
|
||||
$('#loader').hide();
|
||||
console.log(response);
|
||||
if(this.datos["confirmar"] || window.location.href.includes("add")){
|
||||
if (this.datos["confirmar"] || window.location.href.includes("add")) {
|
||||
sessionStorage.setItem('message', response.message);
|
||||
window.location.href = response.url + '/' + response.status;
|
||||
}
|
||||
else{
|
||||
popSuccessAlert(response.message);
|
||||
else {
|
||||
popSuccessAlert(response.message);
|
||||
}
|
||||
},
|
||||
() => { $('#loader').hide(); }
|
||||
@ -257,7 +258,16 @@ class PresupuestoCliente {
|
||||
#procesarPresupuesto(response) {
|
||||
|
||||
$('#loader').hide();
|
||||
// checj if response.tiradas exists and is not empty
|
||||
|
||||
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."
|
||||
, "sk-alert-2", false);
|
||||
return;
|
||||
}
|
||||
else{
|
||||
popAlert2Hide();
|
||||
}
|
||||
|
||||
if (response.tiradas && response.tiradas.length) {
|
||||
|
||||
this.divTiradasPrecios.empty();
|
||||
@ -397,6 +407,32 @@ class PresupuestoCliente {
|
||||
}
|
||||
|
||||
|
||||
#cargarPresupuesto() {
|
||||
|
||||
$('#loader').show();
|
||||
let id = window.location.href.split("/").pop()
|
||||
new Ajax('/presupuestocliente/cargar/' + id,
|
||||
{},
|
||||
{},
|
||||
(response) => {
|
||||
if (response.status === 1) {
|
||||
this.datosGenerales.cargarDatos(response.data.datosGenerales);
|
||||
/*this.disenioInterior.cargarDatos(response);
|
||||
this.disenioCubierta.cargarDatos(response);
|
||||
this.direcciones.cargarDatos(response);
|
||||
*/
|
||||
}
|
||||
console.log(response);
|
||||
$('#loader').hide();
|
||||
$(".calcular-presupuesto").on('change', this.checkForm.bind(this));
|
||||
},
|
||||
() => {
|
||||
$('#loader').hide();
|
||||
$(".calcular-presupuesto").on('change', this.checkForm.bind(this));
|
||||
}
|
||||
).get();
|
||||
}
|
||||
|
||||
|
||||
#isValidDataForm(value) {
|
||||
if (value === null || value === undefined || value === '') {
|
||||
|
||||
Reference in New Issue
Block a user