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:
@ -338,6 +338,53 @@ class DatosGenerales {
|
||||
});
|
||||
}
|
||||
|
||||
cargarDatos(datos) {
|
||||
|
||||
this.titulo.val(datos.titulo);
|
||||
this.autor.val(datos.autor);
|
||||
this.isbn.val(datos.isbn);
|
||||
this.coleccion.val(datos.coleccion);
|
||||
this.referenciaCliente.val(datos.referenciaCliente);
|
||||
|
||||
this.tirada1.val(parseInt(datos.tirada));
|
||||
if (datos.tirada2)
|
||||
this.tirada2.val(parseInt(datos.tirada2));
|
||||
if (datos.tirada3)
|
||||
this.tirada3.val(parseInt(datos.tirada3));
|
||||
if (datos.tirada4)
|
||||
this.tirada4.val(parseInt(datos.tirada4));
|
||||
|
||||
|
||||
this.paginas.val(parseInt(datos.paginas));
|
||||
this.paginasNegro.val(parseInt(datos.paginasNegro));
|
||||
this.paginasColor.val(parseInt(datos.paginasColor));
|
||||
|
||||
/*
|
||||
|
||||
this.papelFormatoId = this.domItem.find("#papelFormatoId");
|
||||
this.checkFormatoPersonalizado = this.domItem.find("#papelFormatoPersonalizado");
|
||||
this.formatoPersonalizado = this.domItem.find("#formatoPersonalizado");
|
||||
this.anchoPersonalizado = this.domItem.find("#papelFormatoAncho");
|
||||
this.altoPersonalizado = this.domItem.find("#papelFormatoAlto");
|
||||
|
||||
this.fresado = $(this.domItem.find("#fresado")[0]);
|
||||
this.cosido = $(this.domItem.find("#cosido")[0]);
|
||||
|
||||
this.tiposLibro = this.domItem.find(".tipo-libro");
|
||||
|
||||
|
||||
this.paginasCuadernillo = this.domItem.find("#paginasCuadernillo");
|
||||
this.pagColorConsecutivas = this.domItem.find("#pagColorConsecutivas");
|
||||
this.divPapelDiferente = this.domItem.find("#divPapelDiferente");
|
||||
this.papelDiferente = this.domItem.find("#papelDiferente");
|
||||
this.divPosPaginasColor = this.domItem.find("#divPosPaginasColor");
|
||||
this.posPaginasColor = this.domItem.find("#posPaginasColor");
|
||||
|
||||
this.ivaReducido = this.domItem.find("#ivaReducido");
|
||||
this.excluirRotativa = this.domItem.find("#excluirRotativa");
|
||||
this.prototipo = this.domItem.find("#prototipo");*/
|
||||
}
|
||||
|
||||
getDimensionLibro() {
|
||||
|
||||
let ancho = 0;
|
||||
|
||||
@ -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