diff --git a/.idea/safekat.iml b/.idea/safekat.iml index c956989b..30e3cdd1 100755 --- a/.idea/safekat.iml +++ b/.idea/safekat.iml @@ -1,7 +1,13 @@ - + + + + + + + diff --git a/ci4/app/Config/RBAC/permissionMatrix.php b/ci4/app/Config/RBAC/permissionMatrix.php index 8dc1c381..c1c73039 100644 --- a/ci4/app/Config/RBAC/permissionMatrix.php +++ b/ci4/app/Config/RBAC/permissionMatrix.php @@ -5,34 +5,34 @@ const SK_PERMISSION_MATRIX = [ "clientes.edit", "clientes.delete", "clientes.menu", - "plantillaTarifa.create", - "plantillaTarifa.edit", - "plantillaTarifa.delete", - "plantillaTarifa.menu", + "plantilla-tarifa.create", + "plantilla-tarifa.edit", + "plantilla-tarifa.delete", + "plantilla-tarifa.menu", "presupuesto.create", "presupuesto.edit", "presupuesto.delete", "presupuesto.menu", - "tarifaPreimpresion.create", - "tarifaPreimpresion.edit", - "tarifaPreimpresion.delete", - "tarifaPreimpresion.menu", - "tarifaManipulado.create", - "tarifaManipulado.edit", - "tarifaManipulado.delete", - "tarifaManipulado.menu", - "tarifaAcabado.create", - "tarifaAcabado.edit", - "tarifaAcabado.delete", - "tarifaAcabado.menu", - "tarifaEncuadernacion.create", - "tarifaEncuadernacion.edit", - "tarifaEncuadernacion.delete", - "tarifaEncuadernacion.menu", - "tarifaEnvio.create", - "tarifaEnvio.edit", - "tarifaEnvio.delete", - "tarifaEnvio.menu", + "tarifa-preimpresion.create", + "tarifa-preimpresion.edit", + "tarifa-preimpresion.delete", + "tarifa-preimpresion.menu", + "tarifa-manipulado.create", + "tarifa-manipulado.edit", + "tarifa-manipulado.delete", + "tarifa-manipulado.menu", + "tarifa-acabado.create", + "tarifa-acabado.edit", + "tarifa-acabado.delete", + "tarifa-acabado.menu", + "tarifa-encuadernacion.create", + "tarifa-encuadernacion.edit", + "tarifa-encuadernacion.delete", + "tarifa-encuadernacion.menu", + "tarifa-envio.create", + "tarifa-envio.edit", + "tarifa-envio.delete", + "tarifa-envio.menu", "proveedores.create", "proveedores.edit", "proveedores.delete", @@ -45,8 +45,36 @@ const SK_PERMISSION_MATRIX = [ "actividad.edit", "actividad.delete", "actividad.menu", + "paises.create", + "paises.edit", + "paises.delete", + "paises.menu", + "maquinas.create", + "maquinas.edit", + "maquinas.delete", + "maquinas.menu", + "maquinas-defecto.create", + "maquinas-defecto.edit", + "maquinas-defecto.delete", + "maquinas-defecto.menu", + "papel-generico.create", + "papel-generico.edit", + "papel-generico.delete", + "papel-generico.menu", + "papel-impresion.create", + "papel-impresion.edit", + "papel-impresion.delete", + "papel-impresion.menu", + "usuarios.create", + "usuarios.edit", + "usuarios.delete", + "usuarios.menu", + "roles-permisos.create", + "roles-permisos.edit", + "roles-permisos.delete", + "roles-permisos.menu", ], - "cliente" => [ + "cliente-admin" => [ "clientes.create", "clientes.edit", "clientes.delete", @@ -56,6 +84,52 @@ const SK_PERMISSION_MATRIX = [ "presupuesto.delete", "presupuesto.menu", ], + "cliente-editor" => [ + "clientes.create", + "clientes.edit", + "clientes.delete", + "clientes.menu", + "plantilla-tarifa.create", + "plantilla-tarifa.edit", + "plantilla-tarifa.delete", + "plantilla-tarifa.menu", + "presupuesto.create", + "presupuesto.edit", + "presupuesto.delete", + "presupuesto.menu", + "tarifa-preimpresion.create", + "tarifa-preimpresion.edit", + "tarifa-preimpresion.delete", + "tarifa-preimpresion.menu", + "tarifa-manipulado.create", + "tarifa-manipulado.edit", + "tarifa-manipulado.delete", + "tarifa-manipulado.menu", + "tarifa-acabado.create", + "tarifa-acabado.edit", + "tarifa-acabado.delete", + "tarifa-acabado.menu", + "tarifa-encuadernacion.create", + "tarifa-encuadernacion.edit", + "tarifa-encuadernacion.delete", + "tarifa-encuadernacion.menu", + "tarifa-envio.create", + "tarifa-envio.edit", + "tarifa-envio.delete", + "tarifa-envio.menu", + "proveedores.create", + "proveedores.edit", + "proveedores.delete", + "proveedores.menu", + "ajustes.create", + "ajustes.edit", + "ajustes.delete", + "ajustes.menu", + "actividad.create", + "actividad.edit", + "actividad.delete", + "actividad.menu", + ], "comercial" => [ "token.token", "token.menu", @@ -86,4 +160,50 @@ const SK_PERMISSION_MATRIX = [ "Profile.index", "Profile.menu", ], + "beta" => [ + "clientes.create", + "clientes.edit", + "clientes.delete", + "clientes.menu", + "plantilla-tarifa.create", + "plantilla-tarifa.edit", + "plantilla-tarifa.delete", + "plantilla-tarifa.menu", + "presupuesto.create", + "presupuesto.edit", + "presupuesto.delete", + "presupuesto.menu", + "tarifa-preimpresion.create", + "tarifa-preimpresion.edit", + "tarifa-preimpresion.delete", + "tarifa-preimpresion.menu", + "tarifa-manipulado.create", + "tarifa-manipulado.edit", + "tarifa-manipulado.delete", + "tarifa-manipulado.menu", + "tarifa-acabado.create", + "tarifa-acabado.edit", + "tarifa-acabado.delete", + "tarifa-acabado.menu", + "tarifa-encuadernacion.create", + "tarifa-encuadernacion.edit", + "tarifa-encuadernacion.delete", + "tarifa-encuadernacion.menu", + "tarifa-envio.create", + "tarifa-envio.edit", + "tarifa-envio.delete", + "tarifa-envio.menu", + "proveedores.create", + "proveedores.edit", + "proveedores.delete", + "proveedores.menu", + "ajustes.create", + "ajustes.edit", + "ajustes.delete", + "ajustes.menu", + "actividad.create", + "actividad.edit", + "actividad.delete", + "actividad.menu", + ], ]; diff --git a/ci4/app/Config/RBAC/permissionMatrix.php.old b/ci4/app/Config/RBAC/permissionMatrix.php.old new file mode 100644 index 00000000..204d15f2 --- /dev/null +++ b/ci4/app/Config/RBAC/permissionMatrix.php.old @@ -0,0 +1,28 @@ + [ + "admin.*", + "users.*", + "beta.*" + ], + "admin"=> [ + "admin.access", + "users.create", + "users.edit", + "users.delete", + "beta.access" + ], + "developer"=> [ + "admin.access", + "admin.settings", + "users.create", + "users.edit", + "beta.access" + ], + "user"=> [ + "users.list" + ], + "beta"=> [ + "beta.access" + ] +]; \ No newline at end of file diff --git a/ci4/app/Config/RBAC/permissions.php b/ci4/app/Config/RBAC/permissions.php index 3899e9b1..aa6861aa 100644 --- a/ci4/app/Config/RBAC/permissions.php +++ b/ci4/app/Config/RBAC/permissions.php @@ -5,34 +5,34 @@ const SK_PERMISSIONS = [ 'clientes.edit' => 'Can edit', 'clientes.delete' => 'Can delete', 'clientes.menu' => 'Menu shall be visualize', - 'plantillaTarifa.create' => 'Can create', - 'plantillaTarifa.edit' => 'Can edit', - 'plantillaTarifa.delete' => 'Can delete', - 'plantillaTarifa.menu' => 'Menu shall be visualize', + 'plantilla-tarifa.create' => 'Can create', + 'plantilla-tarifa.edit' => 'Can edit', + 'plantilla-tarifa.delete' => 'Can delete', + 'plantilla-tarifa.menu' => 'Menu shall be visualize', 'presupuesto.create' => 'Can create', 'presupuesto.edit' => 'Can edit', 'presupuesto.delete' => 'Can delete', 'presupuesto.menu' => 'Menu shall be visualize', - 'tarifaPreimpresion.create' => 'Can create', - 'tarifaPreimpresion.edit' => 'Can edit', - 'tarifaPreimpresion.delete' => 'Can delete', - 'tarifaPreimpresion.menu' => 'Menu shall be visualize', - 'tarifaManipulado.create' => 'Can create', - 'tarifaManipulado.edit' => 'Can edit', - 'tarifaManipulado.delete' => 'Can delete', - 'tarifaManipulado.menu' => 'Menu shall be visualize', - 'tarifaAcabado.create' => 'Can create', - 'tarifaAcabado.edit' => 'Can edit', - 'tarifaAcabado.delete' => 'Can delete', - 'tarifaAcabado.menu' => 'Menu shall be visualize', - 'tarifaEncuadernacion.create' => 'Can create', - 'tarifaEncuadernacion.edit' => 'Can edit', - 'tarifaEncuadernacion.delete' => 'Can delete', - 'tarifaEncuadernacion.menu' => 'Menu shall be visualize', - 'tarifaEnvio.create' => 'Can create', - 'tarifaEnvio.edit' => 'Can edit', - 'tarifaEnvio.delete' => 'Can delete', - 'tarifaEnvio.menu' => 'Menu shall be visualize', + 'tarifa-preimpresion.create' => 'Can create', + 'tarifa-preimpresion.edit' => 'Can edit', + 'tarifa-preimpresion.delete' => 'Can delete', + 'tarifa-preimpresion.menu' => 'Menu shall be visualize', + 'tarifa-manipulado.create' => 'Can create', + 'tarifa-manipulado.edit' => 'Can edit', + 'tarifa-manipulado.delete' => 'Can delete', + 'tarifa-manipulado.menu' => 'Menu shall be visualize', + 'tarifa-acabado.create' => 'Can create', + 'tarifa-acabado.edit' => 'Can edit', + 'tarifa-acabado.delete' => 'Can delete', + 'tarifa-acabado.menu' => 'Menu shall be visualize', + 'tarifa-encuadernacion.create' => 'Can create', + 'tarifa-encuadernacion.edit' => 'Can edit', + 'tarifa-encuadernacion.delete' => 'Can delete', + 'tarifa-encuadernacion.menu' => 'Menu shall be visualize', + 'tarifa-envio.create' => 'Can create', + 'tarifa-envio.edit' => 'Can edit', + 'tarifa-envio.delete' => 'Can delete', + 'tarifa-envio.menu' => 'Menu shall be visualize', 'proveedores.create' => 'Can create', 'proveedores.edit' => 'Can edit', 'proveedores.delete' => 'Can delete', @@ -45,4 +45,32 @@ const SK_PERMISSIONS = [ 'actividad.edit' => 'Can edit', 'actividad.delete' => 'Can delete', 'actividad.menu' => 'Menu shall be visualize', + 'paises.create' => 'Can create', + 'paises.edit' => 'Can edit', + 'paises.delete' => 'Can delete', + 'paises.menu' => 'Menu shall be visualize', + 'maquinas.create' => 'Can create', + 'maquinas.edit' => 'Can edit', + 'maquinas.delete' => 'Can delete', + 'maquinas.menu' => 'Menu shall be visualize', + 'maquinas-defecto.create' => 'Can create', + 'maquinas-defecto.edit' => 'Can edit', + 'maquinas-defecto.delete' => 'Can delete', + 'maquinas-defecto.menu' => 'Menu shall be visualize', + 'papel-generico.create' => 'Can create', + 'papel-generico.edit' => 'Can edit', + 'papel-generico.delete' => 'Can delete', + 'papel-generico.menu' => 'Menu shall be visualize', + 'papel-impresion.create' => 'Can create', + 'papel-impresion.edit' => 'Can edit', + 'papel-impresion.delete' => 'Can delete', + 'papel-impresion.menu' => 'Menu shall be visualize', + 'usuarios.create' => 'Can create', + 'usuarios.edit' => 'Can edit', + 'usuarios.delete' => 'Can delete', + 'usuarios.menu' => 'Menu shall be visualize', + 'roles-permisos.create' => 'Can create', + 'roles-permisos.edit' => 'Can edit', + 'roles-permisos.delete' => 'Can delete', + 'roles-permisos.menu' => 'Menu shall be visualize', ]; diff --git a/ci4/app/Config/RBAC/permissions.php.old b/ci4/app/Config/RBAC/permissions.php.old new file mode 100644 index 00000000..7981a017 --- /dev/null +++ b/ci4/app/Config/RBAC/permissions.php.old @@ -0,0 +1,11 @@ + 'Can access the sites admin area', + 'admin.settings' => 'Can access the main site settings', + 'users.manage-admins' => 'Can manage other admins', + 'users.list' => 'Can list user stuff', + 'users.create' => 'Can create new non-admin users', + 'users.edit' => 'Can edit existing non-admin users', + 'users.delete' => 'Can delete existing non-admin users', + 'beta.access' => 'Can access beta-level features', +]; \ No newline at end of file diff --git a/ci4/app/Config/RBAC/roles.json b/ci4/app/Config/RBAC/roles.json new file mode 100644 index 00000000..a95d9582 --- /dev/null +++ b/ci4/app/Config/RBAC/roles.json @@ -0,0 +1,22 @@ +{ + "superadmin": { + "title": "Super Admin", + "description": "Complete control of the site." + }, + "admin": { + "title": "Admin", + "description": "Day to day administrators of the site." + }, + "developer": { + "title": "Developer", + "description": "Site programmers." + }, + "user": { + "title": "User", + "description": "General users of the site. Often customers." + }, + "beta": { + "title": "Beta User", + "description": "Has access to beta-level features." + } +} \ No newline at end of file diff --git a/ci4/app/Config/RBAC/roles.php b/ci4/app/Config/RBAC/roles.php index 4f0dda0c..217aaf1f 100644 --- a/ci4/app/Config/RBAC/roles.php +++ b/ci4/app/Config/RBAC/roles.php @@ -3,12 +3,16 @@ const SK_ROLES = [ 'admin' => [ 'title' => 'Administrador', - 'description' => 'Describeme', - ], - 'cliente' => [ - 'title' => 'Cliente', 'description' => '', ], + 'cliente-admin' => [ + 'title' => 'Cliente administrador', + 'description' => 'Rol de cliente con permisos de administración', + ], + 'cliente-editor' => [ + 'title' => 'Cliente editor', + 'description' => 'Rol de cliente con permisos de edición', + ], 'comercial' => [ 'title' => 'Comercial', 'description' => '', @@ -37,4 +41,8 @@ const SK_ROLES = [ 'title' => 'Editor', 'description' => '', ], + 'beta' => [ + 'title' => 'Beta', + 'description' => '', + ], ]; diff --git a/ci4/app/Config/RBAC/roles.php.old b/ci4/app/Config/RBAC/roles.php.old new file mode 100644 index 00000000..37505ff7 --- /dev/null +++ b/ci4/app/Config/RBAC/roles.php.old @@ -0,0 +1,23 @@ + [ + 'title' => 'Super Admin', + 'description' => 'Complete control of the site.', + ], + 'admin' => [ + 'title' => 'Admin', + 'description' => 'Day to day administrators of the site.', + ], + 'developer' => [ + 'title' => 'Developer', + 'description' => 'Site programmers.', + ], + 'user' => [ + 'title' => 'User', + 'description' => 'General users of the site. Often customers.', + ], + 'beta' => [ + 'title' => 'Beta User', + 'description' => 'Has access to beta-level features.', + ], +]; \ No newline at end of file diff --git a/ci4/app/Controllers/Js_loader.php b/ci4/app/Controllers/Js_loader.php index 8dceddde..7fabccd0 100755 --- a/ci4/app/Controllers/Js_loader.php +++ b/ci4/app/Controllers/Js_loader.php @@ -111,5 +111,11 @@ class Js_loader extends BaseController $this->response->setHeader('Content-Type', 'text/javascript'); return view('themes/vuexy/form/presupuestos/cliente/resumen.js'); } + + function presupuestoClientePreview_js() + { + $this->response->setHeader('Content-Type', 'text/javascript'); + return view('themes/vuexy/form/presupuestos/cliente/previews.js'); + } } \ No newline at end of file diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_resumenItems.php b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_resumenItems.php index ee42ebe7..9b7ef76a 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_resumenItems.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_resumenItems.php @@ -39,7 +39,9 @@

Total: 100€

10.4€/ud
- +
+
+
diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/previews.js b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/previews.js new file mode 100644 index 00000000..0a0d202c --- /dev/null +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/previews.js @@ -0,0 +1,735 @@ +// Global parameters +var pvObj; + +$('#toReview').on( "click", function() { + + console.log('ec draw'); + + portadaTapaDura(); + + //previewEsquemaCubierta('ec', '',''); + +} ); + + +function previewEsquemaCubierta() { + + /*let tipoImpresion; + + if ($("#tipoCosido").is(":checked")) { + tipoImpresion = parseInt() + } + + let tipoImpresion = parseInt($('#tipo_impresion_id').val()); + + // Fresado TD y Cosido TD + if (tipoImpresion === 1 || tipoImpresion === 3) { + portadaTapaDura(); + } + // Fresado TB y Cosido TB + else if (tipoImpresion === 2 || tipoImpresion === 4) { + portadaTapaBlanda(); + } + // Espiral TD y TB, Wire-o TD y TB + else if (tipoImpresion === 5 || tipoImpresion === 6 || + tipoImpresion === 7 || tipoImpresion === 8) { + portadaEspiral(); + } + else if (tipoImpresion === 21) { + portadaGrapado(); + } + else { + // ? + }*/ + +} + +function portadaTapaDura() { + + // Variables locales + let altoLibro, anchoLibro, lomoLibro, anchoCubierta, altoSangrado, anchoSangrado; + let styleCotas = {size: 12, family: 'Public Sans'}; + let sangradoTexto = "Sangrado 20 mm"; + let sangradoValor = parseFloat(20); // mm + let anchoPliegue = parseFloat(7); // mm + let altoPliegue = parseFloat(7); // mm + let anchoCarton = parseFloat(7); // mm + + // Get the preview Object parameters + getObjetoToPreview(); + + // Definicion de los parametros del Esquema de Cubierta (EC) - + anchoSangrado = 400; // px + altoSangrado = (anchoSangrado * 0.647 > 350) ? anchoSangrado * 0.647 : 350; // px + altoLibro = altoSangrado * 0.88; + anchoLibro = anchoSangrado * 0.39; + lomoLibro = anchoSangrado * 0.133; + anchoCubierta = (2 * anchoLibro) + lomoLibro; + + // Clear the canvas element + $('#pv_ec_shape').empty(); + // Get the element for placing the graphical elements + 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); + + 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 = previewEC.makeRectangle( + origenEC.x, + origenEC.y, + ((2 * anchoLibro) + lomoLibro), + altoLibro); + libro.stroke = 'black'; + libro.linewidth = 1; + + var lomo = previewEC.makeRectangle( + origenEC.x, + origenEC.y, + lomoLibro, + altoLibro); + lomo.stroke = 'black'; + lomo.fill = '#F4F8F2'; + lomo.linewidth = 1; + + // Cotas + var cotaAnchoCubierta = previewEC.makeDobleArrow( + origenEC.x - (anchoSangrado / 2), + origenEC.y + (altoLibro / 2) + 35, + origenEC.x + (anchoSangrado / 2), + origenEC.y + (altoLibro / 2) + 35, + 10); + cotaAnchoCubierta.linewidth = 2; + var cotaAltoCubierta = previewEC.makeDobleArrow( + origenEC.x + (anchoCubierta / 2) + 35, + origenEC.y + (altoSangrado / 2), + origenEC.x + (anchoCubierta / 2) + 35, + origenEC.y - (altoSangrado / 2), + 10); + cotaAltoCubierta.linewidth = 2; + var cotaAltoLibro = previewEC.makeDobleArrow( + origenEC.x + (lomoLibro / 2) + 35, + origenEC.y + (altoLibro / 2), + origenEC.x + (lomoLibro / 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); + 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(sangradoTexto, origenEC.x, origenEC.y + (altoLibro / 2 + 13), styleSangrado); + previewEC.makeText(sangradoTexto, origenEC.x, origenEC.y - (altoLibro / 2 + 13), styleSangrado); + previewEC.makeText(sangradoTexto, origenEC.x + (lomoLibro / 2 + anchoLibro + 13), origenEC.y, styleSangrado).rotation = -Math.PI / 2; + previewEC.makeText(sangradoTexto, origenEC.x - (lomoLibro / 2 + anchoLibro + 13), origenEC.y, styleSangrado).rotation = -Math.PI / 2; + // Cotas + previewEC.makeText(pvObj.lomoLibro + anchoCarton + " mm", origenEC.x, origenEC.y + (altoLibro / 3) + 15, styleCotas); + previewEC.makeText(pvObj.anchoLibro + anchoPliegue + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); + previewEC.makeText(pvObj.anchoLibro + anchoPliegue + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); + previewEC.makeText(pvObj.altoLibro + altoPliegue + " mm", origenEC.x + (lomoLibro / 2) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2; + previewEC.makeText(pvObj.altoLibro + (2 * sangradoValor) + altoPliegue + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2; + previewEC.makeText((2 * pvObj.anchoLibro) + pvObj.lomoLibro + (2 * sangradoValor) + +(2 * anchoPliegue) + anchoCarton + " mm", + origenEC.x, + origenEC.y + (altoLibro / 2) + 50, + styleCotas); + + previewEC.update(); + +} + +function portadaTapaBlanda() { + + // Variables locales + let altoLibro, anchoLibro, lomoLibro, anchoSolapa, anchoCubierta, altoSangrado, anchoSangrado; + let styleCotas = {size: 12, family: 'Public Sans'}; + let sangradoTexto = "Sangrado 5 mm"; + let sangradoValor = parseFloat(5); // mm + let offsetSolapaValor = parseFloat(0); // mm + + // Get the preview Object parameters + getObjetoToPreview(); + + // Definicion de los parametros del Esquema de Cubierta (EC) + if (pvObj.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 + $('#pv_ec_shape').empty(); + // Get the element for placing the graphical elements + 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); + + var sangrado = previewEC.makeRectangle( + origenEC.x, + origenEC.y, + anchoSangrado, + altoSangrado + ); + sangrado.stroke = 'black'; + sangrado.dashes = [5, 5]; + sangrado.fill = '#FCEAF1'; + sangrado.linewidth = 1; + + if (pvObj.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(pvObj.anchoSolapa + " mm", origenEC.x - anchoLibro - (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas); + previewEC.makeText(pvObj.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 = previewEC.makeRectangle( + origenEC.x, + origenEC.y, + lomoLibro, + altoLibro); + lomo.stroke = 'black'; + lomo.fill = '#F4F8F2'; + lomo.linewidth = 1; + + // Cotas + var cotaAnchoCubierta = previewEC.makeDobleArrow( + origenEC.x - (anchoSangrado / 2), + origenEC.y + (altoLibro / 2) + 35, + origenEC.x + (anchoSangrado / 2), + origenEC.y + (altoLibro / 2) + 35, + 10); + cotaAnchoCubierta.linewidth = 2; + var cotaAltoCubierta = previewEC.makeDobleArrow( + origenEC.x + (anchoCubierta / 2) + 35, + origenEC.y + (altoSangrado / 2), + origenEC.x + (anchoCubierta / 2) + 35, + origenEC.y - (altoSangrado / 2), + 10); + cotaAltoCubierta.linewidth = 2; + var cotaAltoLibro = previewEC.makeDobleArrow( + origenEC.x + (lomoLibro / 2) + 35, + origenEC.y + (altoLibro / 2), + origenEC.x + (lomoLibro / 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(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(pvObj.lomoLibro + " mm", origenEC.x, origenEC.y + (altoLibro / 3) + 15, styleCotas); + previewEC.makeText(pvObj.anchoLibro + offsetSolapaValor + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); + previewEC.makeText(pvObj.anchoLibro + offsetSolapaValor + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); + previewEC.makeText(pvObj.altoLibro + " mm", origenEC.x + (lomoLibro / 2) + 25, origenEC.y, styleCotas).rotation = -Math.PI / 2; + previewEC.makeText(pvObj.altoLibro + (2 * sangradoValor) + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro + anchoSolapa) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2; + previewEC.makeText((2 * pvObj.anchoLibro) + (2 * (pvObj.anchoSolapa + offsetSolapaValor)) + pvObj.lomoLibro + (2 * sangradoValor) + " mm", + origenEC.x, + origenEC.y + (altoLibro / 2) + 50, + styleCotas); + + previewEC.update(); + +} + +function portadaEspiral() { + + // Variables locales + let altoLibro, anchoLibro, anchoCalle, anchoCubierta, altoSangrado, anchoSangrado, anchoSolapa, offsetCubierta; + let styleCotas = {size: 12, family: 'Public Sans'}; + let sangradoTexto = (isTapaDura) ? "Sangrado 20 mm" : "Sangrado 5 mm"; + let sangradoValor = (isTapaDura) ? parseFloat(20) : parseFloat(5); // mm + + // Get the preview Object parameters + getObjetoToPreview(); + + // Definicion de los parametros del Esquema de Cubierta (EC) + anchoSangrado = 600; // px + + if((pvObj.anchoSolapa !== 0) && (isTapaDura === 0)){ + altoSangrado = (anchoSangrado * 0.418 > 350) ? anchoSangrado * 0.418 : 350; // px + altoLibro = altoSangrado * 0.95; + anchoLibro = anchoSangrado * 0.28; + anchoCalle = anchoSangrado * 0.02; + anchoSolapa = anchoSangrado * 0.163; + sangrado = anchoSangrado * 0.03; + anchoCubierta = 2 * (anchoLibro + anchoSolapa+ sangrado) + anchoCalle; + offsetCubierta = anchoLibro/2 + anchoCalle/2 + anchoSolapa/2 + sangrado; + } + else { + altoSangrado = (anchoSangrado * 0.647 > 350) ? anchoSangrado * 0.647 : 350; // px + altoLibro = (isTapaDura) ? altoSangrado * 0.88 : altoSangrado * 0.97; + anchoLibro = (isTapaDura) ? anchoSangrado * 0.39 : anchoSangrado * 0.419; + anchoCalle = anchoSangrado * 0.02; + anchoSolapa = 0; + anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + anchoCalle; + offsetCubierta = anchoLibro/2 + anchoCalle/2 + anchoSolapa + sangradoValor; + } + + // Clear the canvas element + $('#pv_ec_shape').empty(); + // Get the element for placing the graphical elements + 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); + + var sangrado = previewEC.makeRectangle( + origenEC.x, + origenEC.y, + anchoSangrado, + altoSangrado + ); + sangrado.stroke = 'black'; + sangrado.dashes = [5, 5]; + sangrado.fill = '#FCEAF1'; + sangrado.linewidth = 1; + + if (pvObj.anchoSolapa != 0) { + var solapa1 = previewEC.makeRectangle( + origenEC.x + (anchoLibro + anchoCalle/2 + anchoSolapa/2 + sangradoValor), + origenEC.y, + anchoSolapa, + altoLibro); + solapa1.stroke = 'black'; + solapa1.linewidth = 1; + + var solapa2 = previewEC.makeRectangle( + origenEC.x - (anchoLibro + anchoCalle/2 + anchoSolapa/2 + sangradoValor), + origenEC.y, + anchoSolapa, + altoLibro); + solapa2.stroke = 'black'; + solapa2.linewidth = 1; + + // Cotas Solapas + var cotaSolapa2 = previewEC.makeDobleArrow( + origenEC.x - (anchoCalle/2 + sangradoValor + anchoLibro + anchoSolapa), + origenEC.y - (altoLibro / 3), + origenEC.x - (anchoLibro + sangradoValor + anchoCalle / 2), + origenEC.y - (altoLibro / 3), + 10); + cotaSolapa2.linewidth = 2; + var cotaSolapa1 = previewEC.makeDobleArrow( + origenEC.x + (anchoCalle/2 + sangradoValor + anchoLibro + anchoSolapa), + origenEC.y - (altoLibro / 3), + origenEC.x + (anchoLibro + sangradoValor + anchoCalle / 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 + (anchoCalle + anchoSolapa) / 2, origenEC.y, stylesSolapa); + previewEC.makeText("Solapa 2", origenEC.x - anchoLibro - (anchoCalle + anchoSolapa) / 2, origenEC.y, stylesSolapa); + // Textos Cotas Solapas + previewEC.makeText(pvObj.anchoSolapa + " mm", origenEC.x - anchoLibro - (anchoCalle + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas); + previewEC.makeText(pvObj.anchoSolapa + " mm", origenEC.x + anchoLibro + (anchoCalle + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas); + + } + + var portada = previewEC.makeRectangle( + origenEC.x + (anchoLibro/2 + anchoCalle/2 + sangradoValor), + origenEC.y, + anchoLibro, + altoLibro); + portada.stroke = 'black'; + portada.linewidth = 1; + + var contraportada = previewEC.makeRectangle( + origenEC.x - (anchoLibro/2 + anchoCalle/2 + sangradoValor), + origenEC.y, + anchoLibro, + altoLibro); + contraportada.stroke = 'black'; + contraportada.linewidth = 1; + + var calle = previewEC.makeRectangle( + origenEC.x, + origenEC.y, + anchoCalle, + altoSangrado); + calle.stroke = 'black'; + calle.dashes = [2, 5]; + calle.fill = '#F4F8F2'; + calle.linewidth = 1; + + // Cotas + var cotaAnchoCubierta = previewEC.makeDobleArrow( + origenEC.x - (anchoSangrado / 2), + origenEC.y + (altoLibro / 2) + 35, + origenEC.x + (anchoSangrado / 2), + origenEC.y + (altoLibro / 2) + 35, + 10); + cotaAnchoCubierta.linewidth = 2; + var cotaAltoCubierta = previewEC.makeDobleArrow( + origenEC.x + (anchoSangrado / 2) + 15, + origenEC.y + (altoSangrado / 2), + origenEC.x + (anchoSangrado / 2) + 15, + origenEC.y - (altoSangrado / 2), + 10); + cotaAltoCubierta.linewidth = 2; + var cotaAltoLibro = previewEC.makeDobleArrow( + origenEC.x + (anchoCalle / 2) + 35, + origenEC.y + (altoLibro / 2), + origenEC.x + (anchoCalle / 2) + 35, + origenEC.y - (altoLibro / 2), + 10); + cotaAltoLibro.linewidth = 2; + var cotaContraportada = previewEC.makeDobleArrow( + origenEC.x - (anchoCalle / 2 + anchoLibro + sangradoValor), + origenEC.y - (altoLibro / 3), + origenEC.x - ((anchoCalle / 2) + sangradoValor), + origenEC.y - (altoLibro / 3), + 10); + cotaContraportada.linewidth = 2; + var cotaPortada = previewEC.makeDobleArrow( + origenEC.x + ((anchoCalle / 2) + sangradoValor), + origenEC.y - (altoLibro / 3), + origenEC.x + (anchoCalle / 2 + anchoLibro + sangradoValor), + 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 + anchoLibro/2 + anchoCalle/2 + sangradoValor + 15, + origenEC.y, + stylesEC + ); + previewEC.makeText("Contraportada", + origenEC.x - (anchoLibro/2 + anchoCalle/2 + sangradoValor), + origenEC.y, + stylesEC + ); + // Sangrados + let styleSangrado = {size: 10, family: 'Public Sans', style: 'italic', fill: 'red'}; + previewEC.makeText(sangradoTexto, origenEC.x + offsetCubierta, origenEC.y + (altoLibro / 2 + 13), styleSangrado); + previewEC.makeText(sangradoTexto, origenEC.x + offsetCubierta, origenEC.y - (altoLibro / 2 + 13), styleSangrado); + previewEC.makeText(sangradoTexto, origenEC.x - offsetCubierta, origenEC.y + (altoLibro / 2 + 13), styleSangrado); + previewEC.makeText(sangradoTexto, origenEC.x - offsetCubierta, origenEC.y - (altoLibro / 2 + 13), styleSangrado); + previewEC.makeText(sangradoTexto, origenEC.x + (anchoSangrado / 2) - 20, origenEC.y, styleSangrado).rotation = -Math.PI / 2; + previewEC.makeText(sangradoTexto, origenEC.x - (anchoSangrado / 2) + 20, origenEC.y, styleSangrado).rotation = -Math.PI / 2; + // Cotas + previewEC.makeText(pvObj.anchoLibro + " mm", origenEC.x - (offsetCubierta - anchoSolapa/2), origenEC.y - (altoLibro / 3) + 15, styleCotas); + previewEC.makeText(pvObj.anchoLibro + " mm", origenEC.x + (offsetCubierta - anchoSolapa/2), origenEC.y - (altoLibro / 3) + 15, styleCotas); + previewEC.makeText(pvObj.altoLibro + " mm", origenEC.x + (anchoCalle / 2) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2; + previewEC.makeText(pvObj.altoLibro + (2 * sangradoValor) + " mm", + origenEC.x + (anchoSangrado / 2) + 30, + origenEC.y, + styleCotas + ).rotation = -Math.PI / 2; + previewEC.makeText((2 * pvObj.anchoLibro) + pvObj.lomoLibro + (2 * sangradoValor) + " mm", + origenEC.x, + origenEC.y + (altoLibro / 2) + 50, + styleCotas); + + previewEC.update(); + +} + +function portadaGrapado() { + + // Variables locales + let altoLibro, anchoLibro, lomoLibro, anchoSolapa, anchoCubierta, altoSangrado, anchoSangrado; + let styleCotas = {size: 12, family: 'Public Sans'}; + let sangradoTexto = "Sangrado 5 mm"; + let sangradoValor = parseFloat(5); // mm + let offsetSolapaValor = parseFloat(0); // mm + + // Get the preview Object parameters + getObjetoToPreview(); + + // Definicion de los parametros del Esquema de Cubierta (EC) + if (pvObj.anchoSolapa == 0) { + anchoSangrado = 600; // px + altoSangrado = (anchoSangrado * 0.647 > 350) ? anchoSangrado * 0.647 : 350; // px + altoLibro = altoSangrado * 0.97; + anchoLibro = anchoSangrado * 0.48; + anchoSolapa = 0; + lomoLibro = 0; // ESTA ES LA DIFERENCIA PARA GRAPADO + 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.3; + anchoSolapa = anchoSangrado * 0.18; + lomoLibro = 0; // ESTA ES LA DIFERENCIA PARA GRAPADO + anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + lomoLibro; + } + + // Clear the canvas element + $('#pv_ec_shape').empty(); + // Get the element for placing the graphical elements + 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); + + var sangrado = previewEC.makeRectangle( + origenEC.x, + origenEC.y, + anchoSangrado, + altoSangrado + ); + sangrado.stroke = 'black'; + sangrado.dashes = [5, 5]; + sangrado.fill = '#FCEAF1'; + sangrado.linewidth = 1; + + if (pvObj.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(pvObj.anchoSolapa + " mm", origenEC.x - anchoLibro - (lomoLibro + anchoSolapa) / 2, origenEC.y - (altoLibro / 3) + 15, styleCotas); + previewEC.makeText(pvObj.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 = previewEC.makeRectangle( + origenEC.x, + origenEC.y, + lomoLibro, + altoLibro); + lomo.stroke = 'black'; + lomo.fill = '#F4F8F2'; + lomo.linewidth = 1; + + // Cotas + var cotaAnchoCubierta = previewEC.makeDobleArrow( + origenEC.x - (anchoSangrado / 2), + origenEC.y + (altoLibro / 2) + 35, + origenEC.x + (anchoSangrado / 2), + origenEC.y + (altoLibro / 2) + 35, + 10); + cotaAnchoCubierta.linewidth = 2; + var cotaAltoCubierta = previewEC.makeDobleArrow( + origenEC.x + (anchoCubierta / 2) + 35, + origenEC.y + (altoSangrado / 2), + origenEC.x + (anchoCubierta / 2) + 35, + origenEC.y - (altoSangrado / 2), + 10); + cotaAltoCubierta.linewidth = 2; + var cotaAltoLibro = previewEC.makeDobleArrow( + origenEC.x + (lomoLibro / 2) + 35, + origenEC.y + (altoLibro / 2), + origenEC.x + (lomoLibro / 2) + 35, + origenEC.y - (altoLibro / 2), + 10); + cotaAltoLibro.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); + // Sangrados + let styleSangrado = {size: 10, family: 'Public Sans', style: 'italic', fill: 'red'}; + 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(pvObj.anchoLibro + offsetSolapaValor + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); + previewEC.makeText(pvObj.anchoLibro + offsetSolapaValor + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); + previewEC.makeText(pvObj.altoLibro + " mm", origenEC.x + (lomoLibro / 2) + 25, origenEC.y, styleCotas).rotation = -Math.PI / 2; + previewEC.makeText(pvObj.altoLibro + (2 * sangradoValor) + " mm", origenEC.x + (lomoLibro / 2 + anchoLibro + anchoSolapa) + 50, origenEC.y, styleCotas).rotation = -Math.PI / 2; + previewEC.makeText((2 * pvObj.anchoLibro) + (2 * (pvObj.anchoSolapa + offsetSolapaValor)) + pvObj.lomoLibro + (2 * sangradoValor) + " mm", + origenEC.x, + origenEC.y + (altoLibro / 2) + 50, + styleCotas); + + previewEC.update(); + +} + +function getLomoLibro() { + const anchoLomoInputs = $("#tableLineasPresupuesto tbody tr:visible td input[id*='_lomo']"); + const anchoLomo = Array.from(anchoLomoInputs).reduce((sum, input) => sum + parseFloat($(input).val()), 0); + + return parseFloat(anchoLomo.toFixed(2)); +} + + +function getObjetoToPreview() { + + pvObj = { + lomoLibro: parseFloat('30.0'), + anchoSolapa: $('#solapasCubierta').is(':checked') ? parseFloat($('#anchoSolapasCubierta').val()) : parseFloat(0), + altoLibro: getDimensionLibro().alto, + anchoLibro: getDimensionLibro().ancho + }; + //console.log(pvObj); + +} diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoclienteForm.php b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoclienteForm.php index e8b5ac94..a8a60b89 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoclienteForm.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoclienteForm.php @@ -128,7 +128,7 @@ Anterior - @@ -223,21 +223,23 @@ initDisenioLibro(); endSection() ?> section('additionalExternalJs') ?> - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + endSection() ?> \ No newline at end of file