-
Posición de formas
+
= lang("Presupuestos.previewConfiguracionEsquemaCubierta") ?>
@@ -282,102 +723,96 @@
= $this->section("additionalInlineJs") ?>
- $('#tab-preview-configuracion-cubierta').on( "click", function() {
+var cubiertaObjeto = 0;
- var cubiertaObjeto = {
- anchoMaquina: 487,
- altoMaquina: 330,
- anchoImpresion: 475,
- altoImpresion: 310,
- anchoLibro:170,
- altoLibro:240,
- solapas:45,
- lomo:25};
+getVisibleTabs();
- previewConfiguracionCubierta(cubiertaObjeto);
+$('#tab-pv-bn').on( "click", function() {
- } );
+ let scV = 4;
+ let scH = 2;
- $('#tab-preview-esquema-cubierta').on( "click", function() {
-
- var altoLib = 400;
-
- var cubiertaObjeto = {
- altoLibro:220,
- anchoLibro:170,
- anchoCubierta:491,
- anchoSolapa:70,
- lomoLibro:11
- };
-
- previewEsquemaCubierta(cubiertaObjeto);
-
- } );
-
- var elem = document.getElementById('draw-maquina');
- var twoMaquina = new Two({fitted: true}).appendTo(elem);
-
- var origin = new Two.Vector(twoMaquina.width/2, twoMaquina.height/2);
-
- var sizeX = 148;
- var sizeY = 98;
-
- var AIx = 355;
- var AIy = 250;
-
- var styles = {
- size: 14,
- family: 'Lato'
+ 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
};
- //var texts = [];
+ getObjetoLP('bn');
+ previewInteriorPlana(cubiertaObjeto);
- var areaMaquina = twoMaquina.makeRectangle(origin.x, origin.y, 360, 255);
- areaMaquina.stroke = 'black';
- areaMaquina.linewidth = 1;
+} );
- var areaImpresion = twoMaquina.makeRectangle(origin.x, origin.y, AIx, AIy);
- areaImpresion.stroke = 'red';
- areaImpresion.linewidth = 1;
+$('#tab-pv-bnhq').on( "click", function() {
+
+ getObjetoLP('bnhq');
+
+} );
+
+$('#tab-pv-color').on( "click", function() {
+
+ getObjetoLP('color');
+
+} );
+
+$('#tab-pv-colorhq').on( "click", function() {
+
+ getObjetoLP('colorhq');
+
+} );
+
+$('#tab-pv-rot-bn').on( "click", function() {
+
+ getObjetoLP('rot_bn');
+
+} );
+
+$('#tab-pv-rot-color').on( "click", function() {
+
+ getObjetoLP('rot_color');
+
+} );
+
+$('#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);
+
+} );
+
+$('#tab-pv-esquema-cubierta').on( "click", function() {
+
+ getObjetoEC();
+ previewEsquemaCubierta(objEC);
+
+} );
- var forma1 = twoMaquina.makeRectangle(origin.x - (AIx/4), origin.y - (AIy/4), sizeX, sizeY);
- forma1.stroke = 'blue';
- forma1.fill = 'blue';
- forma1.linewidth = 1;
-
- var forma2 = twoMaquina.makeRectangle(origin.x + (AIx/4), origin.y - (AIy/4), sizeX, sizeY);
- forma2.stroke = 'grey';
- forma2.fill = 'grey';
- forma2.linewidth = 1;
-
- var forma3 = twoMaquina.makeRectangle(origin.x - (AIx/4), origin.y + (AIy/4), sizeX, sizeY);
- forma3.stroke = 'blue';
- forma3.fill = 'blue';
- forma3.linewidth = 1;
-
- var forma4 = twoMaquina.makeRectangle(origin.x + (AIx/4), origin.y + (AIy/4), sizeX, sizeY);
- forma4.stroke = 'grey';
- forma4.fill = 'grey';
- forma4.linewidth = 1;
-
- 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;
-
-
- //group = twoMaquina.makeGroup(areaMaquina, areaImpresion, ...texts);
-
- //group.position.set(twoMaquina.width / 2, twoMaquina.height / 2);
- //group.center();
-
- twoMaquina.update();
= $this->endSection() ?>
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 690ccb56..716c1d4a 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,11 +1,107 @@
// Global parameters
var _offsetSolapas = 2; // millimeters
+
+var objEC;
+
+
var styles = {
size: 13,
family: 'Public Sans',
}
+var sangradoTexto = "Sangrado 5 mm";
+var sangradoValor = parseFloat(5); // mm
+var offsetSolapaValor = parseFloat(3); // mm
+
+
+function previewInteriorPlana(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;
+
+ // Clear the canvas element
+
+
+ $('#pv_' + cubiertaObj.idIndex + '_shape').empty();
+ // Get the element for placing the graphical elements
+ var divPlana = document.getElementById('pv_' + cubiertaObj.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);
+
+ var areaMaquinaPlana = _pvPlana.makeRectangle(
+ origenPlana.x,
+ origenPlana.y,
+ cubiertaObj.anchoMaquina,
+ cubiertaObj.altoMaquina);
+ areaMaquinaPlana.stroke = 'black';
+ areaMaquinaPlana.linewidth = 1;
+
+ var areaImpresionPlana = _pvPlana.makeRectangle(
+ origenPlana.x,
+ origenPlana.y,
+ cubiertaObj.anchoImpresion,
+ cubiertaObj.altoImpresion);
+ areaImpresionPlana.stroke = 'red';
+ areaImpresionPlana.linewidth = 1;
+
+ var formas = [];
+
+ for(let iV=0; iV < cubiertaObj.formasV; iV++){
+
+ 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)),
+ cubiertaObj.anchoLibro,
+ 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);
+
+ _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 previewConfiguracionCubierta(cubiertaObj) {
@@ -13,9 +109,9 @@ function previewConfiguracionCubierta(cubiertaObj) {
let fullBookWith = ((2 * cubiertaObj.anchoLibro) + (2 * (cubiertaObj.solapas + _offsetSolapas)) + cubiertaObj.lomo);
// Clear the canvas element
- $('#draw-cubierta').empty();
+ $('#pv_cubierta_shape').empty();
// Get the element for placing the graphical elements
- var divCubierta = document.getElementById('draw-cubierta');
+ 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);
@@ -52,9 +148,9 @@ function previewConfiguracionCubierta(cubiertaObj) {
_previewConfiguracionCubierta.update();
// Update preview info fields
- $('#prevLibro').text(cubiertaObj.anchoLibro + "X" + cubiertaObj.altoLibro);
- $('#prevLomo').text(cubiertaObj.lomo);
- $('#prevSolapas').text(cubiertaObj.solapas);
+ $('#pv_ec_libro').text(cubiertaObj.anchoLibro + "X" + cubiertaObj.altoLibro);
+ $('#pv_ec_lomo').text(cubiertaObj.lomo);
+ $('#pv_ec_solapas').text(cubiertaObj.solapas);
}
@@ -86,9 +182,9 @@ function previewEsquemaCubierta(objEC) {
}
// Clear the canvas element
- $('#draw-portada').empty();
+ $('#pv_ec_shape').empty();
// Get the element for placing the graphical elements
- var divEC = document.getElementById('draw-portada');
+ var divEC = document.getElementById('pv_ec_shape');
var previewEC = new Two({fitted: true}).appendTo(divEC);
// Calculate the center of the canvas element
var origenEC = new Two.Vector(previewEC.width / 2, previewEC.height / 2);
@@ -158,17 +254,17 @@ function previewEsquemaCubierta(objEC) {
// Cotas
var cotaAnchoCubierta = previewEC.makeDobleArrow(
- origenEC.x - (anchoCubierta / 2),
+ origenEC.x - (anchoSangrado / 2),
origenEC.y + (altoLibro / 2) + 35,
- origenEC.x + (anchoCubierta / 2),
+ origenEC.x + (anchoSangrado / 2),
origenEC.y + (altoLibro / 2) + 35,
10);
cotaAnchoCubierta.linewidth = 2;
var cotaAltoLibro = previewEC.makeDobleArrow(
origenEC.x + (anchoCubierta / 2) + 35,
- origenEC.y + (altoLibro / 2),
+ origenEC.y + (altoSangrado / 2),
origenEC.x + (anchoCubierta / 2) + 35,
- origenEC.y - (altoLibro / 2),
+ origenEC.y - (altoSangrado / 2),
10);
cotaAltoLibro.linewidth = 2;
var cotaLomo = previewEC.makeDobleArrow(
@@ -202,23 +298,92 @@ function previewEsquemaCubierta(objEC) {
let a = previewEC.makeText("Lomo", origenEC.x, origenEC.y, stylesEC).rotation = -Math.PI / 2;
// Sangrados
let styleSangrado = {size: 10, family: 'Public Sans', style: 'italic', fill: 'red'};
- previewEC.makeText("Sangrado 3 mm", origenEC.x, origenEC.y + (altoLibro / 2 + 20), styleSangrado);
- previewEC.makeText("Sangrado 3 mm", origenEC.x, origenEC.y - (altoLibro / 2 + 20), styleSangrado);
- previewEC.makeText("Sangrado 3 mm", origenEC.x + (lomoLibro / 2 + anchoLibro + anchoSolapa + 20), origenEC.y, styleSangrado).rotation = -Math.PI / 2;
- previewEC.makeText("Sangrado 3 mm", origenEC.x - (lomoLibro / 2 + anchoLibro + anchoSolapa + 20), origenEC.y, styleSangrado).rotation = -Math.PI / 2;
+ previewEC.makeText(sangradoTexto, origenEC.x, origenEC.y + (altoLibro / 2 + 20), styleSangrado);
+ previewEC.makeText(sangradoTexto, origenEC.x, origenEC.y - (altoLibro / 2 + 20), styleSangrado);
+ previewEC.makeText(sangradoTexto, origenEC.x + (lomoLibro / 2 + anchoLibro + anchoSolapa + 20), origenEC.y, styleSangrado).rotation = -Math.PI / 2;
+ previewEC.makeText(sangradoTexto, origenEC.x - (lomoLibro / 2 + anchoLibro + anchoSolapa + 20), origenEC.y, styleSangrado).rotation = -Math.PI / 2;
// Cotas
previewEC.makeText(objEC.lomoLibro + " mm", origenEC.x, origenEC.y + (altoLibro / 3) + 15, styleCotas);
- previewEC.makeText(objEC.anchoLibro + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
- previewEC.makeText(objEC.anchoLibro + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
- previewEC.makeText(objEC.altoLibro + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro + anchoSolapa) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2;
- previewEC.makeText(objEC.anchoCubierta + " mm", origenEC.x, origenEC.y + (altoLibro / 2) + 50, styleCotas);
+ previewEC.makeText(objEC.anchoLibro + offsetSolapaValor + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
+ previewEC.makeText(objEC.anchoLibro + offsetSolapaValor + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas);
+ previewEC.makeText(objEC.altoLibro + (2 * sangradoValor) + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro + anchoSolapa) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2;
+ previewEC.makeText((2 * objEC.anchoLibro) + (2 * (objEC.anchoSolapa + offsetSolapaValor)) + objEC.lomoLibro + (2 * sangradoValor) + " mm",
+ origenEC.x,
+ origenEC.y + (altoLibro / 2) + 50,
+ styleCotas);
previewEC.update();
+}
+
+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,
+ anchoSolapa: parseFloat($('#solapas_ancho').val()),
+ lomoLibro:parseFloat(_anchoLomo.toFixed(2))
+ };
+
// Update preview info fields
- $('#prevLibro').text(objEC.anchoLibro + "X" + objEC.altoLibro);
- $('#prevLomo').text(objEC.lomoLibro);
- $('#prevSolapas').text(objEC.solapas);
+ $('#pv_ec_pg').attr("href", $('#pv_ec_pg').attr('sk-url') + $('#lp_cubierta_papel').val());
+ $('#pv_ec_pi').attr("href", $('#pv_ec_pi').attr('sk-url') + $('#lp_cubierta_papelImpresion').val());
+ $('#pv_ec_mi').attr("href", $('#pv_ec_mi').attr('sk-url') + $('#lp_cubierta_maquina').val());
+ $('#pv_ec_libro').text(objEC.anchoLibro + "X" + objEC.altoLibro);
+ $('#pv_ec_lomo').text(objEC.lomoLibro);
+ $('#pv_ec_solapas').text(objEC.anchoSolapa);
+ (objEC.anchoSolapa != 0) ? $('.pv-ec-solapas').show() : $('.pv-ec-solapas').hide();
+
+}
+
+
+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(),
+ anchoSolapa: parseFloat($('#solapas_ancho').val()),
+ nFormas: $('#lp_' + lpName + '_formas').val(),
+ //lomoLibro:parseFloat(_anchoLomo.toFixed(2))
+ };
+
+ // 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);
+
+}
+
+
+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();
+ }
+
+ });
}
diff --git a/d b/d
deleted file mode 100644
index 51a59d81..00000000
--- a/d
+++ /dev/null
@@ -1,13 +0,0 @@
- bug/presupuestos3[m
- dev/presupuestos_total[m
-* [32mmain_old[m
- [31mremotes/origin/HEAD[m -> origin/main
- [31mremotes/origin/bug/presupuestos3[m
- [31mremotes/origin/dev/formas-presupuestador[m
- [31mremotes/origin/dev/presupuestos3[m
- [31mremotes/origin/dev/presupuestos_pdf[m
- [31mremotes/origin/dev/presupuestos_total[m
- [31mremotes/origin/dev/previsualizadores[m
- [31mremotes/origin/feat/presupuestos[m
- [31mremotes/origin/main[m
- [31mremotes/origin/presupuestos/tipos_presupuestos[m