mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
pruebas solapas max
This commit is contained in:
@ -367,6 +367,8 @@ class PresupuestoAdminEdit {
|
||||
|
||||
}, 0);
|
||||
|
||||
this.calcularSolapas();
|
||||
|
||||
// Funciones para detectar cambios en el formulario
|
||||
this.#checkChangesPresupuesto();
|
||||
$('#bc-save').on("click", function () {
|
||||
@ -382,29 +384,6 @@ class PresupuestoAdminEdit {
|
||||
).get();
|
||||
}
|
||||
|
||||
/*
|
||||
calcularSolapas() {
|
||||
|
||||
|
||||
this.#getDatos(false, true);
|
||||
if (Object.values(this.datos).every(this.#isValidDataForm)) {
|
||||
new Ajax('/presupuestocliente/calcularsolapas',
|
||||
this.datos,
|
||||
{},
|
||||
(response) => {
|
||||
if (response === null || response === undefined || response === "") {
|
||||
console.error("Error en el calculo máximo de solapas.");
|
||||
return;
|
||||
}
|
||||
this.disenioCubierta.tamanioSolapasCubierta.attr('max', response);
|
||||
this.disenioCubierta.solapasSobrecubierta.attr('max', response);
|
||||
this.disenioCubierta.textoSolapasCubierta.text("Entre 60 y " + response + " mm");
|
||||
this.disenioCubierta.textoSolapasSobrecubierta.text("Entre 60 y " + response + " mm");
|
||||
},
|
||||
() => { }
|
||||
).post();
|
||||
}
|
||||
}*/
|
||||
|
||||
checkPaginasPresupuesto() {
|
||||
|
||||
@ -416,7 +395,7 @@ class PresupuestoAdminEdit {
|
||||
cantidad_total += parseInt(rowData.paginas)
|
||||
})
|
||||
htmlString = ''
|
||||
|
||||
|
||||
if (cantidad_total != parseInt($('#paginas').val())) {
|
||||
htmlString = `
|
||||
<div class="alert alert-warning d-flex align-items-baseline" role="alert">
|
||||
@ -429,12 +408,12 @@ class PresupuestoAdminEdit {
|
||||
`</h5>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
}
|
||||
$('#divAlarmasLineasPresupuesto').html(htmlString)
|
||||
}
|
||||
|
||||
|
||||
getPaginasColor(){
|
||||
getPaginasColor() {
|
||||
|
||||
let paginasColor = 0;
|
||||
this.lineasPresupuesto.table.rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||
@ -442,42 +421,51 @@ class PresupuestoAdminEdit {
|
||||
if (rowData.row_id === 'lp_color' || rowData.row_id === 'lp_colorhq') {
|
||||
return parseInt(rowData.paginas);
|
||||
}
|
||||
if(rowData.row_id === 'lp_rot_color'){
|
||||
if (rowData.row_id === 'lp_rot_color') {
|
||||
return parseInt(rowData.numPagColor);
|
||||
}
|
||||
});
|
||||
return paginasColor;
|
||||
return paginasColor;
|
||||
}
|
||||
|
||||
calcularSolapas() {
|
||||
|
||||
let datos = {
|
||||
cliente_id: this.datosGenerales.cliente.getVal(),
|
||||
tirada: this.datosGenerales.tirada.val(),
|
||||
tamanio: this.getDimensionLibro(),
|
||||
paginas: this.datosLibro.paginas.val(),
|
||||
//paginasColor:
|
||||
let anchoTotal = 2*this.getDimensionLibro().ancho;
|
||||
let maxSolapas = 120;
|
||||
|
||||
let mano = 0;
|
||||
this.lineasPresupuesto.table.rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||
var rowData = this.data();
|
||||
if (rowData.row_id != 'lp_cubierta' || rowData.row_id === 'lp_sobrecubierta'
|
||||
|| rowData.row_id === 'lp_guardas' || rowData.row_id === 'lp_faja'
|
||||
) {
|
||||
mano += parseInt(rowData.mano);
|
||||
}
|
||||
});
|
||||
|
||||
if (mano > 0) {
|
||||
anchoTotal += 6 + 5; // dobleces + sangre
|
||||
maxSolapas = Math.min(Math.floor((865-anchoTotal)/2), 0.75*this.getDimensionLibro().ancho);
|
||||
}
|
||||
|
||||
/*if (Object.values(this.datos).every(this.#isValidDataForm)) {
|
||||
new Ajax('/presupuestocliente/calcularsolapas',
|
||||
this.datos,
|
||||
{},
|
||||
(response) => {
|
||||
if (response === null || response === undefined || response === "") {
|
||||
console.error("Error en el calculo máximo de solapas.");
|
||||
return;
|
||||
}
|
||||
this.disenioCubierta.tamanioSolapasCubierta.attr('max', response);
|
||||
this.disenioCubierta.solapasSobrecubierta.attr('max', response);
|
||||
this.disenioCubierta.textoSolapasCubierta.text("Entre 60 y " + response + " mm");
|
||||
this.disenioCubierta.textoSolapasSobrecubierta.text("Entre 60 y " + response + " mm");
|
||||
},
|
||||
() => { }
|
||||
).post();
|
||||
}*/
|
||||
else{
|
||||
maxSolapas = 0.75*this.getDimensionLibro().ancho;
|
||||
}
|
||||
if($('#solapas_ancho').length>0 && $('#solapas_ancho').attr('max') != maxSolapas){
|
||||
$('#solapas_ancho').attr('max', maxSolapas);
|
||||
$('#solapas_ancho').trigger('change');
|
||||
$('#solapas_ancho').closest('.mb-1').find('.form-text').text('Entre 60 y ' + maxSolapas + ' mm');
|
||||
}
|
||||
if($('#solapas_ancho_sobrecubierta').length>0 && $('#solapas_ancho_sobrecubierta').attr('max') != maxSolapas){
|
||||
$('#solapas_ancho_sobrecubierta').attr('max', maxSolapas);
|
||||
$('#solapas_ancho_sobrecubierta').trigger('change');
|
||||
$('#solapas_ancho_sobrecubierta').closest('.mb-1').find('.form-text').text('Entre 60 y ' + maxSolapas + ' mm');
|
||||
}
|
||||
if($('#solapas_ancho_faja').length>0 && $('#solapas_ancho_faja').attr('max') != maxSolapas){
|
||||
$('#solapas_ancho_faja').attr('max', maxSolapas);
|
||||
$('#solapas_ancho_faja').trigger('change');
|
||||
$('#solapas_ancho_faja').closest('.mb-1').find('.form-text').text('Entre 60 y ' + maxSolapas + ' mm');
|
||||
}
|
||||
console.log('maxSolapas', maxSolapas);
|
||||
}
|
||||
|
||||
getDimensionLibro() {
|
||||
|
||||
Reference in New Issue
Block a user