From 38e9feb4c8537689e5d266a1dbe3371003d2457f Mon Sep 17 00:00:00 2001 From: imnavajas Date: Fri, 2 Jun 2023 09:10:19 +0200 Subject: [PATCH 1/4] Edicion de algunos formularios --- .idea/webServers.xml | 23 +++++++++++++------ .idea/workspace.xml | 18 +++++++-------- ci4/app/Language/en/Users.php | 7 +++++- ci4/app/Language/es/Users.php | 7 +++++- .../configuracion/paises/viewPaisForm.php | 17 ++++++++------ .../configuracion/paises/viewPaisList.php | 4 ++-- .../papel/viewPapelGenericoForm.php | 21 +++++++++-------- .../papel/viewPapelImpresionForm.php | 17 ++++++++------ .../vuexy/form/user/_userFormItems.php | 14 +++++------ 9 files changed, 77 insertions(+), 51 deletions(-) diff --git a/.idea/webServers.xml b/.idea/webServers.xml index 82acebb1..bb73a126 100644 --- a/.idea/webServers.xml +++ b/.idea/webServers.xml @@ -2,13 +2,6 @@ + + + DEV/UI + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 21bbd9a6..6d1fb378 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,16 +5,15 @@ + - - - - - - - - - + + + + + + + + + + + - + + + + + + + - + - - - - + + - { - "keyToString": { - "RunOnceActivity.OpenProjectViewOnStart": "true", - "RunOnceActivity.ShowReadmeOnStart": "true", - "WebServerToolWindowFactoryState": "false", - "last_opened_file_path": "C:/temp-sk/safekat/ci4/app/Views/themes/backend/vuexy/form/settings", - "node.js.detected.package.eslint": "true", - "node.js.detected.package.tslint": "true", - "node.js.selected.package.eslint": "(autodetect)", - "node.js.selected.package.tslint": "(autodetect)", - "nodejs_package_manager_path": "npm", - "settings.editor.selected.configurable": "preferences.pluginManager", - "vue.rearranger.settings.migration": "true" + +}]]> - + @@ -98,6 +106,8 @@ + + 1682339938559 diff --git a/ci4/.env b/ci4/.env index 8ff726fd..51699b0d 100644 --- a/ci4/.env +++ b/ci4/.env @@ -22,8 +22,8 @@ CI_ENVIRONMENT = development # APP #-------------------------------------------------------------------- -app.baseURL = 'https://sk-jjo.imnavajas.es' -# app.baseURL = 'https://sk-imn.imnavajas.es' +# app.baseURL = 'https://sk-jjo.imnavajas.es' +app.baseURL = 'https://sk-imn.imnavajas.es' # app.baseURL = "http://safekat.test/" # app.forceGlobalSecureRequests = false @@ -41,22 +41,22 @@ app.baseURL = 'https://sk-jjo.imnavajas.es' # DATABASE #-------------------------------------------------------------------- -database.default.hostname = localhost -database.default.database = sk_jjo -database.default.username = sk_jjo -database.default.password = 61tv&G1Zf^XY -database.default.DBDriver = MySQLi -database.default.DBPrefix = -database.default.dump = - # database.default.hostname = localhost -# database.default.database = sk_imn -# database.default.username = sk_imn -# database.default.password = Uyia19_87 +# database.default.database = sk_jjo +# database.default.username = sk_jjo +# database.default.password = 61tv&G1Zf^XY # database.default.DBDriver = MySQLi -# database.default.DBPrefix = +# database.default.DBPrefix = # database.default.dump = +database.default.hostname = localhost +database.default.database = sk_imn +database.default.username = sk_imn +database.default.password = Uyia19_87 +database.default.DBDriver = MySQLi +database.default.DBPrefix = +database.default.dump = + # database.tests.hostname = localhost # database.tests.database = ci4 # database.tests.username = root diff --git a/ci4/app/Controllers/Catalogo/Catalogo.php b/ci4/app/Controllers/Catalogo/Catalogo.php index d1e9bd0b..2e0d71b3 100644 --- a/ci4/app/Controllers/Catalogo/Catalogo.php +++ b/ci4/app/Controllers/Catalogo/Catalogo.php @@ -13,12 +13,22 @@ class Catalogo extends BaseController public function index() { - echo 'Hola2'; + echo 'Catalogo Libros'; } - public function import() + public function importar() { + echo 'Importar Catalogo Libros'; + } + public function nuevo() + { + echo 'Nuevo Catalogo Libros'; + } + + public function categorias() + { + echo 'Categorias de Catalogo de Libros'; } public function delete() diff --git a/ci4/app/Controllers/Compras/Compras.php b/ci4/app/Controllers/Compras/Compras.php new file mode 100644 index 00000000..c775b03c --- /dev/null +++ b/ci4/app/Controllers/Compras/Compras.php @@ -0,0 +1,26 @@ + "Dashboard", + "menu_dashboard" => "Control Panel", "menu_clientes" => "Customers", - "menu_tarifacliente" => "Customer Fee", + "menu_tarifacliente" => "Fees", "menu_configuration" => "Settings", "menu_calendario" => "Calendar", @@ -692,22 +692,46 @@ return [ "menu_trabajo" => "Works", "menu_trabajo" => "Tipologies", - "menu_digitalizacion" => "Digitalisation", + "menu_digitalizacion" => "Digitalisation", + + "menu_importacion" => "Import", + + "menu_catalogo" => "Catalogue", + "menu_catalogo_libros" => "Books", + "menu_catalogo_nuevo" => "New", + "menu_catalogo_categorias" => "Categories", + "menu_catalogo_categorias" => "Import", "menu_logistica" => "Logistics", + "menu_logistica_envios" => "Envíos conjuntos", + "menu_logistica_etiquetas" => "Labels", + "menu_logistica_tracking" => "Tracking", + "menu_facturación" => "Billing", "menu_albaran" => "Delivery notes", "menu_facturas" => "Invoices", + "menu_facturas_vencimiento" => "Vencimiento", + "menu_facturas_nueva" => "New Invoice", "menu_informes" => "Reports", "menu_pedidos" => "Orders", + "menu_pedidos_activos" => "Actives", + "menu_pedidos_finalizados" => "Finished", + "menu_pedidos_cancelados" => "Cancelled", + "menu_pedidos_manuales" => "Manual", "menu_presupuestos" => "Budgets", + "menu_presupuesto" => "Books", "menu_presupuestomaquetacion" => "Layout budgets", "menu_produccion" => "Production", + "menu_orden_trabajo" => "WOs", + "menu_orden_trabajo_100" => "WOs 100%", + "menu_orden_trabajo_finalizados" => "WOs finalised", + "menu_orden_trabajo_pendientes" => "WOs pending", + "menu_ordentrabajomaquetacion" => "Layout work order", "menu_ordenmaquina" => "Machine order", "menu_pedidoproduccion" => "Orders", diff --git a/ci4/app/Language/es/App.php b/ci4/app/Language/es/App.php index d7fe13c2..59f5b4cc 100644 --- a/ci4/app/Language/es/App.php +++ b/ci4/app/Language/es/App.php @@ -669,10 +669,10 @@ return [ // MENUS - "menu_dashboard" => "Panel", + "menu_dashboard" => "Panel de control", "menu_clientes" => "Clientes", - "menu_tarifacliente" => "Tarifa Clientes", + "menu_tarifacliente" => "Tarifas", "menu_configuration" => "Configuracion", "menu_calendario" => "Calendario", @@ -692,22 +692,48 @@ return [ "menu_trabajo" => "Trabajos", "menu_tipologias" => "Tipologías", - "menu_digitalizacion" => "Digitalización", + "menu_digitalizacion" => "Digitalización", + + "menu_importacion" => "Importación", + + "menu_catalogo" => "Catálogo", + "menu_catalogo_libros" => "Libros", + "menu_catalogo_nuevo" => "Nuevo", + "menu_catalogo_categorias" => "Categorías", + "menu_catalogo_importar" => "Importar", + + + "menu_logistica" => "Logística", + "menu_logistica_envios" => "Envíos conjuntos", + "menu_logistica_etiquetas" => "Etiquetas", + "menu_logistica_tracking" => "Tracking", + - "menu_logistica" => "Logistica", "menu_facturación" => "Facturación", "menu_albaran" => "Albaranes", "menu_facturas" => "Facturas", + "menu_facturas_vencimiento" => "Vencimiento", + "menu_facturas_nueva" => "Nueva Factura", "menu_informes" => "Informes", "menu_pedidos" => "Pedidos", + "menu_pedidos_activos" => "Activos", + "menu_pedidos_finalizados" => "Finalizados", + "menu_pedidos_cancelados" => "Cancelados", + "menu_pedidos_manuales" => "Manuales", "menu_presupuestos" => "Presupuestos", + "menu_presupuesto" => "Libros", "menu_presupuestomaquetacion" => "Presupuestos maquetación", "menu_produccion" => "Producción", + "menu_orden_trabajo" => "OTs", + "menu_orden_trabajo_100" => "OTs 100%", + "menu_orden_trabajo_finalizados" => "OTs finalizados", + "menu_orden_trabajo_pendientes" => "OTs pendientes", + "menu_ordentrabajomaquetacion" => "Orden de trabajo maquetación", "menu_ordenmaquina" => "Orden máquina", "menu_pedidoproduccion" => "Pedidos", diff --git a/ci4/app/Views/themes/backend/vuexy/form/settings/index.php b/ci4/app/Views/themes/backend/vuexy/form/settings/index.php index 3818b102..0ad9d8f1 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/settings/index.php +++ b/ci4/app/Views/themes/backend/vuexy/form/settings/index.php @@ -1333,7 +1333,7 @@ } ]; let order = [[2, "desc"]]; - let translate = '/themes/focus2/vendor/datatables/locales/.json'; + let translate = '/themes/vuexy/vendor/datatables/locales/.json'; let button = ["","","",""]; let columns = [{ data: 'routine' },{ data: 'error' },{ data: 'created_at' }]; loadDataTableAjax('table-grid', '', translate, true, true, order, columns,dataFormat, button); diff --git a/ci4/app/Views/themes/backend/vuexy/main/all.php b/ci4/app/Views/themes/backend/vuexy/main/all.php index 8b7f76a6..2f1bcbe2 100644 --- a/ci4/app/Views/themes/backend/vuexy/main/all.php +++ b/ci4/app/Views/themes/backend/vuexy/main/all.php @@ -96,7 +96,7 @@ if (!empty($token) && $tfa == false) {
- +
diff --git a/ci4/app/Views/themes/backend/vuexy/main/defaultlayout.php b/ci4/app/Views/themes/backend/vuexy/main/defaultlayout.php index f28f070e..ab97b7ae 100644 --- a/ci4/app/Views/themes/backend/vuexy/main/defaultlayout.php +++ b/ci4/app/Views/themes/backend/vuexy/main/defaultlayout.php @@ -99,7 +99,7 @@ if (!empty($token) && $tfa == false) {
- +
diff --git a/ci4/app/Views/themes/backend/vuexy/main/menu_impresion.php b/ci4/app/Views/themes/backend/vuexy/main/menu_impresion.php new file mode 100644 index 00000000..82e5465d --- /dev/null +++ b/ci4/app/Views/themes/backend/vuexy/main/menu_impresion.php @@ -0,0 +1,697 @@ + + + + + + + +
+
+ +
+
+ + */ +?> \ No newline at end of file From 7a2c4026f10f1d9dbf13466285356819f3ac653c Mon Sep 17 00:00:00 2001 From: imnavajas Date: Mon, 5 Jun 2023 15:30:42 +0200 Subject: [PATCH 3/4] Menus laterales --- ci4/app/Config/Basics.php | 110 ++-- ci4/app/Config/Routes.php | 5 +- ci4/app/Controllers/Configuracion/Correo.php | 21 - .../{Usuarios => Configuracion}/Group.php | 2 +- .../{Usuarios => Configuracion}/Users.php | 2 +- ci4/app/Controllers/Language.php | 2 +- .../{Compras => Servicioscompras}/Compras.php | 4 +- .../Productos.php | 2 +- .../Proveedor.php | 2 +- .../Digitalizacion.php | 7 +- .../Serviciosmaquetacion/Maquetacion.php | 24 + .../Serviciosmensajeria/Mensajes.php | 24 + ci4/app/Controllers/Usuarios/Groupold.php | 313 +++++++++ ci4/app/Controllers/Usuarios/Usersold.php | 310 +++++++++ ci4/app/Controllers/Viewmode.php | 18 + ci4/app/Filters/LoginAuthFilter.php | 10 +- ci4/app/Language/en/App.php | 10 + ci4/app/Language/es/App.php | 15 +- .../Views/themes/backend/vuexy/main/all.php | 82 ++- .../themes/backend/vuexy/main/all_selects.php | 436 ------------- .../themes/backend/vuexy/main/crud_layout.php | 594 ------------------ .../backend/vuexy/main/menu_impresion.php | 370 ++++------- .../backend/vuexy/main/selector_menu.php | 15 + 23 files changed, 998 insertions(+), 1380 deletions(-) delete mode 100644 ci4/app/Controllers/Configuracion/Correo.php rename ci4/app/Controllers/{Usuarios => Configuracion}/Group.php (99%) rename ci4/app/Controllers/{Usuarios => Configuracion}/Users.php (99%) rename ci4/app/Controllers/{Compras => Servicioscompras}/Compras.php (76%) rename ci4/app/Controllers/{Compras => Servicioscompras}/Productos.php (82%) rename ci4/app/Controllers/{Compras => Servicioscompras}/Proveedor.php (82%) create mode 100644 ci4/app/Controllers/Serviciosmaquetacion/Maquetacion.php create mode 100644 ci4/app/Controllers/Serviciosmensajeria/Mensajes.php create mode 100644 ci4/app/Controllers/Usuarios/Groupold.php create mode 100644 ci4/app/Controllers/Usuarios/Usersold.php create mode 100644 ci4/app/Controllers/Viewmode.php delete mode 100644 ci4/app/Views/themes/backend/vuexy/main/all_selects.php delete mode 100644 ci4/app/Views/themes/backend/vuexy/main/crud_layout.php create mode 100644 ci4/app/Views/themes/backend/vuexy/main/selector_menu.php diff --git a/ci4/app/Config/Basics.php b/ci4/app/Config/Basics.php index 02535dfc..ed7067e9 100644 --- a/ci4/app/Config/Basics.php +++ b/ci4/app/Config/Basics.php @@ -24,68 +24,72 @@ namespace Config; use CodeIgniter\Config\BaseConfig; -class Basics extends BaseConfig { +class Basics extends BaseConfig +{ - public $appName = 'Safekat'; + public $appName = 'Safekat'; - public $i18n = 'es-ES'; - - public $languages = [ - 'en' => 'English', - 'es' => 'Spanish', - ]; + public $i18n = 'es-ES'; - public $languageFlags = [ - 'en' => 'us', - 'es' => 'es', - ]; + public $vista_impresion = 'impresion'; + public $vista_maquetacion = 'maquetacion'; + public $vista_digitalizacion = 'digitalizacion'; + + public $languages = [ + 'en' => 'English', + 'es' => 'Spanish', + ]; - public $authImplemented = false; + public $languageFlags = [ + 'en' => 'us', + 'es' => 'es', + ]; + public $authImplemented = false; - public $theme = [ - 'name' => 'vuexy', - 'body-sm' => false, - 'navbar' => [ - 'bg' => 'gray', - 'type' => 'dark', - 'border' => true, - 'user' => [ - 'visible' => true, - 'shadow' => 0, - ], - ], - 'sidebar' => [ - 'type' => 'dark', - 'shadow' => 4, - 'border' => false, - 'compact' => true, - 'links' => [ - 'bg' => 'black', // only works with AdminLTE theme - 'shadow' => 1, - ], - 'brand' => [ - 'bg' => 'gray-dark', - 'logo' => [ - 'icon' => 'favicon.ico', // path to image | this example icon on public root folder. - 'text' => 'sk_test', - 'shadow' => 2, - ], - ], - 'user' => [ - 'visible' => true, - 'shadow' => 2, - ], - ], - 'footer' => [ - 'fixed' => false, - 'organization' => 'Your Awesome Company', - 'orglink' => 'https://www.ozar.net/', - ], - ]; + public $theme = [ + 'name' => 'vuexy', + 'body-sm' => false, + 'navbar' => [ + 'bg' => 'gray', + 'type' => 'dark', + 'border' => true, + 'user' => [ + 'visible' => true, + 'shadow' => 0, + ], + ], + 'sidebar' => [ + 'type' => 'dark', + 'shadow' => 4, + 'border' => false, + 'compact' => true, + 'links' => [ + 'bg' => 'black', // only works with AdminLTE theme + 'shadow' => 1, + ], + 'brand' => [ + 'bg' => 'gray-dark', + 'logo' => [ + 'icon' => 'favicon.ico', // path to image | this example icon on public root folder. + 'text' => 'sk_test', + 'shadow' => 2, + ], + ], + 'user' => [ + 'visible' => true, + 'shadow' => 2, + ], + ], + 'footer' => [ + 'fixed' => false, + 'organization' => 'Your Awesome Company', + 'orglink' => 'https://www.ozar.net/', + ], + ]; } diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index 4c206ee7..9089a5ad 100644 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -29,6 +29,7 @@ $routes->setAutoRoute(true); //------------------------------------------------------------------ $routes->get('/', 'Home::index'); $routes->get('lang/{locale}', 'Language::index'); +$routes->get('viewmode/(:alpha)', 'Viewmode::index/$1'); //API ROUTER ------------------------------------------------------ //------------------------------------------------------------------ @@ -75,7 +76,7 @@ $routes->group('tarifaacabado', ['namespace' => 'App\Controllers\Tarifas'], func $routes->post('menuitems', 'Tarifaacabado::menuItems', ['as' => 'menuItemsOfTarifasacabado']); }); -$routes->group('users', ['namespace' => 'App\Controllers\Usuarios'], function ($routes) { +$routes->group('users', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) { $routes->get('', 'Users::index', ['as' => 'userList']); $routes->get('index', 'Users::index', ['as' => 'userIndex']); $routes->get('list', 'Users::index', ['as' => 'userList2']); @@ -88,7 +89,7 @@ $routes->group('users', ['namespace' => 'App\Controllers\Usuarios'], function ($ $routes->post('menuitems', 'Users::menuItems', ['as' => 'menuItemsOfUsers']); }); -$routes->group('group', ['namespace' => 'App\Controllers\Usuarios'], function ($routes) { +$routes->group('group', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) { $routes->get('', 'Group::index', ['as' => 'userGroupList']); $routes->get('index', 'Group::index', ['as' => 'groupIndex']); $routes->post('edit/(:num)', 'Group::edit/$1', ['as' => 'updateGroup']); diff --git a/ci4/app/Controllers/Configuracion/Correo.php b/ci4/app/Controllers/Configuracion/Correo.php deleted file mode 100644 index c28e78b7..00000000 --- a/ci4/app/Controllers/Configuracion/Correo.php +++ /dev/null @@ -1,21 +0,0 @@ -request->getLocale(); $session->remove('lang'); $session->set('lang', $locale); - $url = base_url(); + $url = previous_url(); return redirect()->to($url); } } diff --git a/ci4/app/Controllers/Compras/Compras.php b/ci4/app/Controllers/Servicioscompras/Compras.php similarity index 76% rename from ci4/app/Controllers/Compras/Compras.php rename to ci4/app/Controllers/Servicioscompras/Compras.php index c775b03c..791aee00 100644 --- a/ci4/app/Controllers/Compras/Compras.php +++ b/ci4/app/Controllers/Servicioscompras/Compras.php @@ -1,6 +1,6 @@ getSegment(1) . '/' . $uri->getSegment(2); - echo view(getenv('theme.path').'main/demo_view', $data); + echo 'Digitalización'; } diff --git a/ci4/app/Controllers/Serviciosmaquetacion/Maquetacion.php b/ci4/app/Controllers/Serviciosmaquetacion/Maquetacion.php new file mode 100644 index 00000000..c47d5c1c --- /dev/null +++ b/ci4/app/Controllers/Serviciosmaquetacion/Maquetacion.php @@ -0,0 +1,24 @@ +viewData['pageTitle'] = lang('Group.moduleTitle'); + self::$viewPath = getenv('theme.path').'form/group/'; + + parent::initController($request, $response, $logger); + + } + + public function index() + { + $this->viewData['usingClientSideDataTable'] = true; + $this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('Groups.group')]); + // IMN + $this->group_user_model = new GroupUserModel(); + $this->viewData['model'] = $this->group_user_model; + + parent::index(); + } + + public function add() + { + + $requestMethod = $this->request->getMethod(); + + if ($requestMethod === 'post') : + + $nullIfEmpty = true; // !(phpversion() >= '8.1'); + + $postData = $this->request->getPost(); + + + + $title = $postData['title']; + $dashboard = $postData['dashboard']; + unset($postData['title']); + unset($postData['dashboard']); + unset($postData['id_group']); + unset($postData['save']); + + $controller = null; + $rules_access = null; + + foreach ($postData as $key=>$value){ + $exp = explode('_',$key); + $controller[] = $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)) ; + } + } + } + } + + + + $temp_data['rules'] = json_encode($rules_access??'{}'); + $temp_data['token'] = md5(uniqid(rand(), true));; + $temp_data['title'] = $title; + $temp_data['dashboard'] = $dashboard; + + $sanitizedData = $this->sanitized($temp_data, $nullIfEmpty); + + $noException = true; + if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : + + + if ($this->canValidate()) : + try { + $successfulResult = $this->model->skipValidation(true)->save($sanitizedData); + } catch (\Exception $e) { + $noException = false; + $this->dealWithException($e); + } + else: + $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Group.userGroup'))]); + $this->session->setFlashdata('formErrors', $this->model->errors()); + endif; + + $thenRedirect = true; // Change this to false if you want your user to stay on the form after submission + endif; + if ($noException && $successfulResult) : + + $id = $this->model->db->insertID(); + + $message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Group.userGroup'))]).'.'; + $message .= anchor( "admin/user-groups/{$id}/edit" , lang('Basic.global.continueEditing').'?'); + $message = ucfirst(str_replace("'", "\'", $message)); + + if ($thenRedirect) : + if (!empty($this->indexRoute)) : + return redirect()->to(route_to( $this->indexRoute ) )->with('sweet-success', $message); + else: + return $this->redirect2listView('sweet-success', $message); + endif; + else: + $this->viewData['successMessage'] = $message; + endif; + + endif; // $noException && $successfulResult + + endif; // ($requestMethod === 'post') + + $this->viewData['group'] = isset($sanitizedData) ? new UserGroupModel($sanitizedData) : new UserGroupModel(); + + $this->viewData['formAction'] = route_to('createGroup'); + + $this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('Group.moduleTitle').' '.lang('Basic.global.addNewSuffix'); + + + return $this->displayForm(__METHOD__); + } + + + public function edit($requestedId = null) { + + helper('general'); + $session = session(); + + if ($requestedId == null) : + return $this->redirect2listView(); + endif; + $id = filter_var($requestedId, FILTER_SANITIZE_URL); + $groupEntity = $this->model->find($id); + + if ($groupEntity == false) : + $message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Group.userGroup')), $id]); + return $this->redirect2listView('errorMessage', $message); + endif; + + $requestMethod = $this->request->getMethod(); + + if ($requestMethod === 'post') : + + $nullIfEmpty = true; // !(phpversion() >= '8.1'); + + $postData = $this->request->getPost(); + + $id_group = $groupEntity->id_group; + $token = $groupEntity->token; + $title = $postData['title']; + $dashboard = $postData['dashboard']; + + unset($postData['id_group']); + unset($postData['title']); + unset($postData['dashboard']); + + $controller = null; + $rules_access = null; + + foreach ($postData as $key=>$value){ + $exp = explode('_',$key); + $controller[] = $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)) ; + } + } + } + } + + $temp_data['id_group'] = $id_group; + $temp_data['rules'] = json_encode($rules_access??'{}'); + $temp_data['token'] = $token; + $temp_data['title'] = $title; + $temp_data['dashboard'] = $dashboard; + + $sanitizedData = $this->sanitized($temp_data, $nullIfEmpty); + + + $noException = true; + if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : + + + + if ($this->canValidate()) : + try { + $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); + } catch (\Exception $e) { + $noException = false; + $this->dealWithException($e); + } + else: + $this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Group.userGroup'))]); + $this->session->setFlashdata('formErrors', $this->model->errors()); + + endif; + + $groupEntity->fill($sanitizedData); + + $thenRedirect = true; + endif; + if ($noException && $successfulResult) : + $id = $groupEntity->id ?? $id; + $message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Group.userGroup'))]).'.'; + $message .= anchor(route_to('editGroup', $id), lang('Basic.global.continueEditing').'?'); + $message = ucfirst(str_replace("'", "\'", $message)); + + if($session->get('group') == $this->request->getPost('token')){ + $session->set('rules', $temp_data['rules']); + } + if ($thenRedirect) : + if (!empty($this->indexRoute)) : + return redirect()->to(route_to($this->indexRoute))->with('successMessage', $message); + else: + return $this->redirect2listView('successMessage', $message); + endif; + else: + $this->viewData['successMessage'] = $message; + endif; + + endif; // $noException && $successfulResult + endif; // ($requestMethod === 'post') + + $this->viewData['group'] = $groupEntity; + + $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); + } // end function edit(...) + + + + public function allItemsSelect() { + if ($this->request->isAJAX()) { + $onlyActiveOnes = true; + $reqVal = $this->request->getPost('val') ?? 'id'; + $menu = $this->model->getAllForMenu($reqVal.', nombre', 'nombre', $onlyActiveOnes, false); + $nonItem = new \stdClass; + $nonItem->id = ''; + $nonItem->nombre = '- '.lang('Basic.global.None').' -'; + array_unshift($menu , $nonItem); + + $newTokenHash = csrf_hash(); + $csrfTokenName = csrf_token(); + $data = [ + 'menu' => $menu, + $csrfTokenName => $newTokenHash + ]; + return $this->respond($data); + } else { + return $this->failUnauthorized('Invalid request', 403); + } + } + + public function menuItems() { + if ($this->request->isAJAX()) { + $searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; + $reqId = goSanitize($this->request->getPost('id'))[0]; + $reqText = goSanitize($this->request->getPost('text'))[0]; + $onlyActiveOnes = false; + $columns2select = [$reqId ?? 'id', $reqText ?? 'nombre']; + $onlyActiveOnes = false; + $menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr); + $nonItem = new \stdClass; + $nonItem->id = ''; + $nonItem->text = '- '.lang('Basic.global.None').' -'; + array_unshift($menu , $nonItem); + + $newTokenHash = csrf_hash(); + $csrfTokenName = csrf_token(); + $data = [ + 'menu' => $menu, + $csrfTokenName => $newTokenHash + ]; + return $this->respond($data); + } else { + return $this->failUnauthorized('Invalid request', 403); + } + } +} diff --git a/ci4/app/Controllers/Usuarios/Usersold.php b/ci4/app/Controllers/Usuarios/Usersold.php new file mode 100644 index 00000000..49a3d83b --- /dev/null +++ b/ci4/app/Controllers/Usuarios/Usersold.php @@ -0,0 +1,310 @@ +group_model = new UserGroupModel(); + $this->group_user_model = new GroupUserModel(); + $this->user_model = new UserModel(); + + $this->viewData['pageTitle'] = lang('Users.moduleTitle'); + parent::initController($request, $response, $logger); + + } + + public function index() { + + $this->viewData['usingClientSideDataTable'] = true; + + $this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('Users.user')]); + + $this->viewData['user_model'] = $this->user_model; + + parent::index(); + + } + + public function add() { + + $requestMethod = $this->request->getMethod(); + + if ($requestMethod === 'post') : + + $nullIfEmpty = true; // !(phpversion() >= '8.1'); + + $postData = $this->request->getPost(); + + if(!empty($postData['password'])){ + $phpass = new PasswordHash(8, true); + $postData['password'] = $phpass->HashPassword($this->request->getPost('password')); + } + + $currentGroups = $postData['group']; + unset($postData['group']); + + $sanitizedData = $this->sanitized($postData, $nullIfEmpty); + + if ($this->request->getPost('last_ip') == null ) { + $sanitizedData['last_ip'] = '::1'; + } + + $sanitizedData['token'] = md5(uniqid(rand(), true)); + + $noException = true; + if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : + + + if ($this->canValidate()) : + try { + $successfulResult = $this->model->skipValidation(true)->save($sanitizedData); + } catch (\Exception $e) { + $noException = false; + $this->dealWithException($e); + } + else: + $this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Users.user'))]); + $this->session->setFlashdata('formErrors', $this->model->errors()); + endif; + + $thenRedirect = true; // Change this to false if you want your user to stay on the form after submission + endif; + if ($noException && $successfulResult) : + + $id = $this->model->db->insertID(); + foreach($currentGroups as $group){ + $group_user_data = [ + 'token_user' => $sanitizedData['token'], + 'token_group' => $group + ]; + $this->group_user_model->insert($group_user_data); + } + + $message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Users.user'))]) . 'Downloads'; + $message .= anchor(route_to('editUser', $id), lang('Basic.global.continueEditing').'?'); + $message = ucfirst(str_replace("'", "\'", $message)); + + if ($thenRedirect) : + if (!empty($this->indexRoute)) : + return redirect()->to(route_to($this->indexRoute))->with('successMessage', $message); + else: + return $this->redirect2listView('successMessage', $message); + endif; + else: + $this->viewData['successMessage'] = $message; + endif; + + endif; // $noException && $successfulResult + + endif; // ($requestMethod === 'post') + + $this->viewData['user'] = isset($sanitizedData) ? new UserEntity($sanitizedData) : new UserEntity(); + $this->viewData['paisList'] = $this->getPaisListItems(); + + $this->viewData['formAction'] = route_to('createUser'); + $this->viewData['groups'] = $this->group_model->select('token,title')->findAll(); + + $this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' Users.php' .lang('Users.user').' '.lang('Basic.global.addNewSuffix'); + + + return $this->displayForm(__METHOD__); + } // end function add() + + public function edit($requestedId = null) { + + if ($requestedId == null) : + return $this->redirect2listView(); + endif; + $id = filter_var($requestedId, FILTER_SANITIZE_URL); + $user = $this->model->find($id); + + if ($user == false) : + $message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Users.user')), $id]); + return $this->redirect2listView('errorMessage', $message); + endif; + + $requestMethod = $this->request->getMethod(); + + if ($requestMethod === 'post') : + + $nullIfEmpty = true; // !(phpversion() >= '8.1'); + + $postData = $this->request->getPost(); + $currentGroups = $postData['group']; + unset($postData['group']); + + if(!empty($postData['password'])){ + $phpass = new PasswordHash(8, true); + $postData['password'] = $phpass->HashPassword($this->request->getPost('password')); + } + + $sanitizedData = $this->sanitized($postData, $nullIfEmpty); + if ($this->request->getPost('tfa') == null ) { + $sanitizedData['tfa'] = false; + } + if ($this->request->getPost('blocked') == null ) { + $sanitizedData['blocked'] = false; + } + if ($this->request->getPost('last_ip') == null ) { + $sanitizedData['last_ip'] = '::1'; + } + + $noException = true; + if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : + + + + if ($this->canValidate()) : + try { + $successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData); + } catch (\Exception $e) { + $noException = false; + $this->dealWithException($e); + } + else: + $this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Users.user'))]); + $this->session->setFlashdata('formErrors', $this->model->errors()); + + endif; + + + $user->fill($sanitizedData); + + + + $thenRedirect = true; + endif; + if ($noException && $successfulResult) : + $postData = $this->request->getPost(); + + $this->group_user_model->where('token_user', $user->token)->delete(); + foreach($currentGroups as $group){ + $group_user_data = [ + 'token_user' => $user->token, + 'token_group' => $group + ]; + $this->group_user_model->insert($group_user_data); + } + + $id = $user->id_user ?? $id; + $message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Users.user'))]) . 'Downloads'; + $message .= anchor(route_to('editUser', $id), lang('Basic.global.continueEditing').'?'); + $message = ucfirst(str_replace("'", "\'", $message)); + + if ($thenRedirect) : + if (!empty($this->indexRoute)) : + return redirect()->to(route_to($this->indexRoute))->with('successMessage', $message); + else: + return $this->redirect2listView('successMessage', $message); + endif; + else: + $this->viewData['successMessage'] = $message; + endif; + + endif; // $noException && $successfulResult + endif; // ($requestMethod === 'post') + + $this->viewData['user'] = $user; + $this->viewData['paisList'] = $this->getPaisListItems(); + + $this->viewData['formAction'] = route_to('updateUser', $id); + + $this->viewData['selectedGroups'] = $this->group_user_model->select('token_group')->where('token_user', $user->token)->findAll(); + $this->viewData['groups'] = $this->group_model->select('token,title')->findAll(); + + $this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' Users.php' .lang('Users.user').' '.lang('Basic.global.edit3'); + + + return $this->displayForm(__METHOD__, $id); + } // end function edit(...) + + + + public function allItemsSelect() { + if ($this->request->isAJAX()) { + $onlyActiveOnes = true; + $reqVal = $this->request->getPost('val') ?? 'id_user'; + $menu = $this->model->getAllForMenu($reqVal.', first_name', 'first_name', $onlyActiveOnes, false); + $nonItem = new \stdClass; + $nonItem->id_user = ''; + $nonItem->first_name = '- '.lang('Basic.global.None').' -'; + array_unshift($menu , $nonItem); + + $newTokenHash = csrf_hash(); + $csrfTokenName = csrf_token(); + $data = [ + 'menu' => $menu, + $csrfTokenName => $newTokenHash + ]; + return $this->respond($data); + } else { + return $this->failUnauthorized('Invalid request', 403); + } + } + + public function menuItems() { + if ($this->request->isAJAX()) { + $searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; + $reqId = goSanitize($this->request->getPost('id'))[0]; + $reqText = goSanitize($this->request->getPost('text'))[0]; + $onlyActiveOnes = false; + $columns2select = [$reqId ?? 'id_user', $reqText ?? 'first_name']; + $onlyActiveOnes = false; + $menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr); + $nonItem = new \stdClass; + $nonItem->id = ''; + $nonItem->text = '- '.lang('Basic.global.None').' -'; + array_unshift($menu , $nonItem); + + $newTokenHash = csrf_hash(); + $csrfTokenName = csrf_token(); + $data = [ + 'menu' => $menu, + $csrfTokenName => $newTokenHash + ]; + return $this->respond($data); + } else { + return $this->failUnauthorized('Invalid request', 403); + } + } + + + protected function getPaisListItems() { + $data = [''=>lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Pais.pais'))])]; + $paisModel = model('App\Models\Configuracion\PaisModel'); + + $registers = $paisModel->findAll(); + + return $registers; + } + +} diff --git a/ci4/app/Controllers/Viewmode.php b/ci4/app/Controllers/Viewmode.php new file mode 100644 index 00000000..1be08ba3 --- /dev/null +++ b/ci4/app/Controllers/Viewmode.php @@ -0,0 +1,18 @@ +remove('view_mode'); + $session->set('view_mode', $viewMode); + $url = previous_url(); + return redirect()->to($url); + } +} diff --git a/ci4/app/Filters/LoginAuthFilter.php b/ci4/app/Filters/LoginAuthFilter.php index a1cce1a3..1f24268e 100644 --- a/ci4/app/Filters/LoginAuthFilter.php +++ b/ci4/app/Filters/LoginAuthFilter.php @@ -107,15 +107,18 @@ class LoginAuthFilter implements FilterInterface 'Clientes', 'Compras', 'Configuracion', - 'ServiciosDigitalizacion', + 'EnviosLogistica', 'Facturacion', 'Informes', 'Importacion', - 'EnviosLogistica', 'Pedidos', 'Presupuestos', 'Produccion', 'Proveedores', + 'ServiciosCompras', + 'ServiciosMaquetacion', + 'ServiciosMensajeria', + 'ServiciosDigitalizacion', 'Tarifas', 'Usuarios', ]; @@ -141,9 +144,10 @@ class LoginAuthFilter implements FilterInterface 'Integration', 'Migrate', 'Test', + 'Viewmode', 'GoBaseController', 'GoBaseResourceController', - 'My', 'Activity', 'Notification' // PARA LA DEMO + 'My', 'Usuarios', 'Notification' // PARA LA DEMO ]; } diff --git a/ci4/app/Language/en/App.php b/ci4/app/Language/en/App.php index 469cd940..d3641a7b 100644 --- a/ci4/app/Language/en/App.php +++ b/ci4/app/Language/en/App.php @@ -692,6 +692,10 @@ return [ "menu_trabajo" => "Works", "menu_trabajo" => "Tipologies", + "menu_mensajes" => "Messages", + + "menu_maquetacion" => "Maquetación", + "menu_digitalizacion" => "Digitalisation", "menu_importacion" => "Import", @@ -708,6 +712,12 @@ return [ "menu_logistica_tracking" => "Tracking", + "menu_compras" => "Procurement", + "menu_compras_ajustes" => "Settings", + "menu_productos" => "Products", + "menu_proveedores" => "Providers", + + "menu_facturación" => "Billing", "menu_albaran" => "Delivery notes", "menu_facturas" => "Invoices", diff --git a/ci4/app/Language/es/App.php b/ci4/app/Language/es/App.php index 59f5b4cc..60fcdd62 100644 --- a/ci4/app/Language/es/App.php +++ b/ci4/app/Language/es/App.php @@ -691,7 +691,11 @@ return [ "menu_tiposimpresion" => "Tipos de impresion", "menu_trabajo" => "Trabajos", "menu_tipologias" => "Tipologías", - + + "menu_mensajes" => "Mensajes", + + "menu_maquetacion" => "Maquetación", + "menu_digitalizacion" => "Digitalización", "menu_importacion" => "Importación", @@ -709,6 +713,11 @@ return [ "menu_logistica_tracking" => "Tracking", + "menu_compras" => "Compras", + "menu_compras_ajustes" => "Ajustes", + "menu_productos" => "Productos", + "menu_proveedores" => "Proveedores", + "menu_facturación" => "Facturación", "menu_albaran" => "Albaranes", @@ -739,8 +748,6 @@ return [ "menu_pedidoproduccion" => "Pedidos", "menu_ordentrabajo" => "Orden de trabajo", - "menu_proveedores" => "Proveedores", - "menu_tarifas" => "Tarifas", "menu_tarifapreimpresion" => "Preimpresión", "menu_tarifamanipulado" => "Manipulado", @@ -758,7 +765,7 @@ return [ "menu_general" => "General", "menu_logout" => "Salir", "menu_profile" => "Mi Perfil", - "menu_activity" => "Ocupaciones", + "menu_activity" => "Actividad", "menu_notification" => "Notificaciones", "menu_list" => "Lista", "menu_add" => "Agregar", diff --git a/ci4/app/Views/themes/backend/vuexy/main/all.php b/ci4/app/Views/themes/backend/vuexy/main/all.php index 2f1bcbe2..db682dd1 100644 --- a/ci4/app/Views/themes/backend/vuexy/main/all.php +++ b/ci4/app/Views/themes/backend/vuexy/main/all.php @@ -96,7 +96,7 @@ if (!empty($token) && $tfa == false) {
- +
@@ -153,7 +153,8 @@ if (!empty($token) && $tfa == false) {
- +
@@ -197,7 +198,8 @@ if (!empty($token) && $tfa == false) {
- +
@@ -243,7 +245,8 @@ if (!empty($token) && $tfa == false) {
- +
@@ -289,7 +292,8 @@ if (!empty($token) && $tfa == false) {
- +
@@ -311,7 +315,8 @@ if (!empty($token) && $tfa == false) {
- +
@@ -367,9 +372,60 @@ if (!empty($token) && $tfa == false) { + + + +
- + + + + + + + + +
- + diff --git a/ci4/app/Views/themes/backend/vuexy/main/menu_digitalizacion.php b/ci4/app/Views/themes/backend/vuexy/main/menu_digitalizacion.php new file mode 100644 index 00000000..b12f782b --- /dev/null +++ b/ci4/app/Views/themes/backend/vuexy/main/menu_digitalizacion.php @@ -0,0 +1,373 @@ + + + + + \ No newline at end of file diff --git a/ci4/app/Views/themes/backend/vuexy/main/menu_impresion.php b/ci4/app/Views/themes/backend/vuexy/main/menu_impresion.php index 6c86e9df..60bed43b 100644 --- a/ci4/app/Views/themes/backend/vuexy/main/menu_impresion.php +++ b/ci4/app/Views/themes/backend/vuexy/main/menu_impresion.php @@ -409,7 +409,7 @@ 0): ?> 0): ?> @@ -418,7 +418,7 @@ 0): ?> 0): ?> @@ -427,7 +427,7 @@ 0): ?> 0): ?> @@ -436,7 +436,7 @@ 0): ?> 0): ?> @@ -506,7 +506,7 @@ if (count(getArrayItem($menus, 'name', 'Mensajes')) > 0): ?>