From c9d88753928a6f9a7c28a19113876964c7d08b08 Mon Sep 17 00:00:00 2001 From: jaimejimenezortega Date: Thu, 13 Jun 2024 23:53:20 +0200 Subject: [PATCH] trabajando en pedidos 3 --- ci4/app/Config/Routes.php | 3 + ci4/app/Controllers/Pedidos/Pedido.php | 25 +++ ci4/app/Controllers/Test.php | 17 +- ci4/app/Language/en/Pedidos.php | 22 ++- ci4/app/Language/es/Pedidos.php | 22 ++- ci4/app/Models/Pedidos/PedidoModel.php | 18 ++ .../Models/Presupuestos/PresupuestoModel.php | 167 ++++++++++++++++++ .../vuexy/form/pedidos/_albaranesItems.php | 24 +++ .../vuexy/form/pedidos/_cabeceraItems.php | 6 +- .../vuexy/form/pedidos/_facturasItems.php | 24 +++ .../vuexy/form/pedidos/_lineasItems.php | 162 ++++++++++------- .../vuexy/form/pedidos/viewPedidoForm.php | 11 ++ 12 files changed, 418 insertions(+), 83 deletions(-) create mode 100644 ci4/app/Views/themes/vuexy/form/pedidos/_albaranesItems.php create mode 100644 ci4/app/Views/themes/vuexy/form/pedidos/_facturasItems.php diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index 0fa46c4e..cd29dcfc 100755 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -524,6 +524,7 @@ $routes->resource('clientedirecciones', ['namespace' => 'App\Controllers\Cliente $routes->group('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos'], function ($routes) { $routes->get('list/(:num)', 'Cosidotapablanda::list/$1', ['as' => 'cosidotapablandaList']); // HOMOGENIZAR CON ARGS DINAMICOS!!! $routes->get('add/(:num)', 'Cosidotapablanda::add/$1', ['as' => 'newCosidotapablanda']); + $routes->get('edit/(:any)', 'Cosidotapablanda::edit/$1', ['as' => 'editarPresupuesto']); $routes->post('add/(:num)', 'Cosidotapablanda::add/$1', ['as' => 'createCosidotapablanda']); $routes->post('create', 'Cosidotapablanda::create', ['as' => 'ajaxCreateCosidotapablanda']); $routes->put('(:num)/update', 'Cosidotapablanda::update/$1', ['as' => 'ajaxUpdateCosidotapablanda']); @@ -541,6 +542,7 @@ $routes->group('presupuestocliente', ['namespace' => 'App\Controllers\Presupuest $routes->get('add', 'Presupuestocliente::add', ['as' => 'nuevoPresupuestoCliente']); $routes->post('add', 'Presupuestocliente::add', ['as' => 'crearPresupuestoCliente']); $routes->post('edit/(:num)', 'Presupuestocliente::edit/$1', ['as' => 'editarPresupuestoCliente']); + $routes->get('edit/(:any)', 'Presupuestocliente::edit/$1', ['as' => 'editarPresupuestoCliente2']); $routes->post('getgramaje', 'Presupuestocliente::getGramaje', ['as' => 'obtenerGramaje']); $routes->post('presupuesto', 'Presupuestocliente::presupuesto', ['as' => 'presupuestoCliente']); $routes->post('getDireccionesCliente', 'Presupuestocliente::getDireccionesCliente', ['as' => 'getDirecciones']); @@ -598,6 +600,7 @@ $routes->group('pedidos', ['namespace' => 'App\Controllers\Pedidos'], function ( $routes->get('add', 'Pedido::add', ['as' => 'nuevoPedido']); $routes->post('add', 'Pedido::add', ['as' => 'crearPedido']); $routes->get('edit/(:any)', 'Pedido::edit/$1', ['as' => 'editarPedido']); + $routes->post('getlineas', 'Pedido::getLineas', ['as' => 'tablaLineasPedido']); }); $routes->resource('pedidos', ['namespace' => 'App\Controllers\Pedidos', 'controller' => 'Pedido', 'except' => 'show,new,create,update']); diff --git a/ci4/app/Controllers/Pedidos/Pedido.php b/ci4/app/Controllers/Pedidos/Pedido.php index f8d45fc3..c08bc6b7 100755 --- a/ci4/app/Controllers/Pedidos/Pedido.php +++ b/ci4/app/Controllers/Pedidos/Pedido.php @@ -27,6 +27,8 @@ class Pedido extends \App\Controllers\BaseResourceController $this->viewData['pageTitle'] = lang('Tarifaextra.moduleTitle'); // Se indica que este controlador trabaja con soft_delete + $this->viewData = ['usingServerSideDataTable' => true]; + // Breadcrumbs $this->viewData['breadcrumb'] = [ ['title' => lang("App.menu_pedidos"), 'route' => "javascript:void(0);", 'active' => false], @@ -130,6 +132,29 @@ class Pedido extends \App\Controllers\BaseResourceController } } + public function getlineas(){ + if ($this->request->isAJAX()) { + + $reqData = $this->request->getPost(); + if (!isset($reqData['draw']) || !isset($reqData['columns']) ) { + $errstr = 'No data available in response to this specific request.'; + $response = $this->respond(Collection::datatable( [], 0, 0, $errstr ), 400, $errstr); + return $response; + } + + $id = $reqData['pedido_id'] ?? 0; + $resourceData = $this->model->obtenerLineasPedido($id); + + return $this->respond(Collection::datatable( + $resourceData, + count($resourceData), + count($resourceData) + )); + } else { + return $this->failUnauthorized('Invalid request', 403); + } + } + private function obtenerDatosFormulario(&$pedidoEntity){ $datos = $this->model->obtenerDatosForm($pedidoEntity->id); diff --git a/ci4/app/Controllers/Test.php b/ci4/app/Controllers/Test.php index cccbe256..3b6973fc 100755 --- a/ci4/app/Controllers/Test.php +++ b/ci4/app/Controllers/Test.php @@ -20,18 +20,11 @@ class Test extends BaseController public function index() { - helper('rbac'); - - //$user = auth()->user(); - - //generate_php_permissions_constant(); - - echo generate_php_permissions_matrix_constant(); - - //$user->syncGroups('admin'); - - //var_dump($user->can('token.menu')); - + $model = new PresupuestoModel(); + $data = $model->generarLineaPedido(123); + echo '
';
+        var_dump($data);
+        echo '
'; } diff --git a/ci4/app/Language/en/Pedidos.php b/ci4/app/Language/en/Pedidos.php index 99ae4950..83a6714b 100644 --- a/ci4/app/Language/en/Pedidos.php +++ b/ci4/app/Language/en/Pedidos.php @@ -35,11 +35,31 @@ return [ 'fecha_entrega_externo' => 'External Delivery Date', 'lineas' => 'Lines', - + 'unidades' => "Units", + 'concepto' => "Concept", + 'total' => "Total", + 'presupuesto' => 'Budget', + 'moduleTitle' => 'Orders', 'pedido' => 'Order', 'pedidos' => 'Orders', 'pedidosList' => 'Orders List', + + 'unaCara' => '1 side', + 'dosCaras' => '2 sides', + + 'lineasTemplates' =>[ + 'libro' => "[BUDGET %s] Printing of %s copies of %s pages.\nTitle: %s. Author: %s. ISBN: %s.Size: %smm.\n", + 'libro_linea_interior' => "%s black pages on %s paper of %s grams", + 'libro_linea_cubierta' => "\nCover printed on %s on %s paper of %s grams", + 'libro_linea_sobrecubierta' => "\nDust jacket on %s paper of %s grams", + 'libro_solapas' => " with flaps of %smm.", + 'libro_encuadernacion' => "\nType of binding: %s" + ], + + 'albaranes' => 'Delivery Notes', + + 'facturas' => 'Invoices', 'validation' => [ diff --git a/ci4/app/Language/es/Pedidos.php b/ci4/app/Language/es/Pedidos.php index 08c27abe..5237a09d 100644 --- a/ci4/app/Language/es/Pedidos.php +++ b/ci4/app/Language/es/Pedidos.php @@ -34,12 +34,32 @@ return [ 'fecha_entrega_externo' => "Fecha entrega externo", 'lineas' => 'Líneas pedido', - + 'unidades' => "Unidades", + 'concepto' => "Concepto", + 'total' => "Total", + 'presupuesto' => 'Presupuesto', + 'moduleTitle' => 'Pedidos', 'pedido' => 'Pedido', 'pedidos' => 'Pedidos', 'pedidosList' => 'Lista de Pedidos', + + 'unaCara' => '1 cara', + 'dosCaras' => '2 caras', + + 'lineasTemplates' =>[ + 'libro' => "[PRESUPUESTO %s] Impresión de %s ejemplares de %s páginas.\nTítulo: %s. Autor: %s. ISBN: %s.Tamaño: %smm.\n", + 'libro_linea_interior' => "%s páginas en negro sobre papel %s de %s gramos", + 'libro_linea_cubierta' => "\nCubierta impresa a %s sobre papel %s de %s gramos", + 'libro_linea_sobrecubierta' => "\nSobrecubierta sobre papel %s de %s gramos", + 'libro_solapas' => " con solapas de %smm." , + 'libro_encuadernacion' => "\nTipo de encuadernación: %s" + ], + 'albaranes' => 'Albaranes', + + 'facturas' => 'Facturas', + 'validation' => [ ], diff --git a/ci4/app/Models/Pedidos/PedidoModel.php b/ci4/app/Models/Pedidos/PedidoModel.php index 4018529c..04755c6e 100644 --- a/ci4/app/Models/Pedidos/PedidoModel.php +++ b/ci4/app/Models/Pedidos/PedidoModel.php @@ -67,4 +67,22 @@ class PedidoModel extends \App\Models\BaseModel return $builder->get()->getResultObject(); } + + public function obtenerLineasPedido($pedido_id){ + $builder = $this->db + ->table($this->table . " t1") + ->select( + "t2.presupuesto_id" + ); + $builder->where("t1.id", $pedido_id); + $builder->join("pedidos_linea t2", "t2.pedido_id = t1.id", "left"); + $model_presupuesto = model("App\Models\Presupuestos\PresupuestoModel"); + $lineasPresupuesto = []; + + foreach($builder->get()->getResultObject() as $row){ + array_push($lineasPresupuesto, $model_presupuesto->generarLineaPedido($row->presupuesto_id)[0]); + } + + return $lineasPresupuesto; + } } \ No newline at end of file diff --git a/ci4/app/Models/Presupuestos/PresupuestoModel.php b/ci4/app/Models/Presupuestos/PresupuestoModel.php index e4cb1a6f..5d25dabe 100755 --- a/ci4/app/Models/Presupuestos/PresupuestoModel.php +++ b/ci4/app/Models/Presupuestos/PresupuestoModel.php @@ -538,5 +538,172 @@ class PresupuestoModel extends \App\Models\BaseModel return $json; } + public function generarLineaPedido($presupuesto_id) + { + $builder = $this->db + ->table($this->table . " t1") + ->select( + "t1.id AS numero, t1.tipo_impresion_id as tipo, t1.tirada AS unidades, t1.total_aceptado as total, t1.paginas AS paginas, + t1.titulo AS titulo, t1.autor AS autor, t1.isbn AS isbn, + t1.papel_formato_id AS papel_formato_id, t1.papel_formato_personalizado AS papel_formato_personalizado, + t1.papel_formato_ancho AS papel_formato_ancho, t1.papel_formato_alto AS papel_formato_alto, + CONCAT(CAST(t2.ancho AS INT), 'x', CAST(t2.alto AS INT)) AS tamanio, + t3.codigo AS codigo_encuadernacion, + t1.solapas AS solapas_cubierta, CAST(t1.solapas_ancho AS INT) AS solapas_ancho_cubierta, + t1.solapas_sobrecubierta AS solapas_sobrecubierta, CAST(t1.solapas_ancho_sobrecubierta AS INT) AS solapas_ancho_sobrecubierta," + ); + $builder->join("lg_papel_formato t2", "t1.papel_formato_id = t2.id", "left"); + $builder->join("tipos_presupuestos t3", "t1.tipo_impresion_id = t3.id", "left"); + $builder->where("t1.is_deleted", 0); + $builder->where("t1.id", $presupuesto_id); + $presupuesto = $builder->get()->getResultObject(); + if(count($presupuesto) > 0){ + + $modelLinea = model('App\Models\Presupuestos\PresupuestoLineaModel'); + $lineas = $modelLinea->where('presupuesto_id', $presupuesto_id)->findAll(); + + $presupuesto = $presupuesto[0]; + + // Libro + if($presupuesto->tipo < 10){ + if($presupuesto->papel_formato_personalizado == 1){ + $presupuesto->tamanio= $presupuesto->papel_formato_ancho . "x" . $presupuesto->papel_formato_alto; + } + + $presupuesto->concepto = sprintf(lang('Pedidos.lineasTemplates.libro'), + $presupuesto->numero, + $presupuesto->unidades, + $presupuesto->paginas, + $presupuesto->titulo, + $presupuesto->autor, + $presupuesto->isbn, + $presupuesto->tamanio); + $presupuesto->concepto .= $this->generarConceptoLineasPresupuestoLibro($lineas, $presupuesto); + + $presupuesto = (object)[ + 'numero' => $presupuesto->numero, + 'unidades' => $presupuesto->unidades, + 'total' => $presupuesto->total, + 'concepto' => $presupuesto->concepto, + ]; + } + return [$presupuesto]; + } + + } + + private function generarConceptoLineasPresupuestoLibro($lineas, $presupuesto){ + + $model_papel = model('App\Models\Configuracion\PapelImpresionModel'); + $description_interior = ""; + $description_cubierta = ""; + $description_sobrecubierta = ""; + $paginas_negro = 0; + $paginas_color = 0; + $papel_negro = ""; + $papel_color = ""; + $gramaje_negro = 0; + $gramaje_color = 0; + + $lp_bn_lines = array_filter($lineas, function($linea) { + return strpos($linea->tipo, 'lp_bn') === 0; + }); + $lp_color_lines = array_filter($lineas, function($linea) { + return strpos($linea->tipo, 'lp_color') === 0; + }); + + $lp_rot_bn = array_filter($lineas, function($linea) { + return strpos($linea->tipo, 'lp_rot_bn') === 0; + }); + + $lp_rot_color = array_filter($lineas, function($linea) { + return strpos($linea->tipo, 'lp_rot_color') === 0; + }); + + if(count($lp_bn_lines) > 0){ + $lp_bn_lines = array_values($lp_bn_lines)[0]; + $paginas_negro = $lp_bn_lines->paginas; + $gramaje_negro = $lp_bn_lines->gramaje; + $papel_negro = $model_papel->where('id', $lp_bn_lines->papel_impresion_id)->first()->nombre; + $description_interior .= sprintf(lang('Pedidos.lineasTemplates.libro_linea_interior'), + strval($paginas_negro), + $papel_negro, + strval($gramaje_negro)) . ". "; + } + if(count($lp_color_lines) > 0){ + $lp_color_lines = array_values($lp_color_lines)[0]; + $paginas_color = $lp_color_lines->paginas; + $gramaje_color = $lp_color_lines->gramaje; + $papel_color = $model_papel->where('id', $lp_color_lines->papel_impresion_id)->first()->nombre; + $description_interior .= sprintf(lang('Pedidos.lineasTemplates.libro_linea_interior'), + strval($paginas_color), + $papel_color, + strval($gramaje_color)) . ". "; + } + + if(count($lp_rot_bn) > 0){ + $lp_rot_bn = array_values($lp_rot_bn)[0]; + $paginas_negro = $lp_rot_bn->paginas; + $gramaje_negro = $lp_rot_bn->gramaje; + $papel_negro = $model_papel->where('id', $lp_rot_bn->papel_impresion_id)->first()->nombre; + $description_interior .= sprintf(lang('Pedidos.lineasTemplates.libro_linea_interior'), + strval($paginas_negro), + $papel_negro, + strval($gramaje_negro)) . ". "; + } + + if(count($lp_rot_color) > 0){ + $lp_rot_color = array_values($lp_rot_color)[0]; + $paginas_negro = intval($lp_rot_color->paginas)-intval($lp_rot_color->rotativa_pag_color); + $gramaje = $lp_rot_color->gramaje; + $papel = $model_papel->where('id', $lp_rot_color->papel_impresion_id)->first()->nombre; + if($paginas_negro > 0){ + $description_interior .= sprintf(lang('Pedidos.lineasTemplates.libro_linea_interior'), + strval($paginas_negro), + $papel, + strval($gramaje)) . ". "; + } + + $description_interior .= sprintf(lang('Pedidos.lineasTemplates.libro_linea_interior'), + strval($lp_rot_color->rotativa_pag_color), + $papel, + strval($gramaje)) . ". "; + } + + $lp_cubierta = array_filter($lineas, function($linea) { + return strpos($linea->tipo, 'lp_cubierta') === 0; + }); + $lp_sobrecubierta = array_filter($lineas, function($linea) { + return strpos($linea->tipo, 'lp_sobrecubierta') === 0; + }); + + if(count($lp_cubierta) > 0){ + $lp_cubierta = array_values($lp_cubierta)[0]; + if($lp_cubierta->paginas == 2){ + $lp_cubierta->caras = lang('Pedidos.unaCara'); + } + else{ + $lp_cubierta->caras = lang('Pedidos.dosCaras'); + } + $description_cubierta = sprintf(lang('Pedidos.lineasTemplates.libro_linea_cubierta'), + $lp_cubierta->caras, + $model_papel->where('id', $lp_cubierta->papel_impresion_id)->first()->nombre, + strval($lp_cubierta->gramaje)); + $description_cubierta .= ($presupuesto->solapas_cubierta==1? sprintf(lang('Pedidos.lineasTemplates.libro_solapas'), $presupuesto->solapas_ancho_cubierta):". "); + } + if(count($lp_sobrecubierta) > 0){ + $lp_sobrecubierta = array_values($lp_sobrecubierta)[0]; + $description_sobrecubierta = sprintf(lang('Pedidos.lineasTemplates.libro_linea_sobrecubierta'), + $model_papel->where('id', $lp_sobrecubierta->papel_impresion_id)->first()->nombre, + strval($lp_sobrecubierta->gramaje)); + $description_sobrecubierta .= ($presupuesto->solapas_sobrecubierta==1? sprintf(lang('Pedidos.lineasTemplates.libro_solapas'), $presupuesto->solapas_ancho_sobrecubierta):". "); + } + + $acabado = sprintf(lang('Pedidos.lineasTemplates.libro_encuadernacion'), + lang('Presupuestos.' . $presupuesto->codigo_encuadernacion)); + + return $description_interior. $description_cubierta . $description_sobrecubierta . $acabado; + + } } diff --git a/ci4/app/Views/themes/vuexy/form/pedidos/_albaranesItems.php b/ci4/app/Views/themes/vuexy/form/pedidos/_albaranesItems.php new file mode 100644 index 00000000..d9024819 --- /dev/null +++ b/ci4/app/Views/themes/vuexy/form/pedidos/_albaranesItems.php @@ -0,0 +1,24 @@ +
+ +
+

+ +

+ +
+
+ + +
+
+
+
+ + +section('additionalInlineJs') ?> + + + +endSection() ?> \ No newline at end of file diff --git a/ci4/app/Views/themes/vuexy/form/pedidos/_cabeceraItems.php b/ci4/app/Views/themes/vuexy/form/pedidos/_cabeceraItems.php index 19dac6f8..d1a0f0f9 100644 --- a/ci4/app/Views/themes/vuexy/form/pedidos/_cabeceraItems.php +++ b/ci4/app/Views/themes/vuexy/form/pedidos/_cabeceraItems.php @@ -27,7 +27,7 @@ @@ -60,7 +60,7 @@

@@ -95,7 +95,7 @@

diff --git a/ci4/app/Views/themes/vuexy/form/pedidos/_facturasItems.php b/ci4/app/Views/themes/vuexy/form/pedidos/_facturasItems.php new file mode 100644 index 00000000..c3871138 --- /dev/null +++ b/ci4/app/Views/themes/vuexy/form/pedidos/_facturasItems.php @@ -0,0 +1,24 @@ +
+ +
+

+ +

+ +
+
+ + +
+
+
+
+ + +section('additionalInlineJs') ?> + + + +endSection() ?> \ No newline at end of file diff --git a/ci4/app/Views/themes/vuexy/form/pedidos/_lineasItems.php b/ci4/app/Views/themes/vuexy/form/pedidos/_lineasItems.php index 132fdfb5..a28164e5 100644 --- a/ci4/app/Views/themes/vuexy/form/pedidos/_lineasItems.php +++ b/ci4/app/Views/themes/vuexy/form/pedidos/_lineasItems.php @@ -13,24 +13,21 @@ - - - - - - - - - - - - - + + + + + - + + + + + +
Total:
@@ -40,64 +37,97 @@ section('additionalInlineJs') ?> -$("#fecha_entrega_real").flatpickr({ - dateFormat: "d/m/Y", - locale: { - firstDayOfWeek: 1, - weekdays: { - shorthand: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'], - longhand: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'], - }, - months: { - shorthand: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Оct', 'Nov', 'Dic'], - longhand: ['Enero', 'Febreo', 'Мarzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'], +const lastColNr = $('#tableOfLineasPedido').find("tr:first th").length - 1; +const viewPresupuestoBtns = function(data) { + return ` + +
+ +
+ `; +}; + +var tableOfLineasPedido = new DataTable('#tableOfLineasPedido',{ + processing: true, + serverSide: true, + autoWidth: true, + responsive: true, + scrollX: true, + searchable: false, + info: false, + dom: '', + language: { + url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json" + }, + ajax : $.fn.dataTable.pipeline( { + url: '', + data: function ( d ) { + d.pedido_id = id ?>; }, + method: 'POST', + headers: {'X-Requested-With': 'XMLHttpRequest'}, + async: true, + }), + columnDefs: [ + { + targets: 0, + orderable: false, + data: null, + defaultContent: '' }, + { + targets: [1,2,3], + orderable: false, + }, + ], + columns: [ + { + data: viewPresupuestoBtns, + className: 'dt-center' + }, + {data: 'unidades'}, + {data: 'concepto'}, + {data: 'total'}, + ], + footerCallback: function (row, data, start, end, display) { + let api = this.api(); + + // Remove the formatting to get integer data for summation + let intVal = function (i) { + return typeof i === 'string' + ? i.replace(/[\$,]/g, '') * 1 + : typeof i === 'number' + ? i + : 0; + }; + + // Total over all pages + total = api + .column(3) + .data() + .reduce((a, b) => intVal(a) + intVal(b), 0); + + // Update footer + api.column(3).footer().innerHTML = + 'Total: ' + total; + } }); -$("#fecha_impresion").flatpickr({ - dateFormat: "d/m/Y", - locale: { - firstDayOfWeek: 1, - weekdays: { - shorthand: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'], - longhand: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'], - }, - months: { - shorthand: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Оct', 'Nov', 'Dic'], - longhand: ['Enero', 'Febreo', 'Мarzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'], - }, - }, -}); -$("#fecha_encuadernado").flatpickr({ - dateFormat: "d/m/Y", - locale: { - firstDayOfWeek: 1, - weekdays: { - shorthand: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'], - longhand: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'], - }, - months: { - shorthand: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Оct', 'Nov', 'Dic'], - longhand: ['Enero', 'Febreo', 'Мarzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'], - }, - }, -}); -$("#fecha_entrega_externo").flatpickr({ - dateFormat: "d/m/Y", - locale: { - firstDayOfWeek: 1, - weekdays: { - shorthand: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'], - longhand: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'], - }, - months: { - shorthand: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Оct', 'Nov', 'Dic'], - longhand: ['Enero', 'Febreo', 'Мarzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'], - }, - }, + +$(document).on('click', '.btn-view', function(e) { + user()->inGroup('admin') || auth()->user()->inGroup('beta')): ?> + var url = ''; + + var url = ''; + + url = url.replace(':id', `${$(this).attr('data-id')}` ); + console.log(url); + window.open( + url, + '_blank' // <- This is what makes it open in a new window. + ); }); endSection() ?> \ No newline at end of file diff --git a/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidoForm.php b/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidoForm.php index b65da3c8..4b8e3f10 100644 --- a/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidoForm.php +++ b/ci4/app/Views/themes/vuexy/form/pedidos/viewPedidoForm.php @@ -17,6 +17,8 @@ getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?> + +
"btn btn-secondary float-start"]) ?> @@ -30,9 +32,18 @@ section('css') ?> "> + "> endSection() ?> section('additionalExternalJs') ?> + + + + + + + + endSection() ?>