From b3cc82636d8cbf4b05e488ed14f3a75f0f2f99fa Mon Sep 17 00:00:00 2001 From: Jaime Jimenez Date: Fri, 14 Feb 2025 12:14:23 +0100 Subject: [PATCH 1/9] empezada la estructura de tickets --- ci4/app/Config/Routes.php | 16 ++ .../Controllers/Soporte/Ticketcontroller.php | 189 ++++++++++++++++++ ...025-02-14-114500_create_tickets_system.php | 80 ++++++++ ci4/app/Entities/Soporte/TicketEntity.php | 52 +++++ ci4/app/Language/es/App.php | 4 + ci4/app/Language/es/Tickets.php | 9 + ci4/app/Models/Soporte/ticketModel.php | 26 +++ .../vuexy/form/soporte/viewTicketForm.php | 50 +++++ .../vuexy/form/soporte/viewTicketList.php | 0 .../themes/vuexy/main/menu_impresion.php | 2 + .../themes/vuexy/main/menus/soporte_menu.php | 22 ++ 11 files changed, 450 insertions(+) create mode 100644 ci4/app/Controllers/Soporte/Ticketcontroller.php create mode 100644 ci4/app/Database/Migrations/2025-02-14-114500_create_tickets_system.php create mode 100644 ci4/app/Entities/Soporte/TicketEntity.php create mode 100644 ci4/app/Language/es/Tickets.php create mode 100644 ci4/app/Models/Soporte/ticketModel.php create mode 100644 ci4/app/Views/themes/vuexy/form/soporte/viewTicketForm.php create mode 100644 ci4/app/Views/themes/vuexy/form/soporte/viewTicketList.php create mode 100644 ci4/app/Views/themes/vuexy/main/menus/soporte_menu.php diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index 3b03dfa2..264e3ad3 100644 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -909,6 +909,22 @@ $routes->group('chat', ['namespace' => 'App\Controllers\Chat'], function ($route }); +$routes->group('messages', ['namespace' => 'App\Controllers\Chat'], function ($routes) { + $routes->get('datatable', 'ChatController::datatable_messages', ['as' => 'getDatatableMessages']); + $routes->get('datatable/presupuesto', 'ChatController::datatable_presupuesto_messages', ['as' => 'getDatatablePresupuestoMessages']); + $routes->get('datatable/pedido', 'ChatController::datatable_pedido_messages', ['as' => 'getDatatablePedidoMessages']); + $routes->get('datatable/factura', 'ChatController::datatable_factura_messages', ['as' => 'getDatatableFacturaMessages']); + + $routes->post('direct', 'ChatController::store_new_direct_message', ['as' => 'storeNewDirectMessage']); + $routes->post('direct/client', 'ChatController::store_new_direct_message_client', ['as' => 'storeNewDirectMessageClient']); +}); + + +$routes->group('soporte', ['namespace' => 'App\Controllers\Soporte'], function ($routes) { + $routes->get('', 'Ticketcontroller::index', ['as' => 'TicketIndex']); + $routes->get('add', 'Ticketcontroller::add', ['as' => 'NewTicket']); +}); + $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], function ($routes) { $routes->group('ordentrabajo', ['namespace' => 'App\Controllers\Produccion'], function ($routes) { diff --git a/ci4/app/Controllers/Soporte/Ticketcontroller.php b/ci4/app/Controllers/Soporte/Ticketcontroller.php new file mode 100644 index 00000000..7e47dbe1 --- /dev/null +++ b/ci4/app/Controllers/Soporte/Ticketcontroller.php @@ -0,0 +1,189 @@ +viewData['pageTitle'] = lang('Tickets.moduleTitle'); + + // Breadcrumbs + $this->viewData['breadcrumb'] = [ + ['title' => lang("App.menu_soporte"), 'route' => "javascript:void(0);", 'active' => false], + ['title' => lang("App.menu_ticket_list"), 'route' => route_to('TicketIndex'), 'active' => true] + ]; + + parent::initController($request, $response, $logger); + + } + + public function index() + { + //checkPermission('tickets.menu'); + + $this->viewData['usingClientSideDataTable'] = true; + + $this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('Tarifaextra.tarifaextra')]); + parent::index(); + + } + + public function add() + { + + //checkPermission('tickets.create', $this->indexRoute); + + if ($this->request->getPost()) : + + $nullIfEmpty = false; // !(phpversion() >= '8.1'); + + $postData = $this->request->getPost(); + $sanitizedData = $this->sanitized($postData, $nullIfEmpty); + + + $noException = true; + if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : + + + if ($this->canValidate()) : + try { + $successfulResult = $this->model->skipValidation(true)->save($sanitizedData); + } catch (\Exception $e) { + $noException = false; + $this->dealWithException($e); + } + else: + $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [lang('Basic.global.record')]); + $this->session->setFlashdata('formErrors', $this->model->errors()); + endif; + + $thenRedirect = true; // Change this to false if you want your user to stay on the form after submission + endif; + if ($noException && $successfulResult) : + + $id = $this->model->db->insertID(); + + $message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.'; + + if ($thenRedirect) : + if (!empty($this->indexRoute)) : + return redirect()->to(route_to($this->indexRoute))->with('successMessage', $message); + else: + return $this->redirect2listView('successMessage', $message); + endif; + else: + $this->session->setFlashData('sweet-success', $message); + endif; + + endif; // $noException && $successfulResult + + endif; // ($requestMethod === 'post') + + $this->viewData['ticketEntity'] = isset($sanitizedData) ? new TicketEntity($sanitizedData) : new TicketEntity(); + + $this->viewData['formAction'] = route_to('NewTicket'); + + $this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Tarifaextra.tarifaextra') . ' ' . lang('Basic.global.addNewSuffix'); + + + return $this->displayForm(__METHOD__); + } // end function add() + + public function edit($requestedId = null) + { + /* + checkPermission('tarifa-extra.edit', $this->indexRoute); + + if ($requestedId == null) : + return $this->redirect2listView(); + endif; + $id = filter_var($requestedId, FILTER_SANITIZE_URL); + $tarifaextraEntity = $this->model->find($id); + + if ($tarifaextraEntity == false) : + $message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Tarifaextra.tarifaextra')), $id]); + return $this->redirect2listView('errorMessage', $message); + endif; + + if ($this->request->getPost()) : + + $postData = $this->request->getPost(); + $sanitizedData = $this->sanitized($postData, true); + + // JJO + if (isset($this->model->user_updated_id)) { + $sanitizedData['user_updated_id'] = auth()->user()->id; + } + if ($this->request->getPost('mostrar_en_presupuesto') == null) { + $sanitizedData['mostrar_en_presupuesto'] = false; + } + + $noException = true; + if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : + if ($this->canValidate()) : + try { + $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); + } catch (\Exception $e) { + $noException = false; + $this->dealWithException($e); + } + else: + $this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Tarifaextra.tarifaextra'))]); + $this->session->setFlashdata('formErrors', $this->model->errors()); + + endif; + + $tarifaextraEntity->fill($sanitizedData); + + $thenRedirect = false; + endif; + if ($noException && $successfulResult) : + $id = $tarifaextraEntity->id ?? $id; + $message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.'; + + if ($thenRedirect) : + if (!empty($this->indexRoute)) : + return redirect()->to(route_to($this->indexRoute))->with('successMessage', $message); + else: + return $this->redirect2listView('successMessage', $message); + endif; + else: + $this->session->setFlashData('sweet-success', $message); + endif; + + endif; // $noException && $successfulResult + endif; // ($requestMethod === 'post') + + $this->viewData['tarifaextraEntity'] = $tarifaextraEntity; + + $this->viewData['formAction'] = route_to('updateTarifaextra', $id); + + $this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Tarifaextra.tarifaextra') . ' ' . lang('Basic.global.edit3'); + + + return $this->displayForm(__METHOD__, $id); + */ + } // end function edit(...) + +} diff --git a/ci4/app/Database/Migrations/2025-02-14-114500_create_tickets_system.php b/ci4/app/Database/Migrations/2025-02-14-114500_create_tickets_system.php new file mode 100644 index 00000000..bfcd870e --- /dev/null +++ b/ci4/app/Database/Migrations/2025-02-14-114500_create_tickets_system.php @@ -0,0 +1,80 @@ +forge->addField([ + 'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true], + 'nombre' => ['type' => 'VARCHAR', 'constraint' => 100, 'unique' => true], + ]); + $this->forge->addPrimaryKey('id'); + $this->forge->createTable('categorias'); + + // Tabla de Estados + $this->forge->addField([ + 'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true], + 'nombre' => ['type' => 'VARCHAR', 'constraint' => 100, 'unique' => true], + ]); + $this->forge->addPrimaryKey('id'); + $this->forge->createTable('estados'); + + // Tabla de Tickets + $this->forge->addField([ + 'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true], + 'usuario_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true], + 'categoria_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true], + 'estado_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true], + 'prioridad' => ['type' => 'ENUM', 'constraint' => ['alta', 'media', 'baja'], 'default' => 'media'], + 'titulo' => ['type' => 'VARCHAR', 'constraint' => 255], + 'descripcion' => ['type' => 'TEXT'], + 'created_at' => ['type' => 'DATETIME', 'null' => true], + 'updated_at' => ['type' => 'DATETIME', 'null' => true], + ]); + $this->forge->addPrimaryKey('id'); + $this->forge->addForeignKey('usuario_id', 'users', 'id', 'CASCADE', 'CASCADE'); + $this->forge->addForeignKey('categoria_id', 'categorias', 'id', 'CASCADE', 'CASCADE'); + $this->forge->addForeignKey('estado_id', 'estados', 'id', 'CASCADE', 'CASCADE'); + $this->forge->createTable('tickets'); + + // Tabla de Respuestas + $this->forge->addField([ + 'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true], + 'ticket_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true], + 'usuario_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true], + 'mensaje' => ['type' => 'TEXT'], + 'created_at' => ['type' => 'DATETIME', 'null' => true], + ]); + $this->forge->addPrimaryKey('id'); + $this->forge->addForeignKey('ticket_id', 'tickets', 'id', 'CASCADE', 'CASCADE'); + $this->forge->addForeignKey('usuario_id', 'users', 'id', 'CASCADE', 'CASCADE'); + $this->forge->createTable('respuestas'); + + // Tabla de Adjuntos + $this->forge->addField([ + 'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true], + 'ticket_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => true], + 'respuesta_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => true], + 'archivo' => ['type' => 'VARCHAR', 'constraint' => 255], + 'created_at' => ['type' => 'DATETIME', 'null' => true], + ]); + $this->forge->addPrimaryKey('id'); + $this->forge->addForeignKey('ticket_id', 'tickets', 'id', 'CASCADE', 'CASCADE'); + $this->forge->addForeignKey('respuesta_id', 'respuestas', 'id', 'CASCADE', 'CASCADE'); + $this->forge->createTable('adjuntos'); + } + + public function down() + { + $this->forge->dropTable('adjuntos'); + $this->forge->dropTable('respuestas'); + $this->forge->dropTable('tickets'); + $this->forge->dropTable('categorias'); + $this->forge->dropTable('estados'); + } +} diff --git a/ci4/app/Entities/Soporte/TicketEntity.php b/ci4/app/Entities/Soporte/TicketEntity.php new file mode 100644 index 00000000..192e8d51 --- /dev/null +++ b/ci4/app/Entities/Soporte/TicketEntity.php @@ -0,0 +1,52 @@ + null, + 'usuario_id' => null, + 'tecnico_id' => null, + 'categoria_id'=> null, + 'estado_id' => null, + 'prioridad' => 'media', + 'titulo' => '', + 'descripcion' => '', + 'created_at' => null, + 'updated_at' => null, + ]; + + protected $dates = ['created_at', 'updated_at']; + + public function setTitulo(string $titulo) + { + $this->attributes['titulo'] = ucfirst($titulo); // Capitaliza el título + return $this; + } + + public function setDescripcion(string $descripcion) + { + $this->attributes['descripcion'] = ucfirst($descripcion); + return $this; + } + + public function getPrioridad(): string + { + return ucfirst($this->attributes['prioridad']); + } + + public function asignarTecnico(int $tecnicoId) + { + $this->attributes['tecnico_id'] = $tecnicoId; + return $this; + } + + public function cambiarEstado(int $estadoId) + { + $this->attributes['estado_id'] = $estadoId; + return $this; + } +} diff --git a/ci4/app/Language/es/App.php b/ci4/app/Language/es/App.php index 44552d73..a24597ea 100755 --- a/ci4/app/Language/es/App.php +++ b/ci4/app/Language/es/App.php @@ -818,5 +818,9 @@ return [ "menu_oauth" => "Autenticaciones", "menu_template" => "Plantillas", + "menu_soporte" => "Soporte", + "menu_soporte_new_ticket" => "Crear ticket", + "menu_soporte_ticket_list" => "Mis tickets", + ]; \ No newline at end of file diff --git a/ci4/app/Language/es/Tickets.php b/ci4/app/Language/es/Tickets.php new file mode 100644 index 00000000..679055f3 --- /dev/null +++ b/ci4/app/Language/es/Tickets.php @@ -0,0 +1,9 @@ + 'Ticket', + 'tickets' => 'Tickets', + 'moduleTitle' => 'Tickets', +]; diff --git a/ci4/app/Models/Soporte/ticketModel.php b/ci4/app/Models/Soporte/ticketModel.php new file mode 100644 index 00000000..7e2cc18a --- /dev/null +++ b/ci4/app/Models/Soporte/ticketModel.php @@ -0,0 +1,26 @@ +select('tickets.*, users.nombre as usuario, categorias.nombre as categoria, estados.nombre as estado') + ->join('users', 'users.id = tickets.usuario_id') + ->join('categorias', 'categorias.id = tickets.categoria_id') + ->join('estados', 'estados.id = tickets.estado_id') + ->findAll(); + } + + return $this->find($id); + } +} diff --git a/ci4/app/Views/themes/vuexy/form/soporte/viewTicketForm.php b/ci4/app/Views/themes/vuexy/form/soporte/viewTicketForm.php new file mode 100644 index 00000000..1003598d --- /dev/null +++ b/ci4/app/Views/themes/vuexy/form/soporte/viewTicketForm.php @@ -0,0 +1,50 @@ +include('themes/_commonPartialsBs/datatables') ?> +extend('themes/vuexy/main/defaultlayout') ?> +section('content'); ?> + +
+
+
+
+

Crear Ticket

+
+
+
+ + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + +
+
+
+
+
+ +endSection(); ?> diff --git a/ci4/app/Views/themes/vuexy/form/soporte/viewTicketList.php b/ci4/app/Views/themes/vuexy/form/soporte/viewTicketList.php new file mode 100644 index 00000000..e69de29b diff --git a/ci4/app/Views/themes/vuexy/main/menu_impresion.php b/ci4/app/Views/themes/vuexy/main/menu_impresion.php index 2ba24ff5..fc43702e 100644 --- a/ci4/app/Views/themes/vuexy/main/menu_impresion.php +++ b/ci4/app/Views/themes/vuexy/main/menu_impresion.php @@ -48,6 +48,8 @@ require "menus/mensajes_menu.php"; + require "menus/soporte_menu.php"; + require "menus/sistema_menu.php"; ?> diff --git a/ci4/app/Views/themes/vuexy/main/menus/soporte_menu.php b/ci4/app/Views/themes/vuexy/main/menus/soporte_menu.php new file mode 100644 index 00000000..91f1ec7b --- /dev/null +++ b/ci4/app/Views/themes/vuexy/main/menus/soporte_menu.php @@ -0,0 +1,22 @@ + + From a616ec7ba7fce2d657a2371905d6b9bd7f0d35b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Fri, 14 Feb 2025 23:45:28 +0100 Subject: [PATCH 2/9] =?UTF-8?q?trabajando=20en=20el=20formulario=20de=20a?= =?UTF-8?q?=C3=B1adir?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Soporte/Ticketcontroller.php | 6 +- ...025-02-14-114500_create_tickets_system.php | 34 ++++--- ci4/app/Database/Seeds/TicketsSeeder.php | 60 ++++++++++++ ci4/app/Language/es/Tickets.php | 31 ++++++ ci4/app/Models/Soporte/ticketModel.php | 47 ++++++++- .../vuexy/form/soporte/viewTicketForm.php | 95 +++++++++++++------ .../themes/vuexy/main/menus/soporte_menu.php | 2 +- 7 files changed, 225 insertions(+), 50 deletions(-) create mode 100644 ci4/app/Database/Seeds/TicketsSeeder.php diff --git a/ci4/app/Controllers/Soporte/Ticketcontroller.php b/ci4/app/Controllers/Soporte/Ticketcontroller.php index 7e47dbe1..32cadbbb 100644 --- a/ci4/app/Controllers/Soporte/Ticketcontroller.php +++ b/ci4/app/Controllers/Soporte/Ticketcontroller.php @@ -31,7 +31,7 @@ class Ticketcontroller extends \App\Controllers\GoBaseController // Breadcrumbs $this->viewData['breadcrumb'] = [ ['title' => lang("App.menu_soporte"), 'route' => "javascript:void(0);", 'active' => false], - ['title' => lang("App.menu_ticket_list"), 'route' => route_to('TicketIndex'), 'active' => true] + ['title' => lang("App.menu_soporte_ticket_list"), 'route' => route_to('TicketIndex'), 'active' => true] ]; parent::initController($request, $response, $logger); @@ -104,6 +104,10 @@ class Ticketcontroller extends \App\Controllers\GoBaseController $this->viewData['formAction'] = route_to('NewTicket'); + $this->viewData['categorias'] = $this->model->getCategorias(); + $this->viewData['estados'] = $this->model->getEstados(); + $this->viewData['secciones'] = $this->model->getSecciones(); + $this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Tarifaextra.tarifaextra') . ' ' . lang('Basic.global.addNewSuffix'); diff --git a/ci4/app/Database/Migrations/2025-02-14-114500_create_tickets_system.php b/ci4/app/Database/Migrations/2025-02-14-114500_create_tickets_system.php index bfcd870e..f93d609c 100644 --- a/ci4/app/Database/Migrations/2025-02-14-114500_create_tickets_system.php +++ b/ci4/app/Database/Migrations/2025-02-14-114500_create_tickets_system.php @@ -11,18 +11,26 @@ class CreateTicketsSystem extends Migration // Tabla de Categorías $this->forge->addField([ 'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true], - 'nombre' => ['type' => 'VARCHAR', 'constraint' => 100, 'unique' => true], + 'keyword' => ['type' => 'VARCHAR', 'constraint' => 100, 'unique' => true], ]); $this->forge->addPrimaryKey('id'); - $this->forge->createTable('categorias'); + $this->forge->createTable('tickets_categorias'); + + // Tabla de secciones + $this->forge->addField([ + 'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true], + 'keyword' => ['type' => 'VARCHAR', 'constraint' => 100, 'unique' => true], + ]); + $this->forge->addPrimaryKey('id'); + $this->forge->createTable('tickets_secciones'); // Tabla de Estados $this->forge->addField([ 'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true], - 'nombre' => ['type' => 'VARCHAR', 'constraint' => 100, 'unique' => true], + 'keyword' => ['type' => 'VARCHAR', 'constraint' => 100, 'unique' => true], ]); $this->forge->addPrimaryKey('id'); - $this->forge->createTable('estados'); + $this->forge->createTable('tickets_estados'); // Tabla de Tickets $this->forge->addField([ @@ -38,8 +46,8 @@ class CreateTicketsSystem extends Migration ]); $this->forge->addPrimaryKey('id'); $this->forge->addForeignKey('usuario_id', 'users', 'id', 'CASCADE', 'CASCADE'); - $this->forge->addForeignKey('categoria_id', 'categorias', 'id', 'CASCADE', 'CASCADE'); - $this->forge->addForeignKey('estado_id', 'estados', 'id', 'CASCADE', 'CASCADE'); + $this->forge->addForeignKey('categoria_id', 'tickets_categorias', 'id', 'CASCADE', 'CASCADE'); + $this->forge->addForeignKey('estado_id', 'tickets_estados', 'id', 'CASCADE', 'CASCADE'); $this->forge->createTable('tickets'); // Tabla de Respuestas @@ -53,7 +61,7 @@ class CreateTicketsSystem extends Migration $this->forge->addPrimaryKey('id'); $this->forge->addForeignKey('ticket_id', 'tickets', 'id', 'CASCADE', 'CASCADE'); $this->forge->addForeignKey('usuario_id', 'users', 'id', 'CASCADE', 'CASCADE'); - $this->forge->createTable('respuestas'); + $this->forge->createTable('tickets_respuestas'); // Tabla de Adjuntos $this->forge->addField([ @@ -65,16 +73,16 @@ class CreateTicketsSystem extends Migration ]); $this->forge->addPrimaryKey('id'); $this->forge->addForeignKey('ticket_id', 'tickets', 'id', 'CASCADE', 'CASCADE'); - $this->forge->addForeignKey('respuesta_id', 'respuestas', 'id', 'CASCADE', 'CASCADE'); - $this->forge->createTable('adjuntos'); + $this->forge->addForeignKey('respuesta_id', 'tickets_respuestas', 'id', 'CASCADE', 'CASCADE'); + $this->forge->createTable('tickets_adjuntos'); } public function down() { - $this->forge->dropTable('adjuntos'); - $this->forge->dropTable('respuestas'); + $this->forge->dropTable('tickets_adjuntos'); + $this->forge->dropTable('tickets_respuestas'); $this->forge->dropTable('tickets'); - $this->forge->dropTable('categorias'); - $this->forge->dropTable('estados'); + $this->forge->dropTable('tickets_categorias'); + $this->forge->dropTable('tickets_estados'); } } diff --git a/ci4/app/Database/Seeds/TicketsSeeder.php b/ci4/app/Database/Seeds/TicketsSeeder.php new file mode 100644 index 00000000..3fd49111 --- /dev/null +++ b/ci4/app/Database/Seeds/TicketsSeeder.php @@ -0,0 +1,60 @@ + 'errores', + ], + [ + 'keyword' => 'consultas', + ], + [ + 'keyword' => 'sugerencias', + ], + ]; + $this->db->table('tickets_categorias')->insertBatch($data); + + // secciones + $data = [ + [ + 'keyword' => 'presupuestos', + ], + [ + 'keyword' => 'pedidos', + ], + [ + 'keyword' => 'facturacion', + ], + [ + 'keyword' => 'logistica', + ], + ]; + $this->db->table('tickets_secciones')->insertBatch($data); + + // estados + $data = [ + [ + 'keyword' => 'abierto', + ], + [ + 'keyword' => 'en_proceso', + ], + [ + 'keyword' => 'resuelto', + ], + [ + 'keyword' => 'archivado', + ], + ]; + $this->db->table('tickets_estados')->insertBatch($data); + } +} \ No newline at end of file diff --git a/ci4/app/Language/es/Tickets.php b/ci4/app/Language/es/Tickets.php index 679055f3..b3208387 100644 --- a/ci4/app/Language/es/Tickets.php +++ b/ci4/app/Language/es/Tickets.php @@ -6,4 +6,35 @@ return [ 'ticket' => 'Ticket', 'tickets' => 'Tickets', 'moduleTitle' => 'Tickets', + + "asunto" => "Asunto", + "tipo" => "Tipo", + "seccion" => "Sección", + "estado" => "Estado", + "prioridad" => "Prioridad", + "descripcion" => "Descripción", + "asignarTo" => "Asignado a", + "createTicket" => "Crear Ticket", + + // categorías + 'errores' => 'Errores', + 'consultas' => 'Consultas', + 'sugerencias' => 'Sugerencias', + + // secciones + 'presupuestos' => 'Presupuestos', + 'pedidos' => 'Pedidos', + 'facturacion' => 'Facturación', + 'logistica' => 'Logística', + + // estados + 'abierto' => 'Abierto', + 'en_proceso' => 'En proceso', + 'resuelto' => 'Resuelto', + 'archivado' => 'Archivado', + + //Prioridades + 'alta' => 'Alta', + 'media' => 'Media', + 'baja' => 'Baja', ]; diff --git a/ci4/app/Models/Soporte/ticketModel.php b/ci4/app/Models/Soporte/ticketModel.php index 7e2cc18a..43a0c71b 100644 --- a/ci4/app/Models/Soporte/ticketModel.php +++ b/ci4/app/Models/Soporte/ticketModel.php @@ -5,20 +5,57 @@ namespace App\Models\Soporte; class TicketModel extends \App\Models\BaseModel { - protected $table = 'tickets'; + + protected $table = 'tickets'; protected $primaryKey = 'id'; protected $allowedFields = ['usuario_id', 'tecnico_id', 'categoria_id', 'estado_id', 'prioridad', 'titulo', 'descripcion', 'created_at', 'updated_at']; protected $useTimestamps = true; + public function getEstados() + { + $values = $this->db->table('tickets_estados')->get()->getResultArray(); + $data = []; + + foreach ($values as $value) { + $data[$value['keyword']] = lang("Tickets." . $value['keyword']); + } + + return $data; + } + + public function getCategorias() + { + $values = $this->db->table('tickets_categorias')->get()->getResultArray(); + $data = []; + + foreach ($values as $value) { + $data[$value['keyword']] = lang("Tickets." . $value['keyword']); + } + + return $data; + } + + public function getSecciones() + { + $values = $this->db->table('tickets_secciones')->get()->getResultArray(); + $data = []; + + foreach ($values as $value) { + $data[$value['keyword']] = lang("Tickets." . $value['keyword']); + } + + return $data; + } + public function getTickets($id = null) { if ($id === null) { return $this->select('tickets.*, users.nombre as usuario, categorias.nombre as categoria, estados.nombre as estado') - ->join('users', 'users.id = tickets.usuario_id') - ->join('categorias', 'categorias.id = tickets.categoria_id') - ->join('estados', 'estados.id = tickets.estado_id') - ->findAll(); + ->join('users', 'users.id = tickets.usuario_id') + ->join('categorias', 'categorias.id = tickets.categoria_id') + ->join('estados', 'estados.id = tickets.estado_id') + ->findAll(); } return $this->find($id); diff --git a/ci4/app/Views/themes/vuexy/form/soporte/viewTicketForm.php b/ci4/app/Views/themes/vuexy/form/soporte/viewTicketForm.php index 1003598d..8b814aae 100644 --- a/ci4/app/Views/themes/vuexy/form/soporte/viewTicketForm.php +++ b/ci4/app/Views/themes/vuexy/form/soporte/viewTicketForm.php @@ -1,9 +1,9 @@ -include('themes/_commonPartialsBs/datatables') ?> -extend('themes/vuexy/main/defaultlayout') ?> -section('content'); ?> +include('themes/_commonPartialsBs/datatables') ?> +extend('themes/vuexy/main/defaultlayout') ?> +section('content'); ?>
-
+

Crear Ticket

@@ -11,40 +11,75 @@
- -
- - + +
+
+ + +
+
+ +
+ +
+ + +
+ + +
+ + +
+ + +
+ + +
+ +
+ +
+
+ + +
+ +
+ + +
+
- - + +
-
- - -
- -
- - -
- - +
-endSection(); ?> +endSection(); ?> \ No newline at end of file diff --git a/ci4/app/Views/themes/vuexy/main/menus/soporte_menu.php b/ci4/app/Views/themes/vuexy/main/menus/soporte_menu.php index 91f1ec7b..aed71d1e 100644 --- a/ci4/app/Views/themes/vuexy/main/menus/soporte_menu.php +++ b/ci4/app/Views/themes/vuexy/main/menus/soporte_menu.php @@ -1,7 +1,7 @@