From 99bdaf7a2491966b1c6a1162e7e7ecfd40e87f4c Mon Sep 17 00:00:00 2001 From: imnavajas Date: Fri, 13 Sep 2024 14:54:55 +0200 Subject: [PATCH 01/11] Arreglado bug del direccionamiento en vista de clientes al listados de clientes en lugar de al perfil --- ci4/app/Views/themes/vuexy/main/menus/clientes_menu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci4/app/Views/themes/vuexy/main/menus/clientes_menu.php b/ci4/app/Views/themes/vuexy/main/menus/clientes_menu.php index 23921293..c3d91509 100644 --- a/ci4/app/Views/themes/vuexy/main/menus/clientes_menu.php +++ b/ci4/app/Views/themes/vuexy/main/menus/clientes_menu.php @@ -14,7 +14,7 @@ if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente Date: Fri, 13 Sep 2024 19:52:36 +0200 Subject: [PATCH 03/11] solucionado el problema de calcular serv defecto en presupuestador admin. Quitada merma para calcular precio servicios en presupuestador admin --- ci4/app/Config/RBAC/permissionMatrix.php | 248 +++++++++++------- ci4/app/Config/RBAC/permissions.php | 8 + ci4/app/Config/RBAC/roles.php | 2 +- .../Presupuestoencuadernaciones.php | 2 +- .../cosidotapablanda/_datosServiciosItems.js | 11 +- 5 files changed, 175 insertions(+), 96 deletions(-) diff --git a/ci4/app/Config/RBAC/permissionMatrix.php b/ci4/app/Config/RBAC/permissionMatrix.php index 7199995c..cb1c244e 100644 --- a/ci4/app/Config/RBAC/permissionMatrix.php +++ b/ci4/app/Config/RBAC/permissionMatrix.php @@ -21,6 +21,164 @@ const SK_PERMISSION_MATRIX = [ "presupuesto-cliente.edit", "presupuesto-cliente.delete", "presupuesto-cliente.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", + "tarifa-extra.create", + "tarifa-extra.edit", + "tarifa-extra.delete", + "tarifa-extra.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", + "paises.create", + "paises.edit", + "paises.delete", + "paises.menu", + "formas-pago.create", + "formas-pago.edit", + "formas-pago.delete", + "formas-pago.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", + "ubicaciones.create", + "ubicaciones.edit", + "ubicaciones.delete", + "ubicaciones.menu", + "series-facturas.create", + "series-facturas.edit", + "series-facturas.delete", + "series-facturas.menu", + ], + "cliente-admin" => [ + "perfil.edit", + "perfil.menu", + "direcciones.create", + "direcciones.edit", + "direcciones.delete", + "direcciones.menu", + "presupuesto-cliente.create", + "presupuesto-cliente.edit", + "presupuesto-cliente.delete", + "presupuesto-cliente.menu", + ], + "cliente-editor" => [ + "perfil.create", + "perfil.edit", + "perfil.delete", + "perfil.menu", + "direcciones.create", + "direcciones.edit", + "direcciones.delete", + "direcciones.menu", + "presupuesto-cliente.create", + "presupuesto-cliente.edit", + "presupuesto-cliente.delete", + "presupuesto-cliente.menu", + ], + "comercial" => [ + "token.token", + "token.menu", + ], + "produccion" => [ + "token.token", + "token.menu", + ], + "maquina" => [ + "token.token", + "token.menu", + ], + "maquetador" => [ + "token.token", + "token.menu", + ], + "director" => [ + "token.token", + "token.menu", + ], + "contabilidad" => [ + "token.token", + "token.menu", + ], + "editor" => [ + "token.token", + "token.menu", + "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", + "perfil.create", + "perfil.edit", + "perfil.delete", + "perfil.menu", + "presupuesto.create", + "presupuesto.edit", + "presupuesto.delete", + "presupuesto.menu", + "presupuesto-cliente.create", + "presupuesto-cliente.edit", + "presupuesto-cliente.delete", + "presupuesto-cliente.menu", + "tarifa-preimpresion.create", + "tarifa-preimpresion.edit", + "tarifa-preimpresion.delete", + "tarifa-preimpresion.menu", "tarifa-manipulado.create", "tarifa-manipulado.edit", "tarifa-manipulado.delete", @@ -90,94 +248,4 @@ const SK_PERMISSION_MATRIX = [ "series-facturas.delete", "series-facturas.menu", ], - "cliente-admin" => [ - "perfil.edit", - "perfil.menu", - "presupuesto-cliente.create", - "presupuesto-cliente.edit", - "presupuesto-cliente.delete", - "presupuesto-cliente.menu", - ], - "cliente-editor" => [ - "presupuesto-cliente.create", - "presupuesto-cliente.edit", - "presupuesto-cliente.delete", - "presupuesto-cliente.menu", - ], - "comercial" => [ - "token.token", - "token.menu", - ], - "produccion" => [ - "token.token", - "token.menu", - ], - "maquina" => [ - "token.token", - "token.menu", - ], - "maquetador" => [ - "token.token", - "token.menu", - ], - "director" => [ - "token.token", - "token.menu", - ], - "contabilidad" => [ - "token.token", - "token.menu", - ], - "editor" => [ - "token.token", - "token.menu", - "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/permissions.php b/ci4/app/Config/RBAC/permissions.php index f1f4f727..adabcaf4 100644 --- a/ci4/app/Config/RBAC/permissions.php +++ b/ci4/app/Config/RBAC/permissions.php @@ -13,6 +13,10 @@ const SK_PERMISSIONS = [ 'perfil.edit' => 'Can edit', 'perfil.delete' => 'Can delete', 'perfil.menu' => 'Menu shall be visualize', + 'direcciones.create' => 'Can create', + 'direcciones.edit' => 'Can edit', + 'direcciones.delete' => 'Can delete', + 'direcciones.menu' => 'Menu shall be visualize', 'presupuesto.create' => 'Can create', 'presupuesto.edit' => 'Can edit', 'presupuesto.delete' => 'Can delete', @@ -61,6 +65,10 @@ const SK_PERMISSIONS = [ 'paises.edit' => 'Can edit', 'paises.delete' => 'Can delete', 'paises.menu' => 'Menu shall be visualize', + 'formas-pago.create' => 'Can create', + 'formas-pago.edit' => 'Can edit', + 'formas-pago.delete' => 'Can delete', + 'formas-pago.menu' => 'Menu shall be visualize', 'maquinas.create' => 'Can create', 'maquinas.edit' => 'Can edit', 'maquinas.delete' => 'Can delete', diff --git a/ci4/app/Config/RBAC/roles.php b/ci4/app/Config/RBAC/roles.php index 217aaf1f..5ce300a9 100644 --- a/ci4/app/Config/RBAC/roles.php +++ b/ci4/app/Config/RBAC/roles.php @@ -3,7 +3,7 @@ const SK_ROLES = [ 'admin' => [ 'title' => 'Administrador', - 'description' => '', + 'description' => 'Administrador del ERP', ], 'cliente-admin' => [ 'title' => 'Cliente administrador', diff --git a/ci4/app/Controllers/Presupuestos/Presupuestoencuadernaciones.php b/ci4/app/Controllers/Presupuestos/Presupuestoencuadernaciones.php index 2a617768..69198d50 100755 --- a/ci4/app/Controllers/Presupuestos/Presupuestoencuadernaciones.php +++ b/ci4/app/Controllers/Presupuestos/Presupuestoencuadernaciones.php @@ -110,7 +110,7 @@ class Presupuestoencuadernaciones extends \App\Controllers\BaseResourceControlle $proveedor_id = $reqData['proveedor_id'] ?? 0; } else{ - $solapas = $reqData['solapas'] ?? -1; + $solapas = $reqData['solapas'] ?? 0; } $paginas = $reqData['paginas'] ?? 0; $tirada = $reqData['tirada'] ?? 0; diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.js b/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.js index 31de5f54..436c2340 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.js +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.js @@ -273,7 +273,7 @@ function init_servicio_acabado(){ function select_acabado_event(){ if(parseInt($('#tirada').val())>0){ - var tirada = parseInt($('#tirada').val()) + parseInt($('#merma').val()) + var tirada = parseInt($('#tirada').val()) } else{ var tirada = 0 @@ -778,7 +778,7 @@ function select_enc_event(){ const dimension = getDimensionLibro(); if(parseInt($('#tirada').val())>0){ - var tirada = parseInt($('#tirada').val()) + parseInt($('#merma').val()) + var tirada = parseInt($('#tirada').val()) } else{ var tirada = 0 @@ -858,7 +858,7 @@ async function get_tarifas_enc(tipo=null, tarifa_id = -1){ const dimension = getDimensionLibro(); if(parseInt($('#tirada').val())>0){ - var tirada = parseInt($('#tirada').val()) + parseInt($('#merma').val()) + var tirada = parseInt($('#tirada').val()) } else{ var tirada = 0 @@ -867,6 +867,9 @@ async function get_tarifas_enc(tipo=null, tarifa_id = -1){ var datos = { tarifa_encuadernacion_id : tarifa_id, tirada: tirada, + paginas: parseInt($('#paginas').val())>0?parseInt($('#paginas').val()):0, + ancho: dimension.ancho, + alto: dimension.alto, POD: parseInt($('#POD').val()) }; datos = Object.assign(datos, window.token_ajax) @@ -923,7 +926,7 @@ async function get_tarifas_enc(tipo=null, tarifa_id = -1){ data: function (params) { if( parseInt( $('#tirada').val() )>0){ - var tirada = parseInt($('#tirada').val()) + parseInt($('#merma').val()) + var tirada = parseInt($('#tirada').val()) } else{ var tirada = 0 From d01fbbfe4b6e6dbb5fa8e354f3c04eb56fa81a58 Mon Sep 17 00:00:00 2001 From: imnavajas Date: Fri, 13 Sep 2024 20:55:25 +0200 Subject: [PATCH 04/11] =?UTF-8?q?A=C3=B1adida=20visualizacion=20de=20menus?= =?UTF-8?q?=20en=20roles=20cliente=20(admin/editor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../themes/vuexy/main/menu_impresion.php | 4 +++ .../main/menus/facturacion_cliente_menu.php | 26 ++++++++++++++ .../vuexy/main/menus/pedidos_cliente_menu.php | 36 +++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 ci4/app/Views/themes/vuexy/main/menus/facturacion_cliente_menu.php create mode 100644 ci4/app/Views/themes/vuexy/main/menus/pedidos_cliente_menu.php diff --git a/ci4/app/Views/themes/vuexy/main/menu_impresion.php b/ci4/app/Views/themes/vuexy/main/menu_impresion.php index b88c19be..36488675 100644 --- a/ci4/app/Views/themes/vuexy/main/menu_impresion.php +++ b/ci4/app/Views/themes/vuexy/main/menu_impresion.php @@ -28,6 +28,8 @@ require "menus/pedidos_menu.php"; + require "menus/pedidos_cliente_menu.php"; + require "menus/produccion_menu.php"; require "menus/importacion_menu.php"; @@ -36,6 +38,8 @@ require "menus/facturacion_menu.php"; + require "menus/facturacion_cliente_menu.php"; + require "menus/logistica_menu.php"; require "menus/tarifas_menu.php"; diff --git a/ci4/app/Views/themes/vuexy/main/menus/facturacion_cliente_menu.php b/ci4/app/Views/themes/vuexy/main/menus/facturacion_cliente_menu.php new file mode 100644 index 00000000..52553898 --- /dev/null +++ b/ci4/app/Views/themes/vuexy/main/menus/facturacion_cliente_menu.php @@ -0,0 +1,26 @@ +user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) { + ?> + + + \ No newline at end of file diff --git a/ci4/app/Views/themes/vuexy/main/menus/pedidos_cliente_menu.php b/ci4/app/Views/themes/vuexy/main/menus/pedidos_cliente_menu.php new file mode 100644 index 00000000..2f6f41fc --- /dev/null +++ b/ci4/app/Views/themes/vuexy/main/menus/pedidos_cliente_menu.php @@ -0,0 +1,36 @@ +user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) { + ?> + + + \ No newline at end of file From 2239d399199664cde25e8bd5b0f58a5b5dbde94b Mon Sep 17 00:00:00 2001 From: imnavajas Date: Fri, 13 Sep 2024 21:09:08 +0200 Subject: [PATCH 05/11] Quitado menu vistas de impresion, maquetacion etc a clientes, solo ADMIN --- .../Views/themes/vuexy/main/defaultlayout.php | 74 +++++++++-------- .../themes/vuexy/main/presupuestos_layout.php | 83 +++++++++---------- 2 files changed, 80 insertions(+), 77 deletions(-) diff --git a/ci4/app/Views/themes/vuexy/main/defaultlayout.php b/ci4/app/Views/themes/vuexy/main/defaultlayout.php index 4d03e697..0fe50fab 100644 --- a/ci4/app/Views/themes/vuexy/main/defaultlayout.php +++ b/ci4/app/Views/themes/vuexy/main/defaultlayout.php @@ -138,56 +138,62 @@ $picture = "/assets/img/default-user.png"; - + + diff --git a/ci4/app/Views/themes/vuexy/main/presupuestos_layout.php b/ci4/app/Views/themes/vuexy/main/presupuestos_layout.php index aa7d3c7a..b192db68 100644 --- a/ci4/app/Views/themes/vuexy/main/presupuestos_layout.php +++ b/ci4/app/Views/themes/vuexy/main/presupuestos_layout.php @@ -1,16 +1,7 @@ get('token') ?? ''; -$tfa = $session->get('tfa') ?? false; $settings = $session->get('settings'); - $picture = "/assets/img/default-user.png"; -$pulse = session()->get('pulse'); -$notification = session()->get('notification'); - -if (!empty($token) && $tfa == false) { - //echo ""; -} ?> @@ -154,56 +145,62 @@ if (!empty($token) && $tfa == false) { - + + From 19e81a6c25e864b45e0a768ce80d469b0abf1024 Mon Sep 17 00:00:00 2001 From: imnavajas Date: Sat, 14 Sep 2024 09:26:46 +0200 Subject: [PATCH 06/11] =?UTF-8?q?A=C3=B1adido=20boton=20imprimir=20en=20pr?= =?UTF-8?q?esupuesto=20cliente,=20tanto=20en=20presupuestos=20confirmados?= =?UTF-8?q?=20como=20no?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cliente/viewPresupuestoclienteForm.php | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) 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 e00f7d09..9f60c8f8 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoclienteForm.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoclienteForm.php @@ -174,7 +174,19 @@ Duplicar - + id), + lang("Basic.global.Print"), + [ + "class" => "btn btn-dark float-start me-sm-3 ml-2", + "target" => "_blank" + ] + ); + } + ?> @@ -218,6 +230,17 @@ Duplicar + id), + lang("Basic.global.Print"), + [ + "class" => "btn btn-dark float-start me-sm-3 ml-2", + "target" => "_blank" + ] + ); + ?> From f8497e4388bd34bea05cfc6cf2d4b1630398bc29 Mon Sep 17 00:00:00 2001 From: imnavajas Date: Sat, 14 Sep 2024 21:57:33 +0200 Subject: [PATCH 07/11] Modificado calculo del ancho de esquema de cubierta en admin y cliente para tener en cuenta los 3mm de offset de solapas --- .../form/presupuestos/cliente/previews.js | 32 +++++++++++-------- .../presupuestos/cosidotapablanda/previews.js | 30 ++++++++--------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/previews.js b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/previews.js index 8bbc1a8b..ca350aa3 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/previews.js +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/previews.js @@ -13,7 +13,7 @@ $(document).on('shown.bs.modal', function (e) { function previewEsquemaCubierta(isThumbnail = false) { if($('#cosidoDiv').length){ - + if ($('#cosidoDiv').hasClass('checked') || $("#fresadoDiv").hasClass('checked')) { //console.log("Cosido/Fresado"); if ($("#tapaBlanda").is(":checked")) { @@ -241,6 +241,7 @@ function portadaTapaBlanda(isThumbnail = false) { anchoSolapa = anchoSangrado * 0.163; lomoLibro = anchoSangrado * 0.09; anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + lomoLibro; + offsetSolapaValor = parseFloat('3.0'); // mm } // Clear the canvas element @@ -377,11 +378,11 @@ function portadaTapaBlanda(isThumbnail = false) { 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.anchoLibro + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); + previewEC.makeText(pvObj.anchoLibro + " 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", + previewEC.makeText((2 * pvObj.anchoLibro) + (2 * (pvObj.anchoSolapa + pvObj.offsetSolapa)) + pvObj.lomoLibro + (2 * sangradoValor) + " mm", origenEC.x, origenEC.y + (altoLibro / 2) + 50, styleCotas); @@ -614,8 +615,8 @@ function portadaGrapado(isThumbnail = false) { 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 + let sangradoValor = parseFloat('5.0'); // mm + let offsetSolapaValor = parseFloat('0.0'); // mm let divIdName = (isThumbnail) ? 'thumbnail_ec_shape' : 'pv_ec_shape'; @@ -650,6 +651,7 @@ function portadaGrapado(isThumbnail = false) { anchoSolapa = anchoSangrado * 0.18; lomoLibro = 0; // ESTA ES LA DIFERENCIA PARA GRAPADO anchoCubierta = (2 * anchoLibro) + (2 * anchoSolapa) + lomoLibro; + offsetSolapaValor = parseFloat('3.0'); // mm } // Clear the canvas element @@ -777,11 +779,11 @@ function portadaGrapado(isThumbnail = false) { 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.anchoLibro + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); + previewEC.makeText(pvObj.anchoLibro + " 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", + previewEC.makeText((2 * pvObj.anchoLibro) + (2 * (pvObj.anchoSolapa + pvObj.offsetSolapa)) + pvObj.lomoLibro + (2 * sangradoValor) + " mm", origenEC.x, origenEC.y + (altoLibro / 2) + 50, styleCotas); @@ -796,19 +798,21 @@ function getObjetoToPreview() { if($('#cosidoDiv').length){ pvObj = { - lomoLibro: $('#lomo_cubierta').val() === '' ? parseFloat('0.0') : parseFloat($('#lomo_cubierta').val()), - anchoSolapa: $('#solapasCubierta').is(':checked') ? parseFloat($('#anchoSolapasCubierta').val()) : parseFloat(0), + lomoLibro: $('#lomo_cubierta').val() === '' ? parseFloat('0.0') : parseFloat(parseFloat($('#lomo_cubierta').val()).toFixed(2)), + anchoSolapa: $('#solapasCubierta').is(':checked') ? parseFloat($('#anchoSolapasCubierta').val()) : parseFloat('0.0'), altoLibro: getDimensionLibro().alto, - anchoLibro: getDimensionLibro().ancho + anchoLibro: getDimensionLibro().ancho, + offsetSolapa: $('#solapasCubierta').is(':checked') ? parseFloat('3.0') : parseFloat('0.0') }; } else { let tamanio = $('#resumenTamanio').text().split(' ')[1].split('x'); let solapas = parseInt($('#resumenSolapasCubierta').length ? $('#resumenSolapasCubierta').text().split(' ')[1].replace("mm", '') : 0); pvObj = { - lomoLibro: $('#lomo_cubierta').val() === '' ? parseFloat('0.0') : parseFloat($('#lomo_cubierta').val()), + lomoLibro: $('#lomo_cubierta').val() === '' ? parseFloat('0.0') : parseFloat(parseFloat($('#lomo_cubierta').val()).toFixed(2)), anchoSolapa: solapas, altoLibro: parseInt(tamanio[1]), - anchoLibro: parseInt(tamanio[0]) + anchoLibro: parseInt(tamanio[0]), + offsetSolapa: (solapas != 0) ? parseFloat('3.0') : parseFloat('0.0') }; } //console.log($('#lomo_cubierta').val()); diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/previews.js b/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/previews.js index 949079d0..b083774c 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/previews.js +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/previews.js @@ -343,7 +343,6 @@ function portadaTapaBlanda(lpTagName, isCosido, isTapaDura) { 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 getObjetoLP(lpTagName, isCosido, isTapaDura); @@ -498,11 +497,11 @@ function portadaTapaBlanda(lpTagName, isCosido, isTapaDura) { 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.anchoLibro + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); + previewEC.makeText(pvObj.anchoLibro + " 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", + previewEC.makeText((2 * pvObj.anchoLibro) + (2 * (pvObj.anchoSolapa + pvObj.offsetSolapa)) + pvObj.lomoLibro + (2 * sangradoValor) + " mm", origenEC.x, origenEC.y + (altoLibro / 2) + 50, styleCotas); @@ -717,7 +716,6 @@ function portadaGrapado(lpTagName, isCosido, isTapaDura) { 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 getObjetoLP(lpTagName, isCosido, isTapaDura); @@ -863,11 +861,11 @@ function portadaGrapado(lpTagName, isCosido, isTapaDura) { 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.anchoLibro + " mm", origenEC.x - (lomoLibro / 2 + anchoLibro / 2), origenEC.y - (altoLibro / 3) + 15, styleCotas); + previewEC.makeText(pvObj.anchoLibro + " 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", + previewEC.makeText((2 * pvObj.anchoLibro) + (2 * (pvObj.anchoSolapa + pvObj.offsetSolapa)) + pvObj.lomoLibro + (2 * sangradoValor) + " mm", origenEC.x, origenEC.y + (altoLibro / 2) + 50, styleCotas); @@ -935,7 +933,8 @@ function getObjetoLP(lpName, _isCosido, _isTapaDura) { altoImpresion: parseFloat(rowData.maquina_impresion_alto), anchoImpresion: parseFloat(rowData.maquina_impresion_ancho), altoLibro: getDimensionLibro().alto, - anchoLibro: getDimensionLibro().ancho + anchoLibro: getDimensionLibro().ancho, + offsetSolapa: 0 }; //console.log(pvObj); @@ -962,11 +961,8 @@ function getObjetoLP(lpName, _isCosido, _isTapaDura) { if (pvObj.anchoSolapa != 0) { $('.pv-solapas').show(); - offsetSolapaValor = parseFloat(3); // 3mm + pvObj.offsetSolapa = parseFloat(3); // 3mm - } else { - $('.pv-solapas').hide(); - offsetSolapaValor = parseFloat(0); // No offset } // Custom overwrites @@ -983,13 +979,13 @@ function getObjetoLP(lpName, _isCosido, _isTapaDura) { // Fresado TB y Cosido TB else if (pvObj.tipoImpresion === 2 || pvObj.tipoImpresion === 4) { let sangre = parseFloat(5); // mm - pvObj.anchoForma = ((2 * pvObj.anchoLibro) + (2 * (pvObj.anchoSolapa + offsetSolapaValor)) + (2 * sangre) + pvObj.lomoLibro); + pvObj.anchoForma = ((2 * pvObj.anchoLibro) + (2 * (pvObj.anchoSolapa + pvObj.offsetSolapa)) + (2 * sangre) + pvObj.lomoLibro); pvObj.altoForma += (2 * sangre); } // Grapado else if (pvObj.tipoImpresion === 21) { let sangre = parseFloat(5); // mm - pvObj.anchoForma = ((2 * pvObj.anchoLibro) + (2 * (pvObj.anchoSolapa + offsetSolapaValor)) + (2 * sangre)); + pvObj.anchoForma = ((2 * pvObj.anchoLibro) + (2 * (pvObj.anchoSolapa + pvObj.offsetSolapa)) + (2 * sangre)); pvObj.altoForma += (2 * sangre); } // Espiral TD y TB, Wire-o TD y TB @@ -1011,10 +1007,10 @@ function getObjetoLP(lpName, _isCosido, _isTapaDura) { if (_isTapaDura) { let anchoPliegue = parseFloat(7); // mm let altoPliegue = parseFloat(7); // mm - pvObj.anchoForma = ((2 * pvObj.anchoLibro) + (2 * anchoPliegue) + (2 * (anchoSolapaSobrecubierta + offsetSolapaValor)) + (2 * sangre) + pvObj.lomoLibro); + pvObj.anchoForma = ((2 * pvObj.anchoLibro) + (2 * anchoPliegue) + (2 * (anchoSolapaSobrecubierta + pvObj.offsetSolapa)) + (2 * sangre) + pvObj.lomoLibro); pvObj.altoForma += altoPliegue + (2 * sangre); } else { - pvObj.anchoForma = ((2 * pvObj.anchoLibro) + (2 * (anchoSolapaSobrecubierta + offsetSolapaValor)) + (2 * sangre) + pvObj.lomoLibro); + pvObj.anchoForma = ((2 * pvObj.anchoLibro) + (2 * (anchoSolapaSobrecubierta + pvObj.offsetSolapa)) + (2 * sangre) + pvObj.lomoLibro); pvObj.altoForma += (2 * sangre); } From 07cd952532fee52c440c7c7a70648ad0a52c19c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Mon, 16 Sep 2024 10:57:38 +0200 Subject: [PATCH 08/11] =?UTF-8?q?a=C3=B1adida=20la=20vista=20para=20modifi?= =?UTF-8?q?car=20las=20direcciones=20de=20cliente?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ci4/app/Config/Routes.php | 26 +- .../Clientes/Clientedirecciones.php | 87 +++++ ci4/app/Language/en/Clientes.php | 3 + ci4/app/Language/es/Clientes.php | 3 + .../clientes/cliente/_clienteFormItems.php | 2 +- .../viewClienteDireccionesList.php | 299 ++++++++++++++++++ .../themes/vuexy/main/menus/clientes_menu.php | 2 +- 7 files changed, 399 insertions(+), 23 deletions(-) create mode 100644 ci4/app/Views/themes/vuexy/form/clientes/direcciones/viewClienteDireccionesList.php diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index a44885c5..185309ad 100644 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -365,30 +365,9 @@ $routes->group('clientes', ['namespace' => 'App\Controllers\Clientes'], function $routes->post('menuitems', 'Cliente::menuItems', ['as' => 'menuItemsOfClientes']); }); - /* Precios */ - /*$routes->group('precios', ['namespace' => 'App\Controllers\Clientes'], function ($routes) { - $routes->post('datatable', 'ClientePrecios::datatable', ['as' => 'clientePreciosDT']); - $routes->post('datatable_editor', 'ClientePrecios::datatable_editor', ['as' => 'clientePreciosDTE']); - });*/ - - }); -/*$routes->group('cliente', ['namespace' => 'App\Controllers\Clientes'], function ($routes) { - $routes->get('', 'Cliente::index', ['as' => 'clienteList']); - $routes->get('add', 'Cliente::add', ['as' => 'newCliente']); - $routes->post('add', 'Cliente::add', ['as' => 'createCliente']); - $routes->post('create', 'Cliente::create', ['as' => 'ajaxCreateCliente']); - $routes->put('(:num)/update', 'Cliente::update/$1', ['as' => 'ajaxUpdateCliente']); - $routes->post('edit/(:num)', 'Cliente::edit/$1', ['as' => 'updateCliente']); - $routes->get('delete/(:num)', 'Cliente::delete/$1', ['as' => 'deleteCliente']); - $routes->post('datatable', 'Cliente::datatable', ['as' => 'dataTableOfClientes']); - $routes->post('allmenuitems', 'Cliente::allItemsSelect', ['as' => 'select2ItemsOfClientes']); - -}); -$routes->resource('cliente', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'Cliente', 'except' => 'show,new,create,update']);*/ - $routes->group('clienteprecios', ['namespace' => 'App\Controllers\Clientes'], function ($routes) { $routes->post('datatable', 'ClientePrecios::datatable', ['as' => 'dataTableOfClienteprecios']); $routes->post('datatable_editor', 'ClientePrecios::datatable_editor', ['as' => 'editorOfClienteprecios']); @@ -419,6 +398,11 @@ $routes->group('clienteusuarios', ['namespace' => 'App\Controllers\Clientes'], f }); +$routes->group('misdirecciones', ['namespace' => 'App\Controllers\Clientes'], function ($routes) { + $routes->get('', 'Clientedirecciones::index', ['as' => 'clientedireccionesIndex']); +}); + + $routes->group('formas-pagos', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) { $routes->get('', 'Formaspagos::index', ['as' => 'formaDePagoList']); $routes->get('add', 'Formaspagos::add', ['as' => 'newFormaDePago']); diff --git a/ci4/app/Controllers/Clientes/Clientedirecciones.php b/ci4/app/Controllers/Clientes/Clientedirecciones.php index 18385cf2..d37d665f 100755 --- a/ci4/app/Controllers/Clientes/Clientedirecciones.php +++ b/ci4/app/Controllers/Clientes/Clientedirecciones.php @@ -6,6 +6,8 @@ use App\Entities\Clientes\ClienteDireccionesEntity; use App\Models\Clientes\ClienteDireccionesModel; +use App\Models\Usuarios\UserModel; + use DataTables\Editor; use DataTables\Editor\Field; use DataTables\Editor\Validate; @@ -22,6 +24,53 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController protected static $controllerSlug = 'clientedirecciones'; + protected static $viewPath = 'themes/vuexy/form/clientes/direcciones/'; + + protected $indexRoute = 'clienteDireccionesList'; + + public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) + { + $this->viewData['pageTitle'] = lang('Clientes.direccionesEnvio'); + $this->viewData['usingSweetAlert'] = true; + + $this->viewData = ['usingServerSideDataTable' => true]; // JJO + + // Breadcrumbs (IMN) + $this->viewData['breadcrumb'] = [ + ['title' => lang("Clientes.direccionesEnvio"), 'route' => "javascript:void(0);", 'active' => false], + + ]; + + $this->viewData['comunidadAutonomaList'] = $this->getComunidadAutonomaListItems($clienteEntity->comunidad_autonoma_id ?? null); + $this->viewData['provinciaList'] = $this->getProvinciaListItems($clienteEntity->provincia_id ?? null); + $this->viewData['paisList'] = $this->getPaisListItems($clienteEntity->pais_id ?? null); + + parent::initController($request, $response, $logger); + } + + + public function index() + { + + $id = auth()->user()->id; + $user_model = new UserModel(); + $user = $user_model->find($id); + $cliente_id = $user->cliente_id; + + $viewData = [ + 'currentModule' => static::$controllerSlug, + 'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Clientes.cliente')]), + 'cliente_id' => $cliente_id, + "user_id" => $id, + 'usingServerSideDataTable' => true, + + ]; + + $viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class + + return view(static::$viewPath . 'viewClienteDireccionesList', $viewData); + } + public function add(){ if ($this->request->isAJAX()) { @@ -226,4 +275,42 @@ class Clientedirecciones extends \App\Controllers\BaseResourceController return $this->failUnauthorized('Invalid request', 403); } } + + + protected function getPaisListItems($selId = null) + { + $paisModel = model('App\Models\Configuracion\PaisModel'); + $onlyActiveOnes = true; + $data = $paisModel->getAllForMenu('id, nombre', 'nombre', $onlyActiveOnes); + + return $data; + } + + protected function getComunidadAutonomaListItems($selId = null) + { + $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('ComunidadesAutonomas.comunidadAutonoma'))])]; + if (!is_null($selId)) : + $comunidadAutonomaModel = model('App\Models\Configuracion\ComunidadAutonomaModel'); + + $selOption = $comunidadAutonomaModel->where('id', $selId)->findColumn('nombre'); + if (!empty($selOption)) : + $data[$selId] = $selOption[0]; + endif; + endif; + return $data; + } + + protected function getProvinciaListItems($selId = null) + { + $data = ['' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Provincias.provincia'))])]; + if (!empty($selId)) : + $provinciaModel = model('App\Models\Configuracion\ProvinciaModel'); + + $selOption = $provinciaModel->where('id', $selId)->findColumn('nombre'); + if (!empty($selOption)) : + $data[$selId] = $selOption[0]; + endif; + endif; + return $data; + } } diff --git a/ci4/app/Language/en/Clientes.php b/ci4/app/Language/en/Clientes.php index c35ecd3e..de0cce45 100755 --- a/ci4/app/Language/en/Clientes.php +++ b/ci4/app/Language/en/Clientes.php @@ -54,6 +54,9 @@ return [ 'userCreatedId' => 'User Created ID', 'userUpdateId' => 'User Update ID', 'vencimiento' => 'Vencimiento', + + 'direccionesEnvio' => 'Shipping Addresses', + 'validation' => [ 'ccc' => [ 'max_length' => 'The {field} field cannot exceed {param} characters in length.', diff --git a/ci4/app/Language/es/Clientes.php b/ci4/app/Language/es/Clientes.php index ea299358..3e505bbb 100755 --- a/ci4/app/Language/es/Clientes.php +++ b/ci4/app/Language/es/Clientes.php @@ -46,6 +46,9 @@ return [ 'userCreatedId' => 'User Created ID', 'userUpdateId' => 'User Update ID', 'vencimiento' => 'Vencimiento', + + 'direccionesEnvio' => 'Direcciones de Envío', + 'validation' => [ 'ccc' => [ 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', diff --git a/ci4/app/Views/themes/vuexy/form/clientes/cliente/_clienteFormItems.php b/ci4/app/Views/themes/vuexy/form/clientes/cliente/_clienteFormItems.php index 03ddbcd9..cc7dddde 100644 --- a/ci4/app/Views/themes/vuexy/form/clientes/cliente/_clienteFormItems.php +++ b/ci4/app/Views/themes/vuexy/form/clientes/cliente/_clienteFormItems.php @@ -1421,7 +1421,7 @@ $('#tableOfDireccionesEnvio').on( 'click', 'tbody span.edit-add', function (e) { $('#add_municipio').val(data.municipio) $('#add_provincia').val(data.provincia) $('#add_cp').val(data.cp) - $('#add_telefono').val(data.cp) + $('#add_telefono').val(data.telefono) var $newAddDialog = $("#addressForm") $newAddDialog.modal('show') diff --git a/ci4/app/Views/themes/vuexy/form/clientes/direcciones/viewClienteDireccionesList.php b/ci4/app/Views/themes/vuexy/form/clientes/direcciones/viewClienteDireccionesList.php new file mode 100644 index 00000000..cc8798e8 --- /dev/null +++ b/ci4/app/Views/themes/vuexy/form/clientes/direcciones/viewClienteDireccionesList.php @@ -0,0 +1,299 @@ +include('themes/_commonPartialsBs/select2bs5') ?> +include('themes/_commonPartialsBs/datatables') ?> +include('themes/_commonPartialsBs/_confirm2delete') ?> +extend('themes/vuexy/main/defaultlayout') ?> + +section('content'); ?> +
+
+
+
+

+
+
+ + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+
+ +endSection() ?> + + + +section("additionalInlineJs") ?> +/**************************************** + Direcciones cliente +*****************************************/ +const actionBtns_add = function(data) { + return ` + + + + `; +}; + + +function saveAdd_callback(){ + if($('#addressForm').attr('action')=='create'){ + editorAddress + .create( false ) + .set( 'cliente_id', ) + .set( 'alias', $('#add_alias').val() ) + .set( 'att', $('#add_att').val() ) + .set( 'email', $('#add_email').val() ) + .set( 'direccion', $('#add_direccion').val() ) + .set( 'pais_id', $("#add_pais_id option:selected").val()) + .set( 'municipio', $('#add_municipio').val() ) + .set( 'provincia', $('#add_provincia').val() ) + .set( 'cp', $('#add_cp').val() ) + .set( 'telefono', $('#add_telefono').val() ) + .submit(); + } + else{ // edit + editorAddress + .edit( '#tableOfDireccionesEnvio tbody tr:eq('+$("#addressForm").attr('row-index')+ ')', false ) + .set( 'cliente_id', ) + .set( 'alias', $('#add_alias').val() ) + .set( 'att', $('#add_att').val() ) + .set( 'email', $('#add_email').val() ) + .set( 'direccion', $('#add_direccion').val() ) + .set( 'pais_id', $("#add_pais_id option:selected").val()) + .set( 'municipio', $('#add_municipio').val() ) + .set( 'provincia', $('#add_provincia').val() ) + .set( 'cp', $('#add_cp').val() ) + .set( 'telefono', $('#add_telefono').val() ) + .submit(); + + } +} + + +const editorAddress = new DataTable.Editor({ + ajax: { + url: "", + headers: { + : v, + }, + }, + table : "#tableOfDireccionesEnvio", + idSrc: 'id', + fields: [ { + name: "alias" + }, { + name: "att" + }, { + name: "email" + }, { + name: "direccion" + }, { + name: "municipio" + }, { + name: "provincia" + }, { + name: "pais_id" + }, { + name: "cp" + }, { + name: "telefono" + }, { + "name": "cliente_id", + "type": "hidden" + }, + ], + template: '#direccionesForm' +}); + +editorAddress.on( 'postSubmit', function ( e, json, data, action ) { + + yeniden(json.); + + $( ".error-text-form" ).remove(); + if('fieldErrors' in json){ + if(json.fieldErrors.length > 0){ + json.fieldErrors.forEach((error) => { + $('#add_' + error.name).after( + "

" + error.status + '

') + }) + } + } + else{ + $('#addressForm').modal("hide"); + } + +}) + +editorAddress.on( 'submitSuccess', function ( e, json, data, action ) { + + tableDirecciones.clearPipeline(); + tableDirecciones.draw(); +}); + +editorAddress.on( 'close', function ( e, json, data, action ) { + $('#tableOfDireccionesEnvio').DataTable().ajax.reload(); +}) + +const lastColNr2 = $('#tableOfDireccionesEnvio').find("tr:first th").length - 1; + +var tableDirecciones = $('#tableOfDireccionesEnvio').DataTable( { + draw:2, + serverSide: true, + processing: true, + autoWidth: true, + responsive: true, + order: [0, "asc" ], + pageLength: 10, + lengthChange: false, + searching: false, + paging: true, + info: false, + dom: '<"mt-4"><"float-end"B><"float-start"l><"mt-4 mb-3"p>', + ajax : $.fn.dataTable.pipeline( { + url: '', + data: function ( d ) { + d.cliente_id = ; + }, + method: 'POST', + headers: {'X-Requested-With': 'XMLHttpRequest'}, + async: true, + }), + columns: [ + { 'data': 'alias' }, + { 'data': 'att' }, + { 'data': 'email' }, + { 'data': 'direccion' }, + { 'data': 'cp' }, + { 'data': 'municipio' }, + { 'data': 'provincia' }, + { 'data': 'pais_id' , + "render": function (data, type, row, meta) { + return row.pais; + }}, + { 'data': 'telefono' }, + { + data: actionBtns_add, + className: 'row-edit dt-center' + } + ], + columnDefs: [ + { + orderable: false, + searchable: false, + targets: [lastColNr2] + }, + {"orderData": [ 0], "targets": 0 }, + + ], + language: { + url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json" + }, + buttons: [ { + className: 'btn btn-primary float-end me-sm-3 me-1', + text: "", + action: function ( e, dt, node, config ) { + $("#addressForm").attr('action','create') + var $newAddDialog = $("#addressForm") + $newAddDialog.modal('show') + } + } ] + } ); + + +$('#tableOfDireccionesEnvio').on( 'click', 'tbody span.edit-add', function (e) { + + const row = $(this).closest('tr'); + const data = tableDirecciones.row(row).data() + + $("#addressForm").attr('action','edit') + $("#addressForm").attr('row-index',row[0]._DT_RowIndex) + + $('#add_alias').val(data.alias) + $('#add_att').val(data.att) + $('#add_email').val(data.email) + $('#add_direccion').val(data.direccion) + $("#add_pais_id").val(data.pais_id).change() + $('#add_municipio').val(data.municipio) + $('#add_provincia').val(data.provincia) + $('#add_cp').val(data.cp) + $('#add_telefono').val(data.telefono) + + var $newAddDialog = $("#addressForm") + $newAddDialog.modal('show') +}) + +$(document).on('click', '.btn-delete-add', function(e) { + $(".btn-remove").attr('data-id', $(this).attr('data-id')); + $(".btn-remove").attr('table-id', '#tableOfDireccionesEnvio'); +}); + +function delete_direccion_envio(dataId){ + $.ajax({ + url: `/clientes/clientedirecciones/delete/${dataId}`, + method: 'GET', + }).done((data, textStatus, jqXHR) => { + $('#confirm2delete').modal('toggle'); + tableDirecciones.clearPipeline(); + tableDirecciones.ajax.reload(); + popSuccessAlert(data.msg ?? jqXHR.statusText); + }).fail((jqXHR, textStatus, errorThrown) => { + popErrorAlert(jqXHR.responseJSON.messages.error) + }) +} + +$(document).on('click', '.btn-remove', function(e) { + + const dataId = $(this).attr('data-id'); + const tableId = $(this).attr('table-id'); + + if ($.isNumeric(dataId)) { + if(tableId=='#tableOfDireccionesEnvio') + delete_direccion_envio(dataId) + } +}); + + +endSection() ?> + + +section('css') ?> + + "> + "> +endSection() ?> + +section('additionalExternalJs') ?> + + + + + + + + +endSection() ?> \ No newline at end of file diff --git a/ci4/app/Views/themes/vuexy/main/menus/clientes_menu.php b/ci4/app/Views/themes/vuexy/main/menus/clientes_menu.php index fb8df9d1..71e53116 100644 --- a/ci4/app/Views/themes/vuexy/main/menus/clientes_menu.php +++ b/ci4/app/Views/themes/vuexy/main/menus/clientes_menu.php @@ -22,7 +22,7 @@ if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente user()->can('direcciones.menu')) { ?> From 4b2b4dfade4696edbb3161f40df05f34a07cfeba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Mon, 16 Sep 2024 12:09:27 +0200 Subject: [PATCH 09/11] corregido error en pasar acabados cubierta en presupuesto cliente --- ci4/app/Controllers/Presupuestos/Presupuestocliente.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php index 31a7af10..0be955ff 100755 --- a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php +++ b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php @@ -367,7 +367,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController $gramajeCubierta = $reqData['gramajeCubierta'] ?? 0; $carasCubierta = intval($reqData['carasCubierta'] ?? 0); $solapasCubierta = intval($reqData['solapasCubierta'] ?? 0); - $acabadoCubierta = $reqData['datos_libro']['acabadoCubierta'] ?? 0; + $acabadoCubierta = $reqData['acabadoCubierta'] ?? 0; // Sobrecubierta $sobreCubierta = $reqData["sobrecubierta"] ?? null; @@ -1310,7 +1310,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController $acabadoCubierta = []; if ($tarifaAcabadoCubierta > 0) { $model = model('App\Models\Presupuestos\PresupuestoAcabadosModel'); - $acabadoCubierta = $model->getPrecioTarifa($tarifaAcabadoCubierta, $datosPedido->tirada, $POD); + $acabadoCubierta = $model->getPrecioTarifa($tarifaAcabadoCubierta, $datosPedido->tirada, -1, $POD); } if (count($acabadoCubierta) > 0) { if ($acabadoCubierta[0]->total <= 0) From 4ce8b22c5ab2c74d2fad2894e04263f3cb49d17c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Mon, 16 Sep 2024 13:58:53 +0200 Subject: [PATCH 10/11] customizada vista de peiddos y facturas cliente --- ci4/app/Controllers/Facturacion/Facturas.php | 33 ++- ci4/app/Controllers/Pedidos/Pedido.php | 70 ++++++- ci4/app/Models/Facturas/FacturaModel.php | 12 +- ci4/app/Models/Pedidos/PedidoLineaModel.php | 17 +- ci4/app/Models/Presupuestos/BuscadorModel.php | 1 + .../form/facturas/_facturaCabeceraItems.php | 8 +- .../form/facturas/_facturaLineasItems.php | 2 +- .../form/facturas/_pagosFacturasItems.php | 7 +- .../vuexy/form/facturas/viewFacturasList.php | 15 ++ .../vuexy/form/pedidos/_cabeceraItems.php | 192 +++++++++--------- .../vuexy/form/pedidos/viewPedidoForm.php | 4 +- .../vuexy/form/pedidos/viewPedidosList.php | 9 + ci4/composer.lock | 185 ++++++++--------- 13 files changed, 350 insertions(+), 205 deletions(-) diff --git a/ci4/app/Controllers/Facturacion/Facturas.php b/ci4/app/Controllers/Facturacion/Facturas.php index d21c2bf2..b12c6506 100755 --- a/ci4/app/Controllers/Facturacion/Facturas.php +++ b/ci4/app/Controllers/Facturacion/Facturas.php @@ -41,6 +41,17 @@ class Facturas extends \App\Controllers\BaseResourceController public function index() { + if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) { + // Se obtiene el cliente ID a partir del usuario de la sesion + $model_user = model('App\Models\Usuarios\UserModel'); + $user = $model_user->find(auth()->user()->id); + $clienteId = $user->cliente_id; + } else { + $clienteId = 0; + } + + $this->viewData['cliente_id'] = $clienteId; + $this->viewData['usingClientSideDataTable'] = true; $this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('Tarifaextra.tarifaextra')]); @@ -64,6 +75,17 @@ class Facturas extends \App\Controllers\BaseResourceController ['title' => lang("Facturas.facturaList"), 'route' => "javascript:void(0);", 'active' => true] ]; + if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) { + // Se obtiene el cliente ID a partir del usuario de la sesion + $model_user = model('App\Models\Usuarios\UserModel'); + $user = $model_user->find(auth()->user()->id); + $clienteId = $user->cliente_id; + } else { + $clienteId = 0; + } + + $viewData['cliente_id'] = $clienteId; + return view(static::$viewPath . 'viewFacturasList', $viewData); } @@ -105,6 +127,10 @@ class Facturas extends \App\Controllers\BaseResourceController $sanitizedData['user_updated_id'] = auth()->user()->id; $sanitizedData['user_created_id'] = auth()->user()->id; + + if(!$sanitizedData['creditoAsegurado']){ + $sanitizedData['creditoAsegurado'] = 0; + } if ($allData && $successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : @@ -205,13 +231,14 @@ class Facturas extends \App\Controllers\BaseResourceController $requestedOrder = $reqData['order']['0']['column'] ?? 0; $order = FacturaModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 0]; $dir = $reqData['order']['0']['dir'] ?? 'asc'; + $cliente_id = $reqData['cliente_id'] ?? -1; - $resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); + $resourceData = $this->model->getResource($search, $cliente_id)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); return $this->respond(Collection::datatable( $resourceData, - $this->model->getResource("")->countAllResults(), - $this->model->getResource($search)->countAllResults() + $this->model->getResource("", $cliente_id)->countAllResults(), + $this->model->getResource($search, $cliente_id)->countAllResults() )); } else { return $this->failUnauthorized('Invalid request', 403); diff --git a/ci4/app/Controllers/Pedidos/Pedido.php b/ci4/app/Controllers/Pedidos/Pedido.php index 6ff1ca79..5c499b73 100755 --- a/ci4/app/Controllers/Pedidos/Pedido.php +++ b/ci4/app/Controllers/Pedidos/Pedido.php @@ -40,6 +40,17 @@ class Pedido extends \App\Controllers\BaseResourceController public function index() { + if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) { + // Se obtiene el cliente ID a partir del usuario de la sesion + $model_user = model('App\Models\Usuarios\UserModel'); + $user = $model_user->find(auth()->user()->id); + $clienteId = $user->cliente_id; + } else { + $clienteId = -1; + } + + $this->viewData['cliente_id'] = $clienteId; + $this->viewData['usingClientSideDataTable'] = true; $this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('Tarifaextra.tarifaextra')]); @@ -52,13 +63,24 @@ class Pedido extends \App\Controllers\BaseResourceController $viewData = [ 'currentModule' => static::$controllerSlug, 'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Pedidos.pedido')]), - 'presupuestoEntity' => new PedidoEntity(), + 'pedidoEntity' => new PedidoEntity(), 'usingServerSideDataTable' => true, 'pageTitle' => lang('Pedidos.Pedidos'), 'estadoPedidos' => 'activo', ['title' => lang("App.menu_pedidos"), 'route' => site_url('pedidos/todos'), 'active' => true] ]; + if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) { + // Se obtiene el cliente ID a partir del usuario de la sesion + $model_user = model('App\Models\Usuarios\UserModel'); + $user = $model_user->find(auth()->user()->id); + $clienteId = $user->cliente_id; + } else { + $clienteId = -1; + } + + $viewData['cliente_id'] = $clienteId; + return view(static::$viewPath . 'viewPedidosList', $viewData); } @@ -67,13 +89,24 @@ class Pedido extends \App\Controllers\BaseResourceController $viewData = [ 'currentModule' => static::$controllerSlug, 'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Pedidos.pedido')]), - 'presupuestoEntity' => new PedidoEntity(), + 'pedidoEntity' => new PedidoEntity(), 'usingServerSideDataTable' => true, 'pageTitle' => lang('Pedidos.Pedidos'), 'estadoPedidos' => 'finalizado', ['title' => lang("App.menu_pedidos"), 'route' => site_url('pedidos/todos'), 'active' => true] ]; + if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) { + // Se obtiene el cliente ID a partir del usuario de la sesion + $model_user = model('App\Models\Usuarios\UserModel'); + $user = $model_user->find(auth()->user()->id); + $clienteId = $user->cliente_id; + } else { + $clienteId = -1; + } + + $viewData['cliente_id'] = $clienteId; + return view(static::$viewPath . 'viewPedidosList', $viewData); } @@ -82,13 +115,24 @@ class Pedido extends \App\Controllers\BaseResourceController $viewData = [ 'currentModule' => static::$controllerSlug, 'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Pedidos.pedido')]), - 'presupuestoEntity' => new PedidoEntity(), + 'pedidoEntity' => new PedidoEntity(), 'usingServerSideDataTable' => true, 'pageTitle' => lang('Pedidos.Pedidos'), 'estadoPedidos' => 'cancelado', ['title' => lang("App.menu_pedidos"), 'route' => site_url('pedidos/todos'), 'active' => true] ]; + if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) { + // Se obtiene el cliente ID a partir del usuario de la sesion + $model_user = model('App\Models\Usuarios\UserModel'); + $user = $model_user->find(auth()->user()->id); + $clienteId = $user->cliente_id; + } else { + $clienteId = -1; + } + + $viewData['cliente_id'] = $clienteId; + return view(static::$viewPath . 'viewPedidosList', $viewData); } @@ -98,13 +142,24 @@ class Pedido extends \App\Controllers\BaseResourceController $viewData = [ 'currentModule' => static::$controllerSlug, 'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Pedidos.pedido')]), - 'presupuestoEntity' => new PedidoEntity(), + 'pedidoEntity' => new PedidoEntity(), 'usingServerSideDataTable' => true, 'pageTitle' => lang('Pedidos.Pedidos'), 'estadoPedidos' => 'todos', ['title' => lang("App.menu_pedidos"), 'route' => site_url('pedidos/todos'), 'active' => true] ]; + if (auth()->user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) { + // Se obtiene el cliente ID a partir del usuario de la sesion + $model_user = model('App\Models\Usuarios\UserModel'); + $user = $model_user->find(auth()->user()->id); + $clienteId = $user->cliente_id; + } else { + $clienteId = -1; + } + + $viewData['cliente_id'] = $clienteId; + return view(static::$viewPath . 'viewPedidosList', $viewData); } @@ -242,6 +297,7 @@ class Pedido extends \App\Controllers\BaseResourceController $order = PedidoModel::SORTABLE_TODOS[$requestedOrder >= 0 ? $requestedOrder : 0]; $dir = $reqData['order']['0']['dir'] ?? 'asc'; $estado = $reqData['estado'] ?? 'todos'; + $cliente_id = $reqData['cliente_id'] ?? -1; if($estado == 'todos') $estado = ''; $showTotal = $reqData['showTotal'] ?? false; @@ -249,9 +305,9 @@ class Pedido extends \App\Controllers\BaseResourceController $searchValues = get_filter_datatables_columns($reqData); $model_linea = model('\App\Models\Pedidos\PedidoLineaModel'); - $resourceData = $model_linea->getResource($searchValues, $estado)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); - $totalTirada = $model_linea->getSumOfTirada($searchValues, $estado, $start, $length); - $total = $model_linea->getSumOfTotalAceptado($searchValues, $estado, $start, $length); + $resourceData = $model_linea->getResource($searchValues, $estado, $cliente_id)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); + $totalTirada = $model_linea->getSumOfTirada($searchValues, $estado, $cliente_id, $start, $length); + $total = $model_linea->getSumOfTotalAceptado($searchValues, $estado, $cliente_id, $start, $length); $total2 = 0; if($showTotal){ $total2 = $model_linea->getTotalOfTotalAceptado(); diff --git a/ci4/app/Models/Facturas/FacturaModel.php b/ci4/app/Models/Facturas/FacturaModel.php index f79d5044..80cc59e6 100644 --- a/ci4/app/Models/Facturas/FacturaModel.php +++ b/ci4/app/Models/Facturas/FacturaModel.php @@ -72,7 +72,7 @@ class FacturaModel extends \App\Models\BaseModel { public static $labelField = "id"; - public function getResource(string $search = "") + public function getResource(string $search = "", $cliente_id=-1) { $builder = $this->db ->table($this->table . " t1") @@ -90,8 +90,16 @@ class FacturaModel extends \App\Models\BaseModel { $builder->join("formas_pago t4", "t3.forma_pago_id = t4.id", "left"); $builder->where("t1.deleted_at IS NULL"); + if(auth()->user()->inGroup("cliente-admin") || auth()->user()->inGroup("cliente-editor")) { + $builder->where("t1.estado", "validada"); + } + + if($cliente_id != -1) { + $builder->where("t1.cliente_id", $cliente_id); + } + $builder->groupBy("t1.id"); // Agrupa por id de la factura - + return empty($search) ? $builder : $builder diff --git a/ci4/app/Models/Pedidos/PedidoLineaModel.php b/ci4/app/Models/Pedidos/PedidoLineaModel.php index 44a9f946..19eef0d0 100644 --- a/ci4/app/Models/Pedidos/PedidoLineaModel.php +++ b/ci4/app/Models/Pedidos/PedidoLineaModel.php @@ -48,7 +48,7 @@ class PedidoLineaModel extends \App\Models\BaseModel public static $labelField = "id"; - public function getResource($search = [], $estado="") + public function getResource($search = [], $estado="", $cliente_id = -1) { $builder = $this->db ->table($this->table . " t1") @@ -75,6 +75,10 @@ class PedidoLineaModel extends \App\Models\BaseModel } } + if($cliente_id != -1) { + $builder->where("t3.cliente_id", $cliente_id); + } + if (empty($search)) return $builder; else { @@ -93,7 +97,7 @@ class PedidoLineaModel extends \App\Models\BaseModel } } - public function getSumOfTirada(array $search, $estado = '', $start = 0, $length = 5) + public function getSumOfTirada(array $search, $estado = '', $cliente_id=-1, $start = 0, $length = 5) { $builder = $this->db @@ -104,6 +108,9 @@ class PedidoLineaModel extends \App\Models\BaseModel $builder->join("presupuestos t3", "t1.presupuesto_id = t3.id", "left"); + if($cliente_id != -1) { + $builder->where("t3.cliente_id", $cliente_id); + } // Aplica los filtros de búsqueda y estado if (!empty($search)) { @@ -130,7 +137,7 @@ class PedidoLineaModel extends \App\Models\BaseModel return $builder->get()->getRow()->total_tirada; } - public function getSumOfTotalAceptado(array $search, $estado = '', $start = 0, $length = 5) + public function getSumOfTotalAceptado(array $search, $estado = '', $cliente_id=-1, $start = 0, $length = 5) { $builder = $this->db @@ -140,7 +147,9 @@ class PedidoLineaModel extends \App\Models\BaseModel $builder->join("pedidos t2", "t2.id = t1.pedido_id", "left"); $builder->join("presupuestos t3", "t1.presupuesto_id = t3.id", "left"); - + if($cliente_id != -1) { + $builder->where("t3.cliente_id", $cliente_id); + } // Aplica los filtros de búsqueda y estado if (!empty($search)) { diff --git a/ci4/app/Models/Presupuestos/BuscadorModel.php b/ci4/app/Models/Presupuestos/BuscadorModel.php index b6ca2f10..99caa4f5 100644 --- a/ci4/app/Models/Presupuestos/BuscadorModel.php +++ b/ci4/app/Models/Presupuestos/BuscadorModel.php @@ -139,6 +139,7 @@ class BuscadorModel extends \App\Models\BaseModel $builder->where("t1.is_deleted", 0); + if (empty($search)) return $builder; else { diff --git a/ci4/app/Views/themes/vuexy/form/facturas/_facturaCabeceraItems.php b/ci4/app/Views/themes/vuexy/form/facturas/_facturaCabeceraItems.php index 06227a6f..2abd8168 100644 --- a/ci4/app/Views/themes/vuexy/form/facturas/_facturaCabeceraItems.php +++ b/ci4/app/Views/themes/vuexy/form/facturas/_facturaCabeceraItems.php @@ -37,6 +37,7 @@ + user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))) : ?>
+
@@ -60,6 +62,7 @@
+
@@ -72,6 +75,7 @@
+ user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))) : ?>
+ @@ -201,6 +206,7 @@ ] ) ?> + user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))) : ?> - + diff --git a/ci4/app/Views/themes/vuexy/form/facturas/_facturaLineasItems.php b/ci4/app/Views/themes/vuexy/form/facturas/_facturaLineasItems.php index 1c8dcbaf..15e4109b 100644 --- a/ci4/app/Views/themes/vuexy/form/facturas/_facturaLineasItems.php +++ b/ci4/app/Views/themes/vuexy/form/facturas/_facturaLineasItems.php @@ -244,7 +244,7 @@ var tableLineas = $('#tableOfLineasFactura').DataTable({ data: "descripcion", render: function (data, type, row, meta) { - if(row.pedido_linea_impresion_id != null){ + if(row.pedido_linea_impresion_id != null && user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')) ? 0 : 1 ?>){ // se convierten a float data.total_aceptado y subtotal var total_aceptado = parseFloat(row.total_aceptado); diff --git a/ci4/app/Views/themes/vuexy/form/facturas/_pagosFacturasItems.php b/ci4/app/Views/themes/vuexy/form/facturas/_pagosFacturasItems.php index 19911667..ec668aae 100644 --- a/ci4/app/Views/themes/vuexy/form/facturas/_pagosFacturasItems.php +++ b/ci4/app/Views/themes/vuexy/form/facturas/_pagosFacturasItems.php @@ -28,6 +28,7 @@ + user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))) : ?>
- + @@ -56,12 +57,16 @@ formas_pago.forEach(function(pago) { }); const actionBtns_pagos = function(data) { + user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))) : ?> return `
`; + + return ''; + } var editor_pagos = new $.fn.dataTable.Editor( { diff --git a/ci4/app/Views/themes/vuexy/form/facturas/viewFacturasList.php b/ci4/app/Views/themes/vuexy/form/facturas/viewFacturasList.php index ca774db6..3e2a82ea 100644 --- a/ci4/app/Views/themes/vuexy/form/facturas/viewFacturasList.php +++ b/ci4/app/Views/themes/vuexy/form/facturas/viewFacturasList.php @@ -142,6 +142,9 @@ ajax : $.fn.dataTable.pipeline( { url: '', method: 'POST', + data: function(d, settings){ + d.cliente_id = ""; + }, headers: {'X-Requested-With': 'XMLHttpRequest'}, async: true, }), @@ -258,6 +261,18 @@ ] }); + theTable.on( 'draw.dt', function () { + if( != -1){ + theTable.column(3).visible(false); + theTable.column(7).visible(false); + theTable.column(8).visible(false); + theTable.column(9).visible(false); + theTable.column(10).visible(false); + theTable.column(11).visible(false); + theTable.column(12).visible(false); + } + }); + $(document).on('click', '.btn-edit', function(e) { var url = ''; diff --git a/ci4/app/Views/themes/vuexy/form/pedidos/_cabeceraItems.php b/ci4/app/Views/themes/vuexy/form/pedidos/_cabeceraItems.php index 6f269af0..d85b0047 100644 --- a/ci4/app/Views/themes/vuexy/form/pedidos/_cabeceraItems.php +++ b/ci4/app/Views/themes/vuexy/form/pedidos/_cabeceraItems.php @@ -22,17 +22,19 @@ -
-
- - -
-
+ user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))) : ?> +
+
+ + +
+
+
@@ -55,102 +57,104 @@
+ user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))) : ?> +
+
+

+ +

-
-
-

- -

+
+
+
+
+
+ + +
+
+ +
+
+ + +
+
-
-
-
-
-
- -
-
- -
-
- - -
-
- -
-
-
-
-
+
+
+
+
-
-
-

- -

+
+
+

+ +

-
-
-
-
-
- - +
+
+
+
+
+ + +
-
-
-
- - +
+
+ + +
-
-
-
- - +
+
+ + +
-
-
-
- - +
+
+ + +
-
-
-
-
+
+
+
- estado !== 'finalizado' && $pedidoEntity->estado !== 'cancelado'): ?> -
-
- - + estado !== 'finalizado' && $pedidoEntity->estado !== 'cancelado'): ?> +
+
+ + +
+
+ + +
-
- - -
-
+ +
diff --git a/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidoForm.php b/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidoForm.php index e63cd721..fc16989d 100644 --- a/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidoForm.php +++ b/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidoForm.php @@ -17,7 +17,9 @@ getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?> - + user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor'))) : ?> + +
diff --git a/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidosList.php b/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidosList.php index 6a395ff5..f582f5aa 100644 --- a/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidosList.php +++ b/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidosList.php @@ -199,6 +199,7 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) { data: function(d, settings){ d.estado= ""; d.showTotal= $('#showTotal').is(':checked')? "1":"0"; + d.cliente_id = ""; }, headers: {'X-Requested-With': 'XMLHttpRequest'}, async: true, @@ -283,6 +284,14 @@ $('#tableOfPedidos thead tr:eq(1) th').each(function (i) { }); } + + if( != -1){ + // Se oculta la columna de cliente (3) + theTable.column(3).visible(false); + } + else{ + theTable.column(3).visible(true); + } }); diff --git a/ci4/composer.lock b/ci4/composer.lock index 723c548f..210fa59c 100644 --- a/ci4/composer.lock +++ b/ci4/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "codeigniter4/framework", - "version": "v4.5.1", + "version": "v4.5.5", "source": { "type": "git", "url": "https://github.com/codeigniter4/framework.git", - "reference": "9b2cd730db29d14ac6e760fb15c4bcac15184ec4" + "reference": "2849e7ff36b4c4aa1376d990a9a1e3f0c393b8d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/codeigniter4/framework/zipball/9b2cd730db29d14ac6e760fb15c4bcac15184ec4", - "reference": "9b2cd730db29d14ac6e760fb15c4bcac15184ec4", + "url": "https://api.github.com/repos/codeigniter4/framework/zipball/2849e7ff36b4c4aa1376d990a9a1e3f0c393b8d0", + "reference": "2849e7ff36b4c4aa1376d990a9a1e3f0c393b8d0", "shasum": "" }, "require": { @@ -34,7 +34,7 @@ "kint-php/kint": "^5.0.4", "mikey179/vfsstream": "^1.6", "nexusphp/cs-config": "^3.6", - "phpunit/phpunit": "^10.5.16", + "phpunit/phpunit": "^10.5.16 || ^11.2", "predis/predis": "^1.1 || ^2.0" }, "suggest": { @@ -78,7 +78,7 @@ "slack": "https://codeigniterchat.slack.com", "source": "https://github.com/codeigniter4/CodeIgniter4" }, - "time": "2024-04-14T04:18:29+00:00" + "time": "2024-09-07T08:49:38+00:00" }, { "name": "codeigniter4/settings", @@ -137,16 +137,16 @@ }, { "name": "codeigniter4/shield", - "version": "v1.0.3", + "version": "v1.1.0", "source": { "type": "git", "url": "https://github.com/codeigniter4/shield.git", - "reference": "3fbac7a3da41ebaac7d51708244f68df596409f0" + "reference": "22a8b3b58dafa7a5c080bc61446653aeb9fffc06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/codeigniter4/shield/zipball/3fbac7a3da41ebaac7d51708244f68df596409f0", - "reference": "3fbac7a3da41ebaac7d51708244f68df596409f0", + "url": "https://api.github.com/repos/codeigniter4/shield/zipball/22a8b3b58dafa7a5c080bc61446653aeb9fffc06", + "reference": "22a8b3b58dafa7a5c080bc61446653aeb9fffc06", "shasum": "" }, "require": { @@ -165,7 +165,8 @@ "mockery/mockery": "^1.0", "phpstan/extension-installer": "^1.3", "phpstan/phpstan-strict-rules": "^1.5", - "rector/rector": "1.0.4" + "phpunit/phpunit": "^9.6", + "rector/rector": "1.1.0" }, "suggest": { "ext-curl": "Required to use the password validation rule via PwnedValidator class.", @@ -206,7 +207,7 @@ "slack": "https://codeigniterchat.slack.com", "source": "https://github.com/codeigniter4/shield" }, - "time": "2024-04-14T08:57:57+00:00" + "time": "2024-06-13T08:54:48+00:00" }, { "name": "dompdf/dompdf", @@ -660,16 +661,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.41", + "version": "3.0.42", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "621c73f7dcb310b61de34d1da4c4204e8ace6ceb" + "reference": "db92f1b1987b12b13f248fe76c3a52cadb67bb98" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/621c73f7dcb310b61de34d1da4c4204e8ace6ceb", - "reference": "621c73f7dcb310b61de34d1da4c4204e8ace6ceb", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/db92f1b1987b12b13f248fe76c3a52cadb67bb98", + "reference": "db92f1b1987b12b13f248fe76c3a52cadb67bb98", "shasum": "" }, "require": { @@ -750,7 +751,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.41" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.42" }, "funding": [ { @@ -766,20 +767,20 @@ "type": "tidelift" } ], - "time": "2024-08-12T00:13:54+00:00" + "time": "2024-09-16T03:06:04+00:00" }, { "name": "psr/log", - "version": "3.0.0", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", "shasum": "" }, "require": { @@ -814,22 +815,22 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/3.0.0" + "source": "https://github.com/php-fig/log/tree/3.0.2" }, - "time": "2021-07-14T16:46:02+00:00" + "time": "2024-09-11T13:17:53+00:00" }, { "name": "sabberworm/php-css-parser", - "version": "v8.5.1", + "version": "v8.6.0", "source": { "type": "git", "url": "https://github.com/MyIntervals/PHP-CSS-Parser.git", - "reference": "4a3d572b0f8b28bb6fd016ae8bbfc445facef152" + "reference": "d2fb94a9641be84d79c7548c6d39bbebba6e9a70" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/4a3d572b0f8b28bb6fd016ae8bbfc445facef152", - "reference": "4a3d572b0f8b28bb6fd016ae8bbfc445facef152", + "url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/d2fb94a9641be84d79c7548c6d39bbebba6e9a70", + "reference": "d2fb94a9641be84d79c7548c6d39bbebba6e9a70", "shasum": "" }, "require": { @@ -879,9 +880,9 @@ ], "support": { "issues": "https://github.com/MyIntervals/PHP-CSS-Parser/issues", - "source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v8.5.1" + "source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v8.6.0" }, - "time": "2024-02-15T16:41:13+00:00" + "time": "2024-07-01T07:33:21+00:00" } ], "packages-dev": [ @@ -1020,23 +1021,24 @@ }, { "name": "mikey179/vfsstream", - "version": "v1.6.11", + "version": "v1.6.12", "source": { "type": "git", "url": "https://github.com/bovigo/vfsStream.git", - "reference": "17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f" + "reference": "fe695ec993e0a55c3abdda10a9364eb31c6f1bf0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f", - "reference": "17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f", + "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/fe695ec993e0a55c3abdda10a9364eb31c6f1bf0", + "reference": "fe695ec993e0a55c3abdda10a9364eb31c6f1bf0", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=7.1.0" }, "require-dev": { - "phpunit/phpunit": "^4.5|^5.0" + "phpunit/phpunit": "^7.5||^8.5||^9.6", + "yoast/phpunit-polyfills": "^2.0" }, "type": "library", "extra": { @@ -1067,20 +1069,20 @@ "source": "https://github.com/bovigo/vfsStream/tree/master", "wiki": "https://github.com/bovigo/vfsStream/wiki" }, - "time": "2022-02-23T02:02:42+00:00" + "time": "2024-08-29T18:43:31+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.11.1", + "version": "1.12.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", "shasum": "" }, "require": { @@ -1088,11 +1090,12 @@ }, "conflict": { "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { "doctrine/collections": "^1.6.8", "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", @@ -1118,7 +1121,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" }, "funding": [ { @@ -1126,20 +1129,20 @@ "type": "tidelift" } ], - "time": "2023-03-08T13:26:56+00:00" + "time": "2024-06-12T14:39:25+00:00" }, { "name": "nikic/php-parser", - "version": "v5.0.2", + "version": "v5.2.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" + "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", + "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", "shasum": "" }, "require": { @@ -1150,7 +1153,7 @@ }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^9.0" }, "bin": [ "bin/php-parse" @@ -1182,9 +1185,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.2.0" }, - "time": "2024-03-05T20:51:40+00:00" + "time": "2024-09-15T16:40:33+00:00" }, { "name": "phar-io/manifest", @@ -1306,35 +1309,35 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.31", + "version": "9.2.32", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965" + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965", - "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5", + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.18 || ^5.0", + "nikic/php-parser": "^4.19.1 || ^5.1.0", "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", - "theseer/tokenizer": "^1.2.0" + "phpunit/php-file-iterator": "^3.0.6", + "phpunit/php-text-template": "^2.0.4", + "sebastian/code-unit-reverse-lookup": "^2.0.3", + "sebastian/complexity": "^2.0.3", + "sebastian/environment": "^5.1.5", + "sebastian/lines-of-code": "^1.0.4", + "sebastian/version": "^3.0.2", + "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.6" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -1343,7 +1346,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.2-dev" + "dev-main": "9.2.x-dev" } }, "autoload": { @@ -1372,7 +1375,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32" }, "funding": [ { @@ -1380,7 +1383,7 @@ "type": "github" } ], - "time": "2024-03-02T06:37:42+00:00" + "time": "2024-08-22T04:23:01+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1625,45 +1628,45 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.19", + "version": "9.6.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8" + "reference": "49d7820565836236411f5dc002d16dd689cde42f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1a54a473501ef4cdeaae4e06891674114d79db8", - "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/49d7820565836236411f5dc002d16dd689cde42f", + "reference": "49d7820565836236411f5dc002d16dd689cde42f", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1 || ^2", + "doctrine/instantiator": "^1.5.0 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", + "myclabs/deep-copy": "^1.12.0", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.28", - "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-code-coverage": "^9.2.31", + "phpunit/php-file-iterator": "^3.0.6", "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", + "phpunit/php-text-template": "^2.0.4", + "phpunit/php-timer": "^5.0.3", + "sebastian/cli-parser": "^1.0.2", + "sebastian/code-unit": "^1.0.8", "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.5", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.2", + "sebastian/diff": "^4.0.6", + "sebastian/environment": "^5.1.5", + "sebastian/exporter": "^4.0.6", + "sebastian/global-state": "^5.0.7", + "sebastian/object-enumerator": "^4.0.4", + "sebastian/resource-operations": "^3.0.4", + "sebastian/type": "^3.2.1", "sebastian/version": "^3.0.2" }, "suggest": { @@ -1708,7 +1711,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.19" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.20" }, "funding": [ { @@ -1724,7 +1727,7 @@ "type": "tidelift" } ], - "time": "2024-04-05T04:35:58+00:00" + "time": "2024-07-10T11:45:39+00:00" }, { "name": "psr/container", From 246910154165f00e7e57eaca56ebc3287664df9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Mon, 16 Sep 2024 17:50:20 +0200 Subject: [PATCH 11/11] cambio en como se calcula el margen de servicios en presupuestos --- .../cosidotapablanda/_resumenPresupuestos.js | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestos.js b/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestos.js index a7351f3f..5c74d4d5 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestos.js +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestos.js @@ -89,7 +89,9 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){ var subId = $('#tableOfServiciosEncuadernacion').DataTable().cell(currentRow,0).node().innerHTML; var total = parseFloat($('#precio_total_encuadernado_' + subId)[0].value) totalServicios += total - margenServicios += (total*parseFloat($('#enc_margen_' + subId)[0].innerHTML)/100.0) + var base = parseFloat($('#precio_total_encuadernado_' + subId)[0].value)/(1+parseFloat($('#enc_margen_' + subId)[0].innerHTML)/100.0); + var margen = total - base; + margenServicios += margen; }) } @@ -99,7 +101,9 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){ var subId = $('#tableOfServiciosAcabado').DataTable().cell(currentRow,0).node().innerHTML; var total = parseFloat($('#precio_total_acabado_' + subId)[0].value) totalServicios += total - margenServicios += (total*parseFloat($('#acabado_margen_' + subId)[0].innerHTML)/100.0) + var base = parseFloat($('#precio_total_acabado_' + subId)[0].value)/(1+parseFloat($('#acabado_margen_' + subId)[0].innerHTML)/100.0); + var margen = total - base; + margenServicios += margen; }) } @@ -110,7 +114,9 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){ var subId = $('#tableOfServiciosPreimpresion').DataTable().cell(currentRow,0).node().innerHTML; var total = parseFloat($('#precio_preimpresion_' + subId)[0].value) totalServicios += total - margenServicios += (total*parseFloat($('#preimpresion_margen_' + subId)[0].innerHTML)/100.0) + var base = parseFloat($('#precio_preimpresion_' + subId)[0].value)/(1+parseFloat($('#preimpresion_margen_' + subId)[0].innerHTML)/100.0); + var margen = total - base; + margenServicios += margen; }) } @@ -121,7 +127,9 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){ var subId = $('#tableOfServiciosExtra').DataTable().cell(currentRow,0).node().innerHTML; var total = parseFloat($('#precio_servicioextra_' + subId)[0].value) totalServicios += total - margenServicios += (total*parseFloat($('#servicioextra_margen_' + subId)[0].innerHTML)/100.0) + var base = parseFloat($('#precio_servicioextra_' + subId)[0].value)/(1+parseFloat($('#servicioextra_margen_' + subId)[0].innerHTML)/100.0); + var margen = total - base; + margenServicios += margen; }) } @@ -132,7 +140,9 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){ var subId = $('#tableOfServiciosManipulado').DataTable().cell(currentRow,0).node().innerHTML; var total = parseFloat($('#precio_total_manipulado_' + subId)[0].value) totalServicios += total - margenServicios += (total*parseFloat($('#manipulado_margen_' + subId)[0].innerHTML)/100.0) + var base = parseFloat($('#precio_total_manipulado_' + subId)[0].value)/(1+parseFloat($('#manipulado_margen_' + subId)[0].innerHTML)/100.0); + var margen = total - base; + margenServicios += margen; }) }