mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Modificando usuarios y roles
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
<?php namespace App\Controllers\Clientes;
|
||||
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
|
||||
use App\Models\Collection;
|
||||
|
||||
@ -9,15 +8,9 @@ use App\Entities\Clientes\ClienteEntity;
|
||||
|
||||
use App\Models\Clientes\ClienteModel;
|
||||
|
||||
use App\Models\Configuracion\ProvinciaModel;
|
||||
|
||||
use App\Models\Configuracion\UserModel;
|
||||
|
||||
use App\Models\Configuracion\ComunidadAutonomaModel;
|
||||
|
||||
use App\Models\Configuracion\FormaPagoModel;
|
||||
|
||||
use App\Models\Configuracion\PaisModel;
|
||||
|
||||
class Cliente extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
@ -79,8 +72,6 @@ class Cliente extends \App\Controllers\BaseResourceController
|
||||
public function add()
|
||||
{
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
<?php namespace App\Controllers\Configuracion;
|
||||
|
||||
use App\Entities\Usuarios\UserGroupEntity;
|
||||
|
||||
use App\Controllers\BaseResourceController;
|
||||
use App\Models\Usuarios\UserGroupModel;
|
||||
use App\Models\Usuarios\GroupUserModel;
|
||||
|
||||
@ -47,8 +45,6 @@ class Group extends \App\Controllers\GoBaseController
|
||||
public function add()
|
||||
{
|
||||
|
||||
|
||||
|
||||
if ($this->request->getPost()) :
|
||||
|
||||
$nullIfEmpty = true; // !(phpversion() >= '8.1');
|
||||
|
||||
@ -5,9 +5,7 @@ use App\Entities\Usuarios\UserEntity;
|
||||
|
||||
use App\Models\Usuarios\UserGroupModel;
|
||||
use App\Models\Usuarios\GroupUserModel;
|
||||
use App\Models\Usuarios\UserModel;
|
||||
|
||||
use App\Libraries\PasswordHash;
|
||||
use App\Models\UserModel;
|
||||
|
||||
class Users extends \App\Controllers\GoBaseController {
|
||||
|
||||
@ -18,7 +16,7 @@ class Users extends \App\Controllers\GoBaseController {
|
||||
|
||||
use \CodeIgniter\API\ResponseTrait;
|
||||
|
||||
protected static $primaryModelName = 'App\Models\Usuarios\UserModel';
|
||||
protected static $primaryModelName = 'App\Models\UserModel';
|
||||
|
||||
protected static $singularObjectNameCc = 'user';
|
||||
protected static $singularObjectName = 'User';
|
||||
|
||||
@ -1,88 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\ActivityModel;
|
||||
use App\Models\BackupModel;
|
||||
use App\Models\CronTabModel;
|
||||
use App\Models\NotificationModel;
|
||||
use App\Models\SettingsModel;
|
||||
use App\Models\Usuarios\UserModel;
|
||||
|
||||
class Cron extends BaseController
|
||||
{
|
||||
private $integration;
|
||||
private $user_model;
|
||||
private $notification_model;
|
||||
private $crontab_model;
|
||||
private $settings_model;
|
||||
private $activity_model;
|
||||
private $backup_model;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->integration = new Integration();
|
||||
$this->user_model = new UserModel();
|
||||
$this->notification_model = new NotificationModel();
|
||||
$this->settings_model = new SettingsModel();
|
||||
$this->crontab_model = new CronTabModel();
|
||||
$this->activity_model = new ActivityModel();
|
||||
$this->backup_model = new BackupModel();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$settings = $this->settings_model->first()??[];
|
||||
|
||||
// Cron Notification E-mail
|
||||
try {
|
||||
$email_list = $this->notification_model
|
||||
->select('notification.id_notification, recipient.email, notification.title, notification.body')
|
||||
->join('user AS recipient','notification.user_recipient = recipient.token','left')
|
||||
->where('send_email_notification',true)
|
||||
->where('is_send_email',false)
|
||||
->orderBy('notification.id_notification','desc')
|
||||
->findAll(25);
|
||||
foreach ($email_list as $item){
|
||||
if($this->integration->send_email($item['email'],$item['title'],$item['body'])){
|
||||
$this->notification_model->save(['id_notification' => $item['id_notification'],'is_send_email' => true]);
|
||||
}
|
||||
}
|
||||
}catch (\Exception $e){
|
||||
$this->crontab_model->save(['routine'=>'Notification Email','error'=>$e->getMessage()]);
|
||||
}
|
||||
|
||||
// Cron Backup
|
||||
if(date('Y-m-d') > date('Y-m-d',strtotime($settings['backup_latest']))){
|
||||
if(date('H:i:s') >= date('H:i:s',strtotime($settings['backup_time']))){
|
||||
try {
|
||||
$this->settings_model->save([
|
||||
'id_settings' => $settings['id_settings'],
|
||||
'backup_latest' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
$this->integration->create_backup();
|
||||
}catch (\Exception $e){
|
||||
$this->crontab_model->save(['routine'=>'Backup','error'=>$e->getMessage()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cron Log Delete
|
||||
if(date('Y-m-d') >= date('Y-m-d',strtotime(date($settings['remove_log_latest']) . ' +'.$settings['remove_log_time'].' day'))){
|
||||
try {
|
||||
$this->settings_model->save([
|
||||
'id_settings' => $settings['id_settings'],
|
||||
'remove_log_latest' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
$dateStart = date('Y-m-d H:i:s',strtotime(date('Y-m-d H:i:s') . ' -5 year'));
|
||||
$dateEnd = date('Y-m-d H:i:s',strtotime(date('Y-m-d H:i:s') . ' -30 day'));
|
||||
$this->crontab_model->where('created_at between "'.$dateStart.'" and "'.$dateEnd.'"')->delete();
|
||||
$this->activity_model->where('created_at between "'.$dateStart.'" and "'.$dateEnd.'"')->delete();
|
||||
$this->backup_model->where('created_at between "'.$dateStart.'" and "'.$dateEnd.'"')->delete();
|
||||
}catch (\Exception $e){
|
||||
$this->crontab_model->save(['routine'=>'Delete Log','error'=>$e->getMessage()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -19,134 +19,7 @@ class Home extends BaseController
|
||||
public function index()
|
||||
{
|
||||
|
||||
$session = session();
|
||||
|
||||
echo view(getenv('theme.path').'main/defaultlayout');
|
||||
|
||||
/*
|
||||
//echo view(getenv('theme.path').'main/header');
|
||||
//echo view(getenv('theme.path').'main/menu');
|
||||
//echo view(getenv('theme.path').'form/dashboard/index');
|
||||
//echo view(getenv('theme.path').'main/footer');
|
||||
|
||||
/*switch ($session->get('dashboard')):
|
||||
case 'admin':
|
||||
$data['title'] = [
|
||||
'module' => lang("App.dashboard_hello").' '.$name,
|
||||
'page' => lang("App.dashboard_indicators"),
|
||||
'icon' => ''
|
||||
];
|
||||
|
||||
$data['breadcrumb'] = [
|
||||
['title' => lang("App.menu_dashboard"), 'route' => "", 'active' => true]
|
||||
];
|
||||
|
||||
//Cards Top
|
||||
$initialDate = date('Y-m-d H:i:s', strtotime('-1 day', time()));
|
||||
$finalDate = date('Y-m-d H:i:s');
|
||||
$data['total_user'] = $this->user_model->countAllResults();
|
||||
$data['total_new'] = $this->user_model->where('created_at between \''.$initialDate.'\' and \''.$finalDate.'\'')->countAllResults();
|
||||
$data['total_enabled'] = $this->user_model->where('status',true)->countAllResults();
|
||||
$data['total_disabled'] = $this->user_model->where('status',false)->countAllResults();
|
||||
|
||||
//Char Bar
|
||||
$titles_char_bar["labels"] = explode(',',lang("App.dashboard_chart_months"));
|
||||
$value_char_bar["series"] = [];
|
||||
$return_char_bar_geral = $this->user_model->select("DATE_FORMAT(created_at,'%m') AS month,COUNT(DATE_FORMAT(created_at,'%m')) AS total")
|
||||
->where("DATE_FORMAT(NOW(),'%Y') = DATE_FORMAT(created_at,'%Y')")
|
||||
->groupBy("DATE_FORMAT(created_at,'%Y-%m')")
|
||||
->findAll();
|
||||
$return_char_bar_enabled = $this->user_model->select("DATE_FORMAT(created_at,'%m') AS month,COUNT(DATE_FORMAT(created_at,'%m')) AS total")
|
||||
->where("DATE_FORMAT(NOW(),'%Y') = DATE_FORMAT(created_at,'%Y') AND status = true")
|
||||
->groupBy("DATE_FORMAT(created_at,'%Y-%m')")
|
||||
->findAll();
|
||||
$return_char_bar_disabled = $this->user_model->select("DATE_FORMAT(updated_at,'%m') AS month,COUNT(DATE_FORMAT(updated_at,'%m')) AS total")
|
||||
->where("DATE_FORMAT(NOW(),'%Y') = DATE_FORMAT(updated_at,'%Y') AND status = false")
|
||||
->groupBy("DATE_FORMAT(updated_at,'%Y-%m')")
|
||||
->findAll();
|
||||
$year = [];
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$notFound = true;
|
||||
foreach ($return_char_bar_geral as $item){
|
||||
if($i == intval($item->month)){
|
||||
array_push($year,intval($item->total));
|
||||
$notFound = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($notFound){
|
||||
array_push($year,0);
|
||||
}
|
||||
}
|
||||
array_push($value_char_bar["series"],$year);
|
||||
$year = [];
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$notFound = true;
|
||||
foreach ($return_char_bar_enabled as $item){
|
||||
if($i == intval($item->month)){
|
||||
array_push($year,intval($item->total));
|
||||
$notFound = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($notFound){
|
||||
array_push($year,0);
|
||||
}
|
||||
}
|
||||
array_push($value_char_bar["series"],$year);
|
||||
$year = [];
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$notFound = true;
|
||||
foreach ($return_char_bar_disabled as $item){
|
||||
if($i == intval($item->month)){
|
||||
array_push($year,intval($item->total));
|
||||
$notFound = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($notFound){
|
||||
array_push($year,0);
|
||||
}
|
||||
}
|
||||
array_push($value_char_bar["series"],$year);
|
||||
$data['data_char_bar'] = json_encode(array_merge($titles_char_bar,$value_char_bar));
|
||||
|
||||
$data['data_user'] = $this->user_model->select('picture,first_name,last_name,email,created_at')
|
||||
->orderBy('id_user','DESC')
|
||||
->findAll(15);
|
||||
|
||||
$data['data_activity'] = $this->activity_model
|
||||
->select('auth_user.first_name,auth_user.email,auth_activity.detail,auth_activity.created_at')
|
||||
->join('auth_user','auth_user.token=auth_activity.user')
|
||||
->orderBy('auth_activity.id_activity','DESC')
|
||||
->findAll(30);
|
||||
|
||||
echo view(getenv('theme.path').'main/header');
|
||||
//echo view(getenv('theme.path').'form/dashboard/admin',$data);
|
||||
echo view(getenv('theme.path').'main/footer');
|
||||
break;
|
||||
|
||||
case 'user':
|
||||
$data['title'] = [
|
||||
'module' => lang("App.dashboard_hello").' '.$name,
|
||||
'page' => lang("App.dashboard_indicators"),
|
||||
'icon' => ''
|
||||
];
|
||||
|
||||
$data['breadcrumb'] = [
|
||||
['title' => lang("App.menu_dashboard"), 'route' => "", 'active' => true]
|
||||
];
|
||||
|
||||
echo view(getenv('theme.path').'main/header');
|
||||
//echo view(getenv('theme.path').'form/dashboard/user',$data);
|
||||
echo view(getenv('theme.path').'main/footer');
|
||||
break;
|
||||
default:
|
||||
echo view(getenv('theme.path').'main/header');
|
||||
//echo view(getenv('theme.path').'form/dashboard/index');
|
||||
echo view(getenv('theme.path').'main/footer');
|
||||
endswitch;
|
||||
*/
|
||||
echo view(getenv('theme.path') . 'main/defaultlayout');
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use CodeIgniter\Controller;
|
||||
use Throwable;
|
||||
|
||||
class Migrate extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$migrate = \Config\Services::migrations();
|
||||
|
||||
$file = 'Database\\Migrations\\2023-04-25-161753_RemoveGroupFromUser.php';
|
||||
|
||||
try {
|
||||
$migrate->force($file);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
||||
echo $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,190 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\CountriesModel;
|
||||
use App\Models\Usuarios\UserModel;
|
||||
use App\Models\NotificationModel;
|
||||
|
||||
class Notification extends BaseController
|
||||
{
|
||||
private $user_model;
|
||||
private $countries_model;
|
||||
private $id_user;
|
||||
private $token_user;
|
||||
private $notification_model;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->user_model = new UserModel();
|
||||
$this->countries_model = new CountriesModel();
|
||||
$this->id_user = session()->get('id_user');
|
||||
$this->token_user = session()->get('token');
|
||||
$this->notification_model = new NotificationModel();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = [
|
||||
'module' => lang("App.notification_title"),
|
||||
'page' => lang("App.notification_subtitle"),
|
||||
'icon' => 'fas fa-bell'
|
||||
];
|
||||
|
||||
$data['breadcrumb'] = [
|
||||
['title' => lang("App.menu_dashboard"), 'route' => "/home", 'active' => false],
|
||||
['title' => lang("App.notification_title"), 'route' => "", 'active' => true]
|
||||
];
|
||||
|
||||
$data['btn_add'] = [
|
||||
'title' => lang("App.notification_btn_add"),
|
||||
'route' => '/notification/add',
|
||||
'class' => 'btn btn-lg btn-primary float-md-right',
|
||||
'icon' => 'fas fa-plus'
|
||||
];
|
||||
|
||||
echo view(getenv('theme.path').'main/header');
|
||||
echo view(getenv('theme.path').'form/notification/index',$data);
|
||||
echo view(getenv('theme.path').'main/footer');
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
helper('form');
|
||||
|
||||
$data['title'] = [
|
||||
'module' => lang("App.notification_add_title"),
|
||||
'page' => lang("App.notification_add_subtitle"),
|
||||
'icon' => 'far fa-plus-square'
|
||||
];
|
||||
|
||||
$data['breadcrumb'] = [
|
||||
['title' => lang("App.menu_dashboard"), 'route' => "/home", 'active' => false],
|
||||
['title' => lang("App.notification_title"), 'route' => "/user", 'active' => false],
|
||||
['title' => lang("App.notification_add_title"), 'route' => "", 'active' => true]
|
||||
];
|
||||
|
||||
$data['btn_return'] = [
|
||||
'title' => lang("App.global_come_back"),
|
||||
'route' => '/notification',
|
||||
'class' => 'btn btn-dark mr-1',
|
||||
'icon' => 'fas fa-angle-left'
|
||||
];
|
||||
|
||||
$data['btn_submit'] = [
|
||||
'title' => lang("App.global_save"),
|
||||
'route' => '',
|
||||
'class' => 'btn btn-primary mr-1',
|
||||
'icon' => 'fas fa-save'
|
||||
];
|
||||
|
||||
$data['user'] = $this->user_model->where('status',true)->findAll();
|
||||
|
||||
echo view(getenv('theme.path').'main/header');
|
||||
echo view(getenv('theme.path').'form/notification/form',$data);
|
||||
echo view(getenv('theme.path').'main/footer');
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
//Demo Mode
|
||||
if(env('demo.mode')??false){
|
||||
session()->setFlashdata('sweet', ['warning',lang("App.general_demo_mode")]);
|
||||
return redirect()->to('/notification');
|
||||
}
|
||||
|
||||
$session = session();
|
||||
helper('form');
|
||||
|
||||
$rules = [
|
||||
'title' => 'required',
|
||||
'body' => 'required'
|
||||
];
|
||||
|
||||
$rules_error = [
|
||||
'title' => [
|
||||
'required' => lang("App.notification_rules_title_r"),
|
||||
],
|
||||
'body' => [
|
||||
'required' => lang("App.notification_rules_body_r"),
|
||||
]
|
||||
];
|
||||
|
||||
if ($this->validate($rules,$rules_error)){
|
||||
if($listPost = $this->request->getPost()){
|
||||
|
||||
$listPost['send_email_notification'] = isset($listPost['send_email_notification']) && $listPost['send_email_notification'] == 'on';
|
||||
|
||||
if(!empty($listPost['user_recipient'])){
|
||||
$user = $this->user_model->where('token',$session->get('token'))->first();
|
||||
foreach (keywordEmail()??[] as $item){
|
||||
$field = str_replace(['[','user_',']'],'',$item);
|
||||
$listPost['title'] = str_replace('['.$item.']',$user[$field],$listPost['title']);
|
||||
$listPost['body'] = str_replace('['.$item.']',$user[$field],$listPost['body']);
|
||||
}
|
||||
$listPost['token'] = md5(uniqid(rand(), true));
|
||||
$listPost['user_sender'] = $session->get('token');
|
||||
$this->notification_model->save($listPost);
|
||||
}else{
|
||||
$users = $this->user_model->where('status',true)->findAll();
|
||||
$data = [];
|
||||
foreach ($users as $user){
|
||||
$title = $listPost['title'];
|
||||
$template = $listPost['body'];
|
||||
foreach (keywordEmail()??[] as $item){
|
||||
$field = str_replace(['[','user_',']'],'',$item);
|
||||
$title = str_replace('['.$item.']',$user[$field],$title);
|
||||
$template = str_replace('['.$item.']',$user[$field],$template);
|
||||
}
|
||||
array_push($data,[
|
||||
'id_notification' => null,
|
||||
'user_sender' => $session->get('token'),
|
||||
'user_recipient' => $user['token'],
|
||||
'title' => $title,
|
||||
'body' => $template,
|
||||
'is_read' => false,
|
||||
'is_send_email' => false,
|
||||
'send_email_notification' => $listPost['send_email_notification'],
|
||||
'token' => md5(uniqid(rand(), true)),
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
}
|
||||
if(count($data)>0){
|
||||
$this->notification_model->insertBatch($data);
|
||||
}
|
||||
}
|
||||
if(empty($this->request->getPost('id_notification'))){
|
||||
$session->setFlashdata('sweet', ['success',lang("App.notification_alert_add")]);
|
||||
return redirect()->to('/notification');
|
||||
}else{
|
||||
$session->setFlashdata('sweet', ['success',lang("App.notification_alert_edit")]);
|
||||
return redirect()->to('/notification');
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$session->setFlashdata('error','error');
|
||||
$this->add();
|
||||
}
|
||||
}
|
||||
|
||||
public function delete($token)
|
||||
{
|
||||
//Demo Mode
|
||||
if(env('demo.mode')??false){
|
||||
session()->setFlashdata('sweet', ['warning',lang("App.general_demo_mode")]);
|
||||
return redirect()->to('/notification');
|
||||
}
|
||||
|
||||
$session = session();
|
||||
if(!empty($session->get('token'))){
|
||||
$this->notification_model->where('token', $token)->delete();
|
||||
$session->setFlashdata('sweet', ['success',lang("App.notification_alert_delete")]);
|
||||
return redirect()->to('/notification');
|
||||
}else{
|
||||
return redirect()->to('/login');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,63 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Presupuestos;
|
||||
use App\Controllers\BaseController;
|
||||
|
||||
|
||||
class PresupuestoInterfazCliente extends BaseController
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$data['title'] = [
|
||||
'module' => lang("App.settings_title"),
|
||||
'page' => lang("App.settings_subtitle"),
|
||||
'icon' => 'fas fa-sliders-h'
|
||||
];
|
||||
|
||||
$data['breadcrumb'] = [
|
||||
['title' => lang("App.menu_presupuesto"), 'route' => site_url('presupuesto'), 'active' => true]
|
||||
];
|
||||
|
||||
echo view(getenv('theme.path').'form/presupuestos/index', $data);
|
||||
}
|
||||
|
||||
public function tapa_blanda_encolada()
|
||||
{
|
||||
|
||||
$data['title'] = [
|
||||
'module' => lang("App.settings_title"),
|
||||
'page' => lang("App.settings_subtitle"),
|
||||
'icon' => 'fas fa-sliders-h'
|
||||
];
|
||||
|
||||
$data['breadcrumb'] = [
|
||||
['title' => lang("App.menu_presupuesto"), 'route' => site_url('presupuesto'), 'active' => false],
|
||||
['title' => lang("App.menu_presupuesto"), 'route' => site_url('presupuesto/tapa_blanda_encolada'), 'active' => true]
|
||||
];
|
||||
|
||||
echo view(getenv('theme.path').'form/presupuestos/tapa-blanda-encolada', $data);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
class BackupModel extends BaseModel
|
||||
{
|
||||
protected $table = 'auth_backup';
|
||||
protected $primaryKey = 'id_backup';
|
||||
protected $allowedFields = [
|
||||
'path',
|
||||
'error'
|
||||
];
|
||||
protected $useTimestamps = true;
|
||||
protected $createdField = 'created_at';
|
||||
protected $updatedField = 'updated_at';
|
||||
}
|
||||
@ -249,9 +249,15 @@ class ClienteModel extends \App\Models\BaseModel
|
||||
$sql =
|
||||
"SELECT t1." .
|
||||
$selcols .
|
||||
", t2.nombre AS comunidad_autonoma_id, t3.nombre AS provincia, t4.nombre AS pais_id, t5.first_name AS comercial, t6.last_name AS soporte, t7.nombre AS forma_pago_id FROM " .
|
||||
", t2.nombre AS comunidad_autonoma_id, t3.nombre AS provincia, t4.nombre AS pais_id, t5.first_name AS comercial,
|
||||
t6.last_name AS soporte, t7.nombre AS forma_pago_id FROM " .
|
||||
$this->table .
|
||||
" t1 LEFT JOIN lg_comunidades_autonomas t2 ON t1.comunidad_autonoma_id = t2.id LEFT JOIN lg_provincias t3 ON t1.provincia_id = t3.id LEFT JOIN lg_paises t4 ON t1.pais_id = t4.id LEFT JOIN auth_user t5 ON t1.comercial_id = t5.id_user LEFT JOIN auth_user t6 ON t1.soporte_id = t6.id_user LEFT JOIN lg_formas_pago t7 ON t1.forma_pago_id = t7.id";
|
||||
" t1 LEFT JOIN lg_comunidades_autonomas t2 ON t1.comunidad_autonoma_id = t2.id
|
||||
LEFT JOIN lg_provincias t3 ON t1.provincia_id = t3.id
|
||||
LEFT JOIN lg_paises t4 ON t1.pais_id = t4.id
|
||||
LEFT JOIN users t5 ON t1.comercial_id = t5.id
|
||||
LEFT JOIN users t6 ON t1.soporte_id = t6.id
|
||||
LEFT JOIN lg_formas_pago t7 ON t1.forma_pago_id = t7.id";
|
||||
if (!is_null($limit) && intval($limit) > 0) {
|
||||
$sql .= " LIMIT " . intval($limit);
|
||||
}
|
||||
@ -280,7 +286,7 @@ class ClienteModel extends \App\Models\BaseModel
|
||||
"t1.id AS id, t1.nombre AS nombre, t1.alias AS alias, t1.cif AS cif, t1.email AS email, t1.vencimiento AS vencimiento, t5.first_name AS comercial, t7.nombre AS forma_pago_id"
|
||||
)
|
||||
->where("is_deleted", 0);;
|
||||
$builder->join("auth_user t5", "t1.comercial_id = t5.id_user", "left");
|
||||
$builder->join("users t5", "t1.comercial_id = t5.id", "left");
|
||||
$builder->join("lg_formas_pago t7", "t1.forma_pago_id = t7.id", "left");
|
||||
|
||||
|
||||
|
||||
@ -137,7 +137,7 @@ class ClientePlantillaPreciosLineasModel extends \App\Models\BaseModel
|
||||
t1.user_updated_id AS user_updated_id, t1.updated_at AS updated_at, CONCAT(t2.first_name, ' ', t2.last_name) AS user_updated"
|
||||
);
|
||||
|
||||
$builder->join("auth_user t2", "t1.user_updated_id = t2.id_user", "left");
|
||||
$builder->join("users t2", "t1.user_updated_id = t2.id", "left");
|
||||
|
||||
$builder->where('t1.is_deleted', 0);
|
||||
$builder->where('t1.plantilla_id', $plantilla_id);
|
||||
|
||||
@ -267,7 +267,7 @@ class ClientePreciosModel extends \App\Models\BaseModel
|
||||
t1.user_updated_id AS user_updated_id, t1.updated_at AS updated_at, CONCAT(t2.first_name, ' ', t2.last_name) AS user_updated"
|
||||
);
|
||||
|
||||
$builder->join("auth_user t2", "t1.user_updated_id = t2.id_user", "left");
|
||||
$builder->join("users t2", "t1.user_updated_id = t2.id", "left");
|
||||
|
||||
$builder->where('t1.is_deleted', 0);
|
||||
$builder->where('t1.cliente_id', $cliente_id);
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
class CronTabModel extends BaseModel
|
||||
{
|
||||
protected $table = 'auth_crontab_history';
|
||||
protected $primaryKey = 'id_crontab';
|
||||
protected $allowedFields = [
|
||||
'routine',
|
||||
'error'
|
||||
];
|
||||
protected $useTimestamps = true;
|
||||
protected $createdField = 'created_at';
|
||||
protected $updatedField = 'updated_at';
|
||||
}
|
||||
@ -132,7 +132,7 @@ class BuscadorModel extends \App\Models\BaseModel
|
||||
t6.estado AS estado"
|
||||
);
|
||||
$builder->join("clientes t2", "t1.cliente_id = t2.id", "left");
|
||||
$builder->join("auth_user t3", "t1.user_update_id = t3.id_user", "left");
|
||||
$builder->join("users t3", "t1.user_update_id = t3.id", "left");
|
||||
$builder->join("lg_paises t5", "t1.pais_id = t5.id", "left");
|
||||
$builder->join("presupuesto_estados t6", "t1.estado_id = t6.id", "left");
|
||||
$builder->join("tipos_presupuestos t7", "t1.tipo_impresion_id = t7.id", "left");
|
||||
|
||||
@ -205,8 +205,8 @@ class PresupuestoModel extends \App\Models\BaseModel
|
||||
t6 ON t1.pais_id = t6.id = t7.id LEFT JOIN presupuesto_estados
|
||||
t7 ON t1.estado_id = t8.id LEFT JOIN lg_papel_formato
|
||||
t8 ON t1.papel_formato_id = t9.id LEFT JOIN lg_papel_generico
|
||||
t9 ON t1.total_confirmado_user_id = t26.id_user LEFT JOIN auth_user
|
||||
t10 ON t1.aprobado_user_id = t27.id_user LEFT JOIN auth_user";
|
||||
t9 ON t1.total_confirmado_user_id = t26.id LEFT JOIN users
|
||||
t10 ON t1.aprobado_user_id = t27.id LEFT JOIN users";
|
||||
|
||||
if (!is_null($limit) && intval($limit) > 0) {
|
||||
$sql .= " LIMIT " . intval($limit);
|
||||
@ -239,7 +239,7 @@ class PresupuestoModel extends \App\Models\BaseModel
|
||||
t1.total_presupuesto AS total_presupuesto, t1.total_presupuesto AS total_presupuesto, t6.estado AS estado"
|
||||
);
|
||||
$builder->join("clientes t2", "t1.cliente_id = t2.id", "left");
|
||||
$builder->join("auth_user t3", "t1.user_update_id = t3.id_user", "left");
|
||||
$builder->join("users t3", "t1.user_update_id = t3.id", "left");
|
||||
$builder->join("lg_paises t5", "t1.pais_id = t5.id", "left");
|
||||
$builder->join("presupuesto_estados t6", "t1.estado_id = t6.id", "left");
|
||||
|
||||
@ -299,7 +299,7 @@ class PresupuestoModel extends \App\Models\BaseModel
|
||||
CONCAT(t4.ancho, 'x', t4.alto) AS formato"
|
||||
);
|
||||
$builder->join("clientes t2", "t1.cliente_id = t2.id", "left");
|
||||
$builder->join("auth_user t3", "t1.user_update_id = t3.id_user", "left");
|
||||
$builder->join("users t3", "t1.user_update_id = t3.id", "left");
|
||||
$builder->join("lg_papel_formato t4", "t1.papel_formato_id = t4.id", "left");
|
||||
|
||||
$builder->where("t1.is_deleted", 0);
|
||||
|
||||
@ -14,8 +14,8 @@ class UserModel extends ShieldUserModel
|
||||
|
||||
$this->allowedFields = [
|
||||
...$this->allowedFields,
|
||||
|
||||
// 'first_name',
|
||||
'first_name', // Añadido
|
||||
'last_name', // Añadido
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,7 +70,8 @@ class UserGroupModel extends \App\Models\BaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id_group AS id_group, t1.title AS title, t1.dashboard AS dashboard, t1.rules AS rules, t1.token AS token, t1.created_at AS created_at, t1.updated_at AS updated_at"
|
||||
"t1.id_group AS id_group, t1.title AS title, t1.dashboard AS dashboard, t1.rules AS rules,
|
||||
t1.token AS token, t1.created_at AS created_at, t1.updated_at AS updated_at"
|
||||
);
|
||||
|
||||
return empty($search)
|
||||
@ -84,13 +85,6 @@ class UserGroupModel extends \App\Models\BaseModel
|
||||
->orLike("t1.token", $search)
|
||||
->orLike("t1.created_at", $search)
|
||||
->orLike("t1.updated_at", $search)
|
||||
->orLike("t1.id_group", $search)
|
||||
->orLike("t1.title", $search)
|
||||
->orLike("t1.dashboard", $search)
|
||||
->orLike("t1.rules", $search)
|
||||
->orLike("t1.token", $search)
|
||||
->orLike("t1.created_at", $search)
|
||||
->orLike("t1.updated_at", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,36 +57,25 @@
|
||||
<div class="table-responsive">
|
||||
<table class="table table-flush-spacing">
|
||||
<tbody>
|
||||
<?php foreach (getAllFolder() as $folder): ?>
|
||||
<?php foreach (getAllClass() as $item): ?>
|
||||
<?php if (str_contains($item['path'], $folder)): ?>
|
||||
<tr>
|
||||
<td class="text-nowrap fw-semibold">
|
||||
<?= getDictionary($folder) ?? '' ?>
|
||||
>> <?= getDictionary($item['name']) ?>
|
||||
</td>
|
||||
<?php foreach ($item['methods'] as $subitem): ?>
|
||||
<?php if (!getIgnoreMethod($subitem)): ?>
|
||||
<td>
|
||||
<div class="form-check">
|
||||
<input type="checkbox"
|
||||
id="<?= $item['name'] . '_' . $subitem ?>"
|
||||
name="<?= $item['name'] . '_' . $subitem ?>"
|
||||
class="form-check-input"
|
||||
<?= ruleIsChecked($group->rules, $item['name'], $subitem) ? 'checked' : '' ?>
|
||||
>
|
||||
<label for="<?= $item['name'] . '_' . $subitem ?>"
|
||||
class="form-check-label"><?= getDictionary($subitem) ?></label>
|
||||
</div>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
<tr>
|
||||
<td class="text-nowrap fw-semibold">
|
||||
Recurso
|
||||
</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>
|
||||
|
||||
<?php foreach (getAllClass() as $item): ?>
|
||||
<?php /*foreach (getAllClass() as $item): ?>
|
||||
<?php if (empty($item['path'])): ?>
|
||||
<tr>
|
||||
<td class="text-nowrap fw-semibold"><?= getDictionary($item['name']) ?></td>
|
||||
@ -108,7 +97,7 @@
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; */?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@ -15,10 +15,11 @@
|
||||
<table id="tableOfUsers" class="table table-striped table-hover using-data-table" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php /*<th><?= lang('Users.idUser') ?></th> */?>
|
||||
<th><?= lang('Users.firstName') ?></th>
|
||||
<th><?= lang('Users.lastName') ?></th>
|
||||
<th><?= lang('Users.group') ?></th>
|
||||
<th><?= lang('Users.lastAccess') ?></th>
|
||||
<?php /*
|
||||
<th><?= lang('Users.group') ?></th>
|
||||
<th><?= lang('Users.mobile') ?></th>
|
||||
<th><?= lang('Users.email') ?></th>
|
||||
<th><?= lang('Users.address') ?></th>
|
||||
@ -27,34 +28,30 @@
|
||||
<th><?= lang('Users.country') ?></th>
|
||||
<th><?= lang('Users.zipCode') ?></th>
|
||||
<th><?= lang('Users.lastIp') ?></th>
|
||||
<th><?= lang('Users.lastAccess') ?></th>
|
||||
|
||||
<th><?= lang('Users.picture') ?></th>
|
||||
<th><?= lang('Users.language') ?></th>
|
||||
<th><?= lang('Users.blocked') ?></th>
|
||||
<th><?= lang('Users.emailConfirmed') ?></th>
|
||||
<?php /*
|
||||
<th><?= lang('Users.token') ?></th>
|
||||
<th><?= lang('Users.status') ?></th>
|
||||
<th><?= lang('Users.createdAt') ?></th>
|
||||
<th><?= lang('Users.updatedAt') ?></th>
|
||||
*/?>
|
||||
*/ ?>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($userList as $item ) : ?>
|
||||
<tr>
|
||||
<?php /*
|
||||
<td class="align-middle text-center">
|
||||
<?=$item->id_user ?>
|
||||
</td>
|
||||
*/?>
|
||||
<td class="align-middle">
|
||||
<?= empty($item->first_name) || strlen($item->first_name) < 51 ? esc($item->first_name) : character_limiter(esc($item->first_name), 50) ?>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<?= empty($item->last_name) || strlen($item->last_name) < 51 ? esc($item->last_name) : character_limiter(esc($item->last_name), 50) ?>
|
||||
</td>
|
||||
|
||||
<td class="align-middle text-nowrap">
|
||||
<?= empty($item->last_active) ? '' : date('d/m/Y H:m:s', strtotime($item->last_active)) ?>
|
||||
</td>
|
||||
|
||||
<?php /*
|
||||
|
||||
<td class="align-middle">
|
||||
<?= empty($user_model->getGroupsTitles($item->token)) || strlen($user_model->getGroupsTitles($item->token)) < 51 ? esc($user_model->getGroupsTitles($item->token)) : character_limiter($user_model->getGroupsTitles($item->token), 50) ?>
|
||||
@ -101,29 +98,11 @@
|
||||
<td class="align-middle">
|
||||
<?= esc($item->email_confirmed) ?>
|
||||
</td>
|
||||
<?php /*
|
||||
<td class="align-middle">
|
||||
<?= esc($item->token) ?>
|
||||
</td>
|
||||
<td class="align-middle text-center text-green">
|
||||
*/ ?>
|
||||
|
||||
<?php if ( $item->status ) { ?>
|
||||
|
||||
<i class="text-success bi bi-check-lg"></i>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
<td class="align-middle text-nowrap">
|
||||
<?= empty($item->created_at) ? '' : date('d/m/Y H:m:s', strtotime($item->created_at)) ?>
|
||||
</td>
|
||||
<td class="align-middle text-nowrap">
|
||||
<?= empty($item->updated_at) ? '' : date('d/m/Y H:m:s', strtotime($item->updated_at)) ?>
|
||||
</td>
|
||||
*/ ?>
|
||||
<td class="align-middle text-center text-nowrap">
|
||||
<?=anchor(route_to('editUser', $item->id_user), "<i class='ti ti-pencil ti-sm mx-2'></i>", ['class'=>'text-body', 'data-id'=>$item->id_user,]); ?>
|
||||
<?=anchor('#confirm2delete', "<i class='ti ti-trash ti-sm mx-2'></i>", ['class'=>'text-body', 'data-href'=>route_to('deleteUser', $item->id_user), 'data-bs-toggle'=>'modal', 'data-bs-target'=>'#confirm2delete']); ?>
|
||||
<?=anchor(route_to('editUser', $item->id), "<i class='ti ti-pencil ti-sm mx-2'></i>", ['class'=>'text-body', 'data-id'=>$item->id,]); ?>
|
||||
<?=anchor('#confirm2delete', "<i class='ti ti-trash ti-sm mx-2'></i>", ['class'=>'text-body', 'data-href'=>route_to('deleteUser', $item->id), 'data-bs-toggle'=>'modal', 'data-bs-target'=>'#confirm2delete']); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
@ -398,7 +398,7 @@
|
||||
</a>
|
||||
<ul class="menu-sub">
|
||||
<li class="menu-item">
|
||||
<a href="<?= route_to("tarifaPreimpresionList") ?>" class="menu-link">
|
||||
<a href="<?= route_to("tarifapreimpresionList") ?>" class="menu-link">
|
||||
<div data-i18n="<?= lang("App.menu_tarifapreimpresion") ?>"><?= lang("App.menu_tarifapreimpresion") ?></div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user