diff --git a/ci4/app/Language/es/Presupuestos.php b/ci4/app/Language/es/Presupuestos.php index ebbf64e3..c616b0af 100755 --- a/ci4/app/Language/es/Presupuestos.php +++ b/ci4/app/Language/es/Presupuestos.php @@ -172,8 +172,8 @@ return [ 'preview-conf-bn-hq' => 'Configuración Blanco y Negro', 'preview-conf-color' => 'Configuración Color', 'preview-conf-color-hq' => 'Configuración Color', - 'preview-conf-rot-bn' => 'Configuración Blanco y Negro', - 'preview-conf-rot-color' => 'Configuración Color', + 'preview-conf-rot-bn' => 'Configuración Rotativa', + 'preview-conf-rot-color' => 'Configuración Rotativa', 'previewMaquina' => 'Máquina', 'previewConfiguracionCubierta' => 'Configuración de cubierta', 'previewEsquemaCubierta' => 'Esquema de cubierta', diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_previewItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_previewItems.php index 5e2cb07e..1db36eed 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_previewItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_previewItems.php @@ -485,7 +485,7 @@
-
+
@@ -562,7 +562,7 @@
-
+
@@ -830,7 +830,27 @@ $('#tab-pv-colorhq').on( "click", function() { $('#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); } ); 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 d8750b09..f8d00cfe 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 @@ -19,17 +19,18 @@ function previewInteriorPlana(cubiertaObj) { // Local parameters let margenTop = 3; - let guardaV = 0; guardaH = 0; + let guardaV = 0; + guardaH = 0; // Calculos // Configuracion de las guardas // Guarda vertical - if(cubiertaObj.formasV > 1){ + if (cubiertaObj.formasV > 1) { //guardaV = (cubiertaObj.altoImpresion - (2 * margenTop) - (cubiertaObj.altoLibro * cubiertaObj.formasV)) / (cubiertaObj.formasV - 1); guardaV = 3; } // Guarda horizontal - if(cubiertaObj.formasH > 1){ + if (cubiertaObj.formasH > 1) { guardaH = 3; } // Constantes relativas al libro @@ -66,13 +67,13 @@ function previewInteriorPlana(cubiertaObj) { var formas = []; - for(let iV=0; iV < cubiertaObj.formasV; iV++){ + for (let iV = 0; iV < cubiertaObj.formasV; iV++) { - for(let iH=0; iH < cubiertaObj.formasH; iH++){ + for (let iH = 0; iH < cubiertaObj.formasH; iH++) { 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)), + 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); formas[iV + iH].stroke = 'grey'; @@ -105,6 +106,116 @@ function previewInteriorPlana(cubiertaObj) { } +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 @@ -318,17 +429,17 @@ function previewEsquemaCubierta(objEC) { } -function getObjetoEC(){ +function getObjetoEC() { let _anchoLomo = 0; $("#tableLineasPresupuesto tbody tr:visible td input[id*='_lomo']").each(function () { _anchoLomo += parseFloat($(this).val()); }); - + objEC = { - altoLibro:getDimensionLibro().alto, - anchoLibro:getDimensionLibro().ancho, + altoLibro: getDimensionLibro().alto, + anchoLibro: getDimensionLibro().ancho, anchoSolapa: parseFloat($('#solapas_ancho').val()), - lomoLibro:parseFloat(_anchoLomo.toFixed(2)) + lomoLibro: parseFloat(_anchoLomo.toFixed(2)) }; // Update preview info fields @@ -343,11 +454,11 @@ function getObjetoEC(){ } -function getObjetoLP(lpName){ +function getObjetoLP(lpName) { objEC = { - altoLibro:getDimensionLibro().alto, - anchoLibro:getDimensionLibro().ancho, + 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(), @@ -373,16 +484,20 @@ function getObjetoLP(lpName){ } -function getVisibleTabs(){ +function getVisibleTabs() { $("#tableLineasPresupuesto tbody tr:visible").each(function () { - //console.log(idElem); - 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{ - $("#" + $(this).attr('id').replace('lp_','tab-pv-')).show(); + //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) { + $("#" + $(this).attr('id').replace('lp_rot_', 'tab-pv-rot-')).show(); + } else { + $("#" + $(this).attr('id').replace('lp_', 'tab-pv-')).show(); } }); diff --git a/httpdocs/themes/vuexy/css/sk-datatables.css b/httpdocs/themes/vuexy/css/sk-datatables.css index 291a2963..b8790fe3 100755 --- a/httpdocs/themes/vuexy/css/sk-datatables.css +++ b/httpdocs/themes/vuexy/css/sk-datatables.css @@ -97,6 +97,12 @@ div.draw-shapes { margin: 2.5% auto; } +div.draw-rot-shapes { + width: 95%; + height: 850px; + margin: 2.5% auto; +} + .table-servicios{ overflow-x: scroll; overflow-y: hidden;