-
= lang("Presupuestos.previewMaquinaRotativa") ?>
@@ -559,7 +571,7 @@
-
= lang("Presupuestos.previewPapelGenerico") ?>
+
= lang("Presupuestos.previewMaquinaRotativa") ?>
@@ -616,6 +628,9 @@
= lang("Presupuestos.previewMano") ?>
TBD
+
= lang("Presupuestos.previewSolapas") ?>
+
TBD
+
= lang("Presupuestos.previewMaquina") ?>
TBDxTBD
@@ -625,8 +640,11 @@
= lang("Presupuestos.previewLibro") ?>
TBDxTBD
+
= lang("Presupuestos.previewForma") ?>
+
TBD
+
= lang("Presupuestos.previewFormas") ?>
-
TBD
+
TBD
@@ -691,8 +709,8 @@
= lang("Presupuestos.previewLomo") ?>
TBD
-
= lang("Presupuestos.previewSolapas") ?>
-
TBD
+
= lang("Presupuestos.previewSolapas") ?>
+
TBD
@@ -729,128 +747,33 @@ getVisibleTabs();
$('#tab-pv-bn').on( "click", function() {
- let scV = 4;
- let scH = 2;
- cubiertaObjeto = {
- idIndex: 'bn',
- anchoMaquina: 487,
- altoMaquina: 330,
- anchoImpresion: 475,
- altoImpresion: 310,
- anchoLibro: 170/scH,
- altoLibro: 240/scV,
- solapas:45,
- lomo:25,
- formas: scH * scV,
- formasH: scH,
- formasV: scV
- };
-
- getObjetoLP('bn');
- previewInteriorPlana(cubiertaObjeto);
+ previewInteriorPlana('bn');
} );
$('#tab-pv-bnhq').on( "click", function() {
- let scV = 4;
- let scH = 2;
-
- cubiertaObjeto = {
- idIndex: 'bnhq',
- anchoMaquina: 487,
- altoMaquina: 330,
- anchoImpresion: 475,
- altoImpresion: 310,
- anchoLibro: 170/scH,
- altoLibro: 240/scV,
- solapas:45,
- lomo:25,
- formas: scH * scV,
- formasH: scH,
- formasV: scV
- };
-
- getObjetoLP('bnhq');
- previewInteriorPlana(cubiertaObjeto);
+ previewInteriorPlana('bnhq');
} );
$('#tab-pv-color').on( "click", function() {
- let scV = 2;
- let scH = 2;
-
- cubiertaObjeto = {
- idIndex: 'color',
- anchoMaquina: 487,
- altoMaquina: 330,
- anchoImpresion: 475,
- altoImpresion: 310,
- anchoLibro: 170/scH,
- altoLibro: 240/scV,
- solapas:45,
- lomo:25,
- formas: scH * scV,
- formasH: scH,
- formasV: scV
- };
-
- getObjetoLP('color');
- previewInteriorPlana(cubiertaObjeto);
-
+ previewInteriorPlana('color');
} );
$('#tab-pv-colorhq').on( "click", function() {
- let scV = 4;
- let scH = 2;
- cubiertaObjeto = {
- idIndex: 'colorhq',
- anchoMaquina: 487,
- altoMaquina: 330,
- anchoImpresion: 475,
- altoImpresion: 310,
- anchoLibro: 170/scH,
- altoLibro: 240/scV,
- solapas:45,
- lomo:25,
- formas: scH * scV,
- formasH: scH,
- formasV: scV
- };
-
- getObjetoLP('colorhq');
- previewInteriorPlana(cubiertaObjeto);
+ previewInteriorPlana('colorhq');
} );
$('#tab-pv-rot-bn').on( "click", function() {
- let scV = 3;
- let scH = 1;
-
- cubiertaObjeto = {
- idIndex: 'rot_bn',
- anchoMaquina: 520,
- altoMaquina: 800,
- anchoImpresion: 515,
- altoImpresion: 800,
- altoClick: 305,
- anchoLibro: 170,
- altoLibro: 240,
- solapas:45,
- lomo:25,
- formas: scH * scV,
- formasH: scH,
- formasV: scV
- };
-
getObjetoLP('rot_bn');
- previewRotativa(cubiertaObjeto);
} );
@@ -862,24 +785,7 @@ $('#tab-pv-rot-color').on( "click", function() {
$('#tab-pv-cubierta').on( "click", function() {
- getObjetoLP('cubierta');
-
- cubiertaObjeto = {
- idIndex: 'bn',
- anchoMaquina: 487,
- altoMaquina: 330,
- anchoImpresion: 475,
- altoImpresion: 310,
- anchoLibro: 170,
- altoLibro: 240,
- solapas:45,
- lomo:25,
- formas: 1,
- formasH: 1,
- formasV: 1
- };
-
- previewConfiguracionCubierta(cubiertaObjeto);
+ previewInteriorPlana('cubierta');
} );
diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/previews.js b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/previews.js
index f8d00cfe..0e0aceb1 100755
--- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/previews.js
+++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/previews.js
@@ -1,9 +1,12 @@
// Global parameters
+var _isCosido = true;
var _offsetSolapas = 2; // millimeters
var objEC;
+var pvObj;
+
var styles = {
size: 13,
@@ -15,34 +18,33 @@ var sangradoValor = parseFloat(5); // mm
var offsetSolapaValor = parseFloat(3); // mm
-function previewInteriorPlana(cubiertaObj) {
+function previewInteriorPlana(lpTagName) {
// Local parameters
- let margenTop = 3;
let guardaV = 0;
guardaH = 0;
+ let styleText = {size: 12, family: 'Public Sans'};
+
+ // Get the preview Object parameters
+ getObjetoLP(lpTagName);
- // Calculos
// Configuracion de las guardas
// Guarda vertical
- if (cubiertaObj.formasV > 1) {
- //guardaV = (cubiertaObj.altoImpresion - (2 * margenTop) - (cubiertaObj.altoLibro * cubiertaObj.formasV)) / (cubiertaObj.formasV - 1);
+ if (pvObj.nFormasV > 1) {
guardaV = 3;
}
// Guarda horizontal
- if (cubiertaObj.formasH > 1) {
+ if (pvObj.nFormasH > 1) {
guardaH = 3;
}
- // Constantes relativas al libro
- let LVo = cubiertaObj.altoLibro / 2;
- let LHo = cubiertaObj.anchoLibro / 2;
+ // Constantes relativas a las dimnesiones de la forma
+ let LVo = pvObj.altoForma / 2;
+ let LHo = pvObj.anchoForma / 2;
// Clear the canvas element
-
-
- $('#pv_' + cubiertaObj.idIndex + '_shape').empty();
+ $('#pv_' + pvObj.idIndex + '_shape').empty();
// Get the element for placing the graphical elements
- var divPlana = document.getElementById('pv_' + cubiertaObj.idIndex + '_shape');
+ var divPlana = document.getElementById('pv_' + pvObj.idIndex + '_shape');
var _pvPlana = new Two({fitted: true}).appendTo(divPlana);
// Calculate the center of the canvas element
var origenPlana = new Two.Vector(_pvPlana.width / 2, _pvPlana.height / 2);
@@ -50,8 +52,8 @@ function previewInteriorPlana(cubiertaObj) {
var areaMaquinaPlana = _pvPlana.makeRectangle(
origenPlana.x,
origenPlana.y,
- cubiertaObj.anchoMaquina,
- cubiertaObj.altoMaquina);
+ pvObj.anchoMaquina,
+ pvObj.altoMaquina);
areaMaquinaPlana.stroke = 'black';
areaMaquinaPlana.fill = '#E69F6E';
areaMaquinaPlana.linewidth = 1;
@@ -59,212 +61,39 @@ function previewInteriorPlana(cubiertaObj) {
var areaImpresionPlana = _pvPlana.makeRectangle(
origenPlana.x,
origenPlana.y,
- cubiertaObj.anchoImpresion,
- cubiertaObj.altoImpresion);
+ pvObj.anchoImpresion,
+ pvObj.altoImpresion);
areaImpresionPlana.stroke = 'red';
areaImpresionPlana.fill = '#FCEAF1';
areaImpresionPlana.linewidth = 1;
var formas = [];
- for (let iV = 0; iV < cubiertaObj.formasV; iV++) {
+ for (let iV = 0; iV < pvObj.nFormasV; iV++) {
- for (let iH = 0; iH < cubiertaObj.formasH; iH++) {
+ for (let iH = 0; iH < pvObj.nFormasH; iH++) {
+
+ let _offsetX = ((((pvObj.nFormasH - 1) - 2 * iH) * LHo) + (((pvObj.nFormasH - 1) / 2 - iH) * guardaH));
+ let _offsetY = ((((pvObj.nFormasV - 1) - 2 * iV) * LVo) + (((pvObj.nFormasV - 1) / 2 - iV) * guardaV));
formas[iV + iH] = _pvPlana.makeRectangle(
- origenPlana.x + ((((cubiertaObj.formasH - 1) - 2 * iH) * LHo) + (((cubiertaObj.formasH - 1) / 2 - iH) * guardaH)),
- origenPlana.y + ((((cubiertaObj.formasV - 1) - 2 * iV) * LVo) + (((cubiertaObj.formasV - 1) / 2 - iV) * guardaV)),
- cubiertaObj.anchoLibro,
- cubiertaObj.altoLibro);
+ origenPlana.x + _offsetX,
+ origenPlana.y + _offsetY,
+ pvObj.anchoForma,
+ pvObj.altoForma);
formas[iV + iH].stroke = 'grey';
formas[iV + iH].fill = '#F4F8F2';
formas[iV + iH].linewidth = 1;
+ // Texts
+ _pvPlana.makeText(pvObj.altoForma, (origenPlana.x + _offsetX) + (pvObj.anchoForma / 2 - 25), (origenPlana.y + _offsetY), styleText);
+ _pvPlana.makeText(pvObj.anchoForma, (origenPlana.x + _offsetX), (origenPlana.y + _offsetY) + (pvObj.altoForma / 2 - 15), styleText);
+
}
}
- // Texts
- //_pvPlana.makeText(cubiertaObj.altoLibro, origenPlana.x + (fullBookWith / 2 - 25), origenPlana.y, styles);
- //_pvPlana.makeText(fullBookWith, origenPlana.x, origenPlana.y + (cubiertaObj.altoLibro / 2 - 15), styles);
-
_pvPlana.update();
-
-
- /*
-
-
- var arrowX = twoMaquina.makeArrow(origin.x -200, origin.y, origin.x+200, origin.y, 0);
- arrowX.stroke = 'green';
- arrowX.dashes = [5, 5];
- arrowX.linewidth = 1;
-
- var arrowY = twoMaquina.makeArrow(origin.x, origin.y-200, origin.x, origin.y+200, 0);
- arrowY.stroke = 'pink';
- arrowY.dashes = [5, 5];
- arrowY.linewidth = 2;*/
-
-}
-
-function previewRotativa(cubiertaObj) {
-
- // Local parameters
- let margenTop = 3;
- let guardaV = 0;
- guardaH = 0;
-
- // Calculos
- // Configuracion de las guardas
- // Guarda vertical
- if (cubiertaObj.formasV > 1) {
- //guardaV = (cubiertaObj.altoImpresion - (2 * margenTop) - (cubiertaObj.altoLibro * cubiertaObj.formasV)) / (cubiertaObj.formasV - 1);
- guardaV = 3;
- }
- // Guarda horizontal
- if (cubiertaObj.formasH > 1) {
- guardaH = 3;
- }
- // Constantes relativas al libro
- let LVo = cubiertaObj.altoLibro / 2;
- let LHo = cubiertaObj.anchoLibro / 2;
-
- // offset Y
- let nTopForms = (cubiertaObj.altoImpresion / 2.0 - margenTop) / (LVo + guardaV);
- let yOffset = LVo * getDecimalPart(nTopForms);
-
- console.log(yOffset);
-
- // Clear the canvas element
- $('#pv_' + cubiertaObj.idIndex + '_shape').empty();
- // Get the element for placing the graphical elements
- var divRotativa = document.getElementById('pv_' + cubiertaObj.idIndex + '_shape');
- var _pvRotativa = new Two({fitted: true}).appendTo(divRotativa);
- // Calculate the center of the canvas element
- var origenRotativa = new Two.Vector(_pvRotativa.width / 2, _pvRotativa.height / 2);
-
- var areaMaquinaRotativa = _pvRotativa.makeRectangle(
- origenRotativa.x,
- origenRotativa.y,
- cubiertaObj.anchoMaquina,
- cubiertaObj.altoMaquina);
- areaMaquinaRotativa.stroke = 'black';
- areaMaquinaRotativa.fill = '#E69F6E';
- areaMaquinaRotativa.linewidth = 1;
-
- var areaImpresionRotativa = _pvRotativa.makeRectangle(
- origenRotativa.x,
- origenRotativa.y,
- cubiertaObj.anchoImpresion,
- cubiertaObj.altoImpresion);
- areaImpresionRotativa.stroke = 'red';
- areaImpresionRotativa.fill = '#FCEAF1';
- areaImpresionRotativa.linewidth = 1;
-
- var areaClickRotativa = _pvRotativa.makeRectangle(
- origenRotativa.x,
- origenRotativa.y - (cubiertaObj.altoImpresion / 2 - cubiertaObj.altoClick/2),
- cubiertaObj.anchoImpresion - 10,
- cubiertaObj.altoClick);
- areaClickRotativa.stroke = 'blue';
- //areaClickRotativa.fill = '#FCEAF1';
- areaClickRotativa.linewidth = 2;
-
- var formas = [];
-
- for (let iV = 0; iV < cubiertaObj.formasV; iV++) {
-
- for (let iH = 0; iH < cubiertaObj.formasH; iH++) {
-
- formas[iV + iH] = _pvRotativa.makeRectangle(
- origenRotativa.x + ((((cubiertaObj.formasH - 1) - 2 * iH) * LHo) + (((cubiertaObj.formasH - 1) / 2 - iH) * guardaH)),
- (origenRotativa.y - yOffset) + ((((cubiertaObj.formasV - 1) - 2 * iV) * LVo) + (((cubiertaObj.formasV - 1) / 2 - iV) * guardaV)),
- 2 * cubiertaObj.anchoLibro, // Open book is 2x
- cubiertaObj.altoLibro);
- formas[iV + iH].stroke = 'grey';
- formas[iV + iH].fill = '#F4F8F2';
- formas[iV + iH].linewidth = 1;
-
- }
-
- }
-
- // Texts
- //_pvPlana.makeText(cubiertaObj.altoLibro, origenPlana.x + (fullBookWith / 2 - 25), origenPlana.y, styles);
- //_pvPlana.makeText(fullBookWith, origenPlana.x, origenPlana.y + (cubiertaObj.altoLibro / 2 - 15), styles);
-
- _pvRotativa.update();
-
-
- /*
-
-
- var arrowX = twoMaquina.makeArrow(origin.x -200, origin.y, origin.x+200, origin.y, 0);
- arrowX.stroke = 'green';
- arrowX.dashes = [5, 5];
- arrowX.linewidth = 1;
-
- var arrowY = twoMaquina.makeArrow(origin.x, origin.y-200, origin.x, origin.y+200, 0);
- arrowY.stroke = 'pink';
- arrowY.dashes = [5, 5];
- arrowY.linewidth = 2;*/
-
-}
-
-function getDecimalPart(floatNumber) {
- let int_part = Math.trunc(floatNumber); // returns 3
- let float_part = Number((floatNumber - int_part).toFixed(2)); // return 0.2
- return float_part;
-}
-
-function previewConfiguracionCubierta(cubiertaObj) {
-
- // Local parameters
- let fullBookWith = ((2 * cubiertaObj.anchoLibro) + (2 * (cubiertaObj.solapas + _offsetSolapas)) + cubiertaObj.lomo);
-
- // Clear the canvas element
- $('#pv_cubierta_shape').empty();
- // Get the element for placing the graphical elements
- var divCubierta = document.getElementById('pv_cubierta_shape');
- var _previewConfiguracionCubierta = new Two({fitted: true}).appendTo(divCubierta);
- // Calculate the center of the canvas element
- var origenCubierta = new Two.Vector(_previewConfiguracionCubierta.width / 2, _previewConfiguracionCubierta.height / 2);
-
- var areaMaquinaCubierta = _previewConfiguracionCubierta.makeRectangle(
- origenCubierta.x,
- origenCubierta.y,
- cubiertaObj.anchoMaquina,
- cubiertaObj.altoMaquina);
- areaMaquinaCubierta.stroke = 'black';
- areaMaquinaCubierta.linewidth = 1;
-
- var areaImpresionCubierta = _previewConfiguracionCubierta.makeRectangle(
- origenCubierta.x,
- origenCubierta.y,
- cubiertaObj.anchoImpresion,
- cubiertaObj.altoImpresion);
- areaImpresionCubierta.stroke = 'red';
- areaImpresionCubierta.linewidth = 1;
-
- var formaCubierta = _previewConfiguracionCubierta.makeRectangle(
- origenCubierta.x,
- origenCubierta.y,
- fullBookWith,
- cubiertaObj.altoLibro);
- formaCubierta.stroke = 'grey';
- formaCubierta.fill = '#F4F8F2';
- formaCubierta.linewidth = 1;
-
- // Texts
- _previewConfiguracionCubierta.makeText(cubiertaObj.altoLibro, origenCubierta.x + (fullBookWith / 2 - 25), origenCubierta.y, styles);
- _previewConfiguracionCubierta.makeText(fullBookWith, origenCubierta.x, origenCubierta.y + (cubiertaObj.altoLibro / 2 - 15), styles);
-
- _previewConfiguracionCubierta.update();
-
- // Update preview info fields
- $('#pv_ec_libro').text(cubiertaObj.anchoLibro + "X" + cubiertaObj.altoLibro);
- $('#pv_ec_lomo').text(cubiertaObj.lomo);
- $('#pv_ec_solapas').text(cubiertaObj.solapas);
-
}
@@ -429,6 +258,15 @@ function previewEsquemaCubierta(objEC) {
}
+function getLomoLibro() {
+ let _anchoLomo = 0;
+ $("#tableLineasPresupuesto tbody tr:visible td input[id*='_lomo']").each(function () {
+ _anchoLomo += parseFloat($(this).val());
+ });
+
+ return parseFloat(_anchoLomo.toFixed(2));
+}
+
function getObjetoEC() {
let _anchoLomo = 0;
$("#tableLineasPresupuesto tbody tr:visible td input[id*='_lomo']").each(function () {
@@ -456,30 +294,62 @@ function getObjetoEC() {
function getObjetoLP(lpName) {
- objEC = {
- altoLibro: getDimensionLibro().alto,
- anchoLibro: getDimensionLibro().ancho,
- altoMaquina: $('#lp_' + lpName + '_maquina_alto').val(),
- anchoMaquina: $('#lp_' + lpName + '_maquina_ancho').val(),
- altoImpresion: $('#lp_' + lpName + '_maquina_impresion_alto').val(),
- anchoImpresion: $('#lp_' + lpName + '_maquina_impresion_ancho').val(),
+ pvObj = {
+ idIndex: lpName,
+ gramajeLibro: parseFloat($('#lp_' + lpName + '_gramaje').val()),
+ manoLP: parseFloat($('#lp_' + lpName + '_lomo').val()),
+ lomoLibro: getLomoLibro(),
anchoSolapa: parseFloat($('#solapas_ancho').val()),
- nFormas: $('#lp_' + lpName + '_formas').val(),
- //lomoLibro:parseFloat(_anchoLomo.toFixed(2))
+ nFormas: parseInt($('#lp_' + lpName + '_formas').val()),
+ nFormasH: parseInt($('#lp_' + lpName + '_formas_h').val()),
+ nFormasV: parseInt($('#lp_' + lpName + '_formas_v').val()),
+ orientacionFormas: $('#lp_' + lpName + '_formas_orientacion').val(),
+ altoMaquina: parseFloat($('#lp_' + lpName + '_maquina_alto').val()),
+ anchoMaquina: parseFloat($('#lp_' + lpName + '_maquina_ancho').val()),
+ altoImpresion: parseFloat($('#lp_' + lpName + '_maquina_impresion_alto').val()),
+ anchoImpresion: parseFloat($('#lp_' + lpName + '_maquina_impresion_ancho').val()),
+ altoLibro: getDimensionLibro().alto,
+ anchoLibro: getDimensionLibro().ancho
};
+ // Printing shape definition
+ pvObj.anchoForma = (_isCosido) ? 2 * pvObj.anchoLibro : pvObj.anchoLibro;
+ 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
let pvName = '#pv_' + lpName;
$(pvName + '_pg').attr("href", $(pvName + '_pg').attr('sk-url') + $('#lp_' + lpName + '_papel').val());
$(pvName + '_pi').attr("href", $(pvName + '_pi').attr('sk-url') + $('#lp_' + lpName + '_papelImpresion').val());
$(pvName + '_mi').attr("href", $(pvName + '_mi').attr('sk-url') + $('#lp_' + lpName + '_maquina').val());
- $(pvName + '_gramaje').text(parseFloat($('#lp_' + lpName + '_gramaje').val()));
- $(pvName + '_mano').text(parseFloat($('#lp_' + lpName + '_lomo').val()));
- $(pvName + '_maquina').text(objEC.anchoMaquina + "x" + objEC.altoMaquina);
- $(pvName + '_maquina_impresion').text(objEC.anchoImpresion + "x" + objEC.altoImpresion);
- $(pvName + '_libro').text(objEC.anchoLibro + "x" + objEC.altoLibro);
- $(pvName + '_formas').text(objEC.nFormas);
+ $(pvName + '_gramaje').text(pvObj.gramajeLibro);
+ $(pvName + '_mano').text(pvObj.manoLP);
+ $(pvName + '_solapas').text(pvObj.anchoSolapa);
+ $(pvName + '_maquina').text(pvObj.anchoMaquina + "x" + pvObj.altoMaquina);
+ $(pvName + '_maquina_impresion').text(pvObj.anchoImpresion + "x" + pvObj.altoImpresion);
+ $(pvName + '_libro').text(pvObj.anchoLibro + "x" + pvObj.altoLibro);
+ $(pvName + '_forma').text(pvObj.anchoForma + "x" + pvObj.altoForma);
+ $(pvName + '_nFormas').text(pvObj.nFormas);
+
+ (pvObj.anchoSolapa != 0) ? $('.pv-solapas').show() : $('.pv-solapas').hide();
+
+ // Custom overwrites
+ switch (pvObj.idIndex){
+ case 'cubierta':
+ pvObj.anchoForma = ((2 * pvObj.anchoLibro) + (2 * (pvObj.anchoSolapa + _offsetSolapas)) + pvObj.lomoLibro);
+ $(pvName + '_forma').text(pvObj.anchoForma + "x" + pvObj.altoForma);
+ break;
+ default:
+ break;
+ }
+
}
@@ -488,15 +358,16 @@ function getVisibleTabs() {
$("#tableLineasPresupuesto tbody tr:visible").each(function () {
- //console.log($(this).attr('id'));
+ console.log($(this).attr('id'));
if ($(this).attr('id').indexOf('cubierta') > -1) {
$("#" + $(this).attr('id').replace('lp_', 'tab-pv-')).show();
$("#" + $(this).attr('id').replace('lp_', 'tab-pv-esquema-')).show();
} else if ($(this).attr('id').indexOf('_data') > -1) {
- // Do nothing here
- } else if ($(this).attr('id').indexOf('_rot') > -1) {
+ // Discard
+ } else if ($(this).attr('id').indexOf('lp_rot_') > -1) {
$("#" + $(this).attr('id').replace('lp_rot_', 'tab-pv-rot-')).show();
- } else {
+ }
+ else {
$("#" + $(this).attr('id').replace('lp_', 'tab-pv-')).show();
}