diff --git a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php index 1aaf1de3..3bf94ddf 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(); } @@ -108,8 +114,9 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController $datosPresupuesto->tapa = 'blanda'; $datosPresupuesto->clienteList = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null); + $presupuestoEntity->estado_id = 1; - $this->viewData['formAction'] = route_to('crearPresupuestoCliente'); + $this->viewData['formAction'] = 'add'; $this->viewData['paisList'] = $this->getPaisListItems(); @@ -124,8 +131,6 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController public function edit($requestedId = null) { - // JJO - $session = session(); if ($requestedId == null) : return $this->redirect2listView(); @@ -138,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); @@ -174,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(); @@ -305,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/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/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/_resumenItems.php b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/_resumenItems.php index 45d3720d..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: "", } -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/_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..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(); @@ -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..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,6 +811,5 @@ 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..20a4cff5 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() ); @@ -190,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 : [ @@ -243,9 +270,9 @@ theTable = $('#tableOfPresupuestos').DataTable({ } }, }, - - { 'data': 'cliente' }, - + + { 'data': 'cliente'}, + { 'data': 'titulo' }, { 'data': 'paginas' }, { 'data': 'tirada' }, 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..e00f7d09 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoclienteForm.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cliente/viewPresupuestoclienteForm.php @@ -18,171 +18,220 @@
-
- - estado_id==1): ?> -
- -
-
- -
- -
-
- -
- -
-
- - -
- -
- - - -
- -
- -
- -
-
+ estado_id == 1) : ?> + +
- - estado_id==1): ?> -
+
+ +
+
-
+
+ +
+
- - -
- - -
-
+
+ +
+
+ +
+
- -
-
- - - -
- - -
-
+ - -
-
+
- +
-
- - -
-
-
- +
- -
-
+
+ - + + +
-
-
-
- estado_id == 1) : ?> - - -
-
- estado_id == 1) : ?> - + - - - - - - +
-
- -
-
+ +
+
+ + + +
+ + +
+
+
+ + +
+
+ + + +
+ + +
+
+
+ + +
+
+ + + +
+
+
+ estado_id == 1) : ?> + + +
+
+ estado_id == 1) : ?> + + + + + + + +
+
+
+ +
+ + + +
+
+
+
+
+ + + +
+
+ estado_id == 1) : ?> + + +
+
+ estado_id == 1) : ?> + + + + + + +
+
+ +
+
+
+ + + + + + + +
@@ -199,41 +248,43 @@ 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() ?> - - - section('css') ?> @@ -258,7 +309,9 @@ if(estado_id ?>==1){ - + estado_id == 1) : ?> + +