mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
corregidos algunos fallos en admin y añadido selector papel y gramaje faja cliente
This commit is contained in:
@ -424,7 +424,7 @@ class PresupuestoAdminEdit {
|
||||
</span>
|
||||
<div class="d-flex flex-column ps-1">
|
||||
<h5 class="alert-heading mb-2">` +
|
||||
window.Presupuestos.errores.paginasLP +
|
||||
window.language.Presupuestos.errores.paginasLP +
|
||||
`</h5>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
@ -1509,6 +1509,9 @@ class Comparador {
|
||||
|
||||
let datosComp = {};
|
||||
datosComp.sobrecubierta = this.getDataForComp('faja');
|
||||
if(datosComp.sobrecubierta.error){
|
||||
return;
|
||||
}
|
||||
datosComp.sobrecubierta.data['faja'] = 1; // se indica que es faja para el calculo de formas
|
||||
|
||||
datosComp.sobrecubierta.data[this.csrf_token] = this.csrf_hash;
|
||||
|
||||
@ -98,6 +98,7 @@ class DatosLibro {
|
||||
|
||||
this.anchoSolapasCubierta.on('change', this.changeAnchoSolapasCubierta.bind(this));
|
||||
this.anchoSolapasSobrecubierta.on('change', this.changeAnchoSolapasSobrecubierta.bind(this));
|
||||
this.fajaSolapasAncho.on('change', this.changeAnchoSolapasFaja.bind(this));
|
||||
|
||||
this.paginas.on('change', this.changePaginas.bind(this));
|
||||
this.tirada.on('change', this.changeTirada.bind(this));
|
||||
@ -116,10 +117,13 @@ class DatosLibro {
|
||||
if (this.faja.prop('checked')) {
|
||||
this.div_faja.removeClass('d-none');
|
||||
$('#compFaja').val(1).trigger('change');
|
||||
$(document).trigger('add-servicio-lineas', 'solapas_faja');
|
||||
}
|
||||
else {
|
||||
this.div_faja.addClass('d-none');
|
||||
$('#compFaja').val(0).trigger('change');
|
||||
$(document).trigger('remove-servicio-lineas', 'solapas_faja');
|
||||
$(document).trigger('remove-servicio-lineas', 'solapas_grandes_faja');
|
||||
}
|
||||
}
|
||||
|
||||
@ -300,7 +304,7 @@ class DatosLibro {
|
||||
|
||||
changeAnchoSolapasSobrecubierta() {
|
||||
|
||||
if (this.checkSolapasGrandes('cubierta')) {
|
||||
if (this.checkSolapasGrandes('sobrecubierta')) {
|
||||
$(document).trigger('add-servicio-lineas', 'solapas_grandes_sobrecubierta');
|
||||
}
|
||||
else {
|
||||
@ -311,18 +315,38 @@ class DatosLibro {
|
||||
$('#compSobrecubierta').trigger('change');
|
||||
}
|
||||
|
||||
|
||||
changeAnchoSolapasFaja() {
|
||||
|
||||
if (this.checkSolapasGrandes('faja')) {
|
||||
$(document).trigger('add-servicio-lineas', 'solapas_grandes_faja');
|
||||
}
|
||||
else {
|
||||
$(document).trigger('remove-servicio-lineas', 'solapas_grandes_faja');
|
||||
}
|
||||
|
||||
// para que se actualice el comparador
|
||||
if($('#compGramajeFaja').select2('data').length > 0){
|
||||
$('#compGramajeFaja').trigger('change');
|
||||
}
|
||||
}
|
||||
|
||||
checkSolapasGrandes(elemento) {
|
||||
|
||||
const ancho_libro = 2 * this.getDimensionLibro().ancho;
|
||||
let ancho_solapas = 0.0;
|
||||
let lomo = 0.0;
|
||||
if (elemento == 'cubierta') {
|
||||
ancho_solapas = 2 * parseFloat($('solapas_ancho').val());
|
||||
lomo = parseFloat($('lomo_cubierta').val());
|
||||
ancho_solapas = 2 * parseFloat($('#solapas_ancho').val());
|
||||
lomo = parseFloat($('#lomo_cubierta').val());
|
||||
}
|
||||
else if (elemento == 'sobrecubierta') {
|
||||
ancho_solapas = 2 * parseFloat($('solapas_ancho_sobrecubierta').val());
|
||||
lomo = parseFloat($('lomo_sobrecubierta').val());
|
||||
ancho_solapas = 2 * parseFloat($('#solapas_ancho_sobrecubierta').val());
|
||||
lomo = parseFloat($('#lomo_sobrecubierta').val());
|
||||
}
|
||||
else if (elemento == 'faja') {
|
||||
ancho_solapas = 2 * parseFloat($('#faja_solapas_ancho').val());
|
||||
lomo = parseFloat($('#lomo_sobrecubierta').val());
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
@ -144,6 +144,10 @@ class Servicios {
|
||||
const id = $('#serv_solapas_sobrecubierta').attr('service-id');
|
||||
this.ServiciosManipulado.getPresupuestoManipulado(id);
|
||||
}
|
||||
else if (servicio == 'solapas_faja'){
|
||||
const id = $('#solapas_faja').attr('service-id');
|
||||
this.ServiciosManipulado.getPresupuestoManipulado(id);
|
||||
}
|
||||
else if (servicio == 'solapas_grandes_cubierta'){
|
||||
const id = $('#solapas_grandes_cubierta').attr('service-id');
|
||||
this.ServiciosManipulado.getPresupuestoManipulado(id);
|
||||
@ -152,6 +156,10 @@ class Servicios {
|
||||
const id = $('#solapas_grandes_sobrecubierta').attr('service-id');
|
||||
this.ServiciosManipulado.getPresupuestoManipulado(id);
|
||||
}
|
||||
else if (servicio == 'solapas_grandes_faja'){
|
||||
const id = $('#solapas_grandes_faja').attr('service-id');
|
||||
this.ServiciosManipulado.getPresupuestoManipulado(id);
|
||||
}
|
||||
}
|
||||
|
||||
removeServicio(event, servicio) {
|
||||
|
||||
@ -92,6 +92,7 @@ class DatosGenerales {
|
||||
|
||||
// Eventos
|
||||
this.checkFormatoPersonalizado.bind('change', this.#handleFormatoLibro.bind(this));
|
||||
this.formatoLibro.item.on('change', this.#handleFormatoLibro.bind(this));
|
||||
this.tiposLibro.on('click', this.#handleTipolibro.bind(this));
|
||||
this.domItem.find('.input-paginas').on('change', this.#handlePaginas.bind(this));
|
||||
this.anchoPersonalizado.on('blur', this.#handleCheckFormatoPersonalizado.bind(this));
|
||||
@ -674,6 +675,8 @@ class DatosGenerales {
|
||||
this.formValidation.revalidateField('papel_formato_ancho');
|
||||
this.formValidation.revalidateField('papel_formato_alto');
|
||||
}
|
||||
const alto = this.getDimensionLibro().alto;
|
||||
$('#altoFaja').closest('.config-faja').find('.form-text').text('Entre 50 y ' + alto + ' mm');
|
||||
}
|
||||
|
||||
#checkValue(event){
|
||||
|
||||
@ -33,12 +33,12 @@ class DisenioCubierta {
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tipo: 'colorhq',
|
||||
cubierta: 1,
|
||||
ancho: () => {return this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho},
|
||||
alto: () => {return this.presupuestoCliente.datosGenerales.getDimensionLibro().alto},
|
||||
solapas: () => {return $('#solapas_cubierta').hasClass("d-none") ? 0 : $('#solapas_cubierta').val()},
|
||||
lomo: () => {return $('#lc').val()},
|
||||
tapa_dura: () => {return this.tapaBlanda.hasClass("selected") ? 0 : 1},
|
||||
tirada: () => {return this.presupuestoCliente.datosGenerales.getTiradas()[0]},
|
||||
ancho: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho },
|
||||
alto: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().alto },
|
||||
solapas: () => { return $('#solapas_cubierta').hasClass("d-none") ? 0 : $('#solapas_cubierta').val() },
|
||||
lomo: () => { return $('#lc').val() },
|
||||
tapa_dura: () => { return this.tapaBlanda.hasClass("selected") ? 0 : 1 },
|
||||
tirada: () => { return this.presupuestoCliente.datosGenerales.getTiradas()[0] },
|
||||
}
|
||||
);
|
||||
|
||||
@ -77,11 +77,46 @@ class DisenioCubierta {
|
||||
|
||||
this.configuracionFaja = this.domItem.find(".config-faja");
|
||||
this.faja = this.domItem.find("#addFaja");
|
||||
this.papelFaja = new ClassSelect($("#papelFaja"),
|
||||
'/papelesgenericos/getpapelcliente',
|
||||
window.translations["selectPapel"],
|
||||
false,
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tipo: 'colorhq',
|
||||
sobrecubierta: 1,
|
||||
ancho: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho },
|
||||
alto: () => { return $('#altoFaja').val() },
|
||||
solapas: () => { return $('#solapasFaja').val() },
|
||||
lomo: () => { return parseFloat($('#lsc').val()) + parseFloat($('#lc').val()) },
|
||||
tirada: () => { return this.presupuestoCliente.datosGenerales.getTiradas()[0] },
|
||||
forSelect2: 1,
|
||||
}
|
||||
);
|
||||
this.gramajeFaja = new ClassSelect($("#gramajeFaja"),
|
||||
'/papelesgenericos/getpapelcliente',
|
||||
window.translations["selectGramaje"],
|
||||
false,
|
||||
{
|
||||
[this.csrf_token]: this.csrf_hash,
|
||||
tipo: 'colorhq',
|
||||
papel: () => { return this.papelFaja.getVal() },
|
||||
sobrecubierta: 1,
|
||||
ancho: () => { return this.presupuestoCliente.datosGenerales.getDimensionLibro().ancho },
|
||||
alto: () => { return $('#altoFaja').val() },
|
||||
solapas: () => { return $('#solapasFaja').val() },
|
||||
lomo: () => { return parseFloat($('#lsc').val()) + parseFloat($('#lc').val()) },
|
||||
tirada: () => { return this.presupuestoCliente.datosGenerales.getTiradas()[0] },
|
||||
forSelect2: 1,
|
||||
}
|
||||
);
|
||||
|
||||
this.solapasSobrecubierta = this.domItem.find("#solapasSobrecubierta");
|
||||
this.textoSolapasSobrecubierta = this.domItem.find("#textoLimitesSolapasSobrecubierta");
|
||||
|
||||
this.solapasFaja = this.domItem.find("#solapasFaja");
|
||||
this.altoFaja = this.domItem.find("#altoFaja");
|
||||
this.textoSolapasFaja = this.domItem.find("#textoLimitesSolapasFaja");
|
||||
|
||||
this.fresado = $(this.domItem.find("#fresado")[0]);
|
||||
this.cosido = $(this.domItem.find("#cosido")[0]);
|
||||
@ -154,6 +189,9 @@ class DisenioCubierta {
|
||||
this.acabadoCubierta.init();
|
||||
this.acabadoSobrecubierta.init();
|
||||
|
||||
this.papelFaja.init();
|
||||
this.gramajeFaja.init();
|
||||
|
||||
$('#papelEspecialCubiertaSel').on("change", this.#handlePapelCubiertaEspecial.bind(this));
|
||||
|
||||
// Eventos
|
||||
@ -171,10 +209,12 @@ class DisenioCubierta {
|
||||
}
|
||||
);
|
||||
this.faja.on('change', () => {
|
||||
this.faja.is(":checked") ? this.configuracionFaja.removeClass("d-none") : this.configuracionFaja.addClass("d-none")
|
||||
}
|
||||
);
|
||||
this.faja.is(":checked") ? this.configuracionFaja.removeClass("d-none") : this.configuracionFaja.addClass("d-none");
|
||||
const div = $('#divExtras'); // Selecciona el div
|
||||
div.find('.fv-plugins-message-container').remove();
|
||||
});
|
||||
|
||||
this.papelFaja.item.on('change', () => { this.gramajeFaja.empty(); });
|
||||
|
||||
// Observadores
|
||||
this.observer.observe(this.tapaBlanda[0], { attributes: true });
|
||||
@ -371,6 +411,34 @@ class DisenioCubierta {
|
||||
}
|
||||
}
|
||||
},
|
||||
div_extras: {
|
||||
validators: {
|
||||
callback: {
|
||||
callback: function (input) {
|
||||
|
||||
const div = $('#divExtras'); // Selecciona el div
|
||||
div.find('.fv-plugins-message-container').remove();
|
||||
|
||||
const papelFaja = $('#papelFaja').select2('data').length > 0;
|
||||
const gramajeFaja = $('#gramajeFaja').select2('data').length > 0;
|
||||
if (papelFaja && gramajeFaja) {
|
||||
return true;
|
||||
|
||||
}
|
||||
else {
|
||||
div.append(`
|
||||
<div class="fv-plugins-message-container invalid-feedback">
|
||||
<div data-field="div_impresion_interior" data-validator="callback" style="margin-top: 50px;">
|
||||
${window.translations["validation"].extras_cubierta}
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
trigger: new FormValidation.plugins.Trigger(),
|
||||
@ -388,6 +456,8 @@ class DisenioCubierta {
|
||||
case 'div_gramaje_cubierta':
|
||||
case 'div_papel_especial_cubierta':
|
||||
return '.col-sm-10';
|
||||
case 'div_extras':
|
||||
return '.col-sm-12';
|
||||
default:
|
||||
return '.col-sm-3';
|
||||
}
|
||||
@ -643,9 +713,8 @@ class DisenioCubierta {
|
||||
else {
|
||||
let faja = {};
|
||||
faja.alto = this.domItem.find("#altoFaja").val();
|
||||
let papel = this.domItem.find("#papelFaja").children("option:selected").val();
|
||||
faja.papel = papel.split('_')[0];
|
||||
faja.gramaje = papel.split('_')[1];
|
||||
faja.papel = this.papelFaja.getVal();
|
||||
faja.gramaje = this.gramajeFaja.getVal();
|
||||
faja.solapas = this.domItem.find("#solapasFaja").val();
|
||||
faja.plastificado = this.domItem.find("#plastificadoFaja").children("option:selected").val();
|
||||
return faja;
|
||||
|
||||
@ -178,6 +178,7 @@ class PresupuestoCliente {
|
||||
this.disenioCubierta.solapasSobrecubierta.attr('max', response);
|
||||
this.disenioCubierta.textoSolapasCubierta.text("Entre 60 y " + response + " mm");
|
||||
this.disenioCubierta.textoSolapasSobrecubierta.text("Entre 60 y " + response + " mm");
|
||||
this.disenioCubierta.textoSolapasFaja.text("Entre 60 y " + response + " mm");
|
||||
},
|
||||
() => { }
|
||||
).post();
|
||||
|
||||
Reference in New Issue
Block a user