Terminado el preview a falta de bugs/comentarios

This commit is contained in:
imnavajas
2024-01-03 10:47:56 +01:00
parent fed05de5bf
commit 2aa80c3e4e

View File

@ -114,7 +114,7 @@ function previewRotativa(lpTagName) {
let nTopForms = (pvObj.altoImpresion / 2.0 - margenTop) / (LVo + guardaV); let nTopForms = (pvObj.altoImpresion / 2.0 - margenTop) / (LVo + guardaV);
let yOffset = LVo * getDecimalPart(nTopForms); let yOffset = LVo * getDecimalPart(nTopForms);
console.log(yOffset); //console.log(yOffset);
// Clear the canvas element // Clear the canvas element
$('#pv_' + pvObj.idIndex + '_shape').empty(); $('#pv_' + pvObj.idIndex + '_shape').empty();
@ -371,7 +371,7 @@ function getObjetoLP(lpName) {
pvObj = { pvObj = {
idIndex: lpName, idIndex: lpName,
gramajeLibro: parseFloat($('#lp_' + lpName + '_gramaje').val()), gramajeLibro: parseInt($('#lp_' + lpName + '_gramaje').text()),
manoLP: parseFloat($('#lp_' + lpName + '_lomo').val()), manoLP: parseFloat($('#lp_' + lpName + '_lomo').val()),
lomoLibro: getLomoLibro(), lomoLibro: getLomoLibro(),
anchoSolapa: parseFloat($('#solapas_ancho').val()), anchoSolapa: parseFloat($('#solapas_ancho').val()),
@ -391,13 +391,6 @@ function getObjetoLP(lpName) {
pvObj.anchoForma = (_isCosido) ? 2 * pvObj.anchoLibro : pvObj.anchoLibro; pvObj.anchoForma = (_isCosido) ? 2 * pvObj.anchoLibro : pvObj.anchoLibro;
pvObj.altoForma = pvObj.altoLibro; pvObj.altoForma = pvObj.altoLibro;
// Conditional assignements depending on rotation of the printing shape
if (pvObj.orientacionFormas == 'v') {
let auxReg = pvObj.altoForma;
pvObj.altoForma = pvObj.anchoForma;
pvObj.anchoForma = auxReg;
}
// Update preview info fields // Update preview info fields
let pvName = '#pv_' + lpName; let pvName = '#pv_' + lpName;
$(pvName + '_pg').attr("href", $(pvName + '_pg').attr('sk-url') + $('#lp_' + lpName + '_papel').val()); $(pvName + '_pg').attr("href", $(pvName + '_pg').attr('sk-url') + $('#lp_' + lpName + '_papel').val());
@ -437,8 +430,29 @@ function getObjetoLP(lpName) {
case 'rot_bn': case 'rot_bn':
case 'rot_color': case 'rot_color':
if((pvObj.anchoImpresion / pvObj.altoForma) > (pvObj.anchoImpresion / pvObj.anchoForma)){
let auxReg = pvObj.anchoForma;
pvObj.anchoForma = pvObj.altoForma;
pvObj.altoForma = auxReg;
}
$(pvName + '_forma').text(pvObj.anchoForma + "x" + pvObj.altoForma);
pvObj.altoClick = 305; //parseFloat($('#lp_' + lpName + '_alto_click').val()); pvObj.altoClick = 305; //parseFloat($('#lp_' + lpName + '_alto_click').val());
pvObj.nFormasV = Math.trunc(pvObj.altoImpresion / pvObj.altoForma); pvObj.nFormasH = Math.trunc(pvObj.anchoImpresion / pvObj.anchoForma);
pvObj.nFormasV = Math.trunc((pvObj.altoImpresion - 3) / (pvObj.altoForma + 4));
console.log( )
break;
case 'bn':
case 'bnhq':
case 'color':
case 'colorhq':
// Conditional assignements depending on rotation of the printing shape
if (pvObj.orientacionFormas == 'v') {
let auxReg = pvObj.altoForma;
pvObj.altoForma = pvObj.anchoForma;
pvObj.anchoForma = auxReg;
}
$(pvName + '_forma').text(pvObj.anchoForma + "x" + pvObj.altoForma);
break; break;
default: default:
@ -449,26 +463,60 @@ function getObjetoLP(lpName) {
function getVisibleTabs() { function getVisibleTabs() {
$("#tableLineasPresupuesto tbody tr:visible").each(function () { $("#tableLineasPresupuesto tbody tr").each(function () {
let isVisible = $(this).is(":visible");
let lpName = $(this).attr('id').replace('lp_', '');
let tabName = lpName.replace('_', '-');
//console.log("Visible: " + $(this).attr('id')); switch (lpName){
if ($(this).attr('id').indexOf('cubierta') > -1) { case 'bn':
$("#" + $(this).attr('id').replace('lp_', 'tab-pv-')).show(); case 'bnhq':
$("#" + $(this).attr('id').replace('lp_', 'tab-pv-esquema-')).show(); case 'color':
$("#pv_cubierta").addClass("active show"); case 'colorhq':
$("#pv_esquema-cubierta").addClass("active show"); case 'rot_bn':
} else if ($(this).attr('id').indexOf('_data') > -1) { case 'rot_color':
// Do nothing here if(isVisible) {
} else if ($(this).attr('id').indexOf('_rot') > -1) { $("#tab-pv-" + tabName).show();
$("#" + $(this).attr('id').replace('lp_rot_', 'tab-pv-rot-')).show(); }else{
$("#" + $(this).attr('id').replace('lp_', '')).addClass("active show"); $("#tab-pv-" + tabName).hide();
} else { $("#tab-pv-" + tabName).children('.active').each(function () {
$("#" + $(this).attr('id').replace('lp_', 'tab-pv-')).show(); $(this).removeClass('active');
$("#" + $(this).attr('id').replace('lp_', '')).addClass("active show"); });
$("#pv_" + lpName).removeClass("active show");
}
break;
case 'cubierta':
if(isVisible) {
$("#tab-pv-" + tabName).show();
$("#tab-pv-esquema-" + tabName).show();
}else{
$("#tab-pv-" + tabName).hide();
$("#tab-pv-esquema-" + tabName).hide();
$("#tab-pv-" + tabName).children('.active').each(function () {
$(this).removeClass('active');
});
$("#tab-pv-esquema-" + tabName).children('.active').each(function () {
$(this).removeClass('active');
});
$("#pv_" + lpName).removeClass("active show");
$("#pv_esquema_" + lpName).removeClass("active show");
}
break;
default:
//console.log(tabType + " visible? " +isVisible );
break;
} }
//console.log(tabType + " visible? " +isVisible );
}); });
/*
$("#tableLineasPresupuesto tbody tr:hidden").each(function () { $("#tableLineasPresupuesto tbody tr:hidden").each(function () {
//console.log("Hidden: " + $(this).attr('id')); //console.log("Hidden: " + $(this).attr('id'));
@ -476,17 +524,19 @@ function getVisibleTabs() {
$("#" + $(this).attr('id').replace('lp_', 'tab-pv-')).hide(); $("#" + $(this).attr('id').replace('lp_', 'tab-pv-')).hide();
$("#" + $(this).attr('id').replace('lp_', 'tab-pv-esquema-')).hide(); $("#" + $(this).attr('id').replace('lp_', 'tab-pv-esquema-')).hide();
$("#pv_cubierta").removeClass("active show"); $("#pv_cubierta").removeClass("active show");
$("#pv_esquema-cubierta").removeClass("active show"); $("#pv_esquema_cubierta").removeClass("active show");
} else if ($(this).attr('id').indexOf('_data') > -1) { } else if ($(this).attr('id').indexOf('_data') > -1) {
// Do nothing here // Do nothing here
} else if ($(this).attr('id').indexOf('_rot') > -1) { } else if ($(this).attr('id').indexOf('_rot') > -1) {
$("#" + $(this).attr('id').replace('lp_rot_', 'tab-pv-rot-')).hide(); $("#" + $(this).attr('id').replace('lp_rot_', 'tab-pv-rot-')).hide();
$("#" + $(this).attr('id').replace('lp_', '')).removeClass("active show"); $("#" + $(this).attr('id').replace('lp_', 'pv_')).removeClass("active show");
} else { } else {
$("#" + $(this).attr('id').replace('lp_', 'tab-pv-')).hide(); $("#" + $(this).attr('id').replace('lp_', 'tab-pv-')).hide();
$("#" + $(this).attr('id').replace('lp_', '')).removeClass("active show"); $("#" + $(this).attr('id').replace('lp_', 'pv_')).removeClass("active show");
} }
}); });
*/
} }