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] =?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 @@