diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index 4015ad4c..3405984e 100644 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -93,6 +93,12 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion'] $routes->delete('delete/(:num)', 'ConfigVariables::delete/$1', ['as' => 'deleteVariable']); $routes->get('datatable', 'ConfigVariables::datatable', ['as' => 'datatableVariables']); }); + $routes->group("errores-presupuesto",["namespace" => 'App\Controllers\Configuracion'],function($routes){ + $routes->get('', 'ErrorPresupuestoController::index', ['as' => 'errorPresupuestoIndex']); + $routes->get('edit', 'ErrorPresupuestoController::viewForm/$1', ['as' => 'errorPresupuestoFormIndex']); + $routes->get('datatable', 'ErrorPresupuestoController::datatable', ['as' => 'errorPresupuestoDatatable']); + $routes->post('edit/(:num)', 'ErrorPresupuestoController::update_error_presupuesto/$1', ['as' => 'updateErrorPresupuesto']); + }); }); diff --git a/ci4/app/Controllers/Configuracion/ErrorPresupuestoController.php b/ci4/app/Controllers/Configuracion/ErrorPresupuestoController.php new file mode 100644 index 00000000..0a5d0c28 --- /dev/null +++ b/ci4/app/Controllers/Configuracion/ErrorPresupuestoController.php @@ -0,0 +1,80 @@ +errorPresupuestoModel = model(ErrorPresupuesto::class); + + } + + + public function index() + { + + $viewData = [ + 'currentModule' => static::$controllerSlug, + ]; + + $viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class + + return view(static::$viewPath . $this->indexRoute, $viewData); + } + public function viewForm(int $error_presupuesto_id) + { + + $viewData = [ + 'currentModule' => static::$controllerSlug, + 'errorPresupuesto' => $this->errorPresupuestoModel->find($error_presupuesto_id), + ]; + + return view(static::$viewPath . $this->indexRoute, $viewData); + + } + public function store(){ + $data = []; + $variableCreated = $this->errorPresupuestoModel->store($data); + return $this->response->setJSON($variableCreated); + } + public function get(int $error_presupuesto_id){ + $data = $this->errorPresupuestoModel->find($error_presupuesto_id); + return $this->response->setJSON($data); + } + public function updateErrorPresupuesto(int $error_presupuesto_id){ + + } + + public function datatable(){ + + $query = $this->errorPresupuestoModel->getQueryDatatable(); + return DataTable::of($query) + ->add("action",fn($q) => $q->id) + ->toJson(true); + } + + +} \ No newline at end of file diff --git a/ci4/app/Language/es/App.php b/ci4/app/Language/es/App.php index 57857bae..80a35a45 100755 --- a/ci4/app/Language/es/App.php +++ b/ci4/app/Language/es/App.php @@ -684,6 +684,7 @@ return [ "menu_configuration" => "Configuración", "menu_variables" => "Variables sistema", + "menu_error_presupuesto" => "Errores presupuesto", "menu_calendario" => "Calendario", "menu_paises" => "Paises", "menu_correo" => "Correo", diff --git a/ci4/app/Language/es/ErrorPresupuesto.php b/ci4/app/Language/es/ErrorPresupuesto.php new file mode 100644 index 00000000..2616f0b7 --- /dev/null +++ b/ci4/app/Language/es/ErrorPresupuesto.php @@ -0,0 +1,21 @@ + "Errores presupuesto", + + "datatable" => + [ + "columns" => [ + "presupuesto_user "=> "Usuario presupuesto", + "last_user_id" => "Último usuario", + "visto" => "Visto", + "created_at" => "Creado" + ] + ], + "form" => + [ + "name" => "Nombre", + "value" => "Valor", + "description" => "Descripción", + ] +]; diff --git a/ci4/app/Models/Presupuestos/ErrorPresupuesto.php b/ci4/app/Models/Presupuestos/ErrorPresupuesto.php new file mode 100644 index 00000000..09bd6f4f --- /dev/null +++ b/ci4/app/Models/Presupuestos/ErrorPresupuesto.php @@ -0,0 +1,86 @@ +insert([ + "presupuesto_id" => $presupuesto_id, + "presupuesto_user_id" => $presupuesto_user_id, + "error" => $error, + "datos" => json_encode($datos) + ]); + + } + public function getQueryDatatable() : BaseBuilder + { + $query = $this->builder() + ->select([ + "presupuesto_errores.id", + "CONCAT(t1.first_name,' ',t1.last_name) as presupuestoUser", + "CONCAT(t2.first_name,' ',t2.last_name) as lastUser", + "presupuestos.titulo as presupuestoTitulo", + "presupuesto_errores.created_at", + "presupuesto_errores.datos", + "presupuesto_errores.visto", + ]) + ->join("users t1","t1.id = presupuesto_errores.presupuesto_user_id","left") + ->join("users t2","t2.id = presupuesto_errores.last_user_id","left") + ->join("presupuestos","presupuestos.id = presupuesto_errores.presupuesto_id","left") + ->where("presupuesto_errores.deleted_at",null); + return $query; + } +} diff --git a/ci4/app/Views/themes/vuexy/form/configuracion/error_presupuesto/viewErrorPresupuestoForm.php b/ci4/app/Views/themes/vuexy/form/configuracion/error_presupuesto/viewErrorPresupuestoForm.php new file mode 100644 index 00000000..0a3a4a5e --- /dev/null +++ b/ci4/app/Views/themes/vuexy/form/configuracion/error_presupuesto/viewErrorPresupuestoForm.php @@ -0,0 +1,52 @@ +include('themes/_commonPartialsBs/select2bs5') ?> +include('themes/_commonPartialsBs/datatables') ?> +include('themes/_commonPartialsBs/_confirm2delete') ?> +extend('themes/vuexy/main/defaultlayout') ?> + +section('content'); ?> +
+
+ +
+
+

[id ?>]Error presupuesto

+
+
+ + +
+ +
+
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+ +
+ +
+
+ +endSection() ?> +section("additionalExternalJs") ?> + +endSection() ?> \ No newline at end of file diff --git a/ci4/app/Views/themes/vuexy/form/configuracion/error_presupuesto/viewErrorPresupuestoList.php b/ci4/app/Views/themes/vuexy/form/configuracion/error_presupuesto/viewErrorPresupuestoList.php new file mode 100644 index 00000000..86d9d571 --- /dev/null +++ b/ci4/app/Views/themes/vuexy/form/configuracion/error_presupuesto/viewErrorPresupuestoList.php @@ -0,0 +1,44 @@ +include('themes/_commonPartialsBs/select2bs5') ?> +include('themes/_commonPartialsBs/datatables') ?> +include('themes/_commonPartialsBs/_confirm2delete') ?> +extend('themes/vuexy/main/defaultlayout') ?> + +section('content'); ?> +
+
+ +
+
+

+
+
+ + + + + + + + + + + + + + + + + + +
#PresupuestoUsuario
+
+ +
+
+
+endSection() ?> +section("additionalExternalJs") ?> + +endSection() ?> \ No newline at end of file diff --git a/ci4/app/Views/themes/vuexy/main/menus/configuracion_menu.php b/ci4/app/Views/themes/vuexy/main/menus/configuracion_menu.php index 6b1f65b9..d131ab86 100644 --- a/ci4/app/Views/themes/vuexy/main/menus/configuracion_menu.php +++ b/ci4/app/Views/themes/vuexy/main/menus/configuracion_menu.php @@ -105,6 +105,13 @@ if ( + user()->inGroup('admin') || auth()->user()->inGroup('beta')) { ?> + + \ No newline at end of file diff --git a/httpdocs/assets/js/safekat/pages/configuracion/error_presupuesto/errorPresupuesto.js b/httpdocs/assets/js/safekat/pages/configuracion/error_presupuesto/errorPresupuesto.js new file mode 100644 index 00000000..d4936882 --- /dev/null +++ b/httpdocs/assets/js/safekat/pages/configuracion/error_presupuesto/errorPresupuesto.js @@ -0,0 +1,47 @@ + +class ErrorPresupuestoView { + constructor(domItem) { + this.item = domItem + this.datatableItem = this.item.find("#tableErrorPresupuesto") + this.datatableColumns = [ + { data: 'id', name: "id", searchable: true, sortable: false }, + { data: 'presupuestoTitulo',searchable: true, sortable: false }, + { data: 'presupuestoUser',searchable: true, sortable: false }, + { data: 'lastUser', searchable: true, sortable: false }, + { data: 'visto', searchable: false, sortable: false , + render : (d,t) => { + const iconClass = d ? "ti ti-sm ti-check" : "ti ti-sm ti-x" + return `` + } + }, + { data: 'created_at', searchable: false, sortable: true }, + { + data: 'action', sortable: false, searchable: false, + render: (d, t) => { + return ` +
+ +
+ ` + } + }, + ] + } + init() { + this.datatable = this.datatableItem.DataTable({ + processing: true, + dom: 'Brtip', + serverSide: true, + + language: { + url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json" + }, + columns: this.datatableColumns, + ajax: '/configuracion/errores-presupuesto/datatable' + }); + + } + +} + +export default ErrorPresupuestoView; \ No newline at end of file diff --git a/httpdocs/assets/js/safekat/pages/configuracion/error_presupuesto/errorPresupuestoForm.js b/httpdocs/assets/js/safekat/pages/configuracion/error_presupuesto/errorPresupuestoForm.js new file mode 100644 index 00000000..790b8e7f --- /dev/null +++ b/httpdocs/assets/js/safekat/pages/configuracion/error_presupuesto/errorPresupuestoForm.js @@ -0,0 +1,44 @@ +import Ajax from "../../../components/ajax.js" + + + +class ErrorPresupuestoView { + constructor(domItem) { + this.item = domItem + this.datatableItem = this.item.find("#tableErrorPresupuesto") + this.datatableColumns = [ + { data: 'id', searchable: true, sortable: false }, + { data: 'presupuestoTitulo', searchable: true, sortable: false }, + { data: 'presupuestoUser', searchable: true, sortable: false }, + { data: 'visto', searchable: false, sortable: false }, + { data: 'lastUser', searchable: true, sortable: false }, + { + data: 'action', sortable: false, searchable: false, + render: (d, t) => { + return ` +
+ +
+ ` + } + }, + ] + } + init() { + this.datatable = this.datatableItem.DataTable({ + processing: true, + dom: 'Brtip', + serverSide: true, + + language: { + url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json" + }, + columns: this.datatableColumns, + ajax: '/configuracion/errores-presupuesto/datatable' + }); + + } + +} + +export default ErrorPresupuestoView; \ No newline at end of file diff --git a/httpdocs/assets/js/safekat/pages/configuracion/error_presupuesto/indexForm.js b/httpdocs/assets/js/safekat/pages/configuracion/error_presupuesto/indexForm.js new file mode 100644 index 00000000..e69de29b diff --git a/httpdocs/assets/js/safekat/pages/configuracion/error_presupuesto/indexView.js b/httpdocs/assets/js/safekat/pages/configuracion/error_presupuesto/indexView.js new file mode 100644 index 00000000..2d1f28b0 --- /dev/null +++ b/httpdocs/assets/js/safekat/pages/configuracion/error_presupuesto/indexView.js @@ -0,0 +1,6 @@ +import ErrorPresupuestoView from "./errorPresupuesto.js"; + +$(document).ready(()=>{ + const errorPresupuesto = new ErrorPresupuestoView($("#errorPresupuestoCard")) + errorPresupuesto.init() +}) \ No newline at end of file diff --git a/xdebug.log b/xdebug.log index 0a9383a8..18265e14 100644 --- a/xdebug.log +++ b/xdebug.log @@ -25519,3 +25519,23 @@ [348] Log closed at 2024-10-17 17:34:23.659733 +[7640] Log opened at 2024-10-17 21:51:03.869662 +[7640] [Config] INFO: Control socket set up succesfully: '@xdebug-ctrl.7640' +[7640] [Step Debug] INFO: Connecting to configured address/port: 172.28.188.187:9003. +[7640] [Step Debug] ERR: Time-out connecting to debugging client, waited: 200 ms. Tried: 172.28.188.187:9003 (through xdebug.client_host/xdebug.client_port). +[7640] [Step Debug] INFO: Connecting to configured address/port: 172.28.188.187:9003. +[7640] [Step Debug] ERR: Time-out connecting to debugging client, waited: 200 ms. Tried: 172.28.188.187:9003 (through xdebug.client_host/xdebug.client_port). +[7640] Log closed at 2024-10-17 21:51:04.556593 + +[9851] Log opened at 2024-10-17 21:54:30.472221 +[9851] [Config] INFO: Control socket set up succesfully: '@xdebug-ctrl.9851' +[9851] [Step Debug] INFO: Connecting to configured address/port: 172.28.188.187:9003. +[9851] [Step Debug] ERR: Time-out connecting to debugging client, waited: 200 ms. Tried: 172.28.188.187:9003 (through xdebug.client_host/xdebug.client_port). +[10190] Log opened at 2024-10-17 21:54:55.986235 +[10190] [Config] INFO: Control socket set up succesfully: '@xdebug-ctrl.10190' +[10190] [Step Debug] INFO: Connecting to configured address/port: 172.28.188.187:9003. +[10190] [Step Debug] ERR: Time-out connecting to debugging client, waited: 200 ms. Tried: 172.28.188.187:9003 (through xdebug.client_host/xdebug.client_port). +[10190] [Step Debug] INFO: Connecting to configured address/port: 172.28.188.187:9003. +[10190] [Step Debug] ERR: Time-out connecting to debugging client, waited: 200 ms. Tried: 172.28.188.187:9003 (through xdebug.client_host/xdebug.client_port). +[10190] Log closed at 2024-10-17 21:55:14.675874 +