diff --git a/.idea/php.xml b/.idea/php.xml index 7f6d3f29..ebe16728 100755 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -57,7 +57,7 @@ - + diff --git a/.idea/safekat.iml b/.idea/safekat.iml index 3e9830fc..c956989b 100755 --- a/.idea/safekat.iml +++ b/.idea/safekat.iml @@ -1,9 +1,7 @@ - - - + diff --git a/ci4/app/Controllers/Configuracion/Group.php b/ci4/app/Controllers/Configuracion/Group.php index 0ba2fb80..b2a11bad 100755 --- a/ci4/app/Controllers/Configuracion/Group.php +++ b/ci4/app/Controllers/Configuracion/Group.php @@ -193,6 +193,7 @@ class Group extends \App\Controllers\GoBaseController // IMN hacer las configuraciones hard coded helper('rbac'); generate_php_roles_constant(); + generate_php_permissions_constant(); generate_php_permissions_matrix_constant(); $id = $groupEntity->id ?? $id; diff --git a/ci4/app/Controllers/Configuracion/Paises.php b/ci4/app/Controllers/Configuracion/Paises.php index 2e771c81..05383412 100755 --- a/ci4/app/Controllers/Configuracion/Paises.php +++ b/ci4/app/Controllers/Configuracion/Paises.php @@ -62,20 +62,14 @@ class Paises extends \App\Controllers\BaseResourceController public function add() { - - - if ($this->request->getPost()) : - $nullIfEmpty = true; // !(phpversion() >= '8.1'); - $postData = $this->request->getPost(); - $sanitizedData = $this->sanitized($postData, $nullIfEmpty); - + $sanitizedData = $this->sanitized($postData, true); $noException = true; - if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : + if ($successfulResult = $this->canValidate()) : if ($this->canValidate()) : @@ -113,9 +107,7 @@ class Paises extends \App\Controllers\BaseResourceController endif; // ($requestMethod === 'post') $this->viewData['paisEntity'] = isset($sanitizedData) ? new PaisEntity($sanitizedData) : new PaisEntity(); - $this->viewData['formAction'] = route_to('createPais'); - $this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Paises.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix'); diff --git a/ci4/app/Controllers/Profile.php b/ci4/app/Controllers/Profile.php index 2c0ce90d..d18708e8 100755 --- a/ci4/app/Controllers/Profile.php +++ b/ci4/app/Controllers/Profile.php @@ -2,24 +2,20 @@ namespace App\Controllers; -use App\Libraries\PasswordHash; -use App\Models\CountriesModel; -use App\Models\UserGroupModel; -use App\Models\Usuarios\UserModel; + +use App\Models\UserModel; class Profile extends BaseController { private $user_model; - private $countries_model; private $id_user; - private $token_user; + 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->id_user = auth()->user()->id; + } public function index() @@ -55,46 +51,8 @@ class Profile extends BaseController $session = session(); - $data['obj'] = $this->user_model->where('id_user', $this->id_user)->first(); + $data['obj'] = $this->user_model->where('id', $this->id_user)->first(); - if (!empty($data['obj']->date_birth)) { - $data['obj']->date_birth = dateFormatWeb($data['obj']->date_birth); - } - $data['country'] = $this->countries_model->select('code,name')->where('data_lang', session()->get('lang') ?? 'en')->findAll(); - - $file = $this->request->getFile('file'); - if (!empty($file)) { - $integration = new Integration(); - $allow = ['jpeg', 'jpg', 'gif', 'bmp', 'png']; - $path = 'assets/img/'; - $pathRet = '/' . $integration->saveStorage($file, $path, $allow); - if (!empty($pathRet)) { - $this->user_model->save([ - 'id_user' => $this->id_user, - 'picture' => $pathRet - ]); - $data['obj']['picture'] = $pathRet; - $session->set('picture', $pathRet); - } - } else { - if (!empty($this->request->getPost())) { - $post = $this->request->getPost(); - $image = ''; - foreach ($post as $key => $value) { - if (strpos($key, 'image') !== false) { - $image = $value; - } - } - if (!empty($image)) { - $this->user_model->save([ - 'id_user' => $this->id_user, - 'picture' => $image - ]); - $data['obj']['picture'] = $image; - $session->set('picture', $image); - } - } - } echo view(getenv('theme.path') . 'form/profile/index', $data); @@ -103,11 +61,9 @@ class Profile extends BaseController public function store() { - $session = session(); helper('form'); - $rules = [ 'first_name' => 'required', 'last_name' => 'required', @@ -122,17 +78,10 @@ class Profile extends BaseController if ($this->validate($rules ?? [], $rules_error ?? [])) { if (!empty($this->id_user)) { $this->user_model->save([ - 'id_user' => $this->id_user, + 'id' => $this->id_user, 'first_name' => $this->request->getPost('first_name'), - 'last_name' => $this->request->getPost('last_name'), - 'address' => $this->request->getPost('address'), - 'city' => $this->request->getPost('city'), - 'state' => $this->request->getPost('state'), - 'country' => $this->request->getPost('country'), - 'mobile' => $this->request->getPost('mobile'), - 'language' => $this->request->getPost('language') + 'last_name' => $this->request->getPost('last_name') ]); - $session->set('lang', $this->request->getPost('language') ?? 'en'); $session->setFlashdata('sweet', ['success', lang("App.global_alert_save_success")]); } else { $session->setFlashdata('sweet', ['error', lang("App.global_alert_save_error")]); @@ -143,7 +92,6 @@ class Profile extends BaseController return $this->index(); } - return redirect()->to('/profile'); } } diff --git a/ci4/app/Views/themes/vuexy/form/profile/index.php b/ci4/app/Views/themes/vuexy/form/profile/index.php index e374bd92..58eee725 100644 --- a/ci4/app/Views/themes/vuexy/form/profile/index.php +++ b/ci4/app/Views/themes/vuexy/form/profile/index.php @@ -5,52 +5,9 @@
- -
-
Profile Details
+
Perfil de Usuario
-
-
- user-avatar -
- - - -
Allowed JPG, GIF or PNG. Max size of 800K
-
-
-
-
"> @@ -88,71 +45,6 @@ value="email : set_value('email'); ?>" />
-
- -
- " - value="mobile : set_value('mobile'); ?>" - /> -
-
-
- - " - value="address : set_value('address'); ?>" - /> -
-
- - " - value="state : set_value('state'); ?>" - /> -
-
- - " - value="city : set_value('city'); ?>" - /> -
-
- - country ?? [] : set_value('country'); ?> - -
-
- - language ?? [] : set_value('language'); ?> - -
@@ -192,86 +84,8 @@
- - get('settings'); ?> - - " method="post" id="sendFormTFA"> - -
-
-
-
-
-
-

-
-
-
- > - -
-
-
-
-
-
- GetQR("{$settings['title']} ({$name})", $tfa_secret); - } else { - $tfa_secret = $tfa->createSecret(); - $qrcode = $tfa->GetQR("{$settings['title']} ({$name})", $tfa_secret); - } - ?> -
-
-

- -
-
-

- ' . $item . ''; - } - } else { - $codes = array(); - for ($i = 1; $i <= 8; $i++) { - $code = random_string('numeric', 6); - $codes[] = $code; - echo '' . $code . ''; - } - } - ?> -


- - - -
-
-
-
-
-
-
- -
@@ -280,28 +94,14 @@ section('additionalInlineJs') ?> - "use strict"; - $(document).ready(function () { - $('#first_name').focus(); - }); - $('.file-upload').on('click', function (e) { - e.preventDefault(); - $('#file').trigger('click'); - }); +"use strict"; +$(document).ready(function () { +$('#first_name').focus(); +}); +$('.file-upload').on('click', function (e) { +e.preventDefault(); +$('#file').trigger('click'); +}); - - function download(text, filename) { - let blob = new Blob([text], {type: "text/plain;charset=utf-8"}); - let url = window.URL.createObjectURL(blob); - let a = document.createElement("a"); - a.href = url; - a.download = filename; - a.click(); - } - - function tfaView() { - document.getElementById("sendFormTFA").submit(); - } - endSection() ?> diff --git a/ci4/app/Views/themes/vuexy/main/menu_impresion.php b/ci4/app/Views/themes/vuexy/main/menu_impresion.php index 1cfbbae1..046c88ff 100644 --- a/ci4/app/Views/themes/vuexy/main/menu_impresion.php +++ b/ci4/app/Views/themes/vuexy/main/menu_impresion.php @@ -49,28 +49,22 @@ ?> - - - - - - - - - - - + * JJO + */ + if (auth()->user()->inGroup('beta')) { + ?> + + +