From 90d63432d6c9530a9b6ed6a29747b61343b001ff Mon Sep 17 00:00:00 2001 From: imnavajas Date: Wed, 12 Jul 2023 12:35:31 +0200 Subject: [PATCH] =?UTF-8?q?A=C3=B1adida=20funcion=20clientes=20desde=20oza?= =?UTF-8?q?r?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ci4/app/Config/Routes.php | 96 +++-- ci4/app/Controllers/Clientes/Cliente.php | 347 +++++++++++------- .../Configuracion/Comunidadesautonomas.php | 47 +-- .../Controllers/Configuracion/Formaspagos.php | 271 ++++++++++++++ ci4/app/Controllers/Configuracion/Paises.php | 127 ++++--- .../Controllers/Configuracion/Provincias.php | 289 +++++++++++++++ ci4/app/Entities/Clientes/ClienteEntity.php | 25 +- .../Configuracion/ComunidadAutonomaEntity.php | 18 + .../Configuracion/FormaPagoEntity.php | 15 + .../Configuracion/ProvinciaEntity.php | 19 + ci4/app/Language/en/Clientes.php | 233 ++++++++++++ ci4/app/Language/en/ComunidadesAutonomas.php | 34 ++ ci4/app/Language/en/FormasPagoes.php | 35 ++ ci4/app/Language/en/Paises.php | 17 +- ci4/app/Language/en/Provincias.php | 44 +++ ci4/app/Language/es/Clientes.php | 119 +++--- ci4/app/Language/es/ComunidadesAutonomas.php | 49 +-- ci4/app/Language/es/FormasPago.php | 8 +- ci4/app/Language/es/Paises.php | 23 +- ci4/app/Language/es/PapelGenerico.php | 4 +- ci4/app/Language/es/Provincias.php | 44 +++ .../Language/es/TarifaManipuladoLineas.php | 10 +- ci4/app/Language/es/TipologiasLibros.php | 4 +- ci4/app/Language/es/Users.php | 2 +- ci4/app/Models/Clientes/ClienteModel.php | 250 ++++++------- .../Configuracion/ComunidadAutonomaModel.php | 97 +++++ .../Models/Configuracion/FormaPagoModel.php | 68 ++++ ci4/app/Models/Configuracion/PaisModel.php | 52 ++- .../Models/Configuracion/ProvinciaModel.php | 109 ++++++ .../{ => cliente}/_clienteFormItems.php | 144 +++++--- .../form/clientes/cliente/viewClienteForm.php | 212 +++++++++++ .../{ => cliente}/viewClienteList.php | 142 +++---- .../_comunidadAutonomaFormItems.php | 17 +- .../viewComunidadAutonomaForm.php | 37 ++ .../viewComunidadAutonomaList.php | 1 + .../formas-pago/_formaDePagoFormItems.php | 12 + .../formas-pago/viewFormaDePagoForm.php} | 15 +- .../formas-pago/viewFormaDePagoList.php | 185 ++++++++++ .../configuracion/paises/_paisFormItems.php | 16 +- .../configuracion/paises/viewPaisForm.php | 25 +- .../configuracion/paises/viewPaisList.php | 199 +++++++--- .../provincias/_provinciaFormItems.php | 35 ++ .../provincias/viewProvinciaForm.php | 63 ++++ .../provincias/viewProvinciaList.php | 190 ++++++++++ .../manipulado/viewTarifaManipuladoForm.php | 1 + .../manipulado/viewTarifaManipuladoList.php | 107 +++--- .../themes/frontend/tivo/main/footer.php | 41 --- .../themes/frontend/tivo/main/header.php | 130 ------- .../Views/themes/frontend/tivo/main/menu.php | 61 --- 49 files changed, 3119 insertions(+), 970 deletions(-) create mode 100644 ci4/app/Controllers/Configuracion/Formaspagos.php create mode 100644 ci4/app/Controllers/Configuracion/Provincias.php create mode 100644 ci4/app/Entities/Configuracion/ComunidadAutonomaEntity.php create mode 100644 ci4/app/Entities/Configuracion/FormaPagoEntity.php create mode 100644 ci4/app/Entities/Configuracion/ProvinciaEntity.php create mode 100644 ci4/app/Language/en/Clientes.php create mode 100644 ci4/app/Language/en/ComunidadesAutonomas.php create mode 100644 ci4/app/Language/en/FormasPagoes.php create mode 100644 ci4/app/Language/en/Provincias.php create mode 100644 ci4/app/Language/es/Provincias.php create mode 100644 ci4/app/Models/Configuracion/ComunidadAutonomaModel.php create mode 100644 ci4/app/Models/Configuracion/FormaPagoModel.php create mode 100644 ci4/app/Models/Configuracion/ProvinciaModel.php rename ci4/app/Views/themes/backend/vuexy/form/clientes/{ => cliente}/_clienteFormItems.php (73%) create mode 100644 ci4/app/Views/themes/backend/vuexy/form/clientes/cliente/viewClienteForm.php rename ci4/app/Views/themes/backend/vuexy/form/clientes/{ => cliente}/viewClienteList.php (59%) create mode 100644 ci4/app/Views/themes/backend/vuexy/form/configuracion/formas-pago/_formaDePagoFormItems.php rename ci4/app/Views/themes/backend/vuexy/form/{clientes/viewClienteForm.php => configuracion/formas-pago/viewFormaDePagoForm.php} (55%) create mode 100644 ci4/app/Views/themes/backend/vuexy/form/configuracion/formas-pago/viewFormaDePagoList.php create mode 100644 ci4/app/Views/themes/backend/vuexy/form/configuracion/provincias/_provinciaFormItems.php create mode 100644 ci4/app/Views/themes/backend/vuexy/form/configuracion/provincias/viewProvinciaForm.php create mode 100644 ci4/app/Views/themes/backend/vuexy/form/configuracion/provincias/viewProvinciaList.php delete mode 100644 ci4/app/Views/themes/frontend/tivo/main/footer.php delete mode 100644 ci4/app/Views/themes/frontend/tivo/main/header.php delete mode 100644 ci4/app/Views/themes/frontend/tivo/main/menu.php diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index 5384d9ce..64e4f8ad 100644 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -52,18 +52,6 @@ $routes->delete('api/user/(:segment)', 'Api::user/delete/$1'); * -------------------------------------------------------------------- */ -$routes->group('paises', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) { - $routes->get('', 'Paises::index', ['as' => 'paisList']); - $routes->get('index', 'Paises::index', ['as' => 'paisIndex']); - $routes->get('add', 'Paises::add', ['as' => 'newPais']); - $routes->post('add', 'Paises::add', ['as' => 'createPais']); - $routes->get('edit/(:num)', 'Paises::edit/$1', ['as' => 'editPais']); - $routes->post('edit/(:num)', 'Paises::edit/$1', ['as' => 'updatePais']); - $routes->get('delete/(:num)', 'Paises::delete/$1', ['as' => 'deletePais']); - $routes->post('allmenuitems', 'Paises::allItemsSelect', ['as' => 'select2ItemsOfPaises']); - $routes->post('menuitems', 'Paises::menuItems', ['as' => 'menuItemsOfPaises']); -}); - $routes->group('tarifaacabado', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) { $routes->get('', 'Tarifaacabado::index', ['as' => 'tarifaAcabadoList']); $routes->get('index', 'Tarifaacabado::index', ['as' => 'tarifaAcabadoIndex']); @@ -104,22 +92,6 @@ $routes->group('group', ['namespace' => 'App\Controllers\Configuracion'], functi $routes->post('add', 'Group::add', ['as' => 'createGroup']); }); -$routes->group('cliente', ['namespace' => 'App\Controllers\Clientes'], function ($routes) { - $routes->get('', 'Cliente::index', ['as' => 'clienteList']); - $routes->get('add', 'Cliente::add', ['as' => 'newCliente']); - $routes->post('add', 'Cliente::add', ['as' => 'createCliente']); - $routes->post('create', 'Cliente::create', ['as' => 'ajaxCreateCliente']); - $routes->put('(:num)/update', 'Cliente::update/$1', ['as' => 'ajaxUpdateCliente']); - $routes->post('edit/(:num)', 'Cliente::edit/$1', ['as' => 'updateCliente']); - $routes->get('delete/(:num)', 'Cliente::delete/$1', ['as' => 'deleteCliente']); - $routes->post('datatable', 'Cliente::datatable', ['as' => 'dataTableOfCliente']); - $routes->post('allmenuitems', 'Cliente::allItemsSelect', ['as' => 'select2ItemsOfCliente']); - $routes->post('menuitems', 'Cliente::menuItems', ['as' => 'menuItemsOfCliente']); -}); -$routes->resource('cliente', ['namespace' => 'App\Clientes\Cliente', 'controller' => 'Cliente', 'except' => 'show,new,create,update']); - - - $routes->group('tarifapreimpresion', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) { $routes->get('', 'Tarifapreimpresion::index', ['as' => 'tarifapreimpresionList']); $routes->get('index', 'Tarifapreimpresion::index', ['as' => 'tarifapreimpresionIndex']); @@ -257,6 +229,74 @@ $routes->group('profile', ['namespace' => 'App\Controllers'], function ($routes) }); +$routes->group('comunidades-autonomas', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) { + $routes->get('', 'Comunidadesautonomas::index', ['as' => 'comunidadAutonomaList']); + $routes->get('add', 'Comunidadesautonomas::add', ['as' => 'newComunidadAutonoma']); + $routes->post('add', 'Comunidadesautonomas::add', ['as' => 'createComunidadAutonoma']); + $routes->post('create', 'Comunidadesautonomas::create', ['as' => 'ajaxCreateComunidadAutonoma']); + $routes->put('(:num)/update', 'Comunidadesautonomas::update/$1', ['as' => 'ajaxUpdateComunidadAutonoma']); + $routes->post('(:num)/edit', 'Comunidadesautonomas::edit/$1', ['as' => 'updateComunidadAutonoma']); + $routes->post('datatable', 'Comunidadesautonomas::datatable', ['as' => 'dataTableOfComunidadesAutonomas']); + $routes->post('allmenuitems', 'Comunidadesautonomas::allItemsSelect', ['as' => 'select2ItemsOfComunidadesAutonomas']); + $routes->post('menuitems', 'Comunidadesautonomas::menuItems', ['as' => 'menuItemsOfComunidadesAutonomas']); +}); +$routes->resource('comunidades-autonomas', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Comunidadesautonomas', 'except' => 'show,new,create,update']); + + +$routes->group('paises', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) { + $routes->get('', 'Paises::index', ['as' => 'paisList']); + $routes->get('add', 'Paises::add', ['as' => 'newPais']); + $routes->post('add', 'Paises::add', ['as' => 'createPais']); + $routes->post('create', 'Paises::create', ['as' => 'ajaxCreatePais']); + $routes->put('(:num)/update', 'Paises::update/$1', ['as' => 'ajaxUpdatePais']); + $routes->post('(:num)/edit', 'Paises::edit/$1', ['as' => 'updatePais']); + $routes->post('datatable', 'Paises::datatable', ['as' => 'dataTableOfPaises']); + $routes->post('allmenuitems', 'Paises::allItemsSelect', ['as' => 'select2ItemsOfPaises']); + $routes->post('menuitems', 'Paises::menuItems', ['as' => 'menuItemsOfPaises']); +}); +$routes->resource('paises', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Paises', 'except' => 'show,new,create,update']); + + +$routes->group('provincias', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) { + $routes->get('', 'Provincias::index', ['as' => 'provinciaList']); + $routes->get('add', 'Provincias::add', ['as' => 'newProvincia']); + $routes->post('add', 'Provincias::add', ['as' => 'createProvincia']); + $routes->post('create', 'Provincias::create', ['as' => 'ajaxCreateProvincia']); + $routes->put('(:num)/update', 'Provincias::update/$1', ['as' => 'ajaxUpdateProvincia']); + $routes->post('(:num)/edit', 'Provincias::edit/$1', ['as' => 'updateProvincia']); + $routes->post('datatable', 'Provincias::datatable', ['as' => 'dataTableOfProvincias']); + $routes->post('allmenuitems', 'Provincias::allItemsSelect', ['as' => 'select2ItemsOfProvincias']); + $routes->post('menuitems', 'Provincias::menuItems', ['as' => 'menuItemsOfProvincias']); +}); +$routes->resource('provincias', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Provincias', 'except' => 'show,new,create,update']); + + +$routes->group('cliente', ['namespace' => 'App\Controllers\Clientes'], function ($routes) { + $routes->get('', 'Cliente::index', ['as' => 'clienteList']); + $routes->get('add', 'Cliente::add', ['as' => 'newCliente']); + $routes->post('add', 'Cliente::add', ['as' => 'createCliente']); + $routes->post('create', 'Cliente::create', ['as' => 'ajaxCreateCliente']); + $routes->put('(:num)/update', 'Cliente::update/$1', ['as' => 'ajaxUpdateCliente']); + $routes->post('(:num)/edit', 'Cliente::edit/$1', ['as' => 'updateCliente']); + $routes->post('datatable', 'Cliente::datatable', ['as' => 'dataTableOfClientes']); + $routes->post('allmenuitems', 'Cliente::allItemsSelect', ['as' => 'select2ItemsOfClientes']); + $routes->post('menuitems', 'Cliente::menuItems', ['as' => 'menuItemsOfClientes']); +}); +$routes->resource('cliente', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'Cliente', 'except' => 'show,new,create,update']); + +$routes->group('formas-pagos', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) { + $routes->get('', 'Formaspagos::index', ['as' => 'formaDePagoList']); + $routes->get('add', 'Formaspagos::add', ['as' => 'newFormaDePago']); + $routes->post('add', 'Formaspagos::add', ['as' => 'createFormaDePago']); + $routes->post('create', 'Formaspagos::create', ['as' => 'ajaxCreateFormaDePago']); + $routes->put('(:num)/update', 'Formaspagos::update/$1', ['as' => 'ajaxUpdateFormaDePago']); + $routes->post('(:num)/edit', 'Formaspagos::edit/$1', ['as' => 'updateFormaDePago']); + $routes->post('datatable', 'Formaspagos::datatable', ['as' => 'dataTableOfFormasDePagos']); + $routes->post('allmenuitems', 'Formaspagos::allItemsSelect', ['as' => 'select2ItemsOfFormasDePagos']); + $routes->post('menuitems', 'Formaspagos::menuItems', ['as' => 'menuItemsOfFormasDePagos']); +}); +$routes->resource('formas-pagos', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Formaspagos', 'except' => 'show,new,create,update']); + /* diff --git a/ci4/app/Controllers/Clientes/Cliente.php b/ci4/app/Controllers/Clientes/Cliente.php index 6ccddff0..2ae6d61a 100644 --- a/ci4/app/Controllers/Clientes/Cliente.php +++ b/ci4/app/Controllers/Clientes/Cliente.php @@ -1,4 +1,4 @@ -viewData['pageTitle'] = lang('Cliente.moduleTitle'); + public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { + $this->viewData['pageTitle'] = lang('Clientes.moduleTitle'); $this->viewData['usingSweetAlert'] = true; - // Breadcrumbs + // Breadcrumbs (IMN) $this->viewData['breadcrumb'] = [ ['title' => lang("App.menu_clientes"), 'route' => "", 'active' => false], ['title' => lang("App.menu_cliente"), 'route' => site_url('clientes/cliente'), 'active' => true] @@ -46,25 +51,25 @@ class Cliente extends \App\Controllers\GoBaseResourceController } - public function index() - { - + public function index() { + $viewData = [ - 'currentModule' => static::$controllerSlug, - 'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Cliente.cliente')]), - 'clienteEntity' => new ClienteEntity(), - 'usingServerSideDataTable' => true, - ]; + 'currentModule' => static::$controllerSlug, + 'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Clientes.cliente')]), + 'clienteEntity' => new ClienteEntity(), + 'usingServerSideDataTable' => true, + + ]; $viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class - return view(static::$viewPath . 'viewClienteList', $viewData); + return view(static::$viewPath.'viewClienteList', $viewData); } - public function add() - { - + public function add() { + + $requestMethod = $this->request->getMethod(); @@ -73,39 +78,39 @@ class Cliente extends \App\Controllers\GoBaseResourceController $nullIfEmpty = true; // !(phpversion() >= '8.1'); $postData = $this->request->getPost(); - - $sanitizedData = $this->sanitized($postData, $nullIfEmpty); + + $sanitizedData = $this->sanitized($postData, $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('Cliente.cliente'))]); - $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 + 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('Clientes.cliente'))]); + $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('Cliente.cliente'))]) . '.'; - $message .= anchor("admin/clientes/{$id}/edit", lang('Basic.global.continueEditing') . '?'); + $message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Clientes.cliente'))]).'.'; + $message .= anchor( "admin/cliente/{$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); + return redirect()->to(route_to( $this->indexRoute ) )->with('sweet-success', $message); else: return $this->redirect2listView('sweet-success', $message); endif; @@ -118,20 +123,23 @@ class Cliente extends \App\Controllers\GoBaseResourceController endif; // ($requestMethod === 'post') $this->viewData['clienteEntity'] = isset($sanitizedData) ? new ClienteEntity($sanitizedData) : new ClienteEntity(); - $this->viewData['paisList'] = $this->getPaisListItems(); - $this->viewData['formaPagoList'] = $this->getFormaPagoListItems(); + $this->viewData['comunidadAutonomaList'] = $this->getComunidadAutonomaListItems($clienteEntity->comunidad_autonoma_id ?? null); + $this->viewData['provinciaList'] = $this->getProvinciaListItems($clienteEntity->provincia_id ?? null); + $this->viewData['paisList'] = $this->getPaisListItems($clienteEntity->pais_id ?? null); + $this->viewData['userList'] = $this->getUserListItems($clienteEntity->comercial_id ?? null); + $this->viewData['userList2'] = $this->getUserListItems2($clienteEntity->soporte_id ?? null); + $this->viewData['formaDePagoList'] = $this->getFormaDePagoListItems($clienteEntity->forma_pago_id ?? null); $this->viewData['formAction'] = route_to('createCliente'); - $this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Cliente.moduleTitle') . ' ' . lang('Basic.global.addNewSuffix'); - + $this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('Clientes.moduleTitle').' '.lang('Basic.global.addNewSuffix'); + return $this->displayForm(__METHOD__); } // end function add() - public function edit($requestedId = null) - { - + public function edit($requestedId = null) { + if ($requestedId == null) : return $this->redirect2listView(); endif; @@ -139,7 +147,7 @@ class Cliente extends \App\Controllers\GoBaseResourceController $clienteEntity = $this->model->find($id); if ($clienteEntity == false) : - $message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Cliente.cliente')), $id]); + $message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Clientes.cliente')), $id]); return $this->redirect2listView('sweet-error', $message); endif; @@ -148,90 +156,98 @@ class Cliente extends \App\Controllers\GoBaseResourceController if ($requestMethod === 'post') : $nullIfEmpty = true; // !(phpversion() >= '8.1'); - + $postData = $this->request->getPost(); - - $sanitizedData = $this->sanitized($postData, $nullIfEmpty); - if ($this->request->getPost('creditoAsegurado') == null) { - $sanitizedData['creditoAsegurado'] = false; - } - if ($this->request->getPost('disponible_fe') == null) { - $sanitizedData['disponible_fe'] = false; - } - if ($this->request->getPost('message_tracking') == null) { - $sanitizedData['message_tracking'] = false; - } - if ($this->request->getPost('message_production_start') == null) { - $sanitizedData['message_production_start'] = false; - } - if ($this->request->getPost('tirada_flexible') == null) { - $sanitizedData['tirada_flexible'] = false; - } - if ($this->request->getPost('lineasEnvioFactura') == null) { - $sanitizedData['lineasEnvioFactura'] = false; - } + + $sanitizedData = $this->sanitized($postData, $nullIfEmpty); +if ($this->request->getPost('credito_asegurado') == null ) { + $sanitizedData['credito_asegurado'] = false; + } +if ($this->request->getPost('disponible_fe') == null ) { + $sanitizedData['disponible_fe'] = false; + } +if ($this->request->getPost('message_tracking') == null ) { + $sanitizedData['message_tracking'] = false; + } +if ($this->request->getPost('message_production_start') == null ) { + $sanitizedData['message_production_start'] = false; + } +if ($this->request->getPost('tirada_flexible') == null ) { + $sanitizedData['tirada_flexible'] = false; + } +if ($this->request->getPost('lineasEnvioFactura') == null ) { + $sanitizedData['lineasEnvioFactura'] = false; + } + $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('Clientes.cliente'))]); + $this->session->setFlashdata('formErrors', $this->model->errors()); + + endif; + + $clienteEntity->fill($sanitizedData); - 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('Cliente.cliente'))]); - $this->session->setFlashdata('formErrors', $this->model->errors()); - - endif; - - $clienteEntity->fill($sanitizedData); - - $thenRedirect = true; + $thenRedirect = true; endif; if ($noException && $successfulResult) : $id = $clienteEntity->id ?? $id; - $message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Cliente.cliente'))]) . '.'; - $message .= anchor("admin/clientes/{$id}/edit", lang('Basic.global.continueEditing') . '?'); + $message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Clientes.cliente'))]).'.'; + $message .= anchor( "admin/cliente/{$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); + return redirect()->to(route_to( $this->indexRoute ) )->with('sweet-success', $message); else: return $this->redirect2listView('sweet-success', $message); endif; else: $this->session->setFlashData('sweet-success', $message); endif; - + endif; // $noException && $successfulResult endif; // ($requestMethod === 'post') + //var_dump($clienteEntity); dd(); + $this->viewData['clienteEntity'] = $clienteEntity; - $this->viewData['paisList'] = $this->getPaisListItems(); - $this->viewData['formaPagoList'] = $this->getFormaPagoListItems(); - - $this->viewData['formAction'] = route_to('updateCliente', $id); - - $this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Cliente.moduleTitle') . ' ' . lang('Basic.global.edit3'); + $this->viewData['comunidadAutonomaList'] = $this->getComunidadAutonomaListItems($clienteEntity->comunidad_autonoma_id ?? null); + $this->viewData['provinciaList'] = $this->getProvinciaListItems($clienteEntity->provincia_id ?? null); + $this->viewData['paisList'] = $this->getPaisListItems($clienteEntity->pais_id ?? null); + $this->viewData['userList'] = $this->getUserListItems($clienteEntity->comercial_id ?? null); + $this->viewData['userList2'] = $this->getUserListItems2($clienteEntity->soporte_id ?? null); + $this->viewData['formaDePagoList'] = $this->getFormaDePagoListItems($clienteEntity->forma_pago_id ?? null); + $this->viewData['formAction'] = route_to('updateCliente', $id); + $this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('Clientes.moduleTitle').' '.lang('Basic.global.edit3'); + + return $this->displayForm(__METHOD__, $id); } // end function edit(...) + - public function datatable() - { + public function datatable() { if ($this->request->isAJAX()) { $reqData = $this->request->getPost(); - if (!isset($reqData['draw']) || !isset($reqData['columns'])) { + if (!isset($reqData['draw']) || !isset($reqData['columns']) ) { $errstr = 'No data available in response to this specific request.'; - $response = $this->respond(Collection::datatable([], 0, 0, $errstr), 400, $errstr); + $response = $this->respond(Collection::datatable( [], 0, 0, $errstr ), 400, $errstr); return $response; } $start = $reqData['start'] ?? 0; @@ -242,20 +258,17 @@ class Cliente extends \App\Controllers\GoBaseResourceController $dir = $reqData['order']['0']['dir'] ?? 'asc'; $resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); - foreach ($resourceData as $item) : - if (isset($item->comentarios) && strlen($item->comentarios) > 100) : - $item->comentarios = character_limiter($item->comentarios, 100); - endif; - if (isset($item->direccion) && strlen($item->direccion) > 100) : - $item->direccion = character_limiter($item->direccion, 100); - endif; - if (isset($item->comentarios_produccion) && strlen($item->comentarios_produccion) > 100) : - $item->comentarios_produccion = character_limiter($item->comentarios_produccion, 100); - endif; - if (isset($item->comentarios_tirada_flexible) && strlen($item->comentarios_tirada_flexible) > 100) : - $item->comentarios_tirada_flexible = character_limiter($item->comentarios_tirada_flexible, 100); - endif; - endforeach; + foreach ($resourceData as $item) : +if (isset($item->direccion) && strlen($item->direccion) > 100) : + $item->direccion = character_limiter($item->direccion, 100); +endif;if (isset($item->comentarios_tirada_flexible) && strlen($item->comentarios_tirada_flexible) > 100) : + $item->comentarios_tirada_flexible = character_limiter($item->comentarios_tirada_flexible, 100); +endif;if (isset($item->comentarios_produccion) && strlen($item->comentarios_produccion) > 100) : + $item->comentarios_produccion = character_limiter($item->comentarios_produccion, 100); +endif;if (isset($item->comentarios) && strlen($item->comentarios) > 100) : + $item->comentarios = character_limiter($item->comentarios, 100); +endif; + endforeach; return $this->respond(Collection::datatable( $resourceData, @@ -267,16 +280,15 @@ class Cliente extends \App\Controllers\GoBaseResourceController } } - public function allItemsSelect() - { + public function allItemsSelect() { if ($this->request->isAJAX()) { $onlyActiveOnes = true; $reqVal = $this->request->getPost('val') ?? 'id'; - $menu = $this->model->getAllForMenu($reqVal . ', nombre', 'nombre', $onlyActiveOnes, false); + $menu = $this->model->getAllForMenu($reqVal.', nombre', 'nombre', $onlyActiveOnes, false); $nonItem = new \stdClass; $nonItem->id = ''; - $nonItem->nombre = '- ' . lang('Basic.global.None') . ' -'; - array_unshift($menu, $nonItem); + $nonItem->nombre = '- '.lang('Basic.global.None').' -'; + array_unshift($menu , $nonItem); $newTokenHash = csrf_hash(); $csrfTokenName = csrf_token(); @@ -290,8 +302,7 @@ class Cliente extends \App\Controllers\GoBaseResourceController } } - public function menuItems() - { + public function menuItems() { if ($this->request->isAJAX()) { $searchStr = goSanitize($this->request->getPost('searchTerm'))[0]; $reqId = goSanitize($this->request->getPost('id'))[0]; @@ -302,8 +313,8 @@ class Cliente extends \App\Controllers\GoBaseResourceController $menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr); $nonItem = new \stdClass; $nonItem->id = ''; - $nonItem->text = '- ' . lang('Basic.global.None') . ' -'; - array_unshift($menu, $nonItem); + $nonItem->text = '- '.lang('Basic.global.None').' -'; + array_unshift($menu , $nonItem); $newTokenHash = csrf_hash(); $csrfTokenName = csrf_token(); @@ -318,23 +329,87 @@ class Cliente extends \App\Controllers\GoBaseResourceController } - protected function getFormaPagoListItems() - { - $formasPagoModel = model('App\Models\Configuracion\FormasPagoModel'); - $onlyActiveOnes = true; - $data = $formasPagoModel->getAllForMenu('id, nombre', 'nombre', $onlyActiveOnes); + protected function getPaisListItems($selId = null) { + $data = [''=>lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Paises.pais'))])]; + if (!empty($selId)) : + $paisModel = model('App\Models\Configuracion\PaisModel'); - return $data; - } + $selOption = $paisModel->where('id', $selId)->findColumn('nombre'); + if (!empty($selOption)) : + $data[$selId] = $selOption[0]; + endif; + endif; + return $data; + } - protected function getPaisListItems() - { - $paisModel = model('App\Models\Configuracion\PaisModel'); - $onlyActiveOnes = true; - $data = $paisModel->getAllForMenu('id, nombre', 'nombre', $onlyActiveOnes); + protected function getUserListItems($selId = null) { + $data = [''=>lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Users.user'))])]; + if (!empty($selId)) : + $userModel = model('App\Models\Usuarios\UserModel'); - return $data; - } + $selOption = $userModel->where('id_user', $selId)->findColumn('first_name'); + if (!empty($selOption)) : + $data[$selId] = $selOption[0]; + endif; + endif; + return $data; + } + + + protected function getComunidadAutonomaListItems($selId = null) { + $data = [''=>lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('ComunidadesAutonomas.comunidadAutonoma'))])]; + if (!empty($selId)) : + $comunidadAutonomaModel = model('App\Models\Configuracion\ComunidadAutonomaModel'); + + $selOption = $comunidadAutonomaModel->where('id', $selId)->findColumn('nombre'); + if (!empty($selOption)) : + $data[$selId] = $selOption[0]; + endif; + endif; + return $data; + } + + + protected function getUserListItems2($selId = null) { + $data = [''=>lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Users.user'))])]; + if (!empty($selId)) : + $userModel = model('App\Models\Configuracion\UserModel'); + + $selOption = $userModel->where('id_user', $selId)->findColumn('last_name'); + if (!empty($selOption)) : + $data[$selId] = $selOption[0]; + endif; + endif; + return $data; + } + + + protected function getFormaDePagoListItems($selId = null) { + $data = [''=>lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('FormasPagoes.formaDePago'))])]; + if (!empty($selId)) : + $formaPagoModel = model('App\Models\Configuracion\FormaPagoModel'); + + $selOption = $formaPagoModel->where('id', $selId)->findColumn('nombre'); + if (!empty($selOption)) : + $data[$selId] = $selOption[0]; + endif; + endif; + return $data; + } + + + protected function getProvinciaListItems($selId = null) { + $data = [''=>lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Provincias.provincia'))])]; + if (!empty($selId)) : + $provinciaModel = model('App\Models\Configuracion\ProvinciaModel'); + + $selOption = $provinciaModel->where('id', $selId)->findColumn('nombre'); + if (!empty($selOption)) : + $data[$selId] = $selOption[0]; + endif; + endif; + return $data; + } } diff --git a/ci4/app/Controllers/Configuracion/Comunidadesautonomas.php b/ci4/app/Controllers/Configuracion/Comunidadesautonomas.php index 4e8584c6..624b0744 100644 --- a/ci4/app/Controllers/Configuracion/Comunidadesautonomas.php +++ b/ci4/app/Controllers/Configuracion/Comunidadesautonomas.php @@ -5,15 +5,15 @@ use App\Controllers\GoBaseResourceController; use App\Models\Collection; -use App\Entities\Configuracion\ComunidadesAutonomasEntity; - -use App\Models\Configuracion\ComunidadesAutonomasModel; +use App\Entities\Configuracion\ComunidadAutonomaEntity; use App\Models\Configuracion\PaisModel; +use App\Models\Configuracion\ComunidadAutonomaModel; + class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController { - protected $modelName = ComunidadesAutonomasModel::class; + protected $modelName = ComunidadAutonomaModel::class; protected $format = 'json'; protected static $singularObjectName = 'Comunidad Autonoma'; @@ -21,7 +21,7 @@ class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController { protected static $pluralObjectName = 'Comunidades Autonomas'; protected static $pluralObjectNameCc = 'comunidadesAutonomas'; - protected static $controllerSlug = 'comunidadesautonomas'; + protected static $controllerSlug = 'comunidades-autonomas'; protected static $viewPath = 'themes/backend/vuexy/form/configuracion/comunidades-autonomas/'; @@ -41,7 +41,7 @@ class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController { $viewData = [ 'currentModule' => static::$controllerSlug, 'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('ComunidadesAutonomas.comunidadAutonoma')]), - 'comunidadesAutonomasEntity' => new ComunidadesAutonomasEntity(), + 'comunidadAutonomaEntity' => new ComunidadAutonomaEntity(), 'usingServerSideDataTable' => true, ]; @@ -90,7 +90,7 @@ class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController { $id = $this->model->db->insertID(); $message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('ComunidadesAutonomas.comunidadAutonoma'))]).'.'; - $message .= anchor( "admin/comunidadesautonomas/{$id}/edit" , lang('Basic.global.continueEditing').'?'); + $message .= anchor( "admin/comunidades-autonomas/{$id}/edit" , lang('Basic.global.continueEditing').'?'); $message = ucfirst(str_replace("'", "\'", $message)); if ($thenRedirect) : @@ -107,8 +107,8 @@ class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController { endif; // ($requestMethod === 'post') - $this->viewData['comunidadesAutonomasEntity'] = isset($sanitizedData) ? new ComunidadesAutonomasEntity($sanitizedData) : new ComunidadesAutonomasEntity(); - $this->viewData['paisList'] = $this->getPaisListItems(); + $this->viewData['comunidadAutonomaEntity'] = isset($sanitizedData) ? new ComunidadAutonomaEntity($sanitizedData) : new ComunidadAutonomaEntity(); + $this->viewData['paisList'] = $this->getPaisListItems($comunidadAutonomaEntity->pais_id ?? null); $this->viewData['formAction'] = route_to('createComunidadAutonoma'); @@ -124,9 +124,9 @@ class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController { return $this->redirect2listView(); endif; $id = filter_var($requestedId, FILTER_SANITIZE_URL); - $comunidadesAutonomasEntity = $this->model->find($id); + $comunidadAutonomaEntity = $this->model->find($id); - if ($comunidadesAutonomasEntity == false) : + if ($comunidadAutonomaEntity == false) : $message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('ComunidadesAutonomas.comunidadAutonoma')), $id]); return $this->redirect2listView('sweet-error', $message); endif; @@ -161,14 +161,14 @@ class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController { endif; - $comunidadesAutonomasEntity->fill($sanitizedData); + $comunidadAutonomaEntity->fill($sanitizedData); $thenRedirect = true; endif; if ($noException && $successfulResult) : - $id = $comunidadesAutonomasEntity->id ?? $id; + $id = $comunidadAutonomaEntity->id ?? $id; $message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('ComunidadesAutonomas.comunidadAutonoma'))]).'.'; - $message .= anchor( "admin/comunidadesautonomas/{$id}/edit" , lang('Basic.global.continueEditing').'?'); + $message .= anchor( "admin/comunidades-autonomas/{$id}/edit" , lang('Basic.global.continueEditing').'?'); $message = ucfirst(str_replace("'", "\'", $message)); if ($thenRedirect) : @@ -184,8 +184,8 @@ class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController { endif; // $noException && $successfulResult endif; // ($requestMethod === 'post') - $this->viewData['comunidadesAutonomasEntity'] = $comunidadesAutonomasEntity; - $this->viewData['paisList'] = $this->getPaisListItems(); + $this->viewData['comunidadAutonomaEntity'] = $comunidadAutonomaEntity; + $this->viewData['paisList'] = $this->getPaisListItems($comunidadAutonomaEntity->pais_id ?? null); $this->viewData['formAction'] = route_to('updateComunidadAutonoma', $id); @@ -209,7 +209,7 @@ class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController { $length = $reqData['length'] ?? 5; $search = $reqData['search']['value']; $requestedOrder = $reqData['order']['0']['column'] ?? 1; - $order = ComunidadesAutonomasModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1]; + $order = ComunidadAutonomaModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1]; $dir = $reqData['order']['0']['dir'] ?? 'asc'; $resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); @@ -273,11 +273,16 @@ class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController { } - protected function getPaisListItems() { - $paisModel = model('App\Models\Configuracion\PaisModel'); - $onlyActiveOnes = true; - $data = $paisModel->getAllForMenu('id, nombre','nombre', $onlyActiveOnes ); + protected function getPaisListItems($selId = null) { + $data = [''=>lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Paises.pais'))])]; + if (!empty($selId)) : + $paisModel = model('App\Models\Configuracion\PaisModel'); + $selOption = $paisModel->where('id', $selId)->findColumn('id'); + if (!empty($selOption)) : + $data[$selId] = $selOption[0]; + endif; + endif; return $data; } diff --git a/ci4/app/Controllers/Configuracion/Formaspagos.php b/ci4/app/Controllers/Configuracion/Formaspagos.php new file mode 100644 index 00000000..259760d8 --- /dev/null +++ b/ci4/app/Controllers/Configuracion/Formaspagos.php @@ -0,0 +1,271 @@ +viewData['pageTitle'] = lang('FormasPagoes.moduleTitle'); + $this->viewData['usingSweetAlert'] = true; + parent::initController($request, $response, $logger); + } + + + public function index() { + + $viewData = [ + 'currentModule' => static::$controllerSlug, + 'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('FormasPagoes.formaDePago')]), + 'formaPagoEntity' => new FormaPagoEntity(), + 'usingServerSideDataTable' => true, + + ]; + + $viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class + + return view(static::$viewPath.'viewFormaDePagoList', $viewData); + } + + + public function add() { + + + + $requestMethod = $this->request->getMethod(); + + if ($requestMethod === 'post') : + + $nullIfEmpty = true; // !(phpversion() >= '8.1'); + + $postData = $this->request->getPost(); + + $sanitizedData = $this->sanitized($postData, $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('FormasPagoes.formaDePago'))]); + $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('FormasPagoes.formaDePago'))]).'.'; + $message .= anchor( "admin/formas-pagos/{$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->session->setFlashData('sweet-success', $message); + endif; + + endif; // $noException && $successfulResult + + endif; // ($requestMethod === 'post') + + $this->viewData['formaPagoEntity'] = isset($sanitizedData) ? new FormaPagoEntity($sanitizedData) : new FormaPagoEntity(); + + $this->viewData['formAction'] = route_to('createFormaDePago'); + + $this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('FormasPagoes.moduleTitle').' '.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); + $formaPagoEntity = $this->model->find($id); + + if ($formaPagoEntity == false) : + $message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('FormasPagoes.formaDePago')), $id]); + return $this->redirect2listView('sweet-error', $message); + endif; + + $requestMethod = $this->request->getMethod(); + + if ($requestMethod === 'post') : + + $nullIfEmpty = true; // !(phpversion() >= '8.1'); + + $postData = $this->request->getPost(); + + $sanitizedData = $this->sanitized($postData, $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('FormasPagoes.formaDePago'))]); + $this->session->setFlashdata('formErrors', $this->model->errors()); + + endif; + + $formaPagoEntity->fill($sanitizedData); + + $thenRedirect = true; + endif; + if ($noException && $successfulResult) : + $id = $formaPagoEntity->id ?? $id; + $message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('FormasPagoes.formaDePago'))]).'.'; + $message .= anchor( "admin/formas-pagos/{$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->session->setFlashData('sweet-success', $message); + endif; + + endif; // $noException && $successfulResult + endif; // ($requestMethod === 'post') + + $this->viewData['formaPagoEntity'] = $formaPagoEntity; + + $this->viewData['formAction'] = route_to('updateFormaDePago', $id); + + $this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('FormasPagoes.moduleTitle').' '.lang('Basic.global.edit3'); + + + return $this->displayForm(__METHOD__, $id); + } // end function edit(...) + + + + public function datatable() { + if ($this->request->isAJAX()) { + $reqData = $this->request->getPost(); + if (!isset($reqData['draw']) || !isset($reqData['columns']) ) { + $errstr = 'No data available in response to this specific request.'; + $response = $this->respond(Collection::datatable( [], 0, 0, $errstr ), 400, $errstr); + return $response; + } + $start = $reqData['start'] ?? 0; + $length = $reqData['length'] ?? 5; + $search = $reqData['search']['value']; + $requestedOrder = $reqData['order']['0']['column'] ?? 1; + $order = FormaPagoModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1]; + $dir = $reqData['order']['0']['dir'] ?? 'asc'; + + $resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); + + return $this->respond(Collection::datatable( + $resourceData, + $this->model->getResource()->countAllResults(), + $this->model->getResource($search)->countAllResults() + )); + } else { + return $this->failUnauthorized('Invalid request', 403); + } + } + + 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/Configuracion/Paises.php b/ci4/app/Controllers/Configuracion/Paises.php index 744987f4..af70b4e1 100644 --- a/ci4/app/Controllers/Configuracion/Paises.php +++ b/ci4/app/Controllers/Configuracion/Paises.php @@ -1,19 +1,27 @@ viewData['pageTitle'] = lang('Paises.moduleTitle'); - self::$viewPath = getenv('theme.path').'form/configuracion/paises/'; - + $this->viewData['usingSweetAlert'] = true; parent::initController($request, $response, $logger); - } + public function index() { - $this->viewData['usingClientSideDataTable'] = true; - - $this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('Paises.pais')]); - parent::index(); + $viewData = [ + 'currentModule' => static::$controllerSlug, + 'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Paises.pais')]), + 'paisEntity' => new PaisEntity(), + 'usingServerSideDataTable' => true, + + ]; + $viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class + + return view(static::$viewPath.'viewPaisList', $viewData); } + public function add() { @@ -47,12 +61,13 @@ class Paises extends \App\Controllers\GoBaseController { $nullIfEmpty = true; // !(phpversion() >= '8.1'); $postData = $this->request->getPost(); + $sanitizedData = $this->sanitized($postData, $nullIfEmpty); $noException = true; if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) : - + if ($this->canValidate()) : try { @@ -73,28 +88,28 @@ class Paises extends \App\Controllers\GoBaseController { $id = $this->model->db->insertID(); $message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Paises.pais'))]).'.'; - $message .= anchor(route_to('editPais', $id), lang('Basic.global.continueEditing').'?'); + $message .= anchor( "admin/paises/{$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('successMessage', $message); + return redirect()->to(route_to( $this->indexRoute ) )->with('sweet-success', $message); else: - return $this->redirect2listView('successMessage', $message); + return $this->redirect2listView('sweet-success', $message); endif; else: - $this->viewData['successMessage'] = $message; + $this->session->setFlashData('sweet-success', $message); endif; endif; // $noException && $successfulResult endif; // ($requestMethod === 'post') - $this->viewData['pais'] = isset($sanitizedData) ? new Pais($sanitizedData) : new Pais(); + $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.pais').' '.lang('Basic.global.addNewSuffix'); + $this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('Paises.moduleTitle').' '.lang('Basic.global.addNewSuffix'); return $this->displayForm(__METHOD__); @@ -106,11 +121,11 @@ class Paises extends \App\Controllers\GoBaseController { return $this->redirect2listView(); endif; $id = filter_var($requestedId, FILTER_SANITIZE_URL); - $pais = $this->model->find($id); + $paisEntity = $this->model->find($id); - if ($pais == false) : + if ($paisEntity == false) : $message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Paises.pais')), $id]); - return $this->redirect2listView('errorMessage', $message); + return $this->redirect2listView('sweet-error', $message); endif; $requestMethod = $this->request->getMethod(); @@ -120,10 +135,11 @@ class Paises extends \App\Controllers\GoBaseController { $nullIfEmpty = true; // !(phpversion() >= '8.1'); $postData = $this->request->getPost(); + $sanitizedData = $this->sanitized($postData, $nullIfEmpty); - if ($this->request->getPost('show_erp') == null ) { - $sanitizedData['show_erp'] = false; - } +if ($this->request->getPost('show_erp') == null ) { + $sanitizedData['show_erp'] = false; + } @@ -145,49 +161,76 @@ class Paises extends \App\Controllers\GoBaseController { endif; - $pais->fill($sanitizedData); + $paisEntity->fill($sanitizedData); $thenRedirect = true; endif; if ($noException && $successfulResult) : - $id = $pais->id ?? $id; + $id = $paisEntity->id ?? $id; $message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Paises.pais'))]).'.'; - $message .= anchor(route_to('editPais', $id), lang('Basic.global.continueEditing').'?'); + $message .= anchor( "admin/paises/{$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('successMessage', $message); + return redirect()->to(route_to( $this->indexRoute ) )->with('sweet-success', $message); else: - return $this->redirect2listView('successMessage', $message); + return $this->redirect2listView('sweet-success', $message); endif; else: - $this->viewData['successMessage'] = $message; + $this->session->setFlashData('sweet-success', $message); endif; endif; // $noException && $successfulResult endif; // ($requestMethod === 'post') - $this->viewData['pais'] = $pais; - - $this->viewData['formAction'] = route_to('updatePais', $id); + $this->viewData['paisEntity'] = $paisEntity; - $this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('Paises.pais').' '.lang('Basic.global.edit3'); + $this->viewData['formAction'] = route_to('updatePais', $id); + + $this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('Paises.moduleTitle').' '.lang('Basic.global.edit3'); return $this->displayForm(__METHOD__, $id); } // end function edit(...) - + + + public function datatable() { + if ($this->request->isAJAX()) { + $reqData = $this->request->getPost(); + if (!isset($reqData['draw']) || !isset($reqData['columns']) ) { + $errstr = 'No data available in response to this specific request.'; + $response = $this->respond(Collection::datatable( [], 0, 0, $errstr ), 400, $errstr); + return $response; + } + $start = $reqData['start'] ?? 0; + $length = $reqData['length'] ?? 5; + $search = $reqData['search']['value']; + $requestedOrder = $reqData['order']['0']['column'] ?? 1; + $order = PaisModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1]; + $dir = $reqData['order']['0']['dir'] ?? 'asc'; + + $resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); + + return $this->respond(Collection::datatable( + $resourceData, + $this->model->getResource()->countAllResults(), + $this->model->getResource($search)->countAllResults() + )); + } else { + return $this->failUnauthorized('Invalid request', 403); + } + } public function allItemsSelect() { if ($this->request->isAJAX()) { $onlyActiveOnes = true; $reqVal = $this->request->getPost('val') ?? 'id'; - $menu = $this->model->getAllForMenu($reqVal.', Select a field...', 'Select a field...', $onlyActiveOnes, false); + $menu = $this->model->getAllForMenu($reqVal.', nombre', 'nombre', $onlyActiveOnes, false); $nonItem = new \stdClass; $nonItem->id = ''; - //$nonItem->'Select a field...' = '- '.lang('Basic.global.None').' -'; + $nonItem->nombre = '- '.lang('Basic.global.None').' -'; array_unshift($menu , $nonItem); $newTokenHash = csrf_hash(); @@ -201,14 +244,14 @@ class Paises extends \App\Controllers\GoBaseController { 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 ?? 'Select a field...']; + $columns2select = [$reqId ?? 'id', $reqText ?? 'nombre']; $onlyActiveOnes = false; $menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr); $nonItem = new \stdClass; @@ -227,5 +270,5 @@ class Paises extends \App\Controllers\GoBaseController { return $this->failUnauthorized('Invalid request', 403); } } - + } diff --git a/ci4/app/Controllers/Configuracion/Provincias.php b/ci4/app/Controllers/Configuracion/Provincias.php new file mode 100644 index 00000000..0344c0b1 --- /dev/null +++ b/ci4/app/Controllers/Configuracion/Provincias.php @@ -0,0 +1,289 @@ +viewData['pageTitle'] = lang('Provincias.moduleTitle'); + $this->viewData['usingSweetAlert'] = true; + parent::initController($request, $response, $logger); + } + + + public function index() { + + $viewData = [ + 'currentModule' => static::$controllerSlug, + 'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Provincias.provincia')]), + 'provinciaEntity' => new ProvinciaEntity(), + 'usingServerSideDataTable' => true, + + ]; + + $viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class + + return view(static::$viewPath.'viewProvinciaList', $viewData); + } + + + public function add() { + + + + $requestMethod = $this->request->getMethod(); + + if ($requestMethod === 'post') : + + $nullIfEmpty = true; // !(phpversion() >= '8.1'); + + $postData = $this->request->getPost(); + + $sanitizedData = $this->sanitized($postData, $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('Provincias.provincia'))]); + $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('Provincias.provincia'))]).'.'; + $message .= anchor( "admin/provincias/{$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->session->setFlashData('sweet-success', $message); + endif; + + endif; // $noException && $successfulResult + + endif; // ($requestMethod === 'post') + + $this->viewData['provinciaEntity'] = isset($sanitizedData) ? new ProvinciaEntity($sanitizedData) : new ProvinciaEntity(); + $this->viewData['paisList'] = $this->getPaisListItems($provinciaEntity->pais_id ?? null); + + $this->viewData['formAction'] = route_to('createProvincia'); + + $this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('Provincias.moduleTitle').' '.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); + $provinciaEntity = $this->model->find($id); + + if ($provinciaEntity == false) : + $message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Provincias.provincia')), $id]); + return $this->redirect2listView('sweet-error', $message); + endif; + + $requestMethod = $this->request->getMethod(); + + if ($requestMethod === 'post') : + + $nullIfEmpty = true; // !(phpversion() >= '8.1'); + + $postData = $this->request->getPost(); + + $sanitizedData = $this->sanitized($postData, $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('Provincias.provincia'))]); + $this->session->setFlashdata('formErrors', $this->model->errors()); + + endif; + + $provinciaEntity->fill($sanitizedData); + + $thenRedirect = true; + endif; + if ($noException && $successfulResult) : + $id = $provinciaEntity->id ?? $id; + $message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Provincias.provincia'))]).'.'; + $message .= anchor( "admin/provincias/{$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->session->setFlashData('sweet-success', $message); + endif; + + endif; // $noException && $successfulResult + endif; // ($requestMethod === 'post') + + $this->viewData['provinciaEntity'] = $provinciaEntity; + $this->viewData['paisList'] = $this->getPaisListItems($provinciaEntity->pais_id ?? null); + + $this->viewData['formAction'] = route_to('updateProvincia', $id); + + $this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('Provincias.moduleTitle').' '.lang('Basic.global.edit3'); + + + return $this->displayForm(__METHOD__, $id); + } // end function edit(...) + + + + public function datatable() { + if ($this->request->isAJAX()) { + $reqData = $this->request->getPost(); + if (!isset($reqData['draw']) || !isset($reqData['columns']) ) { + $errstr = 'No data available in response to this specific request.'; + $response = $this->respond(Collection::datatable( [], 0, 0, $errstr ), 400, $errstr); + return $response; + } + $start = $reqData['start'] ?? 0; + $length = $reqData['length'] ?? 5; + $search = $reqData['search']['value']; + $requestedOrder = $reqData['order']['0']['column'] ?? 1; + $order = ProvinciaModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1]; + $dir = $reqData['order']['0']['dir'] ?? 'asc'; + + $resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(); + + return $this->respond(Collection::datatable( + $resourceData, + $this->model->getResource()->countAllResults(), + $this->model->getResource($search)->countAllResults() + )); + } else { + return $this->failUnauthorized('Invalid request', 403); + } + } + + 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); + } + } + + + protected function getPaisListItems($selId = null) { + $data = [''=>lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Paises.pais'))])]; + if (!empty($selId)) : + $paisModel = model('App\Models\Configuracion\PaisModel'); + + $selOption = $paisModel->where('id', $selId)->findColumn('nombre'); + if (!empty($selOption)) : + $data[$selId] = $selOption[0]; + endif; + endif; + return $data; + } + +} diff --git a/ci4/app/Entities/Clientes/ClienteEntity.php b/ci4/app/Entities/Clientes/ClienteEntity.php index cb520b6d..5adbd4b6 100644 --- a/ci4/app/Entities/Clientes/ClienteEntity.php +++ b/ci4/app/Entities/Clientes/ClienteEntity.php @@ -9,29 +9,30 @@ class ClienteEntity extends \CodeIgniter\Entity\Entity "id" => null, "nombre" => null, "alias" => null, + "cif" => null, "direccion" => null, "ciudad" => null, "comunidad_autonoma_id" => null, - "provincia" => null, + "provincia_id" => 0, "cp" => null, "pais_id" => null, "telefono" => null, "email" => null, - "salesman_id" => 1, - "soporte_id" => null, + "comercial_id" => 1, + "soporte_id" => 1, "forma_pago_id" => null, "vencimiento" => 15, - "fechaVencimiento" => null, + "fecha_vencimiento" => null, "margen" => 40.0, "margen_pod" => null, "descuento" => 0.0, "limite_credito" => 0.0, "limite_credito_user_id" => 1, "limite_credito_change_at" => null, - "creditoSolunion" => null, - "creditoAsegurado" => false, + "credito_solunion" => null, + "credito_asegurado" => false, "ccc" => null, - "ccc_customer" => null, + "ccc_cliente" => null, "num_cuenta" => null, "disponible_fe" => false, "message_tracking" => true, @@ -46,6 +47,8 @@ class ClienteEntity extends \CodeIgniter\Entity\Entity "ps_customer_id" => null, "lineasEnvioFactura" => true, "comentarios" => null, + "is_deleted" => 0, + "deleted_at" => null, "created_at" => null, "updated_at" => null, "user_created_id" => 1, @@ -53,9 +56,10 @@ class ClienteEntity extends \CodeIgniter\Entity\Entity ]; protected $casts = [ "comunidad_autonoma_id" => "?int", + "provincia_id" => "int", "pais_id" => "?int", - "salesman_id" => "int", - "soporte_id" => "?int", + "comercial_id" => "int", + "soporte_id" => "int", "forma_pago_id" => "?int", "vencimiento" => "int", "margen" => "float", @@ -63,7 +67,7 @@ class ClienteEntity extends \CodeIgniter\Entity\Entity "descuento" => "float", "limite_credito" => "float", "limite_credito_user_id" => "int", - "creditoAsegurado" => "?boolean", + "credito_asegurado" => "?boolean", "disponible_fe" => "boolean", "message_tracking" => "boolean", "message_production_start" => "boolean", @@ -74,6 +78,7 @@ class ClienteEntity extends \CodeIgniter\Entity\Entity "margen_plantilla_id" => "?int", "ps_customer_id" => "?int", "lineasEnvioFactura" => "boolean", + "is_deleted" => "int", "user_created_id" => "int", "user_update_id" => "int", ]; diff --git a/ci4/app/Entities/Configuracion/ComunidadAutonomaEntity.php b/ci4/app/Entities/Configuracion/ComunidadAutonomaEntity.php new file mode 100644 index 00000000..f406e980 --- /dev/null +++ b/ci4/app/Entities/Configuracion/ComunidadAutonomaEntity.php @@ -0,0 +1,18 @@ + null, + "nombre" => null, + "pais_id" => null, + "created_at" => null, + "updated_at" => null, + ]; + protected $casts = [ + "pais_id" => "int", + ]; +} diff --git a/ci4/app/Entities/Configuracion/FormaPagoEntity.php b/ci4/app/Entities/Configuracion/FormaPagoEntity.php new file mode 100644 index 00000000..902f5b27 --- /dev/null +++ b/ci4/app/Entities/Configuracion/FormaPagoEntity.php @@ -0,0 +1,15 @@ + null, + "nombre" => null, + "created_at" => null, + "updated_at" => null, + ]; + protected $casts = []; +} diff --git a/ci4/app/Entities/Configuracion/ProvinciaEntity.php b/ci4/app/Entities/Configuracion/ProvinciaEntity.php new file mode 100644 index 00000000..fae5df17 --- /dev/null +++ b/ci4/app/Entities/Configuracion/ProvinciaEntity.php @@ -0,0 +1,19 @@ + null, + "code" => null, + "nombre" => null, + "pais_id" => 1, + "created_at" => null, + "updated_at" => null, + ]; + protected $casts = [ + "pais_id" => "int", + ]; +} diff --git a/ci4/app/Language/en/Clientes.php b/ci4/app/Language/en/Clientes.php new file mode 100644 index 00000000..c35ecd3e --- /dev/null +++ b/ci4/app/Language/en/Clientes.php @@ -0,0 +1,233 @@ + 'Alias', + 'ccc' => 'Ccc', + 'cccCliente' => 'Ccc Cliente', + 'cif' => 'Cif', + 'ciudad' => 'Ciudad', + 'cliente' => 'Clientes', + 'clienteList' => 'Cliente List', + 'clientes' => 'Clientes', + 'comentarios' => 'Comentarios', + 'comentariosProduccion' => 'Comentarios Produccion', + 'comentariosTiradaFlexible' => 'Comentarios Tirada Flexible', + 'comercialId' => 'Comercial', + 'comunidadAutonomaId' => 'Comunidad Autonoma ID', + 'cp' => 'Cp', + 'createdAt' => 'Created At', + 'creditoAsegurado' => 'Credito Asegurado', + 'creditoSolunion' => 'Credito Solunion', + 'deletedAt' => 'Deleted At', + 'descuento' => 'Descuento', + 'descuentoTiradaFlexible' => 'Descuento Tirada Flexible', + 'direccion' => 'Direccion', + 'disponibleFe' => 'Disponible Fe', + 'email' => 'Email', + 'fechaVencimiento' => 'Fecha Vencimiento', + 'formaPagoId' => 'Forma Pago ID', + 'id' => 'ID', + 'isDeleted' => 'Is Deleted', + 'limiteCredito' => 'Limite Credito', + 'limiteCreditoChangeAt' => 'Limite Credito Change At', + 'limiteCreditoUserId' => 'Limite Credito User ID', + 'lineasenviofactura' => 'Lineasenviofactura', + 'margen' => 'Margen', + 'margenPlantillaId' => 'Margen Plantilla ID', + 'margenPod' => 'Margen Pod', + 'messageProductionStart' => 'Message Production Start', + 'messageTracking' => 'Message Tracking', + 'moduleTitle' => 'Clientes', + 'nombre' => 'Nombre', + 'numCuenta' => 'Num Cuenta', + 'paisId' => 'Pais ID', + 'provinciaId' => 'Provincia', + 'psCustomerId' => 'Ps Customer ID', + 'saturacion' => 'Saturacion', + 'soporteId' => 'Soporte', + 'telefono' => 'Telefono', + 'tiendaId' => 'Tienda ID', + 'tiradaFlexible' => 'Tirada Flexible', + 'updatedAt' => 'Updated At', + 'userCreatedId' => 'User Created ID', + 'userUpdateId' => 'User Update ID', + 'vencimiento' => 'Vencimiento', + 'validation' => [ + 'ccc' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + + ], + + 'ccc_cliente' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + + ], + + 'ciudad' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + + ], + + 'comentarios' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + + ], + + 'comentarios_produccion' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + + ], + + 'cp' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + + ], + + 'credito_solunion' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + + ], + + 'direccion' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + + ], + + 'fecha_vencimiento' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + + ], + + 'margen_plantilla_id' => [ + 'integer' => 'The {field} field must contain an integer.', + + ], + + 'margen_pod' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + + ], + + 'num_cuenta' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + + ], + + 'ps_customer_id' => [ + 'integer' => 'The {field} field must contain an integer.', + + ], + + 'telefono' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + + ], + + 'tienda_id' => [ + 'integer' => 'The {field} field must contain an integer.', + + ], + + 'alias' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + 'required' => 'The {field} field is required.', + + ], + + 'cif' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + 'required' => 'The {field} field is required.', + + ], + + 'comentarios_tirada_flexible' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + 'required' => 'The {field} field is required.', + + ], + + 'descuento' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + 'required' => 'The {field} field is required.', + + ], + + 'descuento_tirada_flexible' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + 'required' => 'The {field} field is required.', + + ], + + 'email' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + 'valid_email' => 'The {field} field must contain a valid email address.', + + ], + + 'is_deleted' => [ + 'integer' => 'The {field} field must contain an integer.', + 'required' => 'The {field} field is required.', + + ], + + 'limite_credito' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + 'required' => 'The {field} field is required.', + + ], + + 'limite_credito_change_at' => [ + 'required' => 'The {field} field is required.', + 'valid_date' => 'The {field} field must contain a valid date.', + + ], + + 'limite_credito_user_id' => [ + 'integer' => 'The {field} field must contain an integer.', + 'required' => 'The {field} field is required.', + + ], + + 'margen' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + 'required' => 'The {field} field is required.', + + ], + + 'nombre' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + 'required' => 'The {field} field is required.', + + ], + + 'saturacion' => [ + 'decimal' => 'The {field} field must contain a decimal number.', + 'required' => 'The {field} field is required.', + + ], + + 'user_created_id' => [ + 'integer' => 'The {field} field must contain an integer.', + 'required' => 'The {field} field is required.', + + ], + + 'user_update_id' => [ + 'integer' => 'The {field} field must contain an integer.', + 'required' => 'The {field} field is required.', + + ], + + 'vencimiento' => [ + 'integer' => 'The {field} field must contain an integer.', + 'required' => 'The {field} field is required.', + + ], + + + ], + + +]; \ No newline at end of file diff --git a/ci4/app/Language/en/ComunidadesAutonomas.php b/ci4/app/Language/en/ComunidadesAutonomas.php new file mode 100644 index 00000000..9e1e4df4 --- /dev/null +++ b/ci4/app/Language/en/ComunidadesAutonomas.php @@ -0,0 +1,34 @@ + 'Comunidad Autonoma', + 'comunidadAutonomaList' => 'Comunidad Autonoma List', + 'comunidades-autonomas' => 'Comunidades Autonomas', + 'comunidadesAutonoma' => 'Comunidades Autonoma', + 'comunidadesAutonomaList' => 'Comunidades Autonoma List', + 'comunidadesAutonomas' => 'Comunidades Autonomas', + 'createdAt' => 'Created At', + 'id' => 'ID', + 'moduleTitle' => 'Comunidades Autonomas', + 'nombre' => 'Nombre', + 'paisId' => 'Pais', + 'updatedAt' => 'Updated At', + 'validation' => [ + 'id' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + + ], + + 'nombre' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + 'required' => 'The {field} field is required.', + + ], + + + ], + + +]; \ No newline at end of file diff --git a/ci4/app/Language/en/FormasPagoes.php b/ci4/app/Language/en/FormasPagoes.php new file mode 100644 index 00000000..7e7e55cf --- /dev/null +++ b/ci4/app/Language/en/FormasPagoes.php @@ -0,0 +1,35 @@ + 'Created At', + 'formaDePago' => 'Forma de Pago', + 'formaDePagoList' => 'Forma de Pago List', + 'formas-pagoes' => 'Formas Pagoes', + 'formas-pagos' => 'Formas de Pagos', + 'formasDePagos' => 'Formas de Pagos', + 'formasPago' => 'Formas Pago', + 'formasPagoList' => 'Formas Pago List', + 'formasPagoes' => 'Formas Pagoes', + 'id' => 'ID', + 'moduleTitle' => 'Formas Pagoes', + 'nombre' => 'Nombre', + 'updatedAt' => 'Updated At', + 'validation' => [ + 'id' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + + ], + + 'nombre' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + 'required' => 'The {field} field is required.', + + ], + + + ], + + +]; \ No newline at end of file diff --git a/ci4/app/Language/en/Paises.php b/ci4/app/Language/en/Paises.php index ad8ff430..51e4708a 100644 --- a/ci4/app/Language/en/Paises.php +++ b/ci4/app/Language/en/Paises.php @@ -8,11 +8,13 @@ return [ 'id' => 'ID', 'keyErp' => 'Key Erp', 'moduleTitle' => 'Paises', - 'moneda' => 'Currency', - 'nombre' => 'Name', - 'pais' => 'Country', - 'paisList' => 'Country List', - 'paises' => 'Countries', + 'moneda' => 'Moneda', + 'nombre' => 'Nombre', + 'pais' => 'Pais', + 'paisList' => 'Pais List', + 'paise' => 'Paise', + 'paiseList' => 'Paise List', + 'paises' => 'Paises', 'showErp' => 'Show Erp', 'urlErp' => 'URL Erp', 'userErp' => 'User Erp', @@ -22,6 +24,11 @@ return [ ], + 'id' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + + ], + 'key_erp' => [ 'max_length' => 'The {field} field cannot exceed {param} characters in length.', diff --git a/ci4/app/Language/en/Provincias.php b/ci4/app/Language/en/Provincias.php new file mode 100644 index 00000000..ddbe7257 --- /dev/null +++ b/ci4/app/Language/en/Provincias.php @@ -0,0 +1,44 @@ + 'Code', + 'createdAt' => 'Created At', + 'id' => 'ID', + 'moduleTitle' => 'Provincias', + 'nombre' => 'Nombre', + 'paisId' => 'Pais ID', + 'provincia' => 'Provincia', + 'provinciaList' => 'Provincia List', + 'provincias' => 'Provincias', + 'updatedAt' => 'Updated At', + 'validation' => [ + 'id' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + + ], + + 'pais_id' => [ + 'integer' => 'The {field} field must contain an integer.', + + ], + + 'nombre' => [ + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + 'required' => 'The {field} field is required.', + + ], + + 'code' => [ + 'is_unique' => 'The {field} field must contain a unique value', + 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + 'required' => 'The {field} field is required.', + + ], + + + ], + + +]; \ No newline at end of file diff --git a/ci4/app/Language/es/Clientes.php b/ci4/app/Language/es/Clientes.php index 45651367..cc3de4cd 100644 --- a/ci4/app/Language/es/Clientes.php +++ b/ci4/app/Language/es/Clientes.php @@ -5,32 +5,35 @@ return [ 'alias' => 'Alias', 'ccc' => 'Ccc', - 'cccCustomer' => 'Ccc Customer', + 'cccCliente' => 'Ccc Cliente', + 'cif' => 'CIF', 'ciudad' => 'Ciudad', - 'cliente' => 'Cliente', - 'clienteList' => 'Listado de Clientes', + 'cliente' => 'Clientes', + 'clienteList' => 'Cliente List', 'clientes' => 'Clientes', 'comentarios' => 'Comentarios', 'comentariosProduccion' => 'Comentarios Producción', 'comentariosTiradaFlexible' => 'Comentarios Tirada Flexible', - 'comunidadAutonomaId' => 'Comunidad Autónoma', - 'cp' => 'Código Postal', - 'createdAt' => 'Created At', - 'creditoasegurado' => 'Crédito Asegurado', - 'creditosolunion' => 'Crédito Solunion', + 'comercialId' => 'Comercial', + 'comunidadAutonomaId' => 'Comunidad Autónoma ID', + 'cp' => 'Cp', + 'createdAt' => 'Creado el', + 'creditoAsegurado' => 'Crédito Asegurado', + 'creditoSolunion' => 'Crédito Solunion', 'deletedAt' => 'Deleted At', 'descuento' => 'Descuento', 'descuentoTiradaFlexible' => 'Descuento Tirada Flexible', 'direccion' => 'Dirección', 'disponibleFe' => 'Disponible Fe', 'email' => 'Email', - 'fechavencimiento' => 'Fecha Vencimiento', - 'formaPagoId' => 'Forma Pago', + 'fechaVencimiento' => 'Fecha Vencimiento', + 'formaPagoId' => 'Forma Pago ID', 'id' => 'ID', - 'limiteCredito' => 'Limite Credito', - 'limiteCreditoChangeAt' => 'Limite Credito Change At', - 'limiteCreditoUserId' => 'Limite Credito User ID', - 'lineasenviofactura' => 'Lineasenviofactura', + 'isDeleted' => 'Is Deleted', + 'limiteCredito' => 'Limite Crédito', + 'limiteCreditoChangeAt' => 'Limite Crédito Change At', + 'limiteCreditoUserId' => 'Limite Crédito User ID', + 'lineasenviofactura' => 'Lineas envéo factura', 'margen' => 'Margen', 'margenPlantillaId' => 'Margen Plantilla ID', 'margenPod' => 'Margen Pod', @@ -38,17 +41,16 @@ return [ 'messageTracking' => 'Message Tracking', 'moduleTitle' => 'Clientes', 'nombre' => 'Nombre', - 'numCuenta' => 'Número de Cuenta', - 'paisId' => 'País', - 'provincia' => 'Provincia', + 'numCuenta' => 'Num Cuenta', + 'paisId' => 'Pais ID', + 'provinciaId' => 'Provincia', 'psCustomerId' => 'Ps Customer ID', - 'salesmanId' => 'Comercial Asignado', 'saturacion' => 'Saturación', - 'soporteId' => 'Soporte Asignado', + 'soporteId' => 'Soporte', 'telefono' => 'Teléfono', 'tiendaId' => 'Tienda ID', 'tiradaFlexible' => 'Tirada Flexible', - 'updatedAt' => 'Updated At', + 'updatedAt' => 'Actualizado el', 'userCreatedId' => 'User Created ID', 'userUpdateId' => 'User Update ID', 'vencimiento' => 'Vencimiento', @@ -58,7 +60,7 @@ return [ ], - 'ccc_customer' => [ + 'ccc_cliente' => [ 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', ], @@ -78,22 +80,12 @@ return [ ], - 'comunidad_autonoma' => [ - 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', - - ], - - 'comunidad_autonoma_id' => [ - 'integer' => 'El campo {field} debe contener un número entero.', - - ], - 'cp' => [ 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', ], - 'creditoSolunion' => [ + 'credito_solunion' => [ 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', ], @@ -103,7 +95,7 @@ return [ ], - 'fechaVencimiento' => [ + 'fecha_vencimiento' => [ 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', ], @@ -123,26 +115,11 @@ return [ ], - 'pais' => [ - 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', - - ], - - 'provincia' => [ - 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', - - ], - 'ps_customer_id' => [ 'integer' => 'El campo {field} debe contener un número entero.', ], - 'soporte_id' => [ - 'integer' => 'El campo {field} debe contener un número entero.', - - ], - 'telefono' => [ 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', @@ -155,91 +132,97 @@ return [ 'alias' => [ 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', - 'required' => 'El campo {field} es obligatorio.', + 'required' => 'El campo {field} es obligatorio.', + + ], + + 'cif' => [ + 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', + 'required' => 'El campo {field} es obligatorio.', ], 'comentarios_tirada_flexible' => [ 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', - 'required' => 'El campo {field} es obligatorio.', + 'required' => 'El campo {field} es obligatorio.', ], 'descuento' => [ 'decimal' => 'El campo {field} debe contener un número decimal.', - 'required' => 'El campo {field} es obligatorio.', + 'required' => 'El campo {field} es obligatorio.', ], 'descuento_tirada_flexible' => [ 'decimal' => 'El campo {field} debe contener un número decimal.', - 'required' => 'El campo {field} es obligatorio.', + 'required' => 'El campo {field} es obligatorio.', ], 'email' => [ 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', - 'valid_email' => 'El campo {field} debe contener una dirección de correo electrónico válida.', + 'valid_email' => 'The {field} field must contain a valid email address.', + + ], + + 'is_deleted' => [ + 'integer' => 'El campo {field} debe contener un número entero.', + 'required' => 'El campo {field} es obligatorio.', ], 'limite_credito' => [ 'decimal' => 'El campo {field} debe contener un número decimal.', - 'required' => 'El campo {field} es obligatorio.', + 'required' => 'El campo {field} es obligatorio.', ], 'limite_credito_change_at' => [ - 'required' => 'El campo {field} es obligatorio.', + 'required' => 'El campo {field} es obligatorio.', 'valid_date' => 'The {field} field must contain a valid date.', ], 'limite_credito_user_id' => [ 'integer' => 'El campo {field} debe contener un número entero.', - 'required' => 'El campo {field} es obligatorio.', + 'required' => 'El campo {field} es obligatorio.', ], 'margen' => [ 'decimal' => 'El campo {field} debe contener un número decimal.', - 'required' => 'El campo {field} es obligatorio.', + 'required' => 'El campo {field} es obligatorio.', ], 'nombre' => [ 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', - 'required' => 'El campo {field} es obligatorio.', - - ], - - 'salesman_id' => [ - 'integer' => 'El campo {field} debe contener un número entero.', - 'required' => 'El campo {field} es obligatorio.', + 'required' => 'El campo {field} es obligatorio.', ], 'saturacion' => [ 'decimal' => 'El campo {field} debe contener un número decimal.', - 'required' => 'El campo {field} es obligatorio.', + 'required' => 'El campo {field} es obligatorio.', ], 'user_created_id' => [ 'integer' => 'El campo {field} debe contener un número entero.', - 'required' => 'El campo {field} es obligatorio.', + 'required' => 'El campo {field} es obligatorio.', ], 'user_update_id' => [ 'integer' => 'El campo {field} debe contener un número entero.', - 'required' => 'El campo {field} es obligatorio.', + 'required' => 'El campo {field} es obligatorio.', ], 'vencimiento' => [ 'integer' => 'El campo {field} debe contener un número entero.', - 'required' => 'El campo {field} es obligatorio.', + 'required' => 'El campo {field} es obligatorio.', ], diff --git a/ci4/app/Language/es/ComunidadesAutonomas.php b/ci4/app/Language/es/ComunidadesAutonomas.php index 356b936d..3b7743e9 100644 --- a/ci4/app/Language/es/ComunidadesAutonomas.php +++ b/ci4/app/Language/es/ComunidadesAutonomas.php @@ -1,29 +1,34 @@ 'Comunidad Autónoma', - 'comunidadAutonomaList' => 'Listado de Comunidades Autónomas', - 'comunidades-autonomas' => 'Comunidades Autónomas', - 'comunidadesAutonoma' => 'Comunidades Autónoma', - 'comunidadesAutonomaList' => 'Listado de Comunidades Autónomas', - 'comunidadesAutonomas' => 'Comunidades Autónomas', - 'comunidadesautonomas' => 'Comunidades Autónomas', - 'createdAt' => 'Created At', - 'id' => 'ID', - 'moduleTitle' => 'Comunidades Autónomas', - 'nombre' => 'Nombre', - 'pais' => 'País', - 'updatedAt' => 'Updated At', - 'validation' => [ - 'id' => [ - 'max_length' => 'The {field} field cannot exceed {param} characters in length.', - ], + 'comunidadAutonoma' => 'Comunidad Autónoma', + 'comunidadAutonomaList' => 'Comunidad Autónoma List', + 'comunidades-autonomas' => 'Comunidades Autónomas', + 'comunidadesAutonoma' => 'Comunidades Autónoma', + 'comunidadesAutonomaList' => 'Comunidades Autónoma List', + 'comunidadesAutonomas' => 'Comunidades Autónomas', + 'createdAt' => 'Creado el', + 'id' => 'ID', + 'moduleTitle' => 'Comunidades Autónomas', + 'nombre' => 'Nombre', + 'paisId' => 'País', + 'updatedAt' => 'Actualizado el', + 'validation' => [ + 'id' => [ + 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', - 'nombre' => [ - 'max_length' => 'The {field} field cannot exceed {param} characters in length.', - 'required' => 'The {field} field is required.', - ], + ], + + 'nombre' => [ + 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', + 'required' => 'El campo {field} es obligatorio.', + + ], + + + ], - ], ]; \ No newline at end of file diff --git a/ci4/app/Language/es/FormasPago.php b/ci4/app/Language/es/FormasPago.php index c76dd3ec..77ef92b5 100644 --- a/ci4/app/Language/es/FormasPago.php +++ b/ci4/app/Language/es/FormasPago.php @@ -1,7 +1,7 @@ 'Created At', + 'createdAt' => 'Creado el', 'formaPago' => 'Forma Pago', 'formaPagoList' => 'Listado de Formas Pago', 'formas-pago' => 'Formas de Pago', @@ -11,14 +11,14 @@ return [ 'id' => 'ID', 'moduleTitle' => 'Formas de Pago', 'nombre' => 'Nombre', - 'updatedAt' => 'Updated At', + 'updatedAt' => 'Actualizado el', 'validation' => [ 'id' => [ - 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', ], 'nombre' => [ - 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', 'required' => 'The {field} field is required.', ], diff --git a/ci4/app/Language/es/Paises.php b/ci4/app/Language/es/Paises.php index 99e5f277..547c0b2c 100644 --- a/ci4/app/Language/es/Paises.php +++ b/ci4/app/Language/es/Paises.php @@ -3,17 +3,19 @@ return [ - 'code' => 'Código', - 'code3' => 'Código33', + 'code' => 'Code', + 'code3' => 'Code3', 'id' => 'ID', 'keyErp' => 'Key Erp', - 'moduleTitle' => 'Países', + 'moduleTitle' => 'Paises', 'moneda' => 'Moneda', 'nombre' => 'Nombre', - 'pais' => 'País', - 'paisList' => 'Lista Países', - 'paises' => 'Países', - 'showErp' => 'Mostrar Erp', + 'pais' => 'Pais', + 'paisList' => 'Pais List', + 'paise' => 'Paise', + 'paiseList' => 'Paise List', + 'paises' => 'Paises', + 'showErp' => 'Show Erp', 'urlErp' => 'URL Erp', 'userErp' => 'User Erp', 'validation' => [ @@ -22,6 +24,11 @@ return [ ], + 'id' => [ + 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', + + ], + 'key_erp' => [ 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', @@ -50,7 +57,7 @@ return [ ], 'code' => [ - 'is_unique' => 'El campo {field} debe contener un valor único', + 'is_unique' => 'The {field} field must contain a unique value', 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', 'required' => 'El campo {field} es obligatorio.', diff --git a/ci4/app/Language/es/PapelGenerico.php b/ci4/app/Language/es/PapelGenerico.php index b585cc48..08215a20 100644 --- a/ci4/app/Language/es/PapelGenerico.php +++ b/ci4/app/Language/es/PapelGenerico.php @@ -5,7 +5,7 @@ return [ 'code' => 'Código', 'codeOt' => 'Código Ot', - 'createdAt' => 'Created At', + 'createdAt' => 'Creado el', 'deletedAt' => 'Deleted At', 'id' => 'ID', 'isDeleted' => 'Is Deleted', @@ -16,7 +16,7 @@ return [ 'papelGenericoList' => 'Lista Papeles Genéricos', 'papelesGenericos' => 'Papeles Genéricos', 'showInClient' => 'Mostrar en cliente', - 'updatedAt' => 'Updated At', + 'updatedAt' => 'Actualizado el', 'form_acordion_title' => 'Propiedades Papel Genérico', 'validation' => [ diff --git a/ci4/app/Language/es/Provincias.php b/ci4/app/Language/es/Provincias.php new file mode 100644 index 00000000..c957e70f --- /dev/null +++ b/ci4/app/Language/es/Provincias.php @@ -0,0 +1,44 @@ + 'Code', + 'createdAt' => 'Creado el', + 'id' => 'ID', + 'moduleTitle' => 'Provincias', + 'nombre' => 'Nombre', + 'paisId' => 'Pais ID', + 'provincia' => 'Provincia', + 'provinciaList' => 'Provincia List', + 'provincias' => 'Provincias', + 'updatedAt' => 'Actualizado el', + 'validation' => [ + 'id' => [ + 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', + + ], + + 'pais_id' => [ + 'integer' => 'El campo {field} debe contener un número entero.', + + ], + + 'nombre' => [ + 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', + 'required' => 'El campo {field} es obligatorio.', + + ], + + 'code' => [ + 'is_unique' => 'The {field} field must contain a unique value', + 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', + 'required' => 'El campo {field} es obligatorio.', + + ], + + + ], + + +]; \ No newline at end of file diff --git a/ci4/app/Language/es/TarifaManipuladoLineas.php b/ci4/app/Language/es/TarifaManipuladoLineas.php index e6751fc4..34996362 100644 --- a/ci4/app/Language/es/TarifaManipuladoLineas.php +++ b/ci4/app/Language/es/TarifaManipuladoLineas.php @@ -13,31 +13,31 @@ return [ 'tiradaMin' => 'Tirada Min', 'validation' => [ 'precio_max' => [ - 'decimal' => 'The {field} field must contain a decimal number.', + 'decimal' => 'El campo {field} debe contener un número decimal.', 'required' => 'The {field} field is required.', ], 'precio_min' => [ - 'decimal' => 'The {field} field must contain a decimal number.', + 'decimal' => 'El campo {field} debe contener un número decimal.', 'required' => 'The {field} field is required.', ], 'precio_unidad' => [ - 'decimal' => 'The {field} field must contain a decimal number.', + 'decimal' => 'El campo {field} debe contener un número decimal.', 'required' => 'The {field} field is required.', ], 'tirada_max' => [ - 'decimal' => 'The {field} field must contain a decimal number.', + 'decimal' => 'El campo {field} debe contener un número decimal.', 'required' => 'The {field} field is required.', ], 'tirada_min' => [ - 'decimal' => 'The {field} field must contain a decimal number.', + 'decimal' => 'El campo {field} debe contener un número decimal.', 'required' => 'The {field} field is required.', ], diff --git a/ci4/app/Language/es/TipologiasLibros.php b/ci4/app/Language/es/TipologiasLibros.php index 4369e218..1073e935 100644 --- a/ci4/app/Language/es/TipologiasLibros.php +++ b/ci4/app/Language/es/TipologiasLibros.php @@ -13,14 +13,14 @@ return [ 'tipologiaslibros' => 'Tipologias Libros', 'validation' => [ 'nombre' => [ - 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', 'required' => 'The {field} field is required.', ], 'code' => [ 'is_unique' => 'The {field} field must contain a unique value', - 'max_length' => 'The {field} field cannot exceed {param} characters in length.', + 'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.', 'required' => 'The {field} field is required.', ], diff --git a/ci4/app/Language/es/Users.php b/ci4/app/Language/es/Users.php index 9ab94428..4bdd4884 100644 --- a/ci4/app/Language/es/Users.php +++ b/ci4/app/Language/es/Users.php @@ -71,7 +71,7 @@ return [ ], 'email_confirmed' => [ - 'integer' => 'The {field} field must contain an integer.', + 'integer' => 'El campo {field} debe contener un número entero.', 'required' => 'El campo {field} es obligatorio.', ], diff --git a/ci4/app/Models/Clientes/ClienteModel.php b/ci4/app/Models/Clientes/ClienteModel.php index 9896f5ee..4e63c478 100644 --- a/ci4/app/Models/Clientes/ClienteModel.php +++ b/ci4/app/Models/Clientes/ClienteModel.php @@ -15,38 +15,40 @@ class ClienteModel extends \App\Models\GoBaseModel const SORTABLE = [ 0 => "t1.nombre", 1 => "t1.alias", - 2 => "t1.email", - 3 => "t1.salesman_id", - 4 => "t1.forma_pago_id", - 5 => "t1.vencimiento", + 2 => "t1.cif", + 3 => "t1.email", + 4 => "t1.comercial_id", + 5 => "t1.forma_pago_id", + 6 => "t1.vencimiento", ]; protected $allowedFields = [ "nombre", "alias", + "cif", "direccion", "ciudad", "comunidad_autonoma_id", - "provincia", + "provincia_id", "cp", "pais_id", "telefono", "email", - "salesman_id", + "comercial_id", "soporte_id", "forma_pago_id", "vencimiento", - "fechaVencimiento", + "fecha_vencimiento", "margen", "margen_pod", "descuento", "limite_credito", "limite_credito_user_id", "limite_credito_change_at", - "creditoSolunion", - "creditoAsegurado", + "credito_solunion", + "credito_asegurado", "ccc", - "ccc_customer", + "ccc_cliente", "num_cuenta", "disponible_fe", "message_tracking", @@ -61,262 +63,253 @@ class ClienteModel extends \App\Models\GoBaseModel "ps_customer_id", "lineasEnvioFactura", "comentarios", + "is_deleted", + "deleted_at", "user_created_id", "user_update_id", ]; protected $returnType = "App\Entities\Clientes\ClienteEntity"; - protected $useTimestamps = true; - protected $useSoftDeletes = false; - - protected $createdField = "created_at"; - - protected $updatedField = "updated_at"; + protected $deletedField = 'deleted_at'; public static $labelField = "nombre"; protected $validationRules = [ "alias" => [ - "label" => "Cliente.alias", + "label" => "Clientes.alias", "rules" => "trim|required|max_length[255]", ], "ccc" => [ - "label" => "Cliente.ccc", + "label" => "Clientes.ccc", "rules" => "trim|max_length[100]", ], - "ccc_customer" => [ - "label" => "Cliente.cccCustomer", + "ccc_cliente" => [ + "label" => "Clientes.cccCliente", "rules" => "trim|max_length[100]", ], + "cif" => [ + "label" => "Clientes.cif", + "rules" => "trim|required|max_length[50]", + ], "ciudad" => [ - "label" => "Cliente.ciudad", + "label" => "Clientes.ciudad", "rules" => "trim|max_length[100]", ], "comentarios" => [ - "label" => "Cliente.comentarios", + "label" => "Clientes.comentarios", "rules" => "trim|max_length[16313]", ], "comentarios_produccion" => [ - "label" => "Cliente.comentariosProduccion", + "label" => "Clientes.comentariosProduccion", "rules" => "trim|max_length[16313]", ], "comentarios_tirada_flexible" => [ - "label" => "Cliente.comentariosTiradaFlexible", + "label" => "Clientes.comentariosTiradaFlexible", "rules" => "trim|required|max_length[16313]", ], "cp" => [ - "label" => "Cliente.cp", + "label" => "Clientes.cp", "rules" => "trim|max_length[10]", ], - "creditoSolunion" => [ - "label" => "Cliente.creditosolunion", + "credito_solunion" => [ + "label" => "Clientes.creditoSolunion", "rules" => "trim|max_length[100]", ], "descuento" => [ - "label" => "Cliente.descuento", + "label" => "Clientes.descuento", "rules" => "required|decimal", ], "descuento_tirada_flexible" => [ - "label" => "Cliente.descuentoTiradaFlexible", + "label" => "Clientes.descuentoTiradaFlexible", "rules" => "required|decimal", ], "direccion" => [ - "label" => "Cliente.direccion", + "label" => "Clientes.direccion", "rules" => "trim|max_length[300]", ], "email" => [ - "label" => "Cliente.email", + "label" => "Clientes.email", "rules" => "trim|max_length[150]|valid_email|permit_empty", ], - "fechaVencimiento" => [ - "label" => "Cliente.fechavencimiento", + "fecha_vencimiento" => [ + "label" => "Clientes.fechaVencimiento", "rules" => "trim|max_length[100]", ], + "is_deleted" => [ + "label" => "Clientes.isDeleted", + "rules" => "required|integer", + ], "limite_credito" => [ - "label" => "Cliente.limiteCredito", + "label" => "Clientes.limiteCredito", "rules" => "required|decimal", ], "limite_credito_change_at" => [ - "label" => "Cliente.limiteCreditoChangeAt", + "label" => "Clientes.limiteCreditoChangeAt", "rules" => "required|valid_date", ], "limite_credito_user_id" => [ - "label" => "Cliente.limiteCreditoUserId", + "label" => "Clientes.limiteCreditoUserId", "rules" => "required|integer", ], "margen" => [ - "label" => "Cliente.margen", + "label" => "Clientes.margen", "rules" => "required|decimal", ], "margen_plantilla_id" => [ - "label" => "Cliente.margenPlantillaId", + "label" => "Clientes.margenPlantillaId", "rules" => "integer|permit_empty", ], "margen_pod" => [ - "label" => "Cliente.margenPod", + "label" => "Clientes.margenPod", "rules" => "decimal|permit_empty", ], "nombre" => [ - "label" => "Cliente.nombre", + "label" => "Clientes.nombre", "rules" => "trim|required|max_length[255]", ], "num_cuenta" => [ - "label" => "Cliente.numCuenta", + "label" => "Clientes.numCuenta", "rules" => "trim|max_length[10]", ], - "provincia" => [ - "label" => "Cliente.provincia", - "rules" => "trim|max_length[100]", - ], "ps_customer_id" => [ - "label" => "Cliente.psCustomerId", + "label" => "Clientes.psCustomerId", "rules" => "integer|permit_empty", ], - "salesman_id" => [ - "label" => "Cliente.salesmanId", - "rules" => "required|integer", - ], "saturacion" => [ - "label" => "Cliente.saturacion", + "label" => "Clientes.saturacion", "rules" => "required|decimal", ], - "soporte_id" => [ - "label" => "Cliente.soporteId", - "rules" => "integer|permit_empty", - ], "telefono" => [ - "label" => "Cliente.telefono", + "label" => "Clientes.telefono", "rules" => "trim|max_length[60]", ], "tienda_id" => [ - "label" => "Cliente.tiendaId", + "label" => "Clientes.tiendaId", "rules" => "integer|permit_empty", ], "user_created_id" => [ - "label" => "Cliente.userCreatedId", + "label" => "Clientes.userCreatedId", "rules" => "required|integer", ], "user_update_id" => [ - "label" => "Cliente.userUpdateId", + "label" => "Clientes.userUpdateId", "rules" => "required|integer", ], "vencimiento" => [ - "label" => "Cliente.vencimiento", + "label" => "Clientes.vencimiento", "rules" => "required|integer", ], ]; protected $validationMessages = [ "alias" => [ - "max_length" => "Cliente.validation.alias.max_length", - "required" => "Cliente.validation.alias.required", + "max_length" => "Clientes.validation.alias.max_length", + "required" => "Clientes.validation.alias.required", ], "ccc" => [ - "max_length" => "Cliente.validation.ccc.max_length", + "max_length" => "Clientes.validation.ccc.max_length", ], - "ccc_customer" => [ - "max_length" => "Cliente.validation.ccc_customer.max_length", + "ccc_cliente" => [ + "max_length" => "Clientes.validation.ccc_cliente.max_length", + ], + "cif" => [ + "max_length" => "Clientes.validation.cif.max_length", + "required" => "Clientes.validation.cif.required", ], "ciudad" => [ - "max_length" => "Cliente.validation.ciudad.max_length", + "max_length" => "Clientes.validation.ciudad.max_length", ], "comentarios" => [ - "max_length" => "Cliente.validation.comentarios.max_length", + "max_length" => "Clientes.validation.comentarios.max_length", ], "comentarios_produccion" => [ - "max_length" => "Cliente.validation.comentarios_produccion.max_length", + "max_length" => "Clientes.validation.comentarios_produccion.max_length", ], "comentarios_tirada_flexible" => [ - "max_length" => "Cliente.validation.comentarios_tirada_flexible.max_length", - "required" => "Cliente.validation.comentarios_tirada_flexible.required", + "max_length" => "Clientes.validation.comentarios_tirada_flexible.max_length", + "required" => "Clientes.validation.comentarios_tirada_flexible.required", ], "cp" => [ - "max_length" => "Cliente.validation.cp.max_length", + "max_length" => "Clientes.validation.cp.max_length", ], - "creditoSolunion" => [ - "max_length" => "Cliente.validation.creditoSolunion.max_length", + "credito_solunion" => [ + "max_length" => "Clientes.validation.credito_solunion.max_length", ], "descuento" => [ - "decimal" => "Cliente.validation.descuento.decimal", - "required" => "Cliente.validation.descuento.required", + "decimal" => "Clientes.validation.descuento.decimal", + "required" => "Clientes.validation.descuento.required", ], "descuento_tirada_flexible" => [ - "decimal" => "Cliente.validation.descuento_tirada_flexible.decimal", - "required" => "Cliente.validation.descuento_tirada_flexible.required", + "decimal" => "Clientes.validation.descuento_tirada_flexible.decimal", + "required" => "Clientes.validation.descuento_tirada_flexible.required", ], "direccion" => [ - "max_length" => "Cliente.validation.direccion.max_length", + "max_length" => "Clientes.validation.direccion.max_length", ], "email" => [ - "max_length" => "Cliente.validation.email.max_length", - "valid_email" => "Cliente.validation.email.valid_email", + "max_length" => "Clientes.validation.email.max_length", + "valid_email" => "Clientes.validation.email.valid_email", ], - "fechaVencimiento" => [ - "max_length" => "Cliente.validation.fechaVencimiento.max_length", + "fecha_vencimiento" => [ + "max_length" => "Clientes.validation.fecha_vencimiento.max_length", + ], + "is_deleted" => [ + "integer" => "Clientes.validation.is_deleted.integer", + "required" => "Clientes.validation.is_deleted.required", ], "limite_credito" => [ - "decimal" => "Cliente.validation.limite_credito.decimal", - "required" => "Cliente.validation.limite_credito.required", + "decimal" => "Clientes.validation.limite_credito.decimal", + "required" => "Clientes.validation.limite_credito.required", ], "limite_credito_change_at" => [ - "required" => "Cliente.validation.limite_credito_change_at.required", - "valid_date" => "Cliente.validation.limite_credito_change_at.valid_date", + "required" => "Clientes.validation.limite_credito_change_at.required", + "valid_date" => "Clientes.validation.limite_credito_change_at.valid_date", ], "limite_credito_user_id" => [ - "integer" => "Cliente.validation.limite_credito_user_id.integer", - "required" => "Cliente.validation.limite_credito_user_id.required", + "integer" => "Clientes.validation.limite_credito_user_id.integer", + "required" => "Clientes.validation.limite_credito_user_id.required", ], "margen" => [ - "decimal" => "Cliente.validation.margen.decimal", - "required" => "Cliente.validation.margen.required", + "decimal" => "Clientes.validation.margen.decimal", + "required" => "Clientes.validation.margen.required", ], "margen_plantilla_id" => [ - "integer" => "Cliente.validation.margen_plantilla_id.integer", + "integer" => "Clientes.validation.margen_plantilla_id.integer", ], "margen_pod" => [ - "decimal" => "Cliente.validation.margen_pod.decimal", + "decimal" => "Clientes.validation.margen_pod.decimal", ], "nombre" => [ - "max_length" => "Cliente.validation.nombre.max_length", - "required" => "Cliente.validation.nombre.required", + "max_length" => "Clientes.validation.nombre.max_length", + "required" => "Clientes.validation.nombre.required", ], "num_cuenta" => [ - "max_length" => "Cliente.validation.num_cuenta.max_length", - ], - "provincia" => [ - "max_length" => "Cliente.validation.provincia.max_length", + "max_length" => "Clientes.validation.num_cuenta.max_length", ], "ps_customer_id" => [ - "integer" => "Cliente.validation.ps_customer_id.integer", - ], - "salesman_id" => [ - "integer" => "Cliente.validation.salesman_id.integer", - "required" => "Cliente.validation.salesman_id.required", + "integer" => "Clientes.validation.ps_customer_id.integer", ], "saturacion" => [ - "decimal" => "Cliente.validation.saturacion.decimal", - "required" => "Cliente.validation.saturacion.required", - ], - "soporte_id" => [ - "integer" => "Cliente.validation.soporte_id.integer", + "decimal" => "Clientes.validation.saturacion.decimal", + "required" => "Clientes.validation.saturacion.required", ], "telefono" => [ - "max_length" => "Cliente.validation.telefono.max_length", + "max_length" => "Clientes.validation.telefono.max_length", ], "tienda_id" => [ - "integer" => "Cliente.validation.tienda_id.integer", + "integer" => "Clientes.validation.tienda_id.integer", ], "user_created_id" => [ - "integer" => "Cliente.validation.user_created_id.integer", - "required" => "Cliente.validation.user_created_id.required", + "integer" => "Clientes.validation.user_created_id.integer", + "required" => "Clientes.validation.user_created_id.required", ], "user_update_id" => [ - "integer" => "Cliente.validation.user_update_id.integer", - "required" => "Cliente.validation.user_update_id.required", + "integer" => "Clientes.validation.user_update_id.integer", + "required" => "Clientes.validation.user_update_id.required", ], "vencimiento" => [ - "integer" => "Cliente.validation.vencimiento.integer", - "required" => "Cliente.validation.vencimiento.required", + "integer" => "Clientes.validation.vencimiento.integer", + "required" => "Clientes.validation.vencimiento.required", ], ]; public function findAllWithAllRelations(string $selcols = "*", int $limit = null, int $offset = 0) @@ -324,9 +317,9 @@ class ClienteModel extends \App\Models\GoBaseModel $sql = "SELECT t1." . $selcols . - ", t2.nombre AS pais, t3.nombre AS forma_pago 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_paises t2 ON t1.pais_id = t2.id LEFT JOIN lg_formas_pago t3 ON t1.forma_pago_id = t3.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 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"; if (!is_null($limit) && intval($limit) > 0) { $sql .= " LIMIT " . intval($limit); } @@ -352,10 +345,12 @@ class ClienteModel extends \App\Models\GoBaseModel $builder = $this->db ->table($this->table . " t1") ->select( - "t1.id AS id, t1.nombre AS nombre, t1.alias AS alias, t1.direccion AS direccion, t1.ciudad AS ciudad, t1.comunidad_autonoma_id AS comunidad_autonoma_id, t1.provincia AS provincia, t1.cp AS cp, t1.telefono AS telefono, t1.email AS email, t1.salesman_id AS salesman_id, t1.soporte_id AS soporte_id, t1.vencimiento AS vencimiento, t1.fechaVencimiento AS fechaVencimiento, t1.margen AS margen, t1.margen_pod AS margen_pod, t1.descuento AS descuento, t1.limite_credito AS limite_credito, t1.limite_credito_user_id AS limite_credito_user_id, t1.limite_credito_change_at AS limite_credito_change_at, t1.creditoSolunion AS creditoSolunion, t1.creditoAsegurado AS creditoAsegurado, t1.ccc AS ccc, t1.ccc_customer AS ccc_customer, t1.num_cuenta AS num_cuenta, t1.disponible_fe AS disponible_fe, t1.message_tracking AS message_tracking, t1.message_production_start AS message_production_start, t1.tirada_flexible AS tirada_flexible, t1.descuento_tirada_flexible AS descuento_tirada_flexible, t1.comentarios_tirada_flexible AS comentarios_tirada_flexible, t1.saturacion AS saturacion, t1.tienda_id AS tienda_id, t1.margen_plantilla_id AS margen_plantilla_id, t1.comentarios_produccion AS comentarios_produccion, t1.ps_customer_id AS ps_customer_id, t1.lineasEnvioFactura AS lineasEnvioFactura, t1.comentarios AS comentarios, t1.created_at AS created_at, t1.updated_at AS updated_at, t1.user_created_id AS user_created_id, t1.user_update_id AS user_update_id, t2.nombre AS pais, t3.nombre AS forma_pago" - ); - $builder->join("lg_paises t2", "t1.pais_id = t2.id", "left"); - $builder->join("lg_formas_pago t3", "t1.forma_pago_id = t3.id", "left"); + "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("lg_formas_pago t7", "t1.forma_pago_id = t7.id", "left"); + return empty($search) ? $builder @@ -363,11 +358,16 @@ class ClienteModel extends \App\Models\GoBaseModel ->groupStart() ->like("t1.nombre", $search) ->orLike("t1.alias", $search) + ->orLike("t1.cif", $search) ->orLike("t1.email", $search) - ->orLike("t1.salesman_id", $search) + ->orLike("t1.soporte_id", $search) + ->orLike("t1.forma_pago_id", $search) ->orLike("t1.vencimiento", $search) - ->orLike("t1.fechaVencimiento", $search) - + ->orLike("t5.id_user", $search) + ->orLike("t5.first_name", $search) + ->orLike("t5.last_name", $search) + ->orLike("t7.id", $search) + ->orLike("t7.nombre", $search) ->groupEnd(); } } diff --git a/ci4/app/Models/Configuracion/ComunidadAutonomaModel.php b/ci4/app/Models/Configuracion/ComunidadAutonomaModel.php new file mode 100644 index 00000000..dbddaa25 --- /dev/null +++ b/ci4/app/Models/Configuracion/ComunidadAutonomaModel.php @@ -0,0 +1,97 @@ + "t1.id", + 2 => "t1.nombre", + 3 => "t1.pais_id", + 4 => "t1.created_at", + 5 => "t1.updated_at", + 6 => "t2.id", + ]; + + protected $allowedFields = ["nombre", "pais_id"]; + protected $returnType = "App\Entities\Configuracion\ComunidadAutonomaEntity"; + + public static $labelField = "nombre"; + + protected $validationRules = [ + "nombre" => [ + "label" => "ComunidadesAutonomas.nombre", + "rules" => "trim|required|max_length[100]", + ], + ]; + + protected $validationMessages = [ + "nombre" => [ + "max_length" => "ComunidadesAutonomas.validation.nombre.max_length", + "required" => "ComunidadesAutonomas.validation.nombre.required", + ], + ]; + + public function findAllWithPaises(string $selcols = "*", int $limit = null, int $offset = 0) + { + $sql = + "SELECT t1." . + $selcols . + ", t2.id AS pais FROM " . + $this->table . + " t1 LEFT JOIN lg_paises t2 ON t1.pais_id = t2.id"; + if (!is_null($limit) && intval($limit) > 0) { + $sql .= " LIMIT " . $limit; + } + + if (!is_null($offset) && intval($offset) > 0) { + $sql .= " OFFSET " . $offset; + } + + $query = $this->db->query($sql); + $result = $query->getResultObject(); + return $result; + } + + /** + * 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.nombre AS nombre, t1.created_at AS created_at, t1.updated_at AS updated_at, t2.id AS pais" + ); + $builder->join("lg_paises t2", "t1.pais_id = t2.id", "left"); + + return empty($search) + ? $builder + : $builder + ->groupStart() + ->like("t1.id", $search) + ->orLike("t1.nombre", $search) + ->orLike("t1.created_at", $search) + ->orLike("t1.updated_at", $search) + ->orLike("t2.id", $search) + ->orLike("t1.id", $search) + ->orLike("t1.nombre", $search) + ->orLike("t1.pais_id", $search) + ->orLike("t1.created_at", $search) + ->orLike("t1.updated_at", $search) + ->orLike("t2.id", $search) + ->groupEnd(); + } +} diff --git a/ci4/app/Models/Configuracion/FormaPagoModel.php b/ci4/app/Models/Configuracion/FormaPagoModel.php new file mode 100644 index 00000000..b28f3255 --- /dev/null +++ b/ci4/app/Models/Configuracion/FormaPagoModel.php @@ -0,0 +1,68 @@ + "t1.id", + 2 => "t1.nombre", + 3 => "t1.created_at", + 4 => "t1.updated_at", + ]; + + protected $allowedFields = ["nombre"]; + protected $returnType = "App\Entities\Configuracion\FormaPagoEntity"; + + public static $labelField = "nombre"; + + protected $validationRules = [ + "nombre" => [ + "label" => "FormasPagoes.nombre", + "rules" => "trim|required|max_length[255]", + ], + ]; + + protected $validationMessages = [ + "nombre" => [ + "max_length" => "FormasPagoes.validation.nombre.max_length", + "required" => "FormasPagoes.validation.nombre.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.nombre AS nombre, t1.created_at AS created_at, t1.updated_at AS updated_at"); + + return empty($search) + ? $builder + : $builder + ->groupStart() + ->like("t1.id", $search) + ->orLike("t1.nombre", $search) + ->orLike("t1.created_at", $search) + ->orLike("t1.updated_at", $search) + ->orLike("t1.id", $search) + ->orLike("t1.nombre", $search) + ->orLike("t1.created_at", $search) + ->orLike("t1.updated_at", $search) + ->groupEnd(); + } +} diff --git a/ci4/app/Models/Configuracion/PaisModel.php b/ci4/app/Models/Configuracion/PaisModel.php index 0860e880..fbd5f3d8 100644 --- a/ci4/app/Models/Configuracion/PaisModel.php +++ b/ci4/app/Models/Configuracion/PaisModel.php @@ -12,8 +12,20 @@ class PaisModel extends \App\Models\GoBaseModel */ protected $useAutoIncrement = true; + const SORTABLE = [ + 1 => "t1.id", + 2 => "t1.nombre", + 3 => "t1.code", + 4 => "t1.code3", + 5 => "t1.moneda", + 6 => "t1.url_erp", + 7 => "t1.user_erp", + 8 => "t1.key_erp", + 9 => "t1.show_erp", + ]; + protected $allowedFields = ["nombre", "code", "code3", "moneda", "url_erp", "user_erp", "key_erp", "show_erp"]; - protected $returnType = "App\Entities\Configuracion\Pais"; + protected $returnType = "App\Entities\Configuracion\PaisEntity"; public static $labelField = "nombre"; @@ -75,4 +87,42 @@ class PaisModel extends \App\Models\GoBaseModel "max_length" => "Paises.validation.user_erp.max_length", ], ]; + + /** + * 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.nombre AS nombre, t1.code AS code, t1.code3 AS code3, t1.moneda AS moneda, t1.url_erp AS url_erp, t1.user_erp AS user_erp, t1.key_erp AS key_erp, t1.show_erp AS show_erp" + ); + + return empty($search) + ? $builder + : $builder + ->groupStart() + ->like("t1.id", $search) + ->orLike("t1.nombre", $search) + ->orLike("t1.code", $search) + ->orLike("t1.code3", $search) + ->orLike("t1.moneda", $search) + ->orLike("t1.url_erp", $search) + ->orLike("t1.user_erp", $search) + ->orLike("t1.key_erp", $search) + ->orLike("t1.id", $search) + ->orLike("t1.nombre", $search) + ->orLike("t1.code", $search) + ->orLike("t1.code3", $search) + ->orLike("t1.moneda", $search) + ->orLike("t1.url_erp", $search) + ->orLike("t1.user_erp", $search) + ->orLike("t1.key_erp", $search) + ->groupEnd(); + } } diff --git a/ci4/app/Models/Configuracion/ProvinciaModel.php b/ci4/app/Models/Configuracion/ProvinciaModel.php new file mode 100644 index 00000000..2f86e65b --- /dev/null +++ b/ci4/app/Models/Configuracion/ProvinciaModel.php @@ -0,0 +1,109 @@ + "t1.id", + 2 => "t1.code", + 3 => "t1.nombre", + 4 => "t1.pais_id", + 5 => "t1.created_at", + 6 => "t1.updated_at", + 7 => "t2.nombre", + ]; + + protected $allowedFields = ["code", "nombre", "pais_id"]; + protected $returnType = "App\Entities\Configuracion\ProvinciaEntity"; + + public static $labelField = "nombre"; + + protected $validationRules = [ + "code" => [ + "label" => "Provincias.code", + "rules" => "trim|required|max_length[2]|is_unique[lg_provincias.code,id,{id}]", + ], + "nombre" => [ + "label" => "Provincias.nombre", + "rules" => "trim|required|max_length[255]", + ], + ]; + + protected $validationMessages = [ + "code" => [ + "is_unique" => "Provincias.validation.code.is_unique", + "max_length" => "Provincias.validation.code.max_length", + "required" => "Provincias.validation.code.required", + ], + "nombre" => [ + "max_length" => "Provincias.validation.nombre.max_length", + "required" => "Provincias.validation.nombre.required", + ], + ]; + + public function findAllWithPaises(string $selcols = "*", int $limit = null, int $offset = 0) + { + $sql = + "SELECT t1." . + $selcols . + ", t2.nombre AS pais FROM " . + $this->table . + " t1 LEFT JOIN lg_paises t2 ON t1.pais_id = t2.id"; + if (!is_null($limit) && intval($limit) > 0) { + $sql .= " LIMIT " . $limit; + } + + if (!is_null($offset) && intval($offset) > 0) { + $sql .= " OFFSET " . $offset; + } + + $query = $this->db->query($sql); + $result = $query->getResultObject(); + return $result; + } + + /** + * 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.code AS code, t1.nombre AS nombre, t1.created_at AS created_at, t1.updated_at AS updated_at, t2.nombre AS pais" + ); + $builder->join("lg_paises t2", "t1.pais_id = t2.id", "left"); + + return empty($search) + ? $builder + : $builder + ->groupStart() + ->like("t1.id", $search) + ->orLike("t1.code", $search) + ->orLike("t1.nombre", $search) + ->orLike("t1.created_at", $search) + ->orLike("t1.updated_at", $search) + ->orLike("t2.id", $search) + ->orLike("t1.id", $search) + ->orLike("t1.code", $search) + ->orLike("t1.nombre", $search) + ->orLike("t1.pais_id", $search) + ->orLike("t1.created_at", $search) + ->orLike("t1.updated_at", $search) + ->orLike("t2.nombre", $search) + ->groupEnd(); + } +} diff --git a/ci4/app/Views/themes/backend/vuexy/form/clientes/_clienteFormItems.php b/ci4/app/Views/themes/backend/vuexy/form/clientes/cliente/_clienteFormItems.php similarity index 73% rename from ci4/app/Views/themes/backend/vuexy/form/clientes/_clienteFormItems.php rename to ci4/app/Views/themes/backend/vuexy/form/clientes/cliente/_clienteFormItems.php index 1263ef5d..5044c6f4 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/clientes/_clienteFormItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/clientes/cliente/_clienteFormItems.php @@ -16,6 +16,14 @@ value="alias) ?>"> +
+ + +
+
-
@@ -61,14 +85,15 @@ - - - - + $v) : ?> + +
@@ -89,33 +114,50 @@
-
- +
+ - - - - + $v) : ?> + +
@@ -128,11 +170,11 @@
-
@@ -186,23 +228,23 @@ value="limite_credito_change_at) ?>">
+
+ + +
+
-
- - -
-
-
@@ -216,11 +258,11 @@
-
@@ -352,6 +394,14 @@ class="form-control">comentarios) ?>
+
+ + +
+
endSection() ?> + + +section("additionalInlineJs") ?> + + + $('#paisId').select2({ + theme: 'bootstrap-5', + allowClear: false, + ajax: { + url: '', + type: 'post', + dataType: 'json', + + data: function (params) { + return { + id: 'id', + text: 'id', + searchTerm: params.term, + : v + }; + }, + delay: 60, + processResults: function (response) { + + yeniden(response.); + + return { + results: response.menu + }; + }, + + cache: true + } + }); + + +endSection() ?> diff --git a/ci4/app/Views/themes/backend/vuexy/form/configuracion/comunidades-autonomas/viewComunidadAutonomaList.php b/ci4/app/Views/themes/backend/vuexy/form/configuracion/comunidades-autonomas/viewComunidadAutonomaList.php index 0c2ab9a8..be636171 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/configuracion/comunidades-autonomas/viewComunidadAutonomaList.php +++ b/ci4/app/Views/themes/backend/vuexy/form/configuracion/comunidades-autonomas/viewComunidadAutonomaList.php @@ -1,3 +1,4 @@ +include('Themes/_commonPartialsBs/select2bs5') ?> include('Themes/_commonPartialsBs/datatables') ?> include('Themes/_commonPartialsBs/sweetalert') ?> extend('Themes/'.config('Basics')->theme['name'].'/AdminLayout/defaultLayout') ?> diff --git a/ci4/app/Views/themes/backend/vuexy/form/configuracion/formas-pago/_formaDePagoFormItems.php b/ci4/app/Views/themes/backend/vuexy/form/configuracion/formas-pago/_formaDePagoFormItems.php new file mode 100644 index 00000000..27eed497 --- /dev/null +++ b/ci4/app/Views/themes/backend/vuexy/form/configuracion/formas-pago/_formaDePagoFormItems.php @@ -0,0 +1,12 @@ +
+
+
+ + +
+ +
+ +
\ No newline at end of file diff --git a/ci4/app/Views/themes/backend/vuexy/form/clientes/viewClienteForm.php b/ci4/app/Views/themes/backend/vuexy/form/configuracion/formas-pago/viewFormaDePagoForm.php similarity index 55% rename from ci4/app/Views/themes/backend/vuexy/form/clientes/viewClienteForm.php rename to ci4/app/Views/themes/backend/vuexy/form/configuracion/formas-pago/viewFormaDePagoForm.php index 7dbd0d20..ce7b54d8 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/clientes/viewClienteForm.php +++ b/ci4/app/Views/themes/backend/vuexy/form/configuracion/formas-pago/viewFormaDePagoForm.php @@ -1,7 +1,6 @@ -include("themes/_commonPartialsBs/select2bs5") ?> -include("themes/_commonPartialsBs/sweetalert") ?> -extend('themes/backend/vuexy/main/defaultlayout') ?> - +include("Themes/_commonPartialsBs/select2bs5") ?> +include("Themes/_commonPartialsBs/sweetalert") ?> +extend("Themes/" . config("Basics")->theme["name"] . "/AdminLayout/defaultLayout") ?> section("content") ?>
@@ -9,15 +8,15 @@

-
+
- + getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?> - +
diff --git a/ci4/app/Views/themes/backend/vuexy/form/configuracion/formas-pago/viewFormaDePagoList.php b/ci4/app/Views/themes/backend/vuexy/form/configuracion/formas-pago/viewFormaDePagoList.php new file mode 100644 index 00000000..e30bbb48 --- /dev/null +++ b/ci4/app/Views/themes/backend/vuexy/form/configuracion/formas-pago/viewFormaDePagoList.php @@ -0,0 +1,185 @@ +include('Themes/_commonPartialsBs/datatables') ?> +include('Themes/_commonPartialsBs/sweetalert') ?> +extend('Themes/'.config('Basics')->theme['name'].'/AdminLayout/defaultLayout') ?> +section('content'); ?> +
+
+ +
+
+

+
+
+ + + + + + + + + + + + + + + + +
+
+ +
+
+
+ +endSection() ?> + + +section('additionalInlineJs') ?> + + const lastColNr = $('#tableOfFormasdepagos').find("tr:first th").length - 1; + const actionBtns = function(data) { + return ` +
+ + +
+ `; + }; + theTable = $('#tableOfFormasdepagos').DataTable({ + processing: true, + serverSide: true, + autoWidth: true, + responsive: true, + scrollX: true, + lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ], + pageLength: 10, + lengthChange: true, + "dom": 'lfrtipB', // 'lfBrtip', // you can try different layout combinations by uncommenting one or the other + // "dom": '<"top"lf><"clear">rt<"bottom"ipB><"clear">', // remember to comment this line if you uncomment the above + "buttons": [ + 'copy', 'csv', 'excel', 'print', { + extend: 'pdfHtml5', + orientation: 'landscape', + pageSize: 'A4' + } + ], + stateSave: true, + order: [[1, 'asc']], + language: { + url: "/assets/dt/languages[$currentLocale] ?? config('Basics')->i18n ?>.json" + }, + ajax : $.fn.dataTable.pipeline( { + url: '', + method: 'POST', + headers: {'X-Requested-With': 'XMLHttpRequest'}, + async: true, + }), + columnDefs: [ + { + orderable: false, + searchable: false, + targets: [0,lastColNr] + } + ], + columns : [ + { 'data': actionBtns }, + { 'data': 'id' }, + { 'data': 'nombre' }, + { 'data': 'created_at' }, + { 'data': 'updated_at' }, + { 'data': actionBtns } + ] + }); + + + theTable.on( 'draw.dt', function () { + + const dateCols = [3, 4]; + const shortDateFormat = ''; + const dateTimeFormat = ''; + + for (let coln of dateCols) { + theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) { + const datestr = cell.innerHTML; + const dateStrLen = datestr.toString().trim().length; + if (dateStrLen > 0) { + let dateTimeParts= datestr.split(/[- :]/); // regular expression split that creates array with: year, month, day, hour, minutes, seconds values + dateTimeParts[1]--; // monthIndex begins with 0 for January and ends with 11 for December so we need to decrement by one + const d = new Date(...dateTimeParts); // new Date(datestr); + const md = moment(d); + const usingThisFormat = dateStrLen > 11 ? dateTimeFormat : shortDateFormat; + const formattedDateStr = md.format(usingThisFormat); + cell.innerHTML = formattedDateStr; + } + }); + } + }); + +$(document).on('click', '.btn-edit', function(e) { + window.location.href = `/${$(this).attr('data-id')}/edit`; + }); + +$(document).on('click', '.btn-delete', function(e) { + Swal.fire({ + title: '', + text: '', + icon: 'warning', + showCancelButton: true, + confirmButtonColor: '#3085d6', + confirmButtonText: '', + cancelButtonText: '', + cancelButtonColor: '#d33' + }) + .then((result) => { + const dataId = $(this).data('id'); + const row = $(this).closest('tr'); + if (result.value) { + $.ajax({ + url: `/${dataId}`, + method: 'DELETE', + }).done((data, textStatus, jqXHR) => { + Toast.fire({ + icon: 'success', + title: data.msg ?? jqXHR.statusText, + }); + + theTable.clearPipeline(); + theTable.row($(row)).invalidate().draw(); + }).fail((jqXHR, textStatus, errorThrown) => { + Toast.fire({ + icon: 'error', + title: jqXHR.responseJSON.messages.error, + }); + }) + } + }); + }); + + + + +endSection() ?> + + +section('css') ?> + +endSection() ?> + + +section('additionalExternalJs') ?> + + + + + + + + + + +endSection() ?> + diff --git a/ci4/app/Views/themes/backend/vuexy/form/configuracion/paises/_paisFormItems.php b/ci4/app/Views/themes/backend/vuexy/form/configuracion/paises/_paisFormItems.php index 9bfc0f4c..7213682f 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/configuracion/paises/_paisFormItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/configuracion/paises/_paisFormItems.php @@ -4,28 +4,28 @@ - +
- +
- +
- +
@@ -34,28 +34,28 @@ - +
- +
- +
diff --git a/ci4/app/Views/themes/backend/vuexy/form/configuracion/paises/viewPaisForm.php b/ci4/app/Views/themes/backend/vuexy/form/configuracion/paises/viewPaisForm.php index 2256018e..cd7756c2 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/configuracion/paises/viewPaisForm.php +++ b/ci4/app/Views/themes/backend/vuexy/form/configuracion/paises/viewPaisForm.php @@ -1,6 +1,6 @@ -include("themes/_commonPartialsBs/select2bs5") ?> -extend('themes/backend/vuexy/main/defaultlayout') ?> - +include("Themes/_commonPartialsBs/select2bs5") ?> +include("Themes/_commonPartialsBs/sweetalert") ?> +extend("Themes/" . config("Basics")->theme["name"] . "/AdminLayout/defaultLayout") ?> section("content") ?>
@@ -8,20 +8,17 @@

-
+ - +
+ getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?> -
- " - /> - "btn btn-secondary float-start"]) ?> -
+
+
diff --git a/ci4/app/Views/themes/backend/vuexy/form/configuracion/paises/viewPaisList.php b/ci4/app/Views/themes/backend/vuexy/form/configuracion/paises/viewPaisList.php index fbfd09e2..3f20c970 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/configuracion/paises/viewPaisList.php +++ b/ci4/app/Views/themes/backend/vuexy/form/configuracion/paises/viewPaisList.php @@ -1,21 +1,22 @@ -include('themes/_commonPartialsBs/datatables') ?> -extend('themes/backend/vuexy/main/defaultlayout') ?> - +include('Themes/_commonPartialsBs/datatables') ?> +include('Themes/_commonPartialsBs/sweetalert') ?> +extend('Themes/'.config('Basics')->theme['name'].'/AdminLayout/defaultLayout') ?> section('content'); ?>
+

- 'btn btn-primary float-end']); ?>
- + - +
- + + @@ -28,56 +29,154 @@ - - - - - - - - - - - - - - -
- id ?> - - nombre) || strlen($item->nombre) < 51 ? esc($item->nombre) : character_limiter(esc($item->nombre), 50) ?> - - code) ?> - - code3) ?> - - moneda) ?> - - url_erp) ?> - - user_erp) || strlen($item->user_erp) < 51 ? esc($item->user_erp) : character_limiter(esc($item->user_erp), 50) ?> - - key_erp) || strlen($item->key_erp) < 51 ? esc($item->key_erp) : character_limiter(esc($item->key_erp), 50) ?> - - show_erp ) { ?> - - - - - - - id), "", ['class'=>'text-body', 'data-id'=>$item->id,]); ?> - ", ['class'=>'text-body', 'data-href'=>route_to('deletePais', $item->id), 'data-bs-toggle'=>'modal', 'data-bs-target'=>'#confirm2delete']); ?> -
-endSection() ?> \ No newline at end of file +endSection() ?> + + +section('additionalInlineJs') ?> + + const lastColNr = $('#tableOfPaises').find("tr:first th").length - 1; + const actionBtns = function(data) { + return ` +
+ + +
+ `; + }; + theTable = $('#tableOfPaises').DataTable({ + processing: true, + serverSide: true, + autoWidth: true, + responsive: true, + scrollX: true, + lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ], + pageLength: 10, + lengthChange: true, + "dom": 'lfrtipB', // 'lfBrtip', // you can try different layout combinations by uncommenting one or the other + // "dom": '<"top"lf><"clear">rt<"bottom"ipB><"clear">', // remember to comment this line if you uncomment the above + "buttons": [ + 'copy', 'csv', 'excel', 'print', { + extend: 'pdfHtml5', + orientation: 'landscape', + pageSize: 'A4' + } + ], + stateSave: true, + order: [[1, 'asc']], + language: { + url: "/assets/dt/languages[$currentLocale] ?? config('Basics')->i18n ?>.json" + }, + ajax : $.fn.dataTable.pipeline( { + url: '', + method: 'POST', + headers: {'X-Requested-With': 'XMLHttpRequest'}, + async: true, + }), + columnDefs: [ + { + orderable: false, + searchable: false, + targets: [0,lastColNr] + } + ], + columns : [ + { 'data': actionBtns }, + { 'data': 'id' }, + { 'data': 'nombre' }, + { 'data': 'code' }, + { 'data': 'code3' }, + { 'data': 'moneda' }, + { 'data': 'url_erp' }, + { 'data': 'user_erp' }, + { 'data': 'key_erp' }, + { 'data': 'show_erp' }, + { 'data': actionBtns } + ] + }); + + + theTable.on( 'draw.dt', function () { + const boolCols = [9]; + for (let coln of boolCols) { + theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) { + cell.innerHTML = cell.innerHTML == '1' ? '' : ''; + }); + } + + }); + +$(document).on('click', '.btn-edit', function(e) { + window.location.href = `/${$(this).attr('data-id')}/edit`; + }); + +$(document).on('click', '.btn-delete', function(e) { + Swal.fire({ + title: '', + text: '', + icon: 'warning', + showCancelButton: true, + confirmButtonColor: '#3085d6', + confirmButtonText: '', + cancelButtonText: '', + cancelButtonColor: '#d33' + }) + .then((result) => { + const dataId = $(this).data('id'); + const row = $(this).closest('tr'); + if (result.value) { + $.ajax({ + url: `/${dataId}`, + method: 'DELETE', + }).done((data, textStatus, jqXHR) => { + Toast.fire({ + icon: 'success', + title: data.msg ?? jqXHR.statusText, + }); + + theTable.clearPipeline(); + theTable.row($(row)).invalidate().draw(); + }).fail((jqXHR, textStatus, errorThrown) => { + Toast.fire({ + icon: 'error', + title: jqXHR.responseJSON.messages.error, + }); + }) + } + }); + }); + + + + +endSection() ?> + + +section('css') ?> + +endSection() ?> + + +section('additionalExternalJs') ?> + + + + + + + + + + +endSection() ?> + diff --git a/ci4/app/Views/themes/backend/vuexy/form/configuracion/provincias/_provinciaFormItems.php b/ci4/app/Views/themes/backend/vuexy/form/configuracion/provincias/_provinciaFormItems.php new file mode 100644 index 00000000..414ec904 --- /dev/null +++ b/ci4/app/Views/themes/backend/vuexy/form/configuracion/provincias/_provinciaFormItems.php @@ -0,0 +1,35 @@ +
+
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
\ No newline at end of file diff --git a/ci4/app/Views/themes/backend/vuexy/form/configuracion/provincias/viewProvinciaForm.php b/ci4/app/Views/themes/backend/vuexy/form/configuracion/provincias/viewProvinciaForm.php new file mode 100644 index 00000000..de46541f --- /dev/null +++ b/ci4/app/Views/themes/backend/vuexy/form/configuracion/provincias/viewProvinciaForm.php @@ -0,0 +1,63 @@ +include("Themes/_commonPartialsBs/select2bs5") ?> +include("Themes/_commonPartialsBs/sweetalert") ?> +extend("Themes/" . config("Basics")->theme["name"] . "/AdminLayout/defaultLayout") ?> +section("content") ?> +
+
+
+
+

+
+
+ +
+ + getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?> + +
+ +
+
+
+
+endSection() ?> + + +section("additionalInlineJs") ?> + + + $('#paisId').select2({ + theme: 'bootstrap-5', + allowClear: false, + ajax: { + url: '', + type: 'post', + dataType: 'json', + + data: function (params) { + return { + id: 'id', + text: 'nombre', + searchTerm: params.term, + : v + }; + }, + delay: 60, + processResults: function (response) { + + yeniden(response.); + + return { + results: response.menu + }; + }, + + cache: true + } + }); + + +endSection() ?> diff --git a/ci4/app/Views/themes/backend/vuexy/form/configuracion/provincias/viewProvinciaList.php b/ci4/app/Views/themes/backend/vuexy/form/configuracion/provincias/viewProvinciaList.php new file mode 100644 index 00000000..81f9c292 --- /dev/null +++ b/ci4/app/Views/themes/backend/vuexy/form/configuracion/provincias/viewProvinciaList.php @@ -0,0 +1,190 @@ +include('Themes/_commonPartialsBs/select2bs5') ?> +include('Themes/_commonPartialsBs/datatables') ?> +include('Themes/_commonPartialsBs/sweetalert') ?> +extend('Themes/'.config('Basics')->theme['name'].'/AdminLayout/defaultLayout') ?> +section('content'); ?> +
+
+ +
+
+

+
+
+ + + + + + + + + + + + + + + + + + +
+
+ +
+
+
+ +endSection() ?> + + +section('additionalInlineJs') ?> + + const lastColNr = $('#tableOfProvincias').find("tr:first th").length - 1; + const actionBtns = function(data) { + return ` +
+ + +
+ `; + }; + theTable = $('#tableOfProvincias').DataTable({ + processing: true, + serverSide: true, + autoWidth: true, + responsive: true, + scrollX: true, + lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ], + pageLength: 10, + lengthChange: true, + "dom": 'lfrtipB', // 'lfBrtip', // you can try different layout combinations by uncommenting one or the other + // "dom": '<"top"lf><"clear">rt<"bottom"ipB><"clear">', // remember to comment this line if you uncomment the above + "buttons": [ + 'copy', 'csv', 'excel', 'print', { + extend: 'pdfHtml5', + orientation: 'landscape', + pageSize: 'A4' + } + ], + stateSave: true, + order: [[1, 'asc']], + language: { + url: "/assets/dt/languages[$currentLocale] ?? config('Basics')->i18n ?>.json" + }, + ajax : $.fn.dataTable.pipeline( { + url: '', + method: 'POST', + headers: {'X-Requested-With': 'XMLHttpRequest'}, + async: true, + }), + columnDefs: [ + { + orderable: false, + searchable: false, + targets: [0,lastColNr] + } + ], + columns : [ + { 'data': actionBtns }, + { 'data': 'id' }, + { 'data': 'code' }, + { 'data': 'nombre' }, + { 'data': 'pais' }, + { 'data': 'created_at' }, + { 'data': 'updated_at' }, + { 'data': actionBtns } + ] + }); + + + theTable.on( 'draw.dt', function () { + + const dateCols = [5, 6]; + const shortDateFormat = ''; + const dateTimeFormat = ''; + + for (let coln of dateCols) { + theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) { + const datestr = cell.innerHTML; + const dateStrLen = datestr.toString().trim().length; + if (dateStrLen > 0) { + let dateTimeParts= datestr.split(/[- :]/); // regular expression split that creates array with: year, month, day, hour, minutes, seconds values + dateTimeParts[1]--; // monthIndex begins with 0 for January and ends with 11 for December so we need to decrement by one + const d = new Date(...dateTimeParts); // new Date(datestr); + const md = moment(d); + const usingThisFormat = dateStrLen > 11 ? dateTimeFormat : shortDateFormat; + const formattedDateStr = md.format(usingThisFormat); + cell.innerHTML = formattedDateStr; + } + }); + } + }); + +$(document).on('click', '.btn-edit', function(e) { + window.location.href = `/${$(this).attr('data-id')}/edit`; + }); + +$(document).on('click', '.btn-delete', function(e) { + Swal.fire({ + title: '', + text: '', + icon: 'warning', + showCancelButton: true, + confirmButtonColor: '#3085d6', + confirmButtonText: '', + cancelButtonText: '', + cancelButtonColor: '#d33' + }) + .then((result) => { + const dataId = $(this).data('id'); + const row = $(this).closest('tr'); + if (result.value) { + $.ajax({ + url: `/${dataId}`, + method: 'DELETE', + }).done((data, textStatus, jqXHR) => { + Toast.fire({ + icon: 'success', + title: data.msg ?? jqXHR.statusText, + }); + + theTable.clearPipeline(); + theTable.row($(row)).invalidate().draw(); + }).fail((jqXHR, textStatus, errorThrown) => { + Toast.fire({ + icon: 'error', + title: jqXHR.responseJSON.messages.error, + }); + }) + } + }); + }); + + + + +endSection() ?> + + +section('css') ?> + +endSection() ?> + + +section('additionalExternalJs') ?> + + + + + + + + + + +endSection() ?> + diff --git a/ci4/app/Views/themes/backend/vuexy/form/tarifas/manipulado/viewTarifaManipuladoForm.php b/ci4/app/Views/themes/backend/vuexy/form/tarifas/manipulado/viewTarifaManipuladoForm.php index 6338f822..e5ca200a 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/tarifas/manipulado/viewTarifaManipuladoForm.php +++ b/ci4/app/Views/themes/backend/vuexy/form/tarifas/manipulado/viewTarifaManipuladoForm.php @@ -2,6 +2,7 @@ include("themes/_commonPartialsBs/select2bs5") ?> include("themes/_commonPartialsBs/sweetalert") ?> extend('themes/backend/vuexy/main/defaultlayout') ?> + section("content") ?>
diff --git a/ci4/app/Views/themes/backend/vuexy/form/tarifas/manipulado/viewTarifaManipuladoList.php b/ci4/app/Views/themes/backend/vuexy/form/tarifas/manipulado/viewTarifaManipuladoList.php index 383e781a..9f51f7e6 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/tarifas/manipulado/viewTarifaManipuladoList.php +++ b/ci4/app/Views/themes/backend/vuexy/form/tarifas/manipulado/viewTarifaManipuladoList.php @@ -37,65 +37,64 @@ section('additionalInlineJs') ?> - const lastColNr = $('#tableOfTarifasmanipulado').find("tr:first th").length - 1; - const actionBtns = function(data) { - return ` -
- - -
- `; - }; - theTable = $('#tableOfTarifasmanipulado').DataTable({ - processing: true, - serverSide: true, - autoWidth: true, - responsive: true, - scrollX: true, - lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ], - pageLength: 10, - lengthChange: true, - "dom": 'lfBrtip', - "buttons": [ - 'copy', 'csv', 'excel', 'print', { - extend: 'pdfHtml5', - orientation: 'landscape', - pageSize: 'A4' - } - ], - stateSave: true, - order: [[0, 'asc']], - language: { - url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/i18n ?>.json" - }, - ajax : $.fn.dataTable.pipeline( { - url: '', - method: 'POST', - headers: {'X-Requested-With': 'XMLHttpRequest'}, - async: true, - }), - columnDefs: [ - { - orderable: false, - searchable: false, - targets: [lastColNr] - } - ], - columns : [ - { 'data': 'nombre' }, - { 'data': actionBtns } - ] - }); + const lastColNr = $('#tableOfTarifasmanipulado').find("tr:first th").length - 1; + const actionBtns = function(data) { + return ` +
+ + +
+ `; + }; - - + theTable = $('#tableOfTarifasmanipulado').DataTable({ + processing: true, + serverSide: true, + autoWidth: true, + responsive: true, + scrollX: true, + lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ], + pageLength: 10, + lengthChange: true, + "dom": 'lfBrtip', + "buttons": [ + 'copy', 'csv', 'excel', 'print', { + extend: 'pdfHtml5', + orientation: 'landscape', + pageSize: 'A4' + } + ], + stateSave: true, + order: [[0, 'asc']], + language: { + url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/i18n ?>.json" + }, + ajax : $.fn.dataTable.pipeline( { + url: '', + method: 'POST', + headers: {'X-Requested-With': 'XMLHttpRequest'}, + async: true, + }), + columnDefs: [ + { + orderable: false, + searchable: false, + targets: [lastColNr] + } + ], + columns : [ + { 'data': 'nombre' }, + { 'data': actionBtns } + ] + }); -$(document).on('click', '.btn-edit', function(e) { + + $(document).on('click', '.btn-edit', function(e) { //window.location.href = `/${$(this).attr('data-id')}/edit`; window.location.href = `/tarifas/tarifasmanipulado/edit/${$(this).attr('data-id')}`; }); -$(document).on('click', '.btn-delete', function(e) { + $(document).on('click', '.btn-delete', function(e) { Swal.fire({ title: '', text: '', @@ -132,8 +131,6 @@ $(document).on('click', '.btn-delete', function(e) { } }); }); - - endSection() ?> diff --git a/ci4/app/Views/themes/frontend/tivo/main/footer.php b/ci4/app/Views/themes/frontend/tivo/main/footer.php deleted file mode 100644 index 419a570b..00000000 --- a/ci4/app/Views/themes/frontend/tivo/main/footer.php +++ /dev/null @@ -1,41 +0,0 @@ - - - - -
- - \ No newline at end of file diff --git a/ci4/app/Views/themes/frontend/tivo/main/header.php b/ci4/app/Views/themes/frontend/tivo/main/header.php deleted file mode 100644 index c77ff987..00000000 --- a/ci4/app/Views/themes/frontend/tivo/main/header.php +++ /dev/null @@ -1,130 +0,0 @@ -get('settings'); -$picture = session()->get('picture'); -$pulse = session()->get('pulse'); -$notification = session()->get('notification'); -?> - - - - - - - <?= lang("App.dashboard_title") ?> - <?= $settings['title']??'' ?> - - - - - - - - - - - - - - - -
-
-
-
-
-
-
- -
- - - - - - diff --git a/ci4/app/Views/themes/frontend/tivo/main/menu.php b/ci4/app/Views/themes/frontend/tivo/main/menu.php deleted file mode 100644 index b566d716..00000000 --- a/ci4/app/Views/themes/frontend/tivo/main/menu.php +++ /dev/null @@ -1,61 +0,0 @@ - - -
-
- -
-
\ No newline at end of file