añadida validacion en el backend para datos generales
@ -18,6 +18,8 @@
|
||||
border-radius: 8px;
|
||||
padding: 8px;
|
||||
|
||||
margin-inline: 5px;
|
||||
|
||||
transition: border 0.3s ease;
|
||||
}
|
||||
|
||||
@ -58,3 +60,14 @@
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.gramaje-radio{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 70px; /* Ancho mínimo */
|
||||
min-height: 70px; /* Alto mínimo */
|
||||
max-width: 70px; /* Ancho máximo */
|
||||
max-height: 70px; /* Alto máximo */
|
||||
}
|
||||
|
After Width: | Height: | Size: 234 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 153 KiB |
|
After Width: | Height: | Size: 228 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 233 KiB |
|
After Width: | Height: | Size: 183 KiB |
|
After Width: | Height: | Size: 212 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 30 KiB |
@ -0,0 +1,7 @@
|
||||
window.languageBundle.get = function (key, ...params) {
|
||||
let text = this[key] || key;
|
||||
params.forEach((val, i) => {
|
||||
text = text.replace(`{${i}}`, val);
|
||||
});
|
||||
return text;
|
||||
};
|
||||
@ -0,0 +1,111 @@
|
||||
class PresupuestoCliente {
|
||||
|
||||
constructor() {
|
||||
|
||||
// pestaña datos generales
|
||||
this.titulo = $('#titulo');
|
||||
this.autor = $('#autor');
|
||||
this.isbn = $('#isbn');
|
||||
this.tirada1 = $('#tirada1');
|
||||
this.tirada2 = $('#tirada2');
|
||||
this.tirada3 = $('#tirada3');
|
||||
this.tirada4 = $('#tirada4');
|
||||
this.paginasNegro = $('#paginas-negro');
|
||||
this.paginasColor = $('#paginas-color')
|
||||
this.btn_next_datos_generales = $('#next-datos-generales');
|
||||
this.datos_generales_alert = $('#datos-generales-alert');
|
||||
|
||||
// pestaña cubierta
|
||||
this.btn_plantilla_cubierta = $('#btn-plantilla-cubierta');
|
||||
this.btn_impresion_cubierta_help = $('#impresion-cubierta-help');
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
init() {
|
||||
|
||||
this.initButtonsEventListeners();
|
||||
}
|
||||
|
||||
initButtonsEventListeners() {
|
||||
|
||||
this.btn_plantilla_cubierta.on('click', () => {
|
||||
Swal.fire({
|
||||
position: 'top-end',
|
||||
icon: 'info',
|
||||
title: window.languageBundle.get('presupuesto.plantilla-cubierta'),
|
||||
html: `
|
||||
<div class="text-center p-4">
|
||||
<img src="/assets/images/imprimelibros/presupuestador/plantilla-cubierta.png" class="img-fluid" alt="" />
|
||||
</div>
|
||||
<div class="acitivity-timeline p-4">
|
||||
${window.languageBundle.get('presupuesto.plantilla-cubierta-text')}
|
||||
</div>
|
||||
`,
|
||||
confirmButtonClass: 'btn btn-primary w-xs mt-2',
|
||||
showConfirmButton: false,
|
||||
showCloseButton: true
|
||||
});
|
||||
});
|
||||
|
||||
this.btn_impresion_cubierta_help.on('click', () => {
|
||||
Swal.fire({
|
||||
position: 'top-end',
|
||||
icon: 'info',
|
||||
title: window.languageBundle.get('presupuesto.impresion-cubierta'),
|
||||
html: window.languageBundle.get('presupuesto.impresion-cubierta-help'),
|
||||
confirmButtonClass: 'btn btn-primary w-xs mt-2',
|
||||
showConfirmButton: false,
|
||||
showCloseButton: true
|
||||
});
|
||||
});
|
||||
|
||||
this.btn_next_datos_generales.on('click', () => {
|
||||
this.nextDatosGenerales();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
nextDatosGenerales() {
|
||||
const data = {
|
||||
titulo: this.titulo.val(),
|
||||
autor: this.autor.val(),
|
||||
isbn: this.isbn.val(),
|
||||
tirada1: this.tirada1.val(),
|
||||
tirada2: this.tirada2.val(),
|
||||
tirada3: this.tirada3.val(),
|
||||
tirada4: this.tirada4.val(),
|
||||
paginasNegro: this.paginasNegro.val(),
|
||||
paginasColor: this.paginasColor.val()
|
||||
}
|
||||
$.ajax({
|
||||
url: '/presupuesto/validar/datos-generales',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: (response) => {
|
||||
this.datos_generales_alert.addClass('d-none');
|
||||
},
|
||||
error: (xhr, status, error) => {
|
||||
this.datos_generales_alert.removeClass('d-none');
|
||||
this.datos_generales_alert.find('#datos-generales-alert-list').empty();
|
||||
const errors = xhr.responseJSON;
|
||||
if (errors && typeof errors === 'object') {
|
||||
Object.values(errors).forEach(errorMsg => {
|
||||
this.datos_generales_alert.find('#datos-generales-alert-list').append(`<li>${errorMsg}</li>`);
|
||||
});
|
||||
} else {
|
||||
this.datos_generales_alert.find('#datos-generales-alert-list').append('<li>Error desconocido. Por favor, inténtelo de nuevo más tarde.</li>');
|
||||
}
|
||||
$(window).scrollTop(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const presupuestoCliente = new PresupuestoCliente();
|
||||
presupuestoCliente.init();
|
||||
});
|
||||
@ -247,7 +247,6 @@ if (document.getElementById("sa-position"))
|
||||
icon: 'success',
|
||||
title: 'Your work has been saved',
|
||||
showConfirmButton: false,
|
||||
timer: 1500,
|
||||
showCloseButton: true
|
||||
})
|
||||
});
|
||||
|
||||