Merge branch 'main' into feat/sk-32

This commit is contained in:
amazuecos
2025-04-06 06:03:44 +02:00
37 changed files with 789 additions and 618 deletions

View File

@ -101,6 +101,7 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
"total_factor" => null,
"total_factor_ponderado" => null,
'total_aceptado' => null,
'total_aceptado_revisado' => null,
'iva_reducido' => null,
'excluir_rotativa' => null,
"acabado_cubierta_id" => null,
@ -174,6 +175,7 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
"total_factor" => "?float",
"total_factor_ponderado" => "?float",
'total_aceptado' => "?float",
'total_aceptado_revisado' => "?float",
'iva_reducido' => "?boolean",
'excluir_rotativa' => "?boolean",
"acabado_cubierta_id" => "int",

View File

@ -1,11 +1,10 @@
<?php
namespace App\Entities\Usuarios;
use App\Entities\Chat\ChatNotificationEntity;
use App\Models\ChatNotification;
use CodeIgniter\Entity;
use CodeIgniter\Shield\Entities\User;
class UserEntity extends \CodeIgniter\Entity\Entity
class UserEntity extends User
{
protected $attributes = [
"id" => null,
@ -20,7 +19,6 @@ class UserEntity extends \CodeIgniter\Entity\Entity
"created_at" => null,
"updated_at" => null,
"deleted_at" => null,
];
protected $casts = [
"id" => "int",
@ -73,4 +71,6 @@ class UserEntity extends \CodeIgniter\Entity\Entity
$m = model(ChatNotification::class);
return $m->where('user_id',$this->attributes['id'])->findAll() ?? [];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Entities\Usuarios;
use CodeIgniter\Shield\Entities\User;
class UsersEntity extends User
{
protected $attributes = [
'first_name' => null,
'last_name'=> null,
'cliente_id' => null,
'comments' => null,
];
protected $casts = [
"cliente_id" => "int",
];
public function getFullName()
{
$firstName = trim($this->attributes["first_name"] ?? "");
$lastName = trim($this->attributes["last_name"] ?? "");
$fullName = $firstName . ' ' . $lastName;
$fullName = trim($fullName); // In case first name is empty, this will remove the leading space
// Use the username attribute if the full name is still empty after trimming
return $fullName ?: $this->attributes["username"];
}
}