comprobando presupuestos

This commit is contained in:
2024-10-22 08:43:21 +02:00
parent 62a3706049
commit 2f83526d7e
20 changed files with 37035 additions and 223 deletions

View File

@ -1,5 +1,7 @@
import previewFormas from "../preview.js";
class Resumen {
constructor(domItem, datosGenerales, disenioInterior, disenioCubierta, direcciones) {
constructor(domItem, datosGenerales, disenioInterior, disenioCubierta) {
this.domItem = domItem;
@ -39,18 +41,39 @@ class Resumen {
this.divSobrecubierta = $(this.domItem.find("#divResumenSobrecubierta"));
this.papelSobrecubierta = $(this.domItem.find("#resumenPapelSobrecubierta"));
this.gramajeSobrecubierta = $(this.domItem.find("#resumenGramajeSobrecubierta"));
this.solapasSobrecubierta = $(this.domItem.find("#resumenSolapasSobrecubierta"));
this.plastificadoSobrecubierta = $(this.domItem.find("#resumenPlastificadoSobrecubierta"));
this.solapasSobrecubierta = $(this.domItem.find("#resumenSolapaSobrecubierta"));
this.plastificadoSobrecubierta = $(this.domItem.find("#resumenPlastificadoSobreCubierta"));
this.precio_unidad = $(this.domItem.find("#resumenPrecioU"));
this.total_base = $(this.domItem.find("#resumenTotalBase"));
this.iva_porcentaje = $(this.domItem.find("#resumenIvaPorcentaje"));
this.iva = $(this.domItem.find("#resumenIva"));
this.total = $(this.domItem.find("#resumenTotal"));
this.divPreview = $(this.domItem.find("#pv_ec_shape"));
this.btnPreviewCubierta = $(this.domItem.find("#btnPreviewCubierta"));
this.init();
}
init() {
this.btnPreviewCubierta.on('click', this.#btnPreview.bind(this));
}
#btnPreview() {
if(this.divPreview.hasClass('d-none')){
this.btnPreviewCubierta.text('Ocultar desarrollo cubierta');
this.divPreview.removeClass('d-none');
this.generate();
}
else{
this.btnPreviewCubierta.text('Mostrar desarrollo cubierta');
this.divPreview.addClass('d-none');
}
}
generate() {
@ -58,10 +81,32 @@ class Resumen {
this.titulo.text(this.datosGenerales.titulo.val());
this.tipoLibro.text(this.#capitalizeFirstLetter(this.datosGenerales.tiposLibro.filter('.selected').attr('id')));
if (this.datosGenerales.checkFormatoPersonalizado.is(':checked'))
this.formato.text(this.datosGenerales.anchoPersonalizado.val() + ' x ' + this.datosGenerales.altoPersonalizado.val());
else
let ancho = 0, alto = 0;
if (this.datosGenerales.checkFormatoPersonalizado.is(':checked')) {
ancho = parseFloat(this.datosGenerales.anchoPersonalizado.val());
alto = parseFloat(this.datosGenerales.altoPersonalizado.val());
this.formato.text(ancho + ' x ' + alto);
}
else {
ancho = parseFloat(this.datosGenerales.papelFormatoId.find('option:selected').text().split(" x ")[0]);
alto = parseFloat(this.datosGenerales.papelFormatoId.find('option:selected').text().split(" x ")[1]);
this.formato.text(this.datosGenerales.papelFormatoId.find('option:selected').text());
}
new previewFormas(
this.divPreview,
this.datosGenerales.tiposLibro.filter('.selected').attr('id'),
this.disenioCubierta.disenioCubierta.filter('.selected').attr('id'),
"resumen",
{
ancho: ancho,
alto: alto,
lomo: $('#lc').val() === '' ? parseFloat('0.0') : parseFloat($('#lc').val()),
solapas: this.disenioCubierta.getSolapasCubierta(),
lomoRedondo: this.disenioCubierta.tapaDuraLomoRedondo.hasClass('selected'),
}
).previewEsquemaCubierta();
this.paginas.text(this.datosGenerales.paginas.val());
this.paginasColor.text(this.datosGenerales.paginasColor.val());
@ -105,7 +150,7 @@ class Resumen {
this.itemsCubiertaTapaBlanda.addClass('d-none');
const guardas = this.disenioCubierta.getGuardas(true);
this.papelGuardas.text(guardas.papel + ' ' + guardas.gramaje);
this.guardasImpresas.text(guardas.guardasImpresas);
this.guardasImpresas.text(guardas.caras);
this.cabezada.text(this.disenioCubierta.getCabezada(true));
}