From db3ada3830e661616e7c7f5ae976ce19825f1d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez=20ORtega?= Date: Thu, 6 Jun 2024 12:00:44 +0200 Subject: [PATCH 1/5] modificando las cosas --- .../Presupuestos/Presupuestocliente.php | 1 + .../presupuestos/cliente/_resumenItems.php | 4 +- .../cliente/viewPresupuestoclienteForm.php | 337 ++++++++++-------- 3 files changed, 194 insertions(+), 148 deletions(-) diff --git a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php index 1aaf1de3..9297a654 100755 --- a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php +++ b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php @@ -108,6 +108,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController $datosPresupuesto->tapa = 'blanda'; $datosPresupuesto->clienteList = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null); + $presupuestoEntity->estado = 1; $this->viewData['formAction'] = route_to('crearPresupuestoCliente'); 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 45d3720d..073147c5 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_resumenItems.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_resumenItems.php @@ -200,7 +200,7 @@ window.routes_resumen = { duplicarPresupuesto: "", } -if(estado_id?>==2){ +estado_id==2): ?> previewEsquemaCubierta(true); const previewTemplate = `
@@ -312,5 +312,5 @@ if(estado_id?>==2){ return false; }); -} + endSection() ?> 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 6abd657c..7441d4fd 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoclienteForm.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoclienteForm.php @@ -18,136 +18,178 @@
-
- - estado_id==1): ?> -
- -
-
- -
- -
-
- -
- -
-
- - -
- -
- - - -
- -
- -
- -
-
+ estado_id == 1) : ?> + +
- - estado_id==1): ?> -
+
+ +
+
-
+
+ +
+
- - -
- - -
-
+
+ +
+
+ +
+
- -
-
- - - -
- - -
-
+ - -
-
+
- +
-
- - +
+ +
+ + + + +
+ +
+ + + +
+ + +
-
- - -
-
+ +
+
- + +
+ + +
+
+ + +
+
+ + + +
+ + +
+
+
+ + +
+
+ + + +
+
+
+ estado_id == 1) : ?> + + +
+
+ estado_id == 1) : ?> + + + + + + + +
+
+
+ + +
+ + + +
+
+ + + +
estado_id == 1) : ?> @@ -178,11 +220,10 @@
-
-
-
- + + +
@@ -199,35 +240,38 @@ window.datosPresupuesto = ; window.token_ajax= {: v}; -$('#clienteId').select2({ - allowClear: false, - ajax: { - url: '', - type: 'post', - dataType: 'json', +estado_id == 1) : ?> + $('#clienteId').select2({ + allowClear: false, + ajax: { + url: '', + type: 'post', + dataType: 'json', - data: function(params) { - return { - id: 'id', - text: 'nombre', - searchTerm: params.term, - : v - }; - }, - delay: 60, - processResults: function(response) { - yeniden(response.); - return { - results: response.menu - }; - }, - cache: true -} -}); + data: function(params) { + return { + id: 'id', + text: 'nombre', + searchTerm: params.term, + : v + }; + }, + delay: 60, + processResults: function(response) { + yeniden(response.); + return { + results: response.menu + }; + }, + cache: true + } + }); -if(estado_id ?>==1){ initDisenioLibro(); -} + + + + endSection() ?> @@ -238,7 +282,6 @@ if(estado_id ?>==1){ - endSection() ?> @@ -258,7 +301,9 @@ if(estado_id ?>==1){ - + estado_id == 1) : ?> + + From d2f5b77f16a6a4b1988a9905d84994e2bd7b99ab Mon Sep 17 00:00:00 2001 From: imnavajas Date: Thu, 6 Jun 2024 12:22:32 +0200 Subject: [PATCH 2/5] Corregido bug --- .../Presupuestos/Presupuestocliente.php | 6 ++ .../cliente/viewPresupuestoclienteForm.php | 79 +++++++++++-------- 2 files changed, 50 insertions(+), 35 deletions(-) diff --git a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php index 9297a654..6cc24b8e 100755 --- a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php +++ b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php @@ -50,6 +50,12 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController $this->viewData = ['usingServerSideDataTable' => true]; // JJO + // Breadcrumbs + $this->viewData['breadcrumb'] = [ + ['title' => lang("App.menu_presupuestos"), 'route' => "javascript:void(0);", 'active' => false], + ['title' => "Listado", 'route' => site_url('presupuestocliente/list'), 'active' => true] + ]; + parent::initController($request, $response, $logger); $this->model = new PresupuestoModel(); } 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 7441d4fd..247cd02b 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoclienteForm.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoclienteForm.php @@ -178,49 +178,57 @@
-
-
-
- +
+
+
+ +
- + -
-
- estado_id == 1) : ?> - - +
+
+ estado_id == 1) : ?> + + +
+
+ estado_id == 1) : ?> + + + + + + +
+
+
-
- estado_id == 1) : ?> - - - - - - - -
-
- +
+
+ + + + + @@ -282,6 +290,7 @@ window.token_ajax= {: v}; + endSection() ?> From 120e46f994aaf8e959ef4cbea7cd47ff5da26c97 Mon Sep 17 00:00:00 2001 From: imnavajas Date: Thu, 6 Jun 2024 19:55:51 +0200 Subject: [PATCH 3/5] Falta lomo --- .../Presupuestos/Presupuestocliente.php | 10 ++--- ci4/app/Controllers/Sistema/Intranet.php | 2 - .../presupuestos/cliente/_resumenItems.php | 2 +- .../presupuestos/cliente/_tipoLibroItems.php | 4 +- .../form/presupuestos/cliente/disenioLibro.js | 10 ++++- .../cliente/presupuestoCliente.js | 7 ++- .../form/presupuestos/cliente/previews.js | 3 +- .../cliente/viewPresupuestoList.php | 45 ++++++++++++++----- .../cliente/viewPresupuestoclienteForm.php | 2 + 9 files changed, 58 insertions(+), 27 deletions(-) diff --git a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php index 6cc24b8e..f4a2d642 100755 --- a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php +++ b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php @@ -114,9 +114,9 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController $datosPresupuesto->tapa = 'blanda'; $datosPresupuesto->clienteList = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null); - $presupuestoEntity->estado = 1; + $presupuestoEntity->estado_id = 1; - $this->viewData['formAction'] = route_to('crearPresupuestoCliente'); + $this->viewData['formAction'] = 'add'; $this->viewData['paisList'] = $this->getPaisListItems(); @@ -131,8 +131,6 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController public function edit($requestedId = null) { - // JJO - $session = session(); if ($requestedId == null) : return $this->redirect2listView(); @@ -145,8 +143,6 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController return $this->redirect2listView('sweet-error', $message); endif; - $requestMethod = $this->request->getMethod(); - $datosPresupuesto = (object)array(); $datosPresupuesto->POD = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD(); $datosPresupuesto->paisList = model('App\Models\Configuracion\PaisModel')->getAllForMenu('id, nombre', 'nombre', true); @@ -181,7 +177,7 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController $this->generarResumen($presupuestoEntity); } - $this->viewData['formAction'] = route_to('updateCosidotapablanda', $id); + $this->viewData['formAction'] = 'edit'; $this->viewData['paisList'] = $this->getPaisListItems(); diff --git a/ci4/app/Controllers/Sistema/Intranet.php b/ci4/app/Controllers/Sistema/Intranet.php index 48cb27a5..99d3b206 100644 --- a/ci4/app/Controllers/Sistema/Intranet.php +++ b/ci4/app/Controllers/Sistema/Intranet.php @@ -7,8 +7,6 @@ use CodeIgniter\Controller; class Intranet extends Controller { - - function presupuestos($resource_name) { helper('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 073147c5..aefaea35 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_resumenItems.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_resumenItems.php @@ -200,7 +200,7 @@ window.routes_resumen = { duplicarPresupuesto: "", } -estado_id==2): ?> +estado_id===2): ?> previewEsquemaCubierta(true); const previewTemplate = `
diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_tipoLibroItems.php b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_tipoLibroItems.php index 41dc47e2..54cf1280 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_tipoLibroItems.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_tipoLibroItems.php @@ -1,7 +1,7 @@
- - + + lomo_cubierta ?>>
diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/disenioLibro.js b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/disenioLibro.js index 10eb0d72..55bd31c1 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/disenioLibro.js +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/disenioLibro.js @@ -770,7 +770,15 @@ async function calcularPresupuesto() { $('#divTiradasPrecio').append(html); } - } + } + + if($('#resumen-libro').hasClass('active')) { + initDirecciones(); + initTiradasDirecciones(); + generarResumen(); + previewEsquemaCubierta(true); + } + } }, error: function (error) { diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/presupuestoCliente.js b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/presupuestoCliente.js index bc660769..6c79f0ee 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/presupuestoCliente.js +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/presupuestoCliente.js @@ -344,7 +344,12 @@ } }); }); - + + var url = $(location).attr('href'); // Obtener URL actual + if (url.includes('/edit/')) { // Comprobar si la URL contiene 'edit' + validationStepper.to(4); + } + } })(); 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 67eb63fa..3ce56031 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/previews.js +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/previews.js @@ -811,6 +811,7 @@ function getObjetoToPreview() { anchoLibro: parseInt(tamanio[0]) }; } - //console.log(pvObj); + console.log($('#lomo_cubierta').val()); + } diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoList.php b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoList.php index c0aa0184..e30c2454 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoList.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoList.php @@ -114,19 +114,40 @@ $('#tableOfPresupuestos thead tr:eq(1) th').each(function (i) { $(this).html(''); // Agregar opciones al selector - var selector = $('select', this); - selector.append(''); // Opción vacía - selector.append(''); - selector.append(''); - selector.append(''); - selector.append(''); - selector.append(''); - selector.append(''); - selector.append(''); - selector.append(''); - selector.append(''); + var selectorTipo = $('select', this); + selectorTipo.append(''); // Opción vacía + selectorTipo.append(''); + selectorTipo.append(''); + selectorTipo.append(''); + selectorTipo.append(''); + selectorTipo.append(''); + selectorTipo.append(''); + selectorTipo.append(''); + selectorTipo.append(''); + selectorTipo.append(''); - selector.on('change', function () { + selectorTipo.on('change', function () { + var val = $.fn.dataTable.util.escapeRegex( + $(this).val() + ); + theTable.column(i).search(val).draw(); + }); + } + + else if (i == 8) { + + else if (i == 7) { + + // Agregar un selector en la tercera columna + $(this).html(''); + + // Agregar opciones al selector + var selectorEstado = $('select', this); + selectorEstado.append(''); // Opción vacía + selectorEstado.append(''); + selectorEstado.append(''); + + selectorEstado.on('change', function () { var val = $.fn.dataTable.util.escapeRegex( $(this).val() ); 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 247cd02b..20b52216 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoclienteForm.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoclienteForm.php @@ -276,6 +276,8 @@ window.token_ajax= {: v}; }); initDisenioLibro(); + + From 94cf67a47fc3f76b2f15d6827bc6364f78877f9a Mon Sep 17 00:00:00 2001 From: imnavajas Date: Fri, 7 Jun 2024 13:10:32 +0200 Subject: [PATCH 4/5] Arreglado bug del lomo cubierta --- .../themes/vuexy/form/presupuestos/cliente/disenioLibro.js | 2 +- .../Views/themes/vuexy/form/presupuestos/cliente/previews.js | 4 +--- .../form/presupuestos/cliente/viewPresupuestoclienteForm.php | 3 --- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/disenioLibro.js b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/disenioLibro.js index 55bd31c1..7556eeec 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/disenioLibro.js +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/disenioLibro.js @@ -745,7 +745,7 @@ async function calcularPresupuesto() { if(!error){ - $('#lomo_cubierta').val(response.lomo_cubierta); + $('#lomo_cubierta').val(response.info.lomo_cubierta); $('#precios').show(); 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 3ce56031..8bbc1a8b 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/previews.js +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/previews.js @@ -811,7 +811,5 @@ function getObjetoToPreview() { anchoLibro: parseInt(tamanio[0]) }; } - console.log($('#lomo_cubierta').val()); - - + //console.log($('#lomo_cubierta').val()); } 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 20b52216..e00f7d09 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoclienteForm.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoclienteForm.php @@ -285,9 +285,6 @@ window.token_ajax= {: v}; endSection() ?> - - - section('css') ?> From 38abbe22a733ee257b6aaab72dd6878d4e71fd05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Fri, 7 Jun 2024 16:47:11 +0200 Subject: [PATCH 5/5] ya se filtra bien --- .../Presupuestos/Presupuestocliente.php | 4 ++-- ci4/app/Models/Presupuestos/PresupuestoModel.php | 14 ++++++-------- .../presupuestos/cliente/viewPresupuestoList.php | 14 ++++++++++---- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php index f4a2d642..3bf94ddf 100755 --- a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php +++ b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php @@ -308,8 +308,8 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController return $this->respond(Collection::datatable( $resourceData, - $this->model->getListaPresupuestosCliente("", $clienteId)->countAllResults(), - $this->model->getListaPresupuestosCliente($search, $clienteId)->countAllResults() + $this->model->getListaPresupuestosCliente([], $clienteId)->countAllResults(), + $this->model->getListaPresupuestosCliente($searchValues, $clienteId)->countAllResults() )); } else { return $this->failUnauthorized('Invalid request', 403); diff --git a/ci4/app/Models/Presupuestos/PresupuestoModel.php b/ci4/app/Models/Presupuestos/PresupuestoModel.php index 8768f18a..e4cb1a6f 100755 --- a/ci4/app/Models/Presupuestos/PresupuestoModel.php +++ b/ci4/app/Models/Presupuestos/PresupuestoModel.php @@ -32,16 +32,14 @@ class PresupuestoModel extends \App\Models\BaseModel const SORTABLE_CLIENTE = [ 0 => "t1.id", - 1 => "t1.created_at", + 1 => "t1.updated_at", 2 => "t7.codigo", 3 => "t2.nombre", - 4 => "t3.first_name", - 5 => "t1.titulo", - 6 => "t5.nombre", - 8 => "t1.paginas", - 9 => "t1.tirada", - 10 => "t1.total_presupuesto", - 11 => "t6.estado", + 4 => "t1.titulo", + 5 => "t1.paginas", + 6 => "t1.tirada", + 7 => "t1.total_presupuesto", + 8 => "t6.id", ]; protected $allowedFields = [ diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoList.php b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoList.php index e30c2454..20a4cff5 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoList.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoList.php @@ -211,7 +211,13 @@ theTable = $('#tableOfPresupuestos').DataTable({ orderable: false, searchable: false, targets: [lastColNr] - } + }, + user()->inGroup('cliente-admin') || auth()->user()->inGroup('cliente-editor')): ?> + { + target: 3, + visible: false + } + ], columns : [ @@ -264,9 +270,9 @@ theTable = $('#tableOfPresupuestos').DataTable({ } }, }, - - { 'data': 'cliente' }, - + + { 'data': 'cliente'}, + { 'data': 'titulo' }, { 'data': 'paginas' }, { 'data': 'tirada' },