diff --git a/ci4/app/Config/Auth.php b/ci4/app/Config/Auth.php
index c917571c..57efc4ca 100644
--- a/ci4/app/Config/Auth.php
+++ b/ci4/app/Config/Auth.php
@@ -13,6 +13,7 @@ declare(strict_types=1);
namespace Config;
+use App\Entities\Usuarios\UsersEntity;
use App\Models\UserModel;
use CodeIgniter\Shield\Authentication\Passwords\ValidationRules;
use CodeIgniter\Shield\Config\Auth as ShieldAuth;
diff --git a/ci4/app/Controllers/Configuracion/Users.php b/ci4/app/Controllers/Configuracion/Users.php
index 5bbfedba..c78ca50d 100755
--- a/ci4/app/Controllers/Configuracion/Users.php
+++ b/ci4/app/Controllers/Configuracion/Users.php
@@ -150,7 +150,7 @@ class Users extends \App\Controllers\GoBaseController
$this->viewData['clienteList'] = $this->getClienteListItems();
$this->viewData['formAction'] = route_to('createUser');
$this->viewData['groups'] = $this->group_model->select('keyword, title')->findAll();
- $this->viewData['boxTitle'] = lang('Basic.global.addNew') . lang('Users.user') . ' ' . lang('Basic.global.addNewSuffix');
+ $this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Users.user') . ' ' . lang('Basic.global.addNewSuffix');
return $this->displayForm(__METHOD__);
diff --git a/ci4/app/Controllers/Profile.php b/ci4/app/Controllers/Profile.php
index 71772a74..67449c84 100755
--- a/ci4/app/Controllers/Profile.php
+++ b/ci4/app/Controllers/Profile.php
@@ -27,7 +27,7 @@ class Profile extends BaseController
// Find by the user_id
$data['obj'] = $users->findById(auth()->id());
- echo view(getenv('theme.path') . 'form/profile/index', $data);
+ echo view(getenv('theme.path') . 'form/profile/profileDetails', $data);
}
diff --git a/ci4/app/Entities/Usuarios/UserEntity.php b/ci4/app/Entities/Usuarios/UserEntity.php
index 0c1d5383..61f750ce 100755
--- a/ci4/app/Entities/Usuarios/UserEntity.php
+++ b/ci4/app/Entities/Usuarios/UserEntity.php
@@ -24,18 +24,25 @@ class UserEntity extends \CodeIgniter\Entity\Entity
"cliente_id" => "int",
"active" => "boolean",
];
+
/**
- * Returns a full name: "first last"
+ * Get the full name of the user
*
- * @return string
+ * If the first name and last name are available, the full name is generated as "{first name} {last name}".
+ * If the first name or last name is missing, only the available name is used.
+ * If both the first name and last name are missing, the username is used as the full name.
+ *
+ * @return string The full name of the user
*/
public function getFullName()
{
- $fullName =
- (!empty($this->attributes["first_name"]) ? trim($this->attributes["first_name"]) . " " : "") .
- (!empty($this->attributes["last_name"]) ? trim($this->attributes["last_name"]) : "");
- $name = empty($fullName) ? $this->attributes["username"] : $fullName;
- return $name;
+ $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"];
}
/**
diff --git a/ci4/app/Entities/Usuarios/UsersEntity.php b/ci4/app/Entities/Usuarios/UsersEntity.php
index 7ff93bb7..84ae01f1 100644
--- a/ci4/app/Entities/Usuarios/UsersEntity.php
+++ b/ci4/app/Entities/Usuarios/UsersEntity.php
@@ -1,7 +1,6 @@
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"];
+ }
+
+
}
diff --git a/ci4/app/Models/UserModel.php b/ci4/app/Models/UserModel.php
index 934604ff..63d8acfa 100644
--- a/ci4/app/Models/UserModel.php
+++ b/ci4/app/Models/UserModel.php
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Models;
+use App\Entities\Usuarios\UsersEntity;
use CodeIgniter\Shield\Models\UserModel as ShieldUserModel;
class UserModel extends ShieldUserModel
@@ -20,6 +21,8 @@ class UserModel extends ShieldUserModel
];
}
+ protected $returnType = UsersEntity::class;
+
protected $useSoftDeletes = true;
protected $useTimestamps = true;
protected $createdField = 'created_at';
@@ -51,17 +54,23 @@ class UserModel extends ShieldUserModel
}
- public function getUsersList(){
+ public function getUsersList()
+ {
$builder = $this->db
- ->table("users" . " t1")
- ->select(
- "t1.id AS id, t1.first_name AS first_name, t1.last_name AS last_name, t1.last_active AS last_active, t2.group AS group"
- );
-
- $builder->where('t1.deleted_at', null);
- $builder->join("auth_groups_users t2", "t1.id = t2.user_id", "left");
+ ->table('users t1')
+ ->select('
+ t1.id AS id,
+ t1.first_name AS first_name,
+ t1.last_name AS last_name,
+ t1.email AS email,
+ t1.last_active AS last_active,
+ GROUP_CONCAT(DISTINCT t2.`group` SEPARATOR ", ") AS `group`
+ ')
+ ->join('auth_groups_users t2', 't1.id = t2.user_id', 'left')
+ ->where('t1.deleted_at', null)
+ ->groupBy('t1.id, t1.first_name, t1.last_name, t1.email, t1.last_active');
return $builder->get()->getResult();
-
}
+
}
diff --git a/ci4/app/Views/themes/vuexy/form/profile/index.php b/ci4/app/Views/themes/vuexy/form/profile/profileDetails.php
similarity index 76%
rename from ci4/app/Views/themes/vuexy/form/profile/index.php
rename to ci4/app/Views/themes/vuexy/form/profile/profileDetails.php
index bff0c49f..4a9fc610 100644
--- a/ci4/app/Views/themes/vuexy/form/profile/index.php
+++ b/ci4/app/Views/themes/vuexy/form/profile/profileDetails.php
@@ -1,4 +1,4 @@
-= $this->extend('themes/vuexy/main/general_settings_layout') ?>
+= $this->extend('themes/vuexy/main/defaultlayout') ?>
= $this->section('content'); ?>
@@ -75,40 +75,12 @@
\ No newline at end of file
diff --git a/ci4/app/Views/themes/vuexy/form/user/viewUserList.php b/ci4/app/Views/themes/vuexy/form/user/viewUserList.php
index 63935bc1..b22a4c76 100644
--- a/ci4/app/Views/themes/vuexy/form/user/viewUserList.php
+++ b/ci4/app/Views/themes/vuexy/form/user/viewUserList.php
@@ -17,8 +17,8 @@
diff --git a/sk-new-branch.bat b/sk-new-branch.bat
deleted file mode 100755
index 4ce0d215..00000000
--- a/sk-new-branch.bat
+++ /dev/null
@@ -1,20 +0,0 @@
-@echo off
-
-REM Solicitar al usuario el nombre de la nueva rama
-set /p nombre_rama=Nuevo nombre de la rama:
-
-echo %nombre_rama%
-
-REM Verificar si se proporciona un nombre de rama
-if not "%nombre_rama%"=="" (
- REM Cambiar y actualizar la rama main
- git checkout main
- git pull
- REM Crear nueva rama
- git checkout -b %nombre_rama%
- REM Hacer push de la nueva rama al repositorio remoto
- git push -u origin %nombre_rama%
- echo Se ha creado (a partir de la rama main) y cambiado a la nueva rama: %nombre_rama%
-) else (
- echo No se proporcionó un nombre de rama. La creación de la rama ha sido omitida.
-)