mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Completada visualizacion y traduccion de roles y permisos
This commit is contained in:
@ -1,25 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Controllers\Configuracion;
|
|
||||||
use App\Controllers\BaseController;
|
|
||||||
|
|
||||||
|
|
||||||
class Calendario extends BaseController
|
|
||||||
{
|
|
||||||
function __construct()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
echo 'Calendario';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function edit()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
use App\Models\Usuarios\GroupModel;
|
use App\Models\Usuarios\GroupModel;
|
||||||
use App\Models\Usuarios\GroupsUsersModel;
|
use App\Models\Usuarios\GroupsUsersModel;
|
||||||
|
use App\Models\Usuarios\PermisosModel;
|
||||||
|
|
||||||
class Group extends \App\Controllers\GoBaseController
|
class Group extends \App\Controllers\GoBaseController
|
||||||
{
|
{
|
||||||
@ -24,9 +25,14 @@ class Group extends \App\Controllers\GoBaseController
|
|||||||
|
|
||||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
$this->viewData['pageTitle'] = lang('Group.moduleTitle');
|
|
||||||
self::$viewPath = getenv('theme.path') . 'form/group/';
|
self::$viewPath = getenv('theme.path') . 'form/group/';
|
||||||
|
|
||||||
|
// Breadcrumbs
|
||||||
|
$this->viewData['breadcrumb'] = [
|
||||||
|
['title' => "Home", 'route' => "javascript:void(0);", 'active' => false],
|
||||||
|
['title' => lang("App.menu_permission_group"), 'route' => site_url("configuracion/group"), 'active' => true]
|
||||||
|
];
|
||||||
|
|
||||||
parent::initController($request, $response, $logger);
|
parent::initController($request, $response, $logger);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -47,46 +53,35 @@ class Group extends \App\Controllers\GoBaseController
|
|||||||
|
|
||||||
if ($this->request->getPost()) :
|
if ($this->request->getPost()) :
|
||||||
|
|
||||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
|
||||||
|
|
||||||
$postData = $this->request->getPost();
|
$postData = $this->request->getPost();
|
||||||
|
|
||||||
|
$temp_data['id'] = $groupEntity->id;
|
||||||
|
$temp_data['name'] = $postData['name'];
|
||||||
|
$temp_data['description'] = $postData['description'];
|
||||||
|
|
||||||
$name = $postData['name'];
|
// Clear not rules fields
|
||||||
unset($postData['name']);
|
unset($postData['safekat_token']);
|
||||||
unset($postData['id']);
|
unset($postData['id']);
|
||||||
|
unset($postData['name']);
|
||||||
|
unset($postData['description']);
|
||||||
unset($postData['save']);
|
unset($postData['save']);
|
||||||
|
unset($postData['selectAll']);
|
||||||
|
|
||||||
$controller = null;
|
$rules_access = [];
|
||||||
$rules_access = null;
|
|
||||||
|
|
||||||
foreach ($postData as $key => $value) {
|
foreach ($postData as $key => $value) {
|
||||||
$exp = explode('_', $key);
|
$exp = explode('_', $key);
|
||||||
$controller[] = $exp[0];
|
if (!isset($rules_access[$exp[0]])) {
|
||||||
}
|
$rules_access[$exp[0]] = [];
|
||||||
|
|
||||||
if ($controller != null) {
|
|
||||||
foreach (array_unique($controller) as $item) {
|
|
||||||
$rules_access[$item] = [];
|
|
||||||
|
|
||||||
foreach ($postData as $key => $value) {
|
|
||||||
$exp = explode('_', $key);
|
|
||||||
if ($exp[0] == $item) {
|
|
||||||
array_push($rules_access[$item], str_replace($exp[0] . '_', '', $key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
array_push($rules_access[$exp[0]], str_replace($exp[0] . '_', '', $key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$temp_data['rules'] = json_encode($rules_access ?? '{}');
|
$temp_data['rules'] = json_encode($rules_access ?? '{}');
|
||||||
$temp_data['name'] = $name;
|
|
||||||
|
|
||||||
$sanitizedData = $this->sanitized($temp_data, $nullIfEmpty);
|
$sanitizedData = $this->sanitized($temp_data, true);
|
||||||
|
|
||||||
$noException = true;
|
$noException = true;
|
||||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
if ($successfulResult = $this->canValidate()) :
|
||||||
|
|
||||||
|
|
||||||
if ($this->canValidate()) :
|
if ($this->canValidate()) :
|
||||||
try {
|
try {
|
||||||
@ -123,9 +118,8 @@ class Group extends \App\Controllers\GoBaseController
|
|||||||
endif; // ($requestMethod === 'post')
|
endif; // ($requestMethod === 'post')
|
||||||
|
|
||||||
$this->viewData['group'] = isset($sanitizedData) ? new GroupModel($sanitizedData) : new GroupModel();
|
$this->viewData['group'] = isset($sanitizedData) ? new GroupModel($sanitizedData) : new GroupModel();
|
||||||
|
$this->viewData['permisos'] = (new PermisosModel())->find();
|
||||||
$this->viewData['formAction'] = route_to('createGroup');
|
$this->viewData['formAction'] = route_to('createGroup');
|
||||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Group.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix');
|
|
||||||
|
|
||||||
|
|
||||||
return $this->displayForm(__METHOD__);
|
return $this->displayForm(__METHOD__);
|
||||||
}
|
}
|
||||||
@ -135,7 +129,6 @@ class Group extends \App\Controllers\GoBaseController
|
|||||||
{
|
{
|
||||||
|
|
||||||
helper('general');
|
helper('general');
|
||||||
$session = session();
|
|
||||||
|
|
||||||
if ($requestedId == null) :
|
if ($requestedId == null) :
|
||||||
return $this->redirect2listView();
|
return $this->redirect2listView();
|
||||||
@ -148,49 +141,37 @@ class Group extends \App\Controllers\GoBaseController
|
|||||||
return $this->redirect2listView('errorMessage', $message);
|
return $this->redirect2listView('errorMessage', $message);
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($this->request->getPost()) :
|
if ($this->request->getPost()) :
|
||||||
|
|
||||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
|
||||||
|
|
||||||
$postData = $this->request->getPost();
|
$postData = $this->request->getPost();
|
||||||
|
|
||||||
$id_group = $groupEntity->id;
|
$temp_data['id'] = $groupEntity->id;
|
||||||
$name = $postData['name'];
|
$temp_data['name'] = $postData['name'];
|
||||||
|
$temp_data['description'] = $postData['description'];
|
||||||
|
|
||||||
|
// Clear not rules fields
|
||||||
|
unset($postData['safekat_token']);
|
||||||
unset($postData['id']);
|
unset($postData['id']);
|
||||||
unset($postData['name']);
|
unset($postData['name']);
|
||||||
|
unset($postData['description']);
|
||||||
|
unset($postData['save']);
|
||||||
|
unset($postData['selectAll']);
|
||||||
|
|
||||||
$controller = null;
|
$rules_access = [];
|
||||||
$rules_access = null;
|
|
||||||
|
|
||||||
foreach ($postData as $key => $value) {
|
foreach ($postData as $key => $value) {
|
||||||
$exp = explode('_', $key);
|
$exp = explode('_', $key);
|
||||||
$controller[] = $exp[0];
|
if (!isset($rules_access[$exp[0]])) {
|
||||||
}
|
$rules_access[$exp[0]] = [];
|
||||||
|
|
||||||
if ($controller != null) {
|
|
||||||
foreach (array_unique($controller) as $item) {
|
|
||||||
$rules_access[$item] = [];
|
|
||||||
|
|
||||||
foreach ($postData as $key => $value) {
|
|
||||||
$exp = explode('_', $key);
|
|
||||||
if ($exp[0] == $item) {
|
|
||||||
array_push($rules_access[$item], str_replace($exp[0] . '_', '', $key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
array_push($rules_access[$exp[0]], str_replace($exp[0] . '_', '', $key));
|
||||||
}
|
}
|
||||||
|
|
||||||
$temp_data['id'] = $id_group;
|
|
||||||
$temp_data['rules'] = json_encode($rules_access ?? '{}');
|
$temp_data['rules'] = json_encode($rules_access ?? '{}');
|
||||||
$temp_data['name'] = $name;
|
|
||||||
|
|
||||||
$sanitizedData = $this->sanitized($temp_data, $nullIfEmpty);
|
$sanitizedData = $this->sanitized($temp_data, true);
|
||||||
|
|
||||||
$noException = true;
|
$noException = true;
|
||||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
if ($successfulResult = $this->canValidate()) :
|
||||||
|
|
||||||
|
|
||||||
if ($this->canValidate()) :
|
if ($this->canValidate()) :
|
||||||
try {
|
try {
|
||||||
@ -209,13 +190,11 @@ class Group extends \App\Controllers\GoBaseController
|
|||||||
|
|
||||||
$thenRedirect = false;
|
$thenRedirect = false;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ($noException && $successfulResult) :
|
if ($noException && $successfulResult) :
|
||||||
$id = $groupEntity->id ?? $id;
|
$id = $groupEntity->id ?? $id;
|
||||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||||
|
|
||||||
if ($session->get('group') == $this->request->getPost('token')) {
|
|
||||||
$session->set('rules', $temp_data['rules']);
|
|
||||||
}
|
|
||||||
if ($thenRedirect) :
|
if ($thenRedirect) :
|
||||||
if (!empty($this->indexRoute)) :
|
if (!empty($this->indexRoute)) :
|
||||||
return redirect()->to(route_to($this->indexRoute))->with('successMessage', $message);
|
return redirect()->to(route_to($this->indexRoute))->with('successMessage', $message);
|
||||||
@ -230,9 +209,8 @@ class Group extends \App\Controllers\GoBaseController
|
|||||||
endif; // ($requestMethod === 'post')
|
endif; // ($requestMethod === 'post')
|
||||||
|
|
||||||
$this->viewData['group'] = $groupEntity;
|
$this->viewData['group'] = $groupEntity;
|
||||||
|
$this->viewData['permisos'] = (new PermisosModel())->find();
|
||||||
$this->viewData['formAction'] = route_to('updateGroup', $id);
|
$this->viewData['formAction'] = route_to('updateGroup', $id);
|
||||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Group.userGroup') . ' ' . lang('Basic.global.edit3');
|
|
||||||
|
|
||||||
|
|
||||||
return $this->displayForm(__METHOD__, $id);
|
return $this->displayForm(__METHOD__, $id);
|
||||||
} // end function edit(...)
|
} // end function edit(...)
|
||||||
|
|||||||
3
ci4/app/Entities/Usuarios/UserGroupEntity.php → ci4/app/Entities/Usuarios/GroupEntity.php
Executable file → Normal file
3
ci4/app/Entities/Usuarios/UserGroupEntity.php → ci4/app/Entities/Usuarios/GroupEntity.php
Executable file → Normal file
@ -3,10 +3,11 @@ namespace App\Entities\Usuarios;
|
|||||||
|
|
||||||
use CodeIgniter\Entity;
|
use CodeIgniter\Entity;
|
||||||
|
|
||||||
class UserGroupEntity extends \CodeIgniter\Entity\Entity
|
class GroupEntity extends \CodeIgniter\Entity\Entity
|
||||||
{
|
{
|
||||||
protected $attributes = [
|
protected $attributes = [
|
||||||
"id" => null,
|
"id" => null,
|
||||||
|
"keyword" => null,
|
||||||
"name" => null,
|
"name" => null,
|
||||||
"description" => null,
|
"description" => null,
|
||||||
"rules" => null,
|
"rules" => null,
|
||||||
20
ci4/app/Entities/Usuarios/PermisosEntity.php
Normal file
20
ci4/app/Entities/Usuarios/PermisosEntity.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Entities\Usuarios;
|
||||||
|
|
||||||
|
use CodeIgniter\Entity;
|
||||||
|
|
||||||
|
class PermisosEntity extends \CodeIgniter\Entity\Entity
|
||||||
|
{
|
||||||
|
protected $attributes = [
|
||||||
|
"id" => null,
|
||||||
|
"keyword" => null,
|
||||||
|
"name" => null,
|
||||||
|
"description" => null,
|
||||||
|
"rules" => null,
|
||||||
|
"created_at" => null,
|
||||||
|
"updated_at" => null,
|
||||||
|
];
|
||||||
|
protected $casts = [
|
||||||
|
"rules" => "json",
|
||||||
|
];
|
||||||
|
}
|
||||||
@ -1,56 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return [
|
|
||||||
'createdAt' => 'Creado en',
|
|
||||||
'dashboard' => 'Panel',
|
|
||||||
'group_grid_dashboard' => 'Panel',
|
|
||||||
'idGroup' => 'ID Rol',
|
|
||||||
'moduleTitle' => 'Roles y Permisos',
|
|
||||||
'rules' => 'Reglas',
|
|
||||||
'title' => 'Nombre',
|
|
||||||
'group_grid_title' => 'Nombre',
|
|
||||||
'token' => 'Token',
|
|
||||||
'updatedAt' => 'Actualizado en',
|
|
||||||
'groups' => 'Roles y Permisos',
|
|
||||||
'Group' => 'Rol y Permisos',
|
|
||||||
'userGroup' => 'Rol y Permisos',
|
|
||||||
'group' => 'Rol y Permisos',
|
|
||||||
'grouplist' => 'Lista Roles y Permisos',
|
|
||||||
'Groups' => 'Roles y Permisos',
|
|
||||||
'validation' => [
|
|
||||||
'id_group' => [
|
|
||||||
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
|
|
||||||
|
|
||||||
],
|
|
||||||
|
|
||||||
'dashboard' => [
|
|
||||||
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
|
|
||||||
'required' => 'El campo {field} es obligatorio.',
|
|
||||||
|
|
||||||
],
|
|
||||||
|
|
||||||
'rules' => [
|
|
||||||
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
|
|
||||||
'required' => 'El campo {field} es obligatorio.',
|
|
||||||
|
|
||||||
],
|
|
||||||
|
|
||||||
'title' => [
|
|
||||||
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
|
|
||||||
'required' => 'El campo {field} es obligatorio.',
|
|
||||||
|
|
||||||
],
|
|
||||||
|
|
||||||
'token' => [
|
|
||||||
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
|
|
||||||
'required' => 'El campo {field} es obligatorio.',
|
|
||||||
|
|
||||||
],
|
|
||||||
|
|
||||||
|
|
||||||
],
|
|
||||||
|
|
||||||
|
|
||||||
];
|
|
||||||
65
ci4/app/Language/es/RolesPermisos.php
Normal file
65
ci4/app/Language/es/RolesPermisos.php
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'pageTitle' => 'Roles y Permisos',
|
||||||
|
'name' => 'Nombre del Grupo',
|
||||||
|
'rules' => 'Reglas',
|
||||||
|
'createdAt' => 'Creado en',
|
||||||
|
'updatedAt' => 'Actualizado en',
|
||||||
|
|
||||||
|
'addRol' => 'Añadir rol si no existe',
|
||||||
|
'totalUsers' => ' usuarios en total',
|
||||||
|
'editRol' => 'Editar Rol',
|
||||||
|
'rolName' => 'Nombre del Rol',
|
||||||
|
'rolDescription' => 'Descripción del Rol',
|
||||||
|
'rolPermissions' => 'Permisos del Rol',
|
||||||
|
'selectAll' => 'Seleccionar todos',
|
||||||
|
|
||||||
|
'adminRol' => 'Rol de Administrador',
|
||||||
|
'adminRolTooltip' => 'Permitir acceso completo al sistema',
|
||||||
|
|
||||||
|
// System permissions
|
||||||
|
'createPermission' => 'Crear',
|
||||||
|
'editPermission' => 'Editar',
|
||||||
|
'deletePermission' => 'Eliminar',
|
||||||
|
|
||||||
|
// System sections
|
||||||
|
'clientesSection' => 'Clientes',
|
||||||
|
'plantillaTarifaSection' => 'Plantilla de tarifas',
|
||||||
|
'presupuestoSection' => 'Presupuestos',
|
||||||
|
'tarifaPreimpresionSection' => 'Tarifas de preimpresión',
|
||||||
|
'tarifaManipuladoSection' => 'Tarifas de manipulado',
|
||||||
|
'tarifaAcabadoSection' => 'Tarifas de acabado',
|
||||||
|
'tarifaEncuadernacionSection' => 'Tarifas de encuadernación',
|
||||||
|
'tarifaEnvioSection' => 'Tarifas de envio',
|
||||||
|
'proveedoresSection' => 'Proveedores',
|
||||||
|
'ajustesSection' => 'Ajustes',
|
||||||
|
'actividadSection' => 'Accesos',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'validation' => [
|
||||||
|
'id' => [
|
||||||
|
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
|
||||||
|
],
|
||||||
|
'keyword' => [
|
||||||
|
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
|
||||||
|
'required' => 'El campo {field} es obligatorio.',
|
||||||
|
],
|
||||||
|
'name' => [
|
||||||
|
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
|
||||||
|
'required' => 'El campo {field} es obligatorio.',
|
||||||
|
],
|
||||||
|
'description' => [
|
||||||
|
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
|
||||||
|
'required' => 'El campo {field} es obligatorio.',
|
||||||
|
],
|
||||||
|
'rules' => [
|
||||||
|
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
|
||||||
|
'required' => 'El campo {field} es obligatorio.',
|
||||||
|
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
];
|
||||||
@ -30,15 +30,15 @@ class GroupModel extends \App\Models\BaseModel
|
|||||||
7 => "t1.updated_at",
|
7 => "t1.updated_at",
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $allowedFields = ["id", "name", "description", "rules"];
|
protected $allowedFields = ["id", "keyword", "name", "description", "rules"];
|
||||||
protected $returnType = "App\Entities\Usuarios\UserGroupEntity";
|
protected $returnType = "App\Entities\Usuarios\GroupEntity";
|
||||||
|
|
||||||
public static $labelField = "name";
|
public static $labelField = "name";
|
||||||
|
|
||||||
protected $validationRules = [
|
protected $validationRules = [
|
||||||
"description" => [
|
"description" => [
|
||||||
"label" => "UserGroups.description",
|
"label" => "UserGroups.description",
|
||||||
"rules" => "required|max_length[150]",
|
"rules" => "max_length[150]",
|
||||||
],
|
],
|
||||||
"name" => [
|
"name" => [
|
||||||
"label" => "UserGroups.name",
|
"label" => "UserGroups.name",
|
||||||
|
|||||||
@ -1,16 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace App\Models\Usuarios;
|
|
||||||
|
|
||||||
use App\Models\BaseModel;
|
|
||||||
|
|
||||||
class GroupsUsersModel extends BaseModel
|
|
||||||
{
|
|
||||||
protected $table = 'auth_groups_users';
|
|
||||||
protected $allowedFields = [ ];
|
|
||||||
|
|
||||||
public function getUsersWithRol($token_group){
|
|
||||||
|
|
||||||
$result = $this->select('token_user')->where('token_group', $token_group)->countAllResults();
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
92
ci4/app/Models/Usuarios/PermisosModel.php
Normal file
92
ci4/app/Models/Usuarios/PermisosModel.php
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Usuarios;
|
||||||
|
|
||||||
|
class PermisosModel extends \App\Models\BaseModel
|
||||||
|
{
|
||||||
|
protected $table = "auth_permissions";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether primary key uses auto increment.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $useAutoIncrement = true;
|
||||||
|
|
||||||
|
protected $primaryKey = "id";
|
||||||
|
|
||||||
|
protected $useTimestamps = true;
|
||||||
|
protected $dateFormat = 'datetime';
|
||||||
|
protected $createdField = 'created_at';
|
||||||
|
protected $updatedField = 'updated_at';
|
||||||
|
|
||||||
|
const SORTABLE = [
|
||||||
|
1 => "t1.id",
|
||||||
|
2 => "t1.keyword",
|
||||||
|
3 => "t1.name",
|
||||||
|
4 => "t1.description",
|
||||||
|
5 => "t1.rules",
|
||||||
|
6 => "t1.created_at",
|
||||||
|
7 => "t1.updated_at",
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $allowedFields = ["id", "keyword", "name", "description", "rules"];
|
||||||
|
protected $returnType = "App\Entities\Usuarios\PermisosEntity";
|
||||||
|
|
||||||
|
public static $labelField = "name";
|
||||||
|
|
||||||
|
protected $validationRules = [
|
||||||
|
"description" => [
|
||||||
|
"label" => "UserGroups.description",
|
||||||
|
"rules" => "max_length[150]",
|
||||||
|
],
|
||||||
|
"name" => [
|
||||||
|
"label" => "UserGroups.name",
|
||||||
|
"rules" => "required|max_length[50]",
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $validationMessages = [
|
||||||
|
"description" => [
|
||||||
|
"max_length" => "UserGroups.validation.description.max_length",
|
||||||
|
"required" => "UserGroups.validation.description.required",
|
||||||
|
],
|
||||||
|
"name" => [
|
||||||
|
"max_length" => "UserGroups.validation.name.max_length",
|
||||||
|
"required" => "UserGroups.validation.name.required",
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get resource data.
|
||||||
|
*
|
||||||
|
* @param string $search
|
||||||
|
*
|
||||||
|
* @return \CodeIgniter\Database\BaseBuilder
|
||||||
|
*/
|
||||||
|
public function getResource(string $search = "")
|
||||||
|
{
|
||||||
|
$builder = $this->db
|
||||||
|
->table($this->table . " t1")
|
||||||
|
->select(
|
||||||
|
"t1.id AS id, t1.keyword AS keyword, t1.name AS name, t1.description AS description, t1.rules AS rules,
|
||||||
|
t1.token AS token, t1.created_at AS created_at, t1.updated_at AS updated_at"
|
||||||
|
);
|
||||||
|
|
||||||
|
return empty($search)
|
||||||
|
? $builder
|
||||||
|
: $builder
|
||||||
|
->groupStart()
|
||||||
|
->like("t1.id", $search)
|
||||||
|
->orLike("t1.keyword", $search)
|
||||||
|
->orLike("t1.name", $search)
|
||||||
|
->orLike("t1.description", $search)
|
||||||
|
->orLike("t1.rules", $search)
|
||||||
|
->orLike("t1.created_at", $search)
|
||||||
|
->orLike("t1.updated_at", $search)
|
||||||
|
->groupEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -6,7 +6,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card card-info">
|
<div class="card card-info">
|
||||||
<h3 class="card-header"><?= $boxTitle ?? $pageTitle ?></h3>
|
<h3 class="card-header"><?= lang("RolesPermisos.editRol") ?></h3>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<?= formAlert() ?>
|
<?= formAlert() ?>
|
||||||
<form id="groupForm" method="post" class="card-body" action="<?= $formAction ?>">
|
<form id="groupForm" method="post" class="card-body" action="<?= $formAction ?>">
|
||||||
@ -14,79 +14,81 @@
|
|||||||
|
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
<input type="hidden"
|
<input type="hidden"
|
||||||
name="id_group"
|
name="id"
|
||||||
value="<?= old('id', $group->id) ?>"
|
value="<?= old('id', $group->id) ?>"
|
||||||
>
|
>
|
||||||
<div class="col-md-6">
|
<div class="col-md-4">
|
||||||
<label for="title" class="form-label text-dark">
|
<label for="title" class="form-label text-dark">
|
||||||
<?= lang("App.group_field_title") ?>
|
<?= lang("RolesPermisos.rolName") ?>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" name="name" id="name" class="form-control"
|
<input type="text" name="name" id="name" class="form-control"
|
||||||
value="<?= old('name', $group->name) ?>">
|
value="<?= old('name', $group->name) ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col-md-8">
|
||||||
<div class="row g-3 mt-3">
|
<label for="description" class="form-label text-dark">
|
||||||
<div class="col-md-6">
|
<?= lang("RolesPermisos.rolDescription") ?>
|
||||||
<button type="button" name="select_all"
|
</label>
|
||||||
id="select_all"
|
<input type="text" name="description" id="description" class="form-control"
|
||||||
class="btn btn-primary me-sm-3 me-1">
|
value="<?= old('description', $group->description) ?>">
|
||||||
<i class="la la-toggle-on"></i> <?= lang("App.group_btn_select") ?>
|
|
||||||
</button>
|
|
||||||
<button type="button" name="remove_all"
|
|
||||||
id="remove_all"
|
|
||||||
class="btn btn-secondary ">
|
|
||||||
<i class="la la-toggle-off"></i> <?= lang("App.group_btn_remove") ?>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row g-3 mt-3">
|
<div class="row g-3 mt-3">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<h5>Role Permissions</h5>
|
<h5><?= lang("RolesPermisos.rolPermissions") ?></h5>
|
||||||
<!-- Permission table -->
|
<!-- Permission table -->
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-flush-spacing">
|
<table class="table table-flush-spacing">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-nowrap fw-semibold">
|
<td class="text-nowrap fw-semibold" colspan="1">
|
||||||
Recurso
|
<?= lang("RolesPermisos.adminRol") ?>
|
||||||
|
<i class="ti ti-info-circle" data-bs-toggle="tooltip"
|
||||||
|
data-bs-placement="top"
|
||||||
|
aria-label="<?= lang("RolesPermisos.adminRolTooltip") ?>"
|
||||||
|
data-bs-original-title="<?= lang("RolesPermisos.adminRolTooltip") ?>">
|
||||||
|
</i>
|
||||||
|
</td>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" type="checkbox" name="selectAll">
|
||||||
|
<label class="form-check-label" for="selectAll">
|
||||||
|
<?= lang("RolesPermisos.selectAll") ?>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
|
||||||
<div class="form-check">
|
|
||||||
<input type="checkbox"
|
|
||||||
id="recurso_name"
|
|
||||||
name="recurso_name"
|
|
||||||
class="form-check-input"
|
|
||||||
checked
|
|
||||||
>
|
|
||||||
<label for="recurso_name"
|
|
||||||
class="form-check-label">Permiso</label>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php /*foreach (getAllClass() as $item): ?>
|
<?php foreach ($permisos as $permiso): ?>
|
||||||
<?php if (empty($item['path'])): ?>
|
<tr>
|
||||||
|
<td colspan="4" class="text-nowrap fw-semibold">
|
||||||
|
<?= $permiso->name ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php foreach ($permiso->rules as $key => $rules): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-nowrap fw-semibold"><?= getDictionary($item['name']) ?></td>
|
<td class="text-nowrap fw-semibold" >
|
||||||
<?php foreach ($item['methods'] as $subitem): ?>
|
  <?= lang("RolesPermisos." . $key . "Section") ?>
|
||||||
<?php if (!getIgnoreMethod($subitem)): ?>
|
</td>
|
||||||
<td>
|
<?php foreach ($rules as $rule): ?>
|
||||||
<div class="form-check">
|
<td>
|
||||||
<input type="checkbox"
|
<div class="form-check">
|
||||||
id="<?= $item['name'] . '_' . $subitem ?>"
|
<input type="checkbox"
|
||||||
name="<?= $item['name'] . '_' . $subitem ?>"
|
id="<?= $key . '_' . $rule ?>"
|
||||||
class="form-check-input"
|
name="<?= $key . '_' . $rule ?>"
|
||||||
<?= ruleIsChecked($group->rules, $item['name'], $subitem) ? 'checked' : '' ?>
|
class="form-check-input"
|
||||||
>
|
<?= ruleIsChecked($group->rules, $key, $rule) ? 'checked' : '' ?>
|
||||||
<label for="<?= $item['name'] . '_' . $subitem ?>"
|
>
|
||||||
class="form-check-label"><?= getDictionary($subitem) ?></label>
|
<label for="<?= $key . '_' . $rule ?>" class="form-check-label">
|
||||||
</div>
|
<?= lang("RolesPermisos." . $rule . "Permission") ?>
|
||||||
</td>
|
</label>
|
||||||
<?php endif; ?>
|
</div>
|
||||||
|
</td>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endif; ?>
|
<?php endforeach;
|
||||||
<?php endforeach; */?>
|
endforeach;
|
||||||
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@ -109,15 +111,12 @@
|
|||||||
|
|
||||||
<?= $this->section('additionalInlineJs') ?>
|
<?= $this->section('additionalInlineJs') ?>
|
||||||
|
|
||||||
$('#select_all').on('click', function () {
|
$('input[name="selectAll"]').click(function() {
|
||||||
$(':checkbox').each(function() {
|
var checkedStatus = this.checked;
|
||||||
this.checked = true;
|
$('input[type="checkbox"]').each(function() {
|
||||||
});
|
this.checked = checkedStatus;
|
||||||
});
|
|
||||||
$('#remove_all').on('click', function () {
|
|
||||||
$(':checkbox').each(function() {
|
|
||||||
this.checked = false;
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -5,7 +5,7 @@
|
|||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="card card-info">
|
<div class="card card-info">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title"><?= lang('Group.grouplist') ?></h3>
|
<h3 class="card-title"><?= lang('RolesPermisos.pageTitle') ?></h3>
|
||||||
</div><!--//.card-header -->
|
</div><!--//.card-header -->
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="container-xxl flex-grow-1 container-p-y">
|
<div class="container-xxl flex-grow-1 container-p-y">
|
||||||
@ -31,7 +31,7 @@
|
|||||||
>
|
>
|
||||||
<?= lang('Basic.global.addNew') ?>
|
<?= lang('Basic.global.addNew') ?>
|
||||||
</button>
|
</button>
|
||||||
<p class="mb-0 mt-1">Añadir rol si no existe</p>
|
<p class="mb-0 mt-1"><?= lang("RolesPermisos.addRol") ?></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -43,7 +43,7 @@
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<h6 class="fw-normal mb-2"><?= $model->getUsersWithRol($item->keyword); ?> usuarios en total</h6>
|
<h6 class="fw-normal mb-2"><?= $model->getUsersWithRol($item->keyword); ?><?= lang("RolesPermisos.totalUsers") ?></h6>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-content-between align-items-end mt-1">
|
<div class="d-flex justify-content-between align-items-end mt-1">
|
||||||
<div class="role-heading">
|
<div class="role-heading">
|
||||||
|
|||||||
@ -1,166 +0,0 @@
|
|||||||
<!--Style-->
|
|
||||||
<link href="<?=site_url("themes/focus2/vendor/summernote/summernote.css")?>" rel="stylesheet">
|
|
||||||
<!--Content Body-->
|
|
||||||
<div class="content-body">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="row page-titles mx-0">
|
|
||||||
<div class="col-sm-6 p-md-0">
|
|
||||||
<div class="welcome-text">
|
|
||||||
<h4><i class="<?= $title['icon']??'' ?>"></i> <?= $title['module']??'' ?></h4>
|
|
||||||
<span class="ml-1"><?= $title['page']??'' ?></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-6 p-md-0 justify-content-sm-end mt-2 mt-sm-0 d-flex">
|
|
||||||
<ol class="breadcrumb">
|
|
||||||
<?php foreach ($breadcrumb??[] as $item) : ?>
|
|
||||||
<?php if (!$item['active']) : ?>
|
|
||||||
<li class="breadcrumb-item"><a href="<?= site_url($item['route']) ?>"><?= $item['title'] ?></a></li>
|
|
||||||
<?php else : ?>
|
|
||||||
<li class="breadcrumb-item active"><?= $item['title'] ?></li>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<div class="row mx-0" style="width: 100%;">
|
|
||||||
<div class="col-sm-6 p-md-0">
|
|
||||||
<h4 class="card-title"><?= $title['page']??'' ?></h4>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-6 p-md-0 justify-content-sm-end mt-2 mt-sm-0 d-flex">
|
|
||||||
<button type="button" class="btn btn-sm btn-secondary" data-toggle="modal" data-target="#tagModalCenter" title="<?=lang("App.template_label_tag")?>">
|
|
||||||
<i class="fas fa-tags"></i>
|
|
||||||
</button>
|
|
||||||
<!-- Modal -->
|
|
||||||
<div class="modal fade" id="tagModalCenter">
|
|
||||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title"><?=lang("App.template_modal_title")?></h5>
|
|
||||||
<button type="button" class="close" data-dismiss="modal"><span>×</span></button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<p><?=lang("App.template_modal_subtitle")?></p>
|
|
||||||
<?php foreach (keywordEmail()??[] as $item) : ?>
|
|
||||||
<button type="button" class="btn btn-primary btn-sm mt-1 mr-1" onclick="copy('[<?=$item?>]')">[<?=$item?>]</button>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-dark" data-dismiss="modal"><?=lang("App.template_modal_btn_1")?></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<?= formAlert() ?>
|
|
||||||
<form class="form" action="<?=site_url("notification/store")?>" method="post">
|
|
||||||
<?= csrf_field() ?>
|
|
||||||
<div class="form-body">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-4">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="email_gateway" class="text-dark"><?=lang("App.notification_field_user")?></label>
|
|
||||||
<?php $id_select = (isset($obj)) ? $obj['user_recipient'] : set_value('user_recipient');?>
|
|
||||||
<select name="user_recipient" id="user_recipient" class="form-control">
|
|
||||||
<option value="" <?= $id_select == "" ? 'selected' : '' ?>><?=lang("App.notification_field_user_all")?></option>
|
|
||||||
<?php foreach($user??[] as $item): ?>
|
|
||||||
<option value="<?=$item['token']?>" <?= $id_select == $item['token'] ? 'selected' : '' ?>><?=$item['first_name']?> - <?=$item['email']?></option>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-8">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="title" class="text-dark"><?=lang("App.notification_field_title")?></label>
|
|
||||||
<input type="text" name="title" id="title" class="form-control" value="<?= (isset($obj)) ? $obj['title'] : set_value('title') ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="text-dark"><?=lang("App.notification_field_body")?></label>
|
|
||||||
<textarea class="form-control" id="body" name="body" rows="3"><?= (isset($obj)) ? $obj['body'] : set_value('body') ?></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-12">
|
|
||||||
<label class="text-primary"><?=lang("App.notification_field_send_msg")?></label>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="text-dark"><?=lang("App.notification_field_send_email")?></label>
|
|
||||||
<div class="custom-control custom-switch">
|
|
||||||
<input type="checkbox" id="send_email_notification" name="send_email_notification" class="custom-control-input" <?= $obj['send_email_notification']??false ? 'checked' : ''?>>
|
|
||||||
<label for="send_email_notification" class="custom-control-label"><?=lang("App.notification_field_send_label")?></label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-actions mt-2">
|
|
||||||
<a href="<?= site_url($btn_return['route']??'#') ?>" class="<?= $btn_return['class']??''?>">
|
|
||||||
<i class="<?= $btn_return['icon']??'' ?>"></i> <?= $btn_return['title']??'' ?>
|
|
||||||
</a>
|
|
||||||
<button type="submit" class="<?= $btn_submit['class']??''?>">
|
|
||||||
<i class="<?= $btn_submit['icon']??'' ?>"></i> <?= $btn_submit['title']??'' ?>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- Required vendors -->
|
|
||||||
<script src="<?=site_url("themes/focus2/vendor/global/global.min.js")?>"></script>
|
|
||||||
<script src="<?=site_url("themes/focus2/js/quixnav-init.js")?>"></script>
|
|
||||||
<script src="<?=site_url("themes/focus2/js/custom.min.js")?>"></script>
|
|
||||||
<script src="<?=site_url("themes/focus2/vendor/select2/js/select2.full.min.js")?>"></script>
|
|
||||||
<!-- Summernote -->
|
|
||||||
<script src="<?=site_url("themes/focus2/vendor/summernote/summernote.min.js")?>"></script>
|
|
||||||
<!-- Alert -->
|
|
||||||
<script src="<?=site_url("themes/focus2/vendor/sweetalert2/dist/sweetalert2.min.js")?>"></script>
|
|
||||||
<script src="<?=site_url("themes/focus2/vendor/toastr/js/toastr.min.js")?>"></script>
|
|
||||||
<!-- Form -->
|
|
||||||
<script>
|
|
||||||
"use strict";
|
|
||||||
$(document).ready(function () {
|
|
||||||
$('#title').focus();
|
|
||||||
$("#user_recipient").select2();
|
|
||||||
let configSummerNote = {
|
|
||||||
height: 150, // set editor height
|
|
||||||
minHeight: null, // set minimum height of editor
|
|
||||||
maxHeight: null, // set maximum height of editor
|
|
||||||
focus: true, // set focus to editable area after initializing summernote
|
|
||||||
toolbar: [
|
|
||||||
['style', ['style']],
|
|
||||||
['font', ['bold', 'italic', 'underline', 'clear']],
|
|
||||||
['fontname', ['fontname']],
|
|
||||||
['color', ['color']],
|
|
||||||
['para', ['ul', 'ol', 'paragraph']],
|
|
||||||
['height', ['height']],
|
|
||||||
['table', ['table']],
|
|
||||||
['insert', ['link', 'picture', 'hr']],
|
|
||||||
['view', ['codeview']]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
$("#body").summernote(configSummerNote);
|
|
||||||
});
|
|
||||||
$("#body").on("summernote.enter", function(we, e) {
|
|
||||||
$(this).summernote("pasteHTML", "<br><br>");
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
function copy(copyText) {
|
|
||||||
navigator.clipboard.writeText(copyText);
|
|
||||||
toastr.success('<?= lang("App.template_modal_copy_msg") ?>','<?= lang("App.template_modal_copy") ?>!',{positionClass: 'toast-top-center'})
|
|
||||||
$('#tagModalCenter').modal('hide')
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<?= toastAlert() ?>
|
|
||||||
@ -1,149 +0,0 @@
|
|||||||
<!--Content Body-->
|
|
||||||
<div class="content-body">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="row page-titles mx-0">
|
|
||||||
<div class="col-sm-6 p-md-0">
|
|
||||||
<div class="welcome-text">
|
|
||||||
<h4><i class="<?= $title['icon']??'' ?>"></i> <?= $title['module']??'' ?></h4>
|
|
||||||
<span class="ml-1"><?= $title['page']??'' ?></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-6 p-md-0 justify-content-sm-end mt-2 mt-sm-0 d-flex">
|
|
||||||
<ol class="breadcrumb">
|
|
||||||
<?php foreach ($breadcrumb??[] as $item) : ?>
|
|
||||||
<?php if (!$item['active']) : ?>
|
|
||||||
<li class="breadcrumb-item"><a href="<?= site_url($item['route']) ?>"><?= $item['title'] ?></a></li>
|
|
||||||
<?php else : ?>
|
|
||||||
<li class="breadcrumb-item active"><?= $item['title'] ?></li>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header row">
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<h4 class="card-title"><?= $title['page']??'' ?></h4>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-6 justify-content-sm-end mt-2 mt-sm-0 d-flex">
|
|
||||||
<a href="<?= site_url($btn_add['route']??'#')?>" class="<?= $btn_add['class']??''?>">
|
|
||||||
<i class="<?= $btn_add['icon']??'' ?>"></i> <?= $btn_add['title']??'' ?>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<!-- CSRF token -->
|
|
||||||
<input type="hidden" class="txt_csrfname" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>" />
|
|
||||||
<!-- Table -->
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table id='table-grid' class="table table-striped nowrap" style="width:100%">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th><?=lang("App.notification_grid_sender")?></th>
|
|
||||||
<th><?=lang("App.notification_grid_recipient")?></th>
|
|
||||||
<th><?=lang("App.notification_grid_title")?></th>
|
|
||||||
<th><?=lang("App.notification_grid_email")?></th>
|
|
||||||
<th><?=lang("App.notification_grid_view")?></th>
|
|
||||||
<th><?=lang("App.notification_grid_created")?></th>
|
|
||||||
<th><?=lang("App.user_grid_options")?></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- Required vendors -->
|
|
||||||
<script src="<?=site_url("themes/focus2/vendor/global/global.min.js")?>"></script>
|
|
||||||
<script src="<?=site_url("themes/focus2/js/quixnav-init.js")?>"></script>
|
|
||||||
<script src="<?=site_url("themes/focus2/js/custom.min.js")?>"></script>
|
|
||||||
<!-- Datatable -->
|
|
||||||
<script src="<?=site_url("themes/focus2/vendor/datatables/js/jquery.dataTables.min.js")?>"></script>
|
|
||||||
<script src="<?=site_url("themes/focus2/vendor/pickers/daterange/moment.min.js")?>"></script>
|
|
||||||
<script src="<?=site_url("themes/focus2/vendor/datatables/js/dataTables.datetime.js")?>"></script>
|
|
||||||
<script src="<?=site_url("themes/focus2/vendor/datatables/js/dataTables.buttons.min.js")?>"></script>
|
|
||||||
<script src="<?=site_url("themes/focus2/vendor/datatables/js/buttons.bootstrap4.min.js")?>"></script>
|
|
||||||
<script src="<?=site_url("themes/focus2/vendor/datatables/js/jszip.min.js")?>"></script>
|
|
||||||
<script src="<?=site_url("themes/focus2/vendor/datatables/js/pdfmake.min.js")?>"></script>
|
|
||||||
<script src="<?=site_url("themes/focus2/vendor/datatables/js/vfs_fonts.js")?>"></script>
|
|
||||||
<script src="<?=site_url("themes/focus2/vendor/datatables/js/buttons.html5.min.js")?>"></script>
|
|
||||||
<script src="<?=site_url("themes/focus2/vendor/datatables/js/buttons.print.min.js")?>"></script>
|
|
||||||
<script src="<?=site_url("themes/focus2/vendor/datatables/js/buttons.colVis.min.js")?>"></script>
|
|
||||||
<!-- Alert -->
|
|
||||||
<script src="<?=site_url("themes/focus2/vendor/sweetalert2/dist/sweetalert2.min.js")?>"></script>
|
|
||||||
<script src="<?=site_url("themes/focus2/vendor/toastr/js/toastr.min.js")?>"></script>
|
|
||||||
<!-- Custom -->
|
|
||||||
<script src="<?=site_url("assets/js/main.js")?>"></script>
|
|
||||||
<script>
|
|
||||||
"use strict";
|
|
||||||
$(document).ready(function () {
|
|
||||||
let dataFormat = [
|
|
||||||
{
|
|
||||||
targets: 3,
|
|
||||||
render: function ( data, type, row ) {
|
|
||||||
switch (data) {
|
|
||||||
case '1':
|
|
||||||
return '<span class="badge badge-success"><?=lang("App.notification_grid_yes")?></span>';
|
|
||||||
default:
|
|
||||||
return '<span class="badge badge-dark"><?=lang("App.notification_grid_no")?></span>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
targets: 4,
|
|
||||||
render: function ( data, type, row ) {
|
|
||||||
switch (data) {
|
|
||||||
case '1':
|
|
||||||
return '<span class="badge badge-success"><?=lang("App.notification_grid_yes")?></span>';
|
|
||||||
default:
|
|
||||||
return '<span class="badge badge-dark"><?=lang("App.notification_grid_no")?></span>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
targets: 5,
|
|
||||||
render: function ( data, type, row ) {
|
|
||||||
switch (data) {
|
|
||||||
case '1':
|
|
||||||
return '<span class="badge badge-success"><?=lang("App.notification_grid_yes")?></span>';
|
|
||||||
default:
|
|
||||||
return '<span class="badge badge-dark"><?=lang("App.notification_grid_no")?></span>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
targets: 6,
|
|
||||||
render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss','<?=momentDateTimeJS()?>')
|
|
||||||
}
|
|
||||||
];
|
|
||||||
let order = [[0, "asc"]];
|
|
||||||
let translate = '/themes/focus2/vendor/datatables/locales/<?=langJS()?>.json';
|
|
||||||
let button = ["<?=lang("App.global_copy")?>","<?=lang("App.global_print")?>","<?=lang("App.global_excel")?>","<?=lang("App.global_pdf")?>"];
|
|
||||||
let columns = [{ data: 'sender' },{ data: 'recipient' },{ data: 'title' },{ data: 'is_send_email' },{ data: 'is_read' },{ data: 'created_at' },{ data: 'options' }];
|
|
||||||
loadDataTableAjax('table-grid', '<?=site_url('ajax/getNotification')?>', translate, true, true, order, columns,dataFormat, button);
|
|
||||||
});
|
|
||||||
function delete_this(id){
|
|
||||||
swal({
|
|
||||||
title: "<?=lang("App.notification_delete_title")?>",
|
|
||||||
text: "<?=lang("App.notification_delete_subtitle")?>",
|
|
||||||
type: "warning",
|
|
||||||
showCancelButton: !0,
|
|
||||||
confirmButtonColor: "#f34141",
|
|
||||||
confirmButtonText: "<?=lang("App.notification_delete_btn_ok")?>",
|
|
||||||
cancelButtonText: "<?=lang("App.notification_delete_btn_cancel")?>",
|
|
||||||
closeOnConfirm: !1
|
|
||||||
}).then(function(isConfirm) {
|
|
||||||
|
|
||||||
if (isConfirm.value) {
|
|
||||||
window.location.href = '<?=site_url("notification/delete/")?>'+id;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<?= sweetAlert() ?>
|
|
||||||
Reference in New Issue
Block a user