From c1cae0fcf7d7a1ea7d8bf452742749b025a7b758 Mon Sep 17 00:00:00 2001 From: Jaime Jimenez Date: Mon, 24 Feb 2025 09:59:35 +0100 Subject: [PATCH] =?UTF-8?q?a=C3=B1adida=20migracion=20y=20modelo,=20entida?= =?UTF-8?q?d=20y=20controlador=20basicos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tarifas/Acabados/ServiciosAcabado.php | 68 +++++++++++ .../2025-02-24-093400_serviciosAcabado.php | 107 ++++++++++++++++++ .../Acabados/ServicioAcabadoEntity.php | 23 ++++ ci4/app/Language/es/ServicioAcabado.php | 28 +++++ .../Tarifas/Acabados/ServicioAcabadoModel.php | 25 ++++ 5 files changed, 251 insertions(+) create mode 100644 ci4/app/Controllers/Tarifas/Acabados/ServiciosAcabado.php create mode 100644 ci4/app/Database/Migrations/2025-02-24-093400_serviciosAcabado.php create mode 100644 ci4/app/Entities/Tarifas/Acabados/ServicioAcabadoEntity.php create mode 100755 ci4/app/Language/es/ServicioAcabado.php create mode 100644 ci4/app/Models/Tarifas/Acabados/ServicioAcabadoModel.php diff --git a/ci4/app/Controllers/Tarifas/Acabados/ServiciosAcabado.php b/ci4/app/Controllers/Tarifas/Acabados/ServiciosAcabado.php new file mode 100644 index 00000000..c350415a --- /dev/null +++ b/ci4/app/Controllers/Tarifas/Acabados/ServiciosAcabado.php @@ -0,0 +1,68 @@ +viewData['pageTitle'] = lang('Servicioacabado.moduleTitle'); + $this->viewData['usingSweetAlert'] = true; + + // Se indica que este controlador trabaja con soft_delete + $this->soft_delete = true; + // Se indica el flag para los ficheros borrados + $this->delete_flag = 1; + + $this->viewData = ['usingServerSideDataTable' => true]; + + // Breadcrumbs + $this->viewData['breadcrumb'] = [ + ['title' => lang("App.menu_tarifas"), 'route' => "javascript:void(0);", 'active' => false], + ['title' => lang("App.menu_Servicioacabado"), 'route' => site_url('tarifas/acabados'), 'active' => true] + ]; + + parent::initController($request, $response, $logger); + } + + + public function index() + { + + checkPermission('tarifa-acabado.menu'); + + $viewData = [ + 'currentModule' => static::$controllerSlug, + 'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Servicioacabado.serviciosacabado')]), + 'servicioacabadoEntity' => new ServicioAcabadoEntity(), + 'usingServerSideDataTable' => true, + ]; + + $viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class + + return view(static::$viewPath . 'viewServicioAcabadoList', $viewData); + } + +} \ No newline at end of file diff --git a/ci4/app/Database/Migrations/2025-02-24-093400_serviciosAcabado.php b/ci4/app/Database/Migrations/2025-02-24-093400_serviciosAcabado.php new file mode 100644 index 00000000..796e7495 --- /dev/null +++ b/ci4/app/Database/Migrations/2025-02-24-093400_serviciosAcabado.php @@ -0,0 +1,107 @@ +forge->addField([ + 'id' => [ + 'type' => 'INT', + 'constraint' => 11, + 'unsigned' => true, + 'auto_increment' => true, + ], + 'tarifa_id' => [ + 'type' => 'INT', + 'constraint' => 11, + 'unsigned' => true, + ], + 'nombre' =>[ + 'type' => 'VARCHAR', + 'constraint' => 100, + 'unique' => true + ], + 'comentarios' => [ + 'type' => 'TEXT', + 'null' => true, + ], + 'user_updated_id' => [ + 'type' => 'INT', + 'constraint' => 11, + 'unsigned' => true, + ], + 'created_at' => [ + 'type' => 'DATETIME', + 'null' => true, + ], + 'updated_at' => [ + 'type' => 'DATETIME', + 'null' => true, + ], + 'deleted_at' => [ + 'type' => 'DATETIME', + 'null' => true, + ], + ]); + + $this->forge->addPrimaryKey('id'); + $this->forge->addForeignKey('user_updated_id', 'users', 'id', 'CASCADE', 'CASCADE'); + + $this->forge->createTable('servicios_acabado'); + + $this->forge->addField([ + 'id' => [ + 'type' => 'INT', + 'constraint' => 11, + 'unsigned' => true, + 'auto_increment' => true, + ], + 'tarifa_id' => [ + 'type' => 'INT', + 'constraint' => 11, + 'unsigned' => true, + ], + 'servicio_id' => [ + 'type' => 'INT', + 'constraint' => 11, + 'unsigned' => true, + ], + 'user_updated_id' => [ + 'type' => 'INT', + 'constraint' => 11, + 'unsigned' => true, + ], + 'created_at' => [ + 'type' => 'DATETIME', + 'null' => true, + ], + 'updated_at' => [ + 'type' => 'DATETIME', + 'null' => true, + ], + 'deleted_at' => [ + 'type' => 'DATETIME', + 'null' => true, + ], + ]); + + $this->forge->addPrimaryKey('id'); + $this->forge->addForeignKey('servicio_id', 'servicios_acabado', 'id', 'NO_ACTION', 'NO_ACTION'); + $this->forge->addForeignKey('tarifa_id', 'lg_tarifa_acabado', 'id', 'NO_ACTION', 'NO_ACTION'); + $this->forge->addForeignKey('user_updated_id', 'users', 'id', 'NO_ACTION', 'NO_ACTION'); + + $this->forge->createTable('tarifasAcabado_serviciosAcabado'); + } + + public function down() + { + $this->forge->dropTable('servicios_acabado'); + $this->forge->dropTable('tarifasAcabado_serviciosAcabado'); + } +} diff --git a/ci4/app/Entities/Tarifas/Acabados/ServicioAcabadoEntity.php b/ci4/app/Entities/Tarifas/Acabados/ServicioAcabadoEntity.php new file mode 100644 index 00000000..da0fb821 --- /dev/null +++ b/ci4/app/Entities/Tarifas/Acabados/ServicioAcabadoEntity.php @@ -0,0 +1,23 @@ + null, + "nombre" => null, + 'mostrar_en_cliente' => false, + "comentarios" => null, + "user_updated_id" => 0, + "created_at" => null, + "updated_at" => null, + "deleted_at" => null, + ]; + protected $casts = [ + "mostrar_en_cliente" => "boolean", + "comentarios" => "string", + "user_updated_id" => "int", + ]; +} \ No newline at end of file diff --git a/ci4/app/Language/es/ServicioAcabado.php b/ci4/app/Language/es/ServicioAcabado.php new file mode 100755 index 00000000..93a26322 --- /dev/null +++ b/ci4/app/Language/es/ServicioAcabado.php @@ -0,0 +1,28 @@ + 'ID', + 'moduleTitle' => 'Servicios Acabado', + 'nombre' => 'Nombre', + 'comentarios' => 'Comentarios', + 'mostrar_en_presupuesto_cliente' => 'Mostrar en presupuesto (cliente)', + 'serviciosacabado' => 'Servicios Acabado', + 'tarifasacabado' => 'Tarifas Acabado', + "servicio_cubierta" => "Acabado cubierta", + "servicio_sobrecubierta" => "Acabado sobrecubierta", + 'tarifaacabado' => 'Tarifa Acabado', + 'servicioscabadoList' => 'Lista Servicios Acabado', + 'updatedAt' => 'Actualizado en', + 'createdAt' => 'Creado en', + 'deletedAt' => 'Borrado en', + 'userUpdateId' => 'ID Usuario "Actualizado en"', + 'validation' => [ + 'nombre' => [ + 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', + 'required' => 'El campo {field} es obligatorio.', + ], + ], +]; \ No newline at end of file diff --git a/ci4/app/Models/Tarifas/Acabados/ServicioAcabadoModel.php b/ci4/app/Models/Tarifas/Acabados/ServicioAcabadoModel.php new file mode 100644 index 00000000..d419a2f9 --- /dev/null +++ b/ci4/app/Models/Tarifas/Acabados/ServicioAcabadoModel.php @@ -0,0 +1,25 @@ + [ + "label" => "Servicioacabado.nombre", + "rules" => "trim|required|max_length[100]", + ], + ]; +} + +