mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
añadida migracion y modelo, entidad y controlador basicos
This commit is contained in:
68
ci4/app/Controllers/Tarifas/Acabados/ServiciosAcabado.php
Normal file
68
ci4/app/Controllers/Tarifas/Acabados/ServiciosAcabado.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Tarifas\Acabados;
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
use App\Entities\Tarifas\Acabados\ServicioAcabadoEntity;
|
||||
use App\Models\Collection;
|
||||
use App\Models\Tarifas\Acabados\ServiciosAcabadoModel;
|
||||
|
||||
|
||||
class TarifaAcabados extends BaseResourceController
|
||||
{
|
||||
|
||||
protected $modelName = ServicioAcabadoEntity::class;
|
||||
protected $format = 'json';
|
||||
|
||||
protected static $singularObjectName = 'Servicio Acabado';
|
||||
protected static $singularObjectNameCc = 'servicioAcabado';
|
||||
protected static $pluralObjectName = 'Servicios Acabado';
|
||||
protected static $pluralObjectNameCc = 'serviciosAcabado';
|
||||
|
||||
protected static $controllerSlug = 'serviciosacabado';
|
||||
|
||||
protected static $viewPath = 'themes/vuexy/form/tarifas/acabado/';
|
||||
|
||||
protected $indexRoute = 'servicioAcabadoList';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
use function PHPSTORM_META\type;
|
||||
|
||||
class CreateServiciosAcabadoTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->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');
|
||||
}
|
||||
}
|
||||
23
ci4/app/Entities/Tarifas/Acabados/ServicioAcabadoEntity.php
Normal file
23
ci4/app/Entities/Tarifas/Acabados/ServicioAcabadoEntity.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace App\Entities\Tarifas\Acabados;
|
||||
|
||||
use CodeIgniter\Entity;
|
||||
|
||||
class ServicioAcabadoEntity extends \CodeIgniter\Entity\Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"id" => 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",
|
||||
];
|
||||
}
|
||||
28
ci4/app/Language/es/ServicioAcabado.php
Executable file
28
ci4/app/Language/es/ServicioAcabado.php
Executable file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
|
||||
return [
|
||||
|
||||
|
||||
'id' => '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.',
|
||||
],
|
||||
],
|
||||
];
|
||||
25
ci4/app/Models/Tarifas/Acabados/ServicioAcabadoModel.php
Normal file
25
ci4/app/Models/Tarifas/Acabados/ServicioAcabadoModel.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace App\Models\Tarifas\Acabados;
|
||||
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class ServiciosAcabadoModel extends Model
|
||||
{
|
||||
protected $table = 'servicios_acabado';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useSoftDeletes = true;
|
||||
protected $allowedFields = ['tarifa_id', 'nombre', 'comentarios', 'mostrar_en_cliente', 'user_updated_id', 'created_at', 'updated_at', 'deleted_at'];
|
||||
protected $useTimestamps = true;
|
||||
|
||||
protected $returnType = 'App\Entities\Tarifas\Acabados\ServicioAcabadoEntity';
|
||||
|
||||
protected $validationRules = [
|
||||
"nombre" => [
|
||||
"label" => "Servicioacabado.nombre",
|
||||
"rules" => "trim|required|max_length[100]",
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user