Merge branch 'dev/formas-presupuestador' into 'main'

Dev/formas presupuestador

See merge request jjimenez/safekat!78
This commit is contained in:
Ignacio Martinez Navajas
2023-11-28 11:57:46 +00:00
9 changed files with 11170 additions and 10665 deletions

View File

@ -22,8 +22,8 @@ CI_ENVIRONMENT = development
# APP
#--------------------------------------------------------------------
app.baseURL = 'https://sk-jjo.imnavajas.es'
# app.baseURL = 'https://sk-imn.imnavajas.es'
#app.baseURL = 'https://sk-jjo.imnavajas.es'
app.baseURL = 'https://sk-imn.imnavajas.es'
# app.baseURL = "http://safekat.test/"
# app.forceGlobalSecureRequests = false

View File

@ -161,8 +161,12 @@ return [
'comentariosProduccion' => 'Comentarios Produccion',
'preview' => 'Previsualización de configuraciones',
'previewMaquina' => 'Configuración de máquina',
'previewCubierta' => 'Configuración de cubierta',
'previewPortada' => 'Configuración de portada',
'previewConfiguracionCubierta' => 'Configuración de cubierta',
<<<<<<< HEAD
'previewEsquemaCubierta' => 'Configuración de portada',
=======
'previewEsquemaCubierta' => 'Esquema de cubierta',
>>>>>>> 594ce37f88c472a7a063e2e5c85e2c0b3899728c
'resumen' => 'Resumen del presupuesto',
'confirmar' => 'Confirmar presupuesto',

View File

@ -1288,6 +1288,7 @@ function fill_lp_bn(row, fromComparator=false){
calcularPresupuesto_bn(false)
}
else{
//console.log(row);
// Si viene de hacerlo a mano...
$('#lp_bn_tiempo').val(row.tiempo_maquina)
$('#lp_bn_numeroPliegos').val(isNaN(parseFloat(row.pliegos_libro)) ? "" : parseFloat(row.pliegos_libro).toFixed(2))
@ -1301,6 +1302,7 @@ function fill_lp_bn(row, fromComparator=false){
$('#lp_bn_totalClicks').val(isNaN(parseFloat(row.precio_click_pedido)) ? "" : parseFloat(row.precio_click_pedido).toFixed(2))
$('#lp_bn_tarifa_impresion_id').val(isNaN(parseInt(row.tarifa_impresion_id)) ? "" : parseInt(row.tarifa_impresion_id))
}
@ -2899,6 +2901,18 @@ function fill_lp_cubierta(row, fromComparador=false){
}
else{
console.log(row);
var portadaObjeto = {
anchoLibro:row.dimensiones_libro[0],
altoLibro:row.dimensiones_libro[1],
solapas:$('#solapas_ancho').val(),
lomo:row.mano};
//previewEsquemaCubierta(portadaObjeto);
// Si viene de hacerlo a mano...
$('#lp_cubierta_tiempo').val(row.tiempo_maquina)
$('#lp_cubierta_numeroPliegos').val(isNaN(parseFloat(row.pliegos_libro)) ? "" : parseFloat(row.pliegos_libro).toFixed(2))

View File

@ -5,7 +5,7 @@
data-bs-target="#accordionPreviewTip" aria-expanded="false"
aria-controls="accordionPreviewTip">
<h4><?= lang("Presupuestos.preview") ?></h4>
</button>
</button>
</h2>
<div id="accordionPreviewTip" class="accordion-collapse collapse show"
@ -25,7 +25,7 @@
<?= lang("Presupuestos.previewMaquina") ?>
</button>
</li>
<li id="tab-preview-cubierta" class="nav-item">
<li id="tab-preview-configuracion-cubierta" class="nav-item">
<button
type="button"
class="nav-link"
@ -34,19 +34,19 @@
data-bs-target="#preview-cubierta"
aria-controls="preview-cubierta"
aria-selected="false">
<?= lang("Presupuestos.previewCubierta") ?>
<?= lang("Presupuestos.previewConfiguracionCubierta") ?>
</button>
</li>
<li id="tab-preview-portada" class="nav-item">
<li id="tab-preview-esquema-cubierta" class="nav-item">
<button
type="button"
class="nav-link"
role="tab"
data-bs-toggle="tab"
data-bs-target="#preview-portada"
aria-controls="preview-portada"
data-bs-target="#preview-esquema-cubierta"
aria-controls="preview-esquema-cubierta"
aria-selected="false">
<?= lang("Presupuestos.previewPortada") ?>
<?= lang("Presupuestos.previewEsquemaCubierta") ?>
</button>
</li>
@ -204,7 +204,7 @@
</div>
</div>
<div class="tab-pane fade" id="preview-portada" role="tabpanel">
<div class="tab-pane fade" id="preview-esquema-cubierta" role="tabpanel">
<div class="row">
<div class="col-3">
<div class="p-4 mb-3 pb-3" >
@ -282,7 +282,7 @@
<!------------------------------------------------------->
<?= $this->section("additionalInlineJs") ?>
$('#tab-preview-cubierta').on( "click", function() {
$('#tab-preview-configuracion-cubierta').on( "click", function() {
var cubiertaObjeto = {
anchoMaquina: 487,
@ -294,19 +294,23 @@
solapas:45,
lomo:25};
previewCubierta(cubiertaObjeto);
previewConfiguracionCubierta(cubiertaObjeto);
} );
$('#tab-preview-portada').on( "click", function() {
$('#tab-preview-esquema-cubierta').on( "click", function() {
var portadaObjeto = {
var altoLib = 400;
var cubiertaObjeto = {
altoLibro:220,
anchoLibro:170,
altoLibro:240,
solapas:45,
lomo:25};
anchoCubierta:491,
anchoSolapa:70,
lomoLibro:11
};
previewPortada(portadaObjeto);
previewEsquemaCubierta(cubiertaObjeto);
} );

View File

@ -7,7 +7,7 @@ var styles = {
}
function previewCubierta(cubiertaObj) {
function previewConfiguracionCubierta(cubiertaObj) {
// Local parameters
let fullBookWith = ((2 * cubiertaObj.anchoLibro) + (2 * (cubiertaObj.solapas + _offsetSolapas)) + cubiertaObj.lomo);
@ -16,11 +16,11 @@ function previewCubierta(cubiertaObj) {
$('#draw-cubierta').empty();
// Get the element for placing the graphical elements
var divCubierta = document.getElementById('draw-cubierta');
var _previewCubierta = new Two({fitted: true}).appendTo(divCubierta);
var _previewConfiguracionCubierta = new Two({fitted: true}).appendTo(divCubierta);
// Calculate the center of the canvas element
var origenCubierta = new Two.Vector(_previewCubierta.width / 2, _previewCubierta.height / 2);
var origenCubierta = new Two.Vector(_previewConfiguracionCubierta.width / 2, _previewConfiguracionCubierta.height / 2);
var areaMaquinaCubierta = _previewCubierta.makeRectangle(
var areaMaquinaCubierta = _previewConfiguracionCubierta.makeRectangle(
origenCubierta.x,
origenCubierta.y,
cubiertaObj.anchoMaquina,
@ -28,7 +28,7 @@ function previewCubierta(cubiertaObj) {
areaMaquinaCubierta.stroke = 'black';
areaMaquinaCubierta.linewidth = 1;
var areaImpresionCubierta = _previewCubierta.makeRectangle(
var areaImpresionCubierta = _previewConfiguracionCubierta.makeRectangle(
origenCubierta.x,
origenCubierta.y,
cubiertaObj.anchoImpresion,
@ -36,72 +36,189 @@ function previewCubierta(cubiertaObj) {
areaImpresionCubierta.stroke = 'red';
areaImpresionCubierta.linewidth = 1;
var formaCubierta = _previewCubierta.makeRectangle(
var formaCubierta = _previewConfiguracionCubierta.makeRectangle(
origenCubierta.x,
origenCubierta.y,
fullBookWith,
cubiertaObj.altoLibro);
formaCubierta.stroke = '#6997D3';
formaCubierta.fill = '#6997D3';
formaCubierta.stroke = 'grey';
formaCubierta.fill = '#F4F8F2';
formaCubierta.linewidth = 1;
// Texts
_previewCubierta.makeText(cubiertaObj.altoLibro, origenCubierta.x + (fullBookWith/2 -25), origenCubierta.y, styles);
_previewCubierta.makeText(fullBookWith, origenCubierta.x, origenCubierta.y + (cubiertaObj.altoLibro/2-15) , styles);
_previewConfiguracionCubierta.makeText(cubiertaObj.altoLibro, origenCubierta.x + (fullBookWith / 2 - 25), origenCubierta.y, styles);
_previewConfiguracionCubierta.makeText(fullBookWith, origenCubierta.x, origenCubierta.y + (cubiertaObj.altoLibro / 2 - 15), styles);
_previewCubierta.update();
_previewConfiguracionCubierta.update();
// Update preview info fields
$('#prevLibro').text(cubiertaObj.anchoLibro + "X" + cubiertaObj.altoLibro );
$('#prevLibro').text(cubiertaObj.anchoLibro + "X" + cubiertaObj.altoLibro);
$('#prevLomo').text(cubiertaObj.lomo);
$('#prevSolapas').text(cubiertaObj.solapas);
}
function previewPortada(portadaObj) {
function previewEsquemaCubierta(objEC) {
// Variables locales
let altoLibro, anchoLibro, lomoLibro, anchoSolapa, anchoCubierta, altoSangrado, anchoSangrado;
let styleCotas = {size: 12, family: 'Public Sans'};
// Definicion de los parametros del Esquema de Cubierta (EC)
if (objEC.anchoSolapa == 0) {
anchoSangrado = 600; // px
altoSangrado = (anchoSangrado * 0.647 > 350) ? anchoSangrado * 0.647 : 350; // px
altoLibro = altoSangrado * 0.97;
anchoLibro = anchoSangrado * 0.419;
anchoSolapa = 0;
lomoLibro = anchoSangrado * 0.133;
anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + lomoLibro;
} else {
anchoSangrado = 600; // px
altoSangrado = (anchoSangrado * 0.418 > 350) ? anchoSangrado * 0.418 : 350; // px
altoLibro = altoSangrado * 0.95;
anchoLibro = anchoSangrado * 0.28;
anchoSolapa = anchoSangrado * 0.163;
lomoLibro = anchoSangrado * 0.09;
anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + lomoLibro;
}
// Clear the canvas element
$('#draw-portada').empty();
// Get the element for placing the graphical elements
var divPortada = document.getElementById('draw-portada');
var _previewPortada = new Two({fitted: true}).appendTo(divPortada);
var divEC = document.getElementById('draw-portada');
var previewEC = new Two({fitted: true}).appendTo(divEC);
// Calculate the center of the canvas element
var origenPortada = new Two.Vector(_previewPortada.width / 2, _previewPortada.height / 2);
var origenEC = new Two.Vector(previewEC.width / 2, previewEC.height / 2);
var solapas = _previewPortada.makeRectangle(
origenPortada.x,
origenPortada.y,
((2 * portadaObj.anchoLibro) + (2 * (portadaObj.solapas + _offsetSolapas)) + portadaObj.lomo),
portadaObj.altoLibro);
solapas.stroke = '#5FD2B5';
solapas.fill = '#5FD2B5';
solapas.linewidth = 1;
var sangrado = previewEC.makeRectangle(
origenEC.x,
origenEC.y,
anchoSangrado,
altoSangrado
);
sangrado.stroke = 'black';
sangrado.dashes = [5, 5];
sangrado.fill = '#FCEAF1';
sangrado.linewidth = 1;
var libro = _previewPortada.makeRectangle(
origenPortada.x,
origenPortada.y,
((2 * portadaObj.anchoLibro) + portadaObj.lomo),
portadaObj.altoLibro);
libro.stroke = '#6997D3';
libro.fill = '#6997D3';
if (objEC.anchoSolapa != 0) {
var solapas = previewEC.makeRectangle(
origenEC.x,
origenEC.y,
anchoCubierta,
altoLibro);
solapas.stroke = 'black';
solapas.linewidth = 1;
// Cotas Solapas
var cotaSolapa2 = previewEC.makeDobleArrow(
origenEC.x - anchoCubierta / 2,
origenEC.y - (altoLibro / 3),
origenEC.x - anchoLibro - lomoLibro / 2,
origenEC.y - (altoLibro / 3),
10);
cotaSolapa2.linewidth = 2;
var cotaSolapa1 = previewEC.makeDobleArrow(
origenEC.x + anchoCubierta / 2,
origenEC.y - (altoLibro / 3),
origenEC.x + anchoLibro + lomoLibro / 2,
origenEC.y - (altoLibro / 3),
10);
cotaSolapa1.linewidth = 2;
// Textos Solapas
let stylesSolapa = {size: 18, family: 'Public Sans'};
previewEC.makeText("Solapa 1", origenEC.x + anchoLibro + (lomoLibro + anchoSolapa) / 2, origenEC.y, stylesSolapa);
previewEC.makeText("Solapa 2", origenEC.x - anchoLibro - (lomoLibro + anchoSolapa) / 2, origenEC.y, stylesSolapa);
// Textos Cotas Solapas
previewEC.makeText(objEC.anchoSolapa + " mm", origenEC.x - anchoLibro - (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas);
previewEC.makeText(objEC.anchoSolapa + " mm", origenEC.x + anchoLibro + (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas);
}
var libro = previewEC.makeRectangle(
origenEC.x,
origenEC.y,
((2 * anchoLibro) + lomoLibro),
altoLibro);
libro.stroke = 'black';
libro.linewidth = 1;
var lomo = _previewPortada.makeRectangle(
origenPortada.x,
origenPortada.y,
portadaObj.lomo,
portadaObj.altoLibro);
lomo.stroke = '#8171D4';
lomo.fill = '#8171D4';
var lomo = previewEC.makeRectangle(
origenEC.x,
origenEC.y,
lomoLibro,
altoLibro);
lomo.stroke = 'black';
lomo.fill = '#F4F8F2';
lomo.linewidth = 1;
_previewPortada.update();
// Cotas
var cotaAnchoCubierta = previewEC.makeDobleArrow(
origenEC.x - (anchoCubierta / 2),
origenEC.y + (altoLibro / 2) + 35,
origenEC.x + (anchoCubierta / 2),
origenEC.y + (altoLibro / 2) + 35,
10);
cotaAnchoCubierta.linewidth = 2;
var cotaAltoLibro = previewEC.makeDobleArrow(
origenEC.x + (anchoCubierta / 2) + 35,
origenEC.y + (altoLibro / 2),
origenEC.x + (anchoCubierta / 2) + 35,
origenEC.y - (altoLibro / 2),
10);
cotaAltoLibro.linewidth = 2;
var cotaLomo = previewEC.makeDobleArrow(
origenEC.x - (lomoLibro / 2),
origenEC.y + (altoLibro / 3),
origenEC.x + (lomoLibro / 2),
origenEC.y + (altoLibro / 3),
10);
cotaLomo.linewidth = 2;
var cotaContraportada = previewEC.makeDobleArrow(
origenEC.x - (lomoLibro / 2 + anchoLibro),
origenEC.y - (altoLibro / 3),
origenEC.x - (lomoLibro / 2),
origenEC.y - (altoLibro / 3),
10);
cotaContraportada.linewidth = 2;
var cotaPortada = previewEC.makeDobleArrow(
origenEC.x + (lomoLibro / 2),
origenEC.y - (altoLibro / 3),
origenEC.x + (lomoLibro / 2 + anchoLibro),
origenEC.y - (altoLibro / 3),
10);
cotaPortada.linewidth = 2;
// Textos:
// Titulos generales
let stylesEC = {size: 22, weight: 'bold', family: 'Public Sans'};
previewEC.makeText("Portada", origenEC.x + (lomoLibro + anchoLibro) / 2, origenEC.y, stylesEC);
previewEC.makeText("Contraportada", origenEC.x - (lomoLibro + anchoLibro) / 2, origenEC.y, stylesEC);
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;
// 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.update();
// Update preview info fields
$('#prevLibro').text(portadaObj.anchoLibro + "X" + portadaObj.altoLibro );
$('#prevLomo').text(portadaObj.lomo);
$('#prevSolapas').text(portadaObj.solapas);
$('#prevLibro').text(objEC.anchoLibro + "X" + objEC.altoLibro);
$('#prevLomo').text(objEC.lomoLibro);
$('#prevSolapas').text(objEC.solapas);
}

View File

@ -160,6 +160,7 @@ $('#presupuestoForm').on( "submit", function( event ) {
<script src="<?= site_url('themes/vuexy/vendor/libs/autosize/autosize.js') ?>"></script>
<?php if(str_contains($formAction,'edit')): ?>
<script src="<?= site_url('js_loader/comparadorCosidoTapaBlanda_js') ?>"></script>
<script src="<?= site_url('js_loader/previsualizador_js') ?>"></script>
<script src="<?= site_url('themes/vuexy/vendor/libs/two/two.js') ?>"></script>
<?php endif; ?>
<?=$this->endSection() ?>

View File

@ -93,6 +93,6 @@ table.dataTable.table-hover>tbody>tr.selected:hover>* {
div.draw-shapes {
width: 95%;
height: 500px;
height: 550px;
margin: 2.5% auto;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long