Añadida funcion clientes desde ozar

This commit is contained in:
imnavajas
2023-07-12 12:35:31 +02:00
parent 42a20b93b0
commit 90d63432d6
49 changed files with 3119 additions and 970 deletions

View File

@ -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']);
/*

View File

@ -1,4 +1,4 @@
<?php namespace App\Controllers\Clientes;
<?php namespace App\Controllers\Clientes;
use App\Controllers\GoBaseResourceController;
@ -9,12 +9,17 @@ use App\Entities\Clientes\ClienteEntity;
use App\Models\Clientes\ClienteModel;
use App\Models\Configuracion\FormasPagoModel;
use App\Models\Configuracion\ProvinciaModel;
use App\Models\Configuracion\UserModel;
use App\Models\Configuracion\ComunidadAutonomaModel;
use App\Models\Configuracion\FormaPagoModel;
use App\Models\Configuracion\PaisModel;
class Cliente extends \App\Controllers\GoBaseResourceController
{
class Cliente extends \App\Controllers\GoBaseResourceController {
protected $modelName = ClienteModel::class;
protected $format = 'json';
@ -24,19 +29,19 @@ class Cliente extends \App\Controllers\GoBaseResourceController
protected static $pluralObjectName = 'Clientes';
protected static $pluralObjectNameCc = 'clientes';
protected static $controllerSlug = 'clientes';
protected static $controllerSlug = 'cliente';
protected static $viewPath = 'themes/backend/vuexy/form/clientes/';
protected static $viewPath = 'themes/backend/vuexy/form/clientes/cliente/';
protected $indexRoute = 'clienteList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
$this->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;
}
}

View File

@ -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;
}

View File

@ -0,0 +1,271 @@
<?php namespace App\Controllers\Configuracion;
use App\Controllers\GoBaseResourceController;
use App\Models\Collection;
use App\Entities\Configuracion\FormaPagoEntity;
use App\Models\Configuracion\FormaPagoModel;
class Formaspagos extends \App\Controllers\GoBaseResourceController {
protected $modelName = FormaPagoModel::class;
protected $format = 'json';
protected static $singularObjectName = 'Forma de Pago';
protected static $singularObjectNameCc = 'formaDePago';
protected static $pluralObjectName = 'Formas de Pagos';
protected static $pluralObjectNameCc = 'formasDePagos';
protected static $controllerSlug = 'formas-pagos';
protected static $viewPath = 'themes/backend/vuexy/form/configuracion/formasPagoViews/';
protected $indexRoute = 'formaDePagoList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
$this->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);
}
}
}

View File

@ -1,19 +1,27 @@
<?php namespace App\Controllers\Configuracion;
use App\Entities\Configuracion\Pais;
class Paises extends \App\Controllers\GoBaseController {
use App\Controllers\GoBaseResourceController;
use \CodeIgniter\API\ResponseTrait;
use App\Models\Collection;
protected static $primaryModelName = 'App\Models\Configuracion\PaisModel';
use App\Entities\Configuracion\PaisEntity;
use App\Models\Configuracion\PaisModel;
class Paises extends \App\Controllers\GoBaseResourceController {
protected $modelName = PaisModel::class;
protected $format = 'json';
protected static $singularObjectNameCc = 'pais';
protected static $singularObjectName = 'Pais';
protected static $singularObjectNameCc = 'pais';
protected static $pluralObjectName = 'Paises';
protected static $pluralObjectNameCc = 'paises';
protected static $controllerSlug = 'paises';
static $viewPath = '';
protected static $viewPath = 'themes/backend/vuexy/form/configuracion/paises/';
protected $indexRoute = 'paisList';
@ -21,21 +29,27 @@ class Paises extends \App\Controllers\GoBaseController {
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
$this->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);
}
}
}

View File

@ -0,0 +1,289 @@
<?php namespace App\Controllers\Configuracion;
use App\Controllers\GoBaseResourceController;
use App\Models\Collection;
use App\Entities\Configuracion\ProvinciaEntity;
use App\Models\Configuracion\PaisModel;
use App\Models\Configuracion\ProvinciaModel;
class Provincias extends \App\Controllers\GoBaseResourceController {
protected $modelName = ProvinciaModel::class;
protected $format = 'json';
protected static $singularObjectName = 'Provincia';
protected static $singularObjectNameCc = 'provincia';
protected static $pluralObjectName = 'Provincias';
protected static $pluralObjectNameCc = 'provincias';
protected static $controllerSlug = 'provincias';
protected static $viewPath = 'themes/backend/vuexy/form/configuracion/provincias/';
protected $indexRoute = 'provinciaList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
$this->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;
}
}

View File

@ -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",
];

View File

@ -0,0 +1,18 @@
<?php
namespace App\Entities\Configuracion;
use CodeIgniter\Entity;
class ComunidadAutonomaEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"nombre" => null,
"pais_id" => null,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [
"pais_id" => "int",
];
}

View File

@ -0,0 +1,15 @@
<?php
namespace App\Entities\Configuracion;
use CodeIgniter\Entity;
class FormaPagoEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"nombre" => null,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [];
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Entities\Configuracion;
use CodeIgniter\Entity;
class ProvinciaEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"code" => null,
"nombre" => null,
"pais_id" => 1,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [
"pais_id" => "int",
];
}

View File

@ -0,0 +1,233 @@
<?php
return [
'alias' => '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.',
],
],
];

View File

@ -0,0 +1,34 @@
<?php
return [
'comunidadAutonoma' => '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.',
],
],
];

View File

@ -0,0 +1,35 @@
<?php
return [
'createdAt' => '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.',
],
],
];

View File

@ -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.',

View File

@ -0,0 +1,44 @@
<?php
return [
'code' => '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.',
],
],
];

View File

@ -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.',
],

View File

@ -1,29 +1,34 @@
<?php
return [
'comunidadAutonoma' => '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.',
],
],
],
];

View File

@ -1,7 +1,7 @@
<?php
return [
'createdAt' => '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.',
],

View File

@ -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.',

View File

@ -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' => [

View File

@ -0,0 +1,44 @@
<?php
return [
'code' => '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.',
],
],
];

View File

@ -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.',
],

View File

@ -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.',
],

View File

@ -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.',
],

View File

@ -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();
}
}

View File

@ -0,0 +1,97 @@
<?php
namespace App\Models\Configuracion;
class ComunidadAutonomaModel extends \App\Models\GoBaseModel
{
protected $table = "lg_comunidades_autonomas";
/**
* Whether primary key uses auto increment.
*
* @var bool
*/
protected $useAutoIncrement = true;
const SORTABLE = [
1 => "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();
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace App\Models\Configuracion;
class FormaPagoModel extends \App\Models\GoBaseModel
{
protected $table = "lg_formas_pago";
/**
* Whether primary key uses auto increment.
*
* @var bool
*/
protected $useAutoIncrement = true;
const SORTABLE = [
1 => "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();
}
}

View File

@ -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();
}
}

View File

@ -0,0 +1,109 @@
<?php
namespace App\Models\Configuracion;
class ProvinciaModel extends \App\Models\GoBaseModel
{
protected $table = "lg_provincias";
/**
* Whether primary key uses auto increment.
*
* @var bool
*/
protected $useAutoIncrement = true;
const SORTABLE = [
1 => "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();
}
}

View File

@ -16,6 +16,14 @@
value="<?= old('alias', $clienteEntity->alias) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="cif" class="form-label">
<?= lang('Clientes.cif') ?>*
</label>
<input type="text" id="cif" name="cif" required maxLength="50" class="form-control"
value="<?= old('cif', $clienteEntity->cif) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="direccion" class="form-label">
<?= lang('Clientes.direccion') ?>
@ -36,17 +44,33 @@
<label for="comunidadAutonomaId" class="form-label">
<?= lang('Clientes.comunidadAutonomaId') ?>
</label>
<select id="comunidadAutonomaId" name="comunidad_autonoma_id">
<option value="" selected="selected"><?= lang('Basic.global.pleaseSelectOne') ?></option>
<select id="comunidadAutonomaId" name="comunidad_autonoma_id" class="select2 form-control"
style="width: 100%;">
<?php if (isset($comunidadAutonomaList) && is_array($comunidadAutonomaList) && !empty($comunidadAutonomaList)) :
foreach ($comunidadAutonomaList as $k => $v) : ?>
<option value="<?= $k ?>"<?= $k == $clienteEntity->comunidad_autonoma_id ? ' selected' : '' ?>>
<?= $v ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="provincia" class="form-label">
<?= lang('Clientes.provincia') ?>
<label for="provinciaId" class="form-label">
<?= lang('Clientes.provinciaId') ?>*
</label>
<input type="text" id="provincia" name="provincia" maxLength="100" class="form-control"
value="<?= old('provincia', $clienteEntity->provincia) ?>">
<select id="provinciaId" name="provincia_id" required class="form-control select2" style="width: 100%;">
<?php if (isset($provinciaList) && is_array($provinciaList) && !empty($provinciaList)) :
foreach ($provinciaList as $k => $v) : ?>
<option value="<?= $k ?>"<?= $k == $clienteEntity->provincia_id ? ' selected' : '' ?>>
<?= $v ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
@ -61,14 +85,15 @@
<label for="paisId" class="form-label">
<?= lang('Clientes.paisId') ?>
</label>
<select id="paisId" name="pais_id" class="form-control select2bs" style="width: 100%;">
<option value=""><?= lang('Basic.global.pleaseSelectA', [lang('Clientes.paisId')]) ?></option>
<select id="paisId" name="pais_id" class="form-control select2" style="width: 100%;">
<?php foreach ($paisList as $item) : ?>
<option value="<?= $item->id ?>"<?= $item->id == $clienteEntity->pais_id ? ' selected' : '' ?>>
<?= $item->nombre ?>
</option>
<?php endforeach; ?>
<?php if (isset($paisList) && is_array($paisList) && !empty($paisList)) :
foreach ($paisList as $k => $v) : ?>
<option value="<?= $k ?>"<?= $k == $clienteEntity->pais_id ? ' selected' : '' ?>>
<?= $v ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div><!--//.mb-3 -->
@ -89,33 +114,50 @@
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="salesmanId" class="form-label">
<?= lang('Clientes.salesmanId') ?>*
<label for="comercialId" class="form-label">
<?= lang('Clientes.comercialId') ?>*
</label>
<input type="number" id="salesmanId" name="salesman_id" required placeholder="1" maxLength="10"
class="form-control" value="<?= old('salesman_id', $clienteEntity->salesman_id) ?>">
<select id="comercialId" name="comercial_id" required class="form-control select2" style="width: 100%;">
<?php if (isset($userList) && is_array($userList) && !empty($userList)) :
foreach ($userList as $k => $v) : ?>
<option value="<?= $k ?>"<?= $k == $clienteEntity->comercial_id ? ' selected' : '' ?>>
<?= $v ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="soporteId" class="form-label">
<?= lang('Clientes.soporteId') ?>
<?= lang('Clientes.soporteId') ?>*
</label>
<input type="number" id="soporteId" name="soporte_id" maxLength="10" class="form-control"
value="<?= old('soporte_id', $clienteEntity->soporte_id) ?>">
<select id="soporteId" name="soporte_id" required class="form-control select2" style="width: 100%;">
<?php if (isset($userList2) && is_array($userList2) && !empty($userList2)) :
foreach ($userList2 as $k => $v) : ?>
<option value="<?= $k ?>"<?= $k == $clienteEntity->soporte_id ? ' selected' : '' ?>>
<?= $v ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="formaPagoId" class="form-label">
<?= lang('Clientes.formaPagoId') ?>
</label>
<select id="formaPagoId" name="forma_pago_id" class="form-control select2" style="width: 100%;">
<select id="formaPagoId" name="forma_pago_id" class="form-control select2bs" style="width: 100%;">
<option value=""><?= lang('Basic.global.pleaseSelectA', [lang('Clientes.formaPagoId')]) ?></option>
<?php foreach ($formaPagoList as $item) : ?>
<option value="<?= $item->id ?>"<?= $item->id == $clienteEntity->forma_pago_id ? ' selected' : '' ?>>
<?= $item->nombre ?>
</option>
<?php endforeach; ?>
<?php if (isset($formaDePagoList) && is_array($formaDePagoList) && !empty($formaDePagoList)) :
foreach ($formaDePagoList as $k => $v) : ?>
<option value="<?= $k ?>"<?= $k == $clienteEntity->forma_pago_id ? ' selected' : '' ?>>
<?= $v ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div><!--//.mb-3 -->
@ -128,11 +170,11 @@
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="fechavencimiento" class="form-label">
<?= lang('Clientes.fechavencimiento') ?>
<label for="fechaVencimiento" class="form-label">
<?= lang('Clientes.fechaVencimiento') ?>
</label>
<input type="text" id="fechavencimiento" name="fechaVencimiento" maxLength="100" class="form-control"
value="<?= old('fechaVencimiento', $clienteEntity->fechaVencimiento) ?>">
<input type="text" id="fechaVencimiento" name="fecha_vencimiento" maxLength="100" class="form-control"
value="<?= old('fecha_vencimiento', $clienteEntity->fecha_vencimiento) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
@ -186,23 +228,23 @@
value="<?= old('limite_credito_change_at', $clienteEntity->limite_credito_change_at) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="creditoSolunion" class="form-label">
<?= lang('Clientes.creditoSolunion') ?>
</label>
<input type="text" id="creditoSolunion" name="credito_solunion" maxLength="100" class="form-control"
value="<?= old('credito_solunion', $clienteEntity->credito_solunion) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
<div class="col-md-12 col-lg-6 px-4">
<div class="mb-3">
<label for="creditosolunion" class="form-label">
<?= lang('Clientes.creditosolunion') ?>
</label>
<input type="text" id="creditosolunion" name="creditoSolunion" maxLength="100" class="form-control"
value="<?= old('creditoSolunion', $clienteEntity->creditoSolunion) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="creditoasegurado" class="form-check-label">
<input type="checkbox" id="creditoasegurado" name="creditoAsegurado" value="1"
class="form-check-input"<?= $clienteEntity->creditoAsegurado == true ? 'checked' : ''; ?>>
<?= lang('Clientes.creditoasegurado') ?>
<label for="creditoAsegurado" class="form-check-label">
<input type="checkbox" id="creditoAsegurado" name="credito_asegurado" value="1"
class="form-check-input"<?= $clienteEntity->credito_asegurado == true ? 'checked' : ''; ?>>
<?= lang('Clientes.creditoAsegurado') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
@ -216,11 +258,11 @@
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="cccCustomer" class="form-label">
<?= lang('Clientes.cccCustomer') ?>
<label for="cccCliente" class="form-label">
<?= lang('Clientes.cccCliente') ?>
</label>
<input type="text" id="cccCustomer" name="ccc_customer" maxLength="100" class="form-control"
value="<?= old('ccc_customer', $clienteEntity->ccc_customer) ?>">
<input type="text" id="cccCliente" name="ccc_cliente" maxLength="100" class="form-control"
value="<?= old('ccc_cliente', $clienteEntity->ccc_cliente) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
@ -352,6 +394,14 @@
class="form-control"><?= old('comentarios', $clienteEntity->comentarios) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="isDeleted" class="form-label">
<?= lang('Clientes.isDeleted') ?>*
</label>
<input type="number" id="isDeleted" name="is_deleted" required placeholder="0" maxLength="4"
class="form-control" value="<?= old('is_deleted', $clienteEntity->is_deleted) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="userCreatedId" class="form-label">
<?= lang('Clientes.userCreatedId') ?>*

View File

@ -0,0 +1,212 @@
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
<?=$this->extend('themes/backend/vuexy/main/defaultlayout') ?>
<?= $this->section("content") ?>
<div class="row">
<div class="col-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
</div><!--//.card-header -->
<form id="clienteForm" method="post" class="card-body" action="<?= $formAction ?>">
<?= csrf_field() ?>
<div class="card-body">
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
<?= view("themes/backend/vuexy/form/clientes/cliente/_clienteFormItems") ?>
</div><!-- /.card-body -->
<div class="pt-4">
<input
type="submit"
class="btn btn-primary float-start me-sm-3 me-1"
name="save"
value="<?= lang("Basic.global.Save") ?>"
>
<?= anchor(route_to("clienteList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
</div><!-- /.card-footer -->
</form>
</div><!-- //.card -->
</div><!--//.col -->
</div><!--//.row -->
<?= $this->endSection() ?>
<?= $this->section("additionalInlineJs") ?>
$('#soporteId').select2({
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfUsers") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id_user',
text: 'first_name',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#formaPagoId').select2({
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfFormasDePagos") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#paisId').select2({
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfPaises") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#provinciaId').select2({
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfProvincias") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#comunidadAutonomaId').select2({
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfComunidadesAutonomas") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
$('#comercialId').select2({
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfUsers") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id_user',
text: 'first_name',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
<?= $this->endSection() ?>

View File

@ -1,26 +1,26 @@
<?=$this->include('themes/_commonPartialsBs/select2bs5') ?>
<?=$this->include('themes/_commonPartialsBs/datatables') ?>
<?=$this->include('themes/_commonPartialsBs/sweetalert') ?>
<?=$this->extend('themes/backend/vuexy/main/defaultlayout') ?>
<?=$this->section('content'); ?>
<div class="row">
<div class="col-md-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?=lang('Clientes.clienteList') ?></h3>
<?=anchor(route_to('newCliente'), lang('Basic.global.addNew').' '.lang('Clientes.cliente'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-header -->
<div class="card-body">
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableOfClientes" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('Clientes.nombre') ?></th>
<th><?= lang('Clientes.alias') ?></th>
<th><?= lang('Clientes.cif') ?></th>
<th><?= lang('Clientes.email') ?></th>
<th><?= lang('Clientes.salesmanId') ?></th>
<th><?= lang('FormasPago.formaPago') ?></th>
<th><?= lang('Users.comercial') ?></th>
<th><?= lang('FormasPagoes.formaDePago') ?></th>
<th><?= lang('Clientes.vencimiento') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
@ -31,7 +31,6 @@
</table>
</div><!--//.card-body -->
<div class="card-footer">
<?=anchor(route_to('newCliente'), lang('Basic.global.addNew').' '.lang('Clientes.cliente'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-footer -->
</div><!--//.card -->
</div><!--//.col -->
@ -41,68 +40,72 @@
<?=$this->section('additionalInlineJs') ?>
const lastColNr = $('#tableOfClientes').find("tr:first th").length - 1;
const actionBtns = function(data) {
return `
<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i>
<i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i>
</div>
</td>`;
};
const lastColNr = $('#tableOfClientes').find("tr:first th").length - 1;
const actionBtns = function(data) {
return `<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<button class="btn btn-sm btn-warning btn-edit me-1" data-id="${data.id}"><?= lang('Basic.global.edit') ?></button>
<button class="btn btn-sm btn-danger btn-delete ms-1" data-id="${data.id}"><?= lang('Basic.global.Delete') ?></button>
</div>
</td>`;
};
theTable = $('#tableOfClientes').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: [[1, 'asc']],
language: {
url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/<?= config('Basics')->i18n ?>.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= site_url('cliente/datatable') ?>',
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columnDefs: [
{
orderable: false,
searchable: false,
targets: [lastColNr]
}
],
columns : [
{ 'data': 'nombre' },
{ 'data': 'alias' },
{ 'data': 'email' },
{ 'data': 'salesman_id' },
{ 'data': 'forma_pago' },
{ 'data': 'vencimiento' },
{ 'data': actionBtns }
]
});
$(document).on('click', '.btn-edit', function(e) {
window.location.href = `<?= route_to('clienteList') ?>/${$(this).attr('data-id')}/edit`;
theTable = $('#tableOfClientes').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/<?= config('Basics')->i18n ?>.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfClientes') ?>',
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columnDefs: [
{
orderable: false,
searchable: false,
targets: [lastColNr]
}
],
columns : [
{ 'data': 'nombre' },
{ 'data': 'alias' },
{ 'data': 'cif' },
{ 'data': 'email' },
{ 'data': 'comercial' },
{ 'data': 'forma_pago_id' },
{ 'data': 'vencimiento' },
{ 'data': actionBtns }
]
});
$(document).on('click', '.btn-delete', function(e) {
$(document).on('click', '.btn-edit', function(e) {
//window.location.href = `<?= site_url('/cliente/edit') ?>/${$(this).attr('data-id')}/edit`;
window.location.href = `/clientes/cliente/edit/${$(this).attr('data-id')}`;
});
$(document).on('click', '.btn-delete', function(e) {
Swal.fire({
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Clientes.cliente'))]) ?>',
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
@ -125,7 +128,7 @@ $(document).on('click', '.btn-delete', function(e) {
icon: 'success',
title: data.msg ?? jqXHR.statusText,
});
theTable.clearPipeline();
theTable.row($(row)).invalidate().draw();
}).fail((jqXHR, textStatus, errorThrown) => {
@ -137,11 +140,14 @@ $(document).on('click', '.btn-delete', function(e) {
}
});
});
<?=$this->endSection() ?>
<?=$this->section('css') ?>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.bootstrap5.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.bootstrap5.min.css">
<?=$this->endSection() ?>
@ -153,5 +159,5 @@ $(document).on('click', '.btn-delete', function(e) {
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.0/jszip.min.js" integrity="sha512-xcHCGC5tQ0SHlRX8Anbz6oy/OullASJkEhb4gjkneVpGE3/QGYejf14CUO5n5q5paiHfRFTa9HKgByxzidw2Bw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/pdfmake.min.js" integrity="sha512-rDbVu5s98lzXZsmJoMa0DjHNE+RwPJACogUCLyq3Xxm2kJO6qsQwjbE5NDk2DqmlKcxDirCnU1wAzVLe12IM3w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/vfs_fonts.js" integrity="sha512-cktKDgjEiIkPVHYbn8bh/FEyYxmt4JDJJjOCu5/FQAkW4bc911XtKYValiyzBiJigjVEvrIAyQFEbRJZyDA1wQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<?= $this->endSection() ?>
<?=$this->endSection() ?>

View File

@ -4,21 +4,22 @@
<label for="nombre" class="form-label">
<?=lang('ComunidadesAutonomas.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="100" class="form-control" value="<?=old('nombre', $comunidadesAutonomasEntity->nombre) ?>">
<input type="text" id="nombre" name="nombre" required maxLength="100" class="form-control" value="<?=old('nombre', $comunidadAutonomaEntity->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="paisId" class="form-label">
<?=lang('ComunidadesAutonomas.pais') ?>*
<?=lang('ComunidadesAutonomas.paisId') ?>*
</label>
<select id="paisId" name="pais_id" required class="form-control select2bs" style="width: 100%;" >
<option value=""><?=lang('Basic.global.pleaseSelectA', [lang('ComunidadesAutonomas.pais')]) ?></option>
<select id="paisId" name="pais_id" required class="form-control select2bs2" style="width: 100%;" >
<?php foreach ($paisList as $item) : ?>
<option value="<?=$item->id ?>"<?=$item->id==$comunidadesAutonomasEntity->pais_id ? ' selected':'' ?>>
<?=$item->nombre ?>
<?php if ( isset($paisList) && is_array($paisList) && !empty($paisList) ) :
foreach ($paisList as $k => $v) : ?>
<option value="<?=$k ?>"<?=$k==$comunidadAutonomaEntity->pais_id ? ' selected':'' ?>>
<?=$v ?>
</option>
<?php endforeach; ?>
<?php endforeach;
endif; ?>
</select>
</div><!--//.mb-3 -->

View File

@ -26,3 +26,40 @@
</div><!--//.col -->
</div><!--//.row -->
<?= $this->endSection() ?>
<?= $this->section("additionalInlineJs") ?>
$('#paisId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfPaises") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'id',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
<?= $this->endSection() ?>

View File

@ -1,3 +1,4 @@
<?=$this->include('Themes/_commonPartialsBs/select2bs5') ?>
<?=$this->include('Themes/_commonPartialsBs/datatables') ?>
<?=$this->include('Themes/_commonPartialsBs/sweetalert') ?>
<?=$this->extend('Themes/'.config('Basics')->theme['name'].'/AdminLayout/defaultLayout') ?>

View File

@ -0,0 +1,12 @@
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('FormasPagoes.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control" value="<?=old('nombre', $formaPagoEntity->nombre) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -1,7 +1,6 @@
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
<?=$this->extend('themes/backend/vuexy/main/defaultlayout') ?>
<?= $this->include("Themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("Themes/_commonPartialsBs/sweetalert") ?>
<?= $this->extend("Themes/" . config("Basics")->theme["name"] . "/AdminLayout/defaultLayout") ?>
<?= $this->section("content") ?>
<div class="row">
<div class="col-12">
@ -9,15 +8,15 @@
<div class="card-header">
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
</div><!--//.card-header -->
<form id="clienteForm" method="post" action="<?= $formAction ?>">
<form id="formaDePagoForm" method="post" action="<?= $formAction ?>">
<?= csrf_field() ?>
<div class="card-body">
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
<?= view("Themes/_commonPartialsBs/_alertBoxes") ?>
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
<?= view("themes/backend/vuexy/form/clientes/_clienteFormItems") ?>
<?= view("themes/backend/vuexy/form/configuracion/formasPagoViews/_formaDePagoFormItems") ?>
</div><!-- /.card-body -->
<div class="card-footer">
<?= anchor(route_to("clienteList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
<?= anchor(route_to("formaDePagoList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
<input type="submit" class="btn btn-primary float-end" name="save" value="<?= lang("Basic.global.Save") ?>">
</div><!-- /.card-footer -->
</form>

View File

@ -0,0 +1,185 @@
<?=$this->include('Themes/_commonPartialsBs/datatables') ?>
<?=$this->include('Themes/_commonPartialsBs/sweetalert') ?>
<?=$this->extend('Themes/'.config('Basics')->theme['name'].'/AdminLayout/defaultLayout') ?>
<?=$this->section('content'); ?>
<div class="row">
<div class="col-md-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?=lang('FormasPagoes.formaDePagoList') ?></h3>
</div><!--//.card-header -->
<div class="card-body">
<?= view('Themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableOfFormasdepagos" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
<th><?=lang('FormasPagoes.id')?></th>
<th><?= lang('FormasPagoes.nombre') ?></th>
<th><?= lang('FormasPagoes.createdAt') ?></th>
<th><?= lang('FormasPagoes.updatedAt') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div><!--//.card-body -->
<div class="card-footer">
<?=anchor(route_to('newFormaDePago'), lang('Basic.global.addNew').' '.lang('FormasPagoes.formaDePago'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-footer -->
</div><!--//.card -->
</div><!--//.col -->
</div><!--//.row -->
<?=$this->endSection() ?>
<?=$this->section('additionalInlineJs') ?>
const lastColNr = $('#tableOfFormasdepagos').find("tr:first th").length - 1;
const actionBtns = function(data) {
return `<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<button class="btn btn-sm btn-warning btn-edit me-1" data-id="${data.id}"><?= lang('Basic.global.edit') ?></button>
<button class="btn btn-sm btn-danger btn-delete ms-1" data-id="${data.id}"><?= lang('Basic.global.Delete') ?></button>
</div>
</td>`;
};
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/<?= config('Basics')->languages[$currentLocale] ?? config('Basics')->i18n ?>.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfFormasDePagos') ?>',
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 = '<?= convertPhpDateToMomentFormat('mm/dd/YYYY')?>';
const dateTimeFormat = '<?= convertPhpDateToMomentFormat('mm/dd/YYYY h:i a')?>';
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 = `<?= route_to('formaDePagoList') ?>/${$(this).attr('data-id')}/edit`;
});
$(document).on('click', '.btn-delete', function(e) {
Swal.fire({
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('FormasPagoes.forma de pago'))]) ?>',
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
cancelButtonColor: '#d33'
})
.then((result) => {
const dataId = $(this).data('id');
const row = $(this).closest('tr');
if (result.value) {
$.ajax({
url: `<?= route_to('formaDePagoList') ?>/${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,
});
})
}
});
});
<?=$this->endSection() ?>
<?=$this->section('css') ?>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.css">
<?=$this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.0/jszip.min.js" integrity="sha512-xcHCGC5tQ0SHlRX8Anbz6oy/OullASJkEhb4gjkneVpGE3/QGYejf14CUO5n5q5paiHfRFTa9HKgByxzidw2Bw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/pdfmake.min.js" integrity="sha512-rDbVu5s98lzXZsmJoMa0DjHNE+RwPJACogUCLyq3Xxm2kJO6qsQwjbE5NDk2DqmlKcxDirCnU1wAzVLe12IM3w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/vfs_fonts.js" integrity="sha512-cktKDgjEiIkPVHYbn8bh/FEyYxmt4JDJJjOCu5/FQAkW4bc911XtKYValiyzBiJigjVEvrIAyQFEbRJZyDA1wQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<?=$this->endSection() ?>

View File

@ -4,28 +4,28 @@
<label for="nombre" class="form-label">
<?=lang('Paises.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control" value="<?=old('nombre', $pais->nombre) ?>">
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control" value="<?=old('nombre', $paisEntity->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="code" class="form-label">
<?=lang('Paises.code') ?>*
</label>
<input type="text" id="code" name="code" required maxLength="2" class="form-control" value="<?=old('code', $pais->code) ?>">
<input type="text" id="code" name="code" required maxLength="2" class="form-control" value="<?=old('code', $paisEntity->code) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="code3" class="form-label">
<?=lang('Paises.code3') ?>
</label>
<input type="text" id="code3" name="code3" maxLength="3" class="form-control" value="<?=old('code3', $pais->code3) ?>">
<input type="text" id="code3" name="code3" maxLength="3" class="form-control" value="<?=old('code3', $paisEntity->code3) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="moneda" class="form-label">
<?=lang('Paises.moneda') ?>*
</label>
<input type="text" id="moneda" name="moneda" required maxLength="3" class="form-control" value="<?=old('moneda', $pais->moneda) ?>">
<input type="text" id="moneda" name="moneda" required maxLength="3" class="form-control" value="<?=old('moneda', $paisEntity->moneda) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
@ -34,28 +34,28 @@
<label for="urlErp" class="form-label">
<?=lang('Paises.urlErp') ?>
</label>
<input type="url" id="urlErp" name="url_erp" maxLength="255" class="form-control" value="<?=old('url_erp', $pais->url_erp) ?>">
<input type="url" id="urlErp" name="url_erp" maxLength="255" class="form-control" value="<?=old('url_erp', $paisEntity->url_erp) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="userErp" class="form-label">
<?=lang('Paises.userErp') ?>
</label>
<input type="text" id="userErp" name="user_erp" maxLength="255" class="form-control" value="<?=old('user_erp', $pais->user_erp) ?>">
<input type="text" id="userErp" name="user_erp" maxLength="255" class="form-control" value="<?=old('user_erp', $paisEntity->user_erp) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="keyErp" class="form-label">
<?=lang('Paises.keyErp') ?>
</label>
<input type="text" id="keyErp" name="key_erp" maxLength="255" class="form-control" value="<?=old('key_erp', $pais->key_erp) ?>">
<input type="text" id="keyErp" name="key_erp" maxLength="255" class="form-control" value="<?=old('key_erp', $paisEntity->key_erp) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="showErp" class="form-check-label">
<input type="checkbox" id="showErp" name="show_erp" value="1" class="form-check-input"<?=$pais->show_erp== true ? 'checked' : ''; ?>>
<input type="checkbox" id="showErp" name="show_erp" value="1" class="form-check-input"<?=$paisEntity->show_erp== true ? 'checked' : ''; ?>>
<?=lang('Paises.showErp') ?>
</label>
</div><!--//.form-check -->

View File

@ -1,6 +1,6 @@
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
<?=$this->extend('themes/backend/vuexy/main/defaultlayout') ?>
<?= $this->include("Themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("Themes/_commonPartialsBs/sweetalert") ?>
<?= $this->extend("Themes/" . config("Basics")->theme["name"] . "/AdminLayout/defaultLayout") ?>
<?= $this->section("content") ?>
<div class="row">
<div class="col-12">
@ -8,20 +8,17 @@
<div class="card-header">
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
</div><!--//.card-header -->
<form id="paisForm" method="post" class="card-body" action="<?= $formAction ?>">
<form id="paisForm" method="post" action="<?= $formAction ?>">
<?= csrf_field() ?>
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
<div class="card-body">
<?= view("Themes/_commonPartialsBs/_alertBoxes") ?>
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
<?= view("themes/backend/vuexy/form/configuracion/paises/_paisFormItems") ?>
<div class="pt-4">
<input
type="submit"
class="btn btn-primary float-start me-sm-3 me-1"
name="save"
value="<?= lang("Basic.global.Save") ?>"
/>
<?= anchor(route_to("paisList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
</div><!-- /.card-footer -->
</div><!-- /.card-body -->
<div class="card-footer">
<?= anchor(route_to("paisList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
<input type="submit" class="btn btn-primary float-end" name="save" value="<?= lang("Basic.global.Save") ?>">
</div><!-- /.card-footer -->
</form>
</div><!-- //.card -->
</div><!--//.col -->

View File

@ -1,21 +1,22 @@
<?=$this->include('themes/_commonPartialsBs/datatables') ?>
<?=$this->extend('themes/backend/vuexy/main/defaultlayout') ?>
<?=$this->include('Themes/_commonPartialsBs/datatables') ?>
<?=$this->include('Themes/_commonPartialsBs/sweetalert') ?>
<?=$this->extend('Themes/'.config('Basics')->theme['name'].'/AdminLayout/defaultLayout') ?>
<?=$this->section('content'); ?>
<div class="row">
<div class="col-md-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?=lang('Paises.paisList') ?></h3>
<?=anchor(route_to('newPais'), lang('Basic.global.addNew').' '.lang('Paises.pais'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-header -->
<div class="card-body">
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
<?= view('Themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableOfPaises" class="table table-striped table-hover using-data-table" style="width: 100%;">
<table id="tableOfPaises" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('Paises.id') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
<th><?=lang('Paises.id')?></th>
<th><?= lang('Paises.nombre') ?></th>
<th><?= lang('Paises.code') ?></th>
<th><?= lang('Paises.code3') ?></th>
@ -28,56 +29,154 @@
</tr>
</thead>
<tbody>
<?php foreach ($paisList as $item ) : ?>
<tr>
<td class="align-middle text-center">
<?=$item->id ?>
</td>
<td class="align-middle">
<?= empty($item->nombre) || strlen($item->nombre) < 51 ? esc($item->nombre) : character_limiter(esc($item->nombre), 50) ?>
</td>
<td class="align-middle">
<?= esc($item->code) ?>
</td>
<td class="align-middle">
<?= esc($item->code3) ?>
</td>
<td class="align-middle">
<?= esc($item->moneda) ?>
</td>
<td class="align-middle">
<?= esc($item->url_erp) ?>
</td>
<td class="align-middle">
<?= empty($item->user_erp) || strlen($item->user_erp) < 51 ? esc($item->user_erp) : character_limiter(esc($item->user_erp), 50) ?>
</td>
<td class="align-middle">
<?= empty($item->key_erp) || strlen($item->key_erp) < 51 ? esc($item->key_erp) : character_limiter(esc($item->key_erp), 50) ?>
</td>
<td class="align-middle text-center text-green">
<?php if ( $item->show_erp ) { ?>
<i class="text-success bi bi-check-lg"></i>
<?php } ?>
</td>
<td class="align-middle text-center text-nowrap">
<?=anchor(route_to('editPais', $item->id), "<i class='ti ti-pencil ti-sm mx-2'></i>", ['class'=>'text-body', 'data-id'=>$item->id,]); ?>
<?=anchor('#confirm2delete', "<i class='ti ti-trash ti-sm mx-2'></i>", ['class'=>'text-body', 'data-href'=>route_to('deletePais', $item->id), 'data-bs-toggle'=>'modal', 'data-bs-target'=>'#confirm2delete']); ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div><!--//.card-body -->
<div class="card-footer">
<?=anchor(route_to('newPais'), lang('Basic.global.addNew').' '.lang('Paises.pais'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-footer -->
</div><!--//.card -->
</div><!--//.col -->
</div><!--//.row -->
<?=$this->endSection() ?>
<?=$this->endSection() ?>
<?=$this->section('additionalInlineJs') ?>
const lastColNr = $('#tableOfPaises').find("tr:first th").length - 1;
const actionBtns = function(data) {
return `<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<button class="btn btn-sm btn-warning btn-edit me-1" data-id="${data.id}"><?= lang('Basic.global.edit') ?></button>
<button class="btn btn-sm btn-danger btn-delete ms-1" data-id="${data.id}"><?= lang('Basic.global.Delete') ?></button>
</div>
</td>`;
};
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/<?= config('Basics')->languages[$currentLocale] ?? config('Basics')->i18n ?>.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfPaises') ?>',
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' ? '<i class="text-success bi bi-check-lg"></i>' : '';
});
}
});
$(document).on('click', '.btn-edit', function(e) {
window.location.href = `<?= route_to('paisList') ?>/${$(this).attr('data-id')}/edit`;
});
$(document).on('click', '.btn-delete', function(e) {
Swal.fire({
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Paises.pais'))]) ?>',
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
cancelButtonColor: '#d33'
})
.then((result) => {
const dataId = $(this).data('id');
const row = $(this).closest('tr');
if (result.value) {
$.ajax({
url: `<?= route_to('paisList') ?>/${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,
});
})
}
});
});
<?=$this->endSection() ?>
<?=$this->section('css') ?>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.css">
<?=$this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.0/jszip.min.js" integrity="sha512-xcHCGC5tQ0SHlRX8Anbz6oy/OullASJkEhb4gjkneVpGE3/QGYejf14CUO5n5q5paiHfRFTa9HKgByxzidw2Bw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/pdfmake.min.js" integrity="sha512-rDbVu5s98lzXZsmJoMa0DjHNE+RwPJACogUCLyq3Xxm2kJO6qsQwjbE5NDk2DqmlKcxDirCnU1wAzVLe12IM3w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/vfs_fonts.js" integrity="sha512-cktKDgjEiIkPVHYbn8bh/FEyYxmt4JDJJjOCu5/FQAkW4bc911XtKYValiyzBiJigjVEvrIAyQFEbRJZyDA1wQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<?=$this->endSection() ?>

View File

@ -0,0 +1,35 @@
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<label for="code" class="form-label">
<?=lang('Provincias.code') ?>*
</label>
<input type="text" id="code" name="code" required maxLength="2" class="form-control" value="<?=old('code', $provinciaEntity->code) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="nombre" class="form-label">
<?=lang('Provincias.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control" value="<?=old('nombre', $provinciaEntity->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="paisId" class="form-label">
<?=lang('Provincias.paisId') ?>*
</label>
<select id="paisId" name="pais_id" class="form-control select2bs2" style="width: 100%;" >
<?php if ( isset($paisList) && is_array($paisList) && !empty($paisList) ) :
foreach ($paisList as $k => $v) : ?>
<option value="<?=$k ?>"<?=$k==$provinciaEntity->pais_id ? ' selected':'' ?>>
<?=$v ?>
</option>
<?php endforeach;
endif; ?>
</select>
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -0,0 +1,63 @@
<?= $this->include("Themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("Themes/_commonPartialsBs/sweetalert") ?>
<?= $this->extend("Themes/" . config("Basics")->theme["name"] . "/AdminLayout/defaultLayout") ?>
<?= $this->section("content") ?>
<div class="row">
<div class="col-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
</div><!--//.card-header -->
<form id="provinciaForm" method="post" action="<?= $formAction ?>">
<?= csrf_field() ?>
<div class="card-body">
<?= view("Themes/_commonPartialsBs/_alertBoxes") ?>
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
<?= view("themes/backend/vuexy/form/configuracion/provincias/_provinciaFormItems") ?>
</div><!-- /.card-body -->
<div class="card-footer">
<?= anchor(route_to("provinciaList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
<input type="submit" class="btn btn-primary float-end" name="save" value="<?= lang("Basic.global.Save") ?>">
</div><!-- /.card-footer -->
</form>
</div><!-- //.card -->
</div><!--//.col -->
</div><!--//.row -->
<?= $this->endSection() ?>
<?= $this->section("additionalInlineJs") ?>
$('#paisId').select2({
theme: 'bootstrap-5',
allowClear: false,
ajax: {
url: '<?= route_to("menuItemsOfPaises") ?>',
type: 'post',
dataType: 'json',
data: function (params) {
return {
id: 'id',
text: 'nombre',
searchTerm: params.term,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
};
},
delay: 60,
processResults: function (response) {
yeniden(response.<?= csrf_token() ?>);
return {
results: response.menu
};
},
cache: true
}
});
<?= $this->endSection() ?>

View File

@ -0,0 +1,190 @@
<?=$this->include('Themes/_commonPartialsBs/select2bs5') ?>
<?=$this->include('Themes/_commonPartialsBs/datatables') ?>
<?=$this->include('Themes/_commonPartialsBs/sweetalert') ?>
<?=$this->extend('Themes/'.config('Basics')->theme['name'].'/AdminLayout/defaultLayout') ?>
<?=$this->section('content'); ?>
<div class="row">
<div class="col-md-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title"><?=lang('Provincias.provinciaList') ?></h3>
</div><!--//.card-header -->
<div class="card-body">
<?= view('Themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableOfProvincias" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
<th><?=lang('Provincias.id')?></th>
<th><?= lang('Provincias.code') ?></th>
<th><?= lang('Provincias.nombre') ?></th>
<th><?= lang('Paises.pais') ?></th>
<th><?= lang('Provincias.createdAt') ?></th>
<th><?= lang('Provincias.updatedAt') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div><!--//.card-body -->
<div class="card-footer">
<?=anchor(route_to('newProvincia'), lang('Basic.global.addNew').' '.lang('Provincias.provincia'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-footer -->
</div><!--//.card -->
</div><!--//.col -->
</div><!--//.row -->
<?=$this->endSection() ?>
<?=$this->section('additionalInlineJs') ?>
const lastColNr = $('#tableOfProvincias').find("tr:first th").length - 1;
const actionBtns = function(data) {
return `<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<button class="btn btn-sm btn-warning btn-edit me-1" data-id="${data.id}"><?= lang('Basic.global.edit') ?></button>
<button class="btn btn-sm btn-danger btn-delete ms-1" data-id="${data.id}"><?= lang('Basic.global.Delete') ?></button>
</div>
</td>`;
};
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/<?= config('Basics')->languages[$currentLocale] ?? config('Basics')->i18n ?>.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfProvincias') ?>',
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 = '<?= convertPhpDateToMomentFormat('mm/dd/YYYY')?>';
const dateTimeFormat = '<?= convertPhpDateToMomentFormat('mm/dd/YYYY h:i a')?>';
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 = `<?= route_to('provinciaList') ?>/${$(this).attr('data-id')}/edit`;
});
$(document).on('click', '.btn-delete', function(e) {
Swal.fire({
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Provincias.provincia'))]) ?>',
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
cancelButtonColor: '#d33'
})
.then((result) => {
const dataId = $(this).data('id');
const row = $(this).closest('tr');
if (result.value) {
$.ajax({
url: `<?= route_to('provinciaList') ?>/${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,
});
})
}
});
});
<?=$this->endSection() ?>
<?=$this->section('css') ?>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.css">
<?=$this->endSection() ?>
<?= $this->section('additionalExternalJs') ?>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.<?=config('Basics')->theme['name'] == 'Bootstrap5' ? 'bootstrap5' : 'bootstrap4' ?>.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.0/jszip.min.js" integrity="sha512-xcHCGC5tQ0SHlRX8Anbz6oy/OullASJkEhb4gjkneVpGE3/QGYejf14CUO5n5q5paiHfRFTa9HKgByxzidw2Bw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/pdfmake.min.js" integrity="sha512-rDbVu5s98lzXZsmJoMa0DjHNE+RwPJACogUCLyq3Xxm2kJO6qsQwjbE5NDk2DqmlKcxDirCnU1wAzVLe12IM3w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.5/vfs_fonts.js" integrity="sha512-cktKDgjEiIkPVHYbn8bh/FEyYxmt4JDJJjOCu5/FQAkW4bc911XtKYValiyzBiJigjVEvrIAyQFEbRJZyDA1wQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<?=$this->endSection() ?>

View File

@ -2,6 +2,7 @@
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
<?= $this->section("content") ?>
<div class="row">
<div class="col-12">

View File

@ -37,65 +37,64 @@
<?=$this->section('additionalInlineJs') ?>
const lastColNr = $('#tableOfTarifasmanipulado').find("tr:first th").length - 1;
const actionBtns = function(data) {
return `<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i>
<i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i>
</div>
</td>`;
};
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/<?= config('Basics')->i18n ?>.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfTarifasManipulado') ?>',
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 `<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i>
<i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i>
</div>
</td>`;
};
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/<?= config('Basics')->i18n ?>.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfTarifasManipulado') ?>',
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 = `<?= route_to('tarifaManipuladoList') ?>/${$(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: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Tarifamanipulado.tarifa manipulado'))]) ?>',
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
@ -132,8 +131,6 @@ $(document).on('click', '.btn-delete', function(e) {
}
});
});
<?=$this->endSection() ?>

View File

@ -1,41 +0,0 @@
<script src="<?= site_url('themes/focus2/vendor/timeago/jquery.timeago.js'); ?>"></script>
<script src="<?= site_url('themes/focus2/vendor/timeago/locales/jquery.timeago.'.langJS().'.js'); ?>"></script>
<script>
"use strict";
$(document).ready(function () {
let time_ago = document.getElementsByClassName("timeAgo");
for (let i = 0; i < time_ago.length; i++) {
time_ago[i].innerText = jQuery.timeago(time_ago[i].innerText)
}
});
(function($) {
"use strict"
window.addEventListener('resize', function(e){
let body = document.querySelector('body');
let ws = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
let mw = document.getElementById('main-wrapper');
if(ws>=1216){
body.setAttribute('data-sidebar-style', 'full');
body.setAttribute('data-sidebar-position', 'fixed');
body.setAttribute('data-header-position', 'fixed');
mw.classList.remove('menu-toggle');
}else if(ws<1216 && ws>=768){
body.setAttribute('data-sidebar-style', 'mini');
mw.classList.add('menu-toggle');
body.setAttribute('data-sidebar-position', 'fixed');
body.setAttribute('data-header-position', 'fixed');
}else{
body.setAttribute('data-sidebar-style', 'overlay');
mw.classList.remove('menu-toggle');
}
});
})(jQuery);
</script>
<div class="footer">
<div class="copyright">
<p>Copyright © Designed by <a href="https://quixkit.com/" target="_blank">Quixkit</a> &amp; Developed by <a href="https://eduardofiorini.com/" target="_blank">Eduardo Fiorini</a> - WebGuard v1.2.0 </p>
</div>
</div>
</div>
</body>
</html>

View File

@ -1,130 +0,0 @@
<?php
$settings = session()->get('settings');
$picture = session()->get('picture');
$pulse = session()->get('pulse');
$notification = session()->get('notification');
?>
<!DOCTYPE html>
<html lang="<?= $settings['default_language']??'en'=='pt' ? 'pt-br' : $settings['default_language']??'en' ?>">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title><?= lang("App.dashboard_title") ?> - <?= $settings['title']??'' ?></title>
<!-- Favicon icon -->
<link rel="icon" type="image/png" sizes="16x16" href="<?=site_url('themes/focus2/images/favicon.png')?>">
<link href="<?=site_url('themes/focus2/vendor/owl-carousel/css/owl.carousel.min.css')?>" rel="stylesheet">
<link href="<?=site_url('themes/focus2/vendor/owl-carousel/css/owl.theme.default.min.css')?>" rel="stylesheet">
<link href="<?=site_url('themes/focus2/vendor/jqvmap/css/jqvmap.min.css')?>" rel="stylesheet">
<link href="<?=site_url('themes/focus2/vendor/datatables/css/jquery.dataTables.min.css')?>" rel="stylesheet">
<link href="<?=site_url('themes/focus2/vendor/select2/css/select2.min.css')?>" rel="stylesheet">
<link href="<?=site_url('themes/focus2/vendor/sweetalert2/dist/sweetalert2.min.css')?>" rel="stylesheet">
<link href="<?=site_url('themes/focus2/vendor/lou-multi-select/css/multi-select.css')?>" rel="stylesheet">
<link href="<?=site_url('themes/focus2/vendor/nestable2/css/jquery.nestable.min.css')?>" rel="stylesheet">
<link href="<?=site_url('themes/focus2/vendor/toastr/css/toastr.min.css')?>" rel="stylesheet">
<link href="<?=site_url('themes/focus2/css/style.css')?>" rel="stylesheet">
</head>
<body>
<!--PreLoader-->
<div id="preloader">
<div class="sk-three-bounce">
<div class="sk-child sk-bounce1"></div>
<div class="sk-child sk-bounce2"></div>
<div class="sk-child sk-bounce3"></div>
</div>
</div>
<!--Main Wrapper-->
<div id="main-wrapper">
<!--Nav Header-->
<div class="nav-header">
<a href="<?=site_url('home')?>" class="brand-logo">
<img class="logo-abbr" src="<?=site_url('themes/focus2/images/logo.png')?>" alt="">
<img class="logo-compact" src="<?=site_url('themes/focus2/images/logo-text.png')?>" alt="">
<img class="brand-title" src="<?=site_url('themes/focus2/images/logo-text.png')?>" alt="">
</a>
<div class="nav-control">
<div class="hamburger">
<span class="line"></span><span class="line"></span><span class="line"></span>
</div>
</div>
</div>
<!--Header-->
<div class="header">
<div class="header-content">
<nav class="navbar navbar-expand">
<div class="collapse navbar-collapse justify-content-between">
<div class="header-left"></div>
<ul class="navbar-nav header-right">
<li class="nav-item dropdown notification_dropdown">
<a class="nav-link" href="#" role="button" data-toggle="dropdown">
<i class="fas fa-bell"></i>
<?php if ($pulse > 0) : ?>
<div class="pulse-css text-danger"></div>
<?php endif; ?>
</a>
<div class="dropdown-menu dropdown-menu-right">
<ul class="list-unstyled">
<?php foreach ($notification??[] as $item) : ?>
<a href="<?=site_url('my/notification_view/'.$item['token'])?>">
<li class="media dropdown-item">
<?php if ($item['is_read']) : ?>
<span class="success"><i class="far fa-envelope-open"></i> </span>
<?php else : ?>
<span class="primary"><i class="far fa-envelope"></i> </span>
<?php endif; ?>
<div class="media-body">
<p><?=$item['title']?></p>
</div>
<span class="notify-time timeAgo"><?=$item['created_at']?></span>
</li>
</a>
<?php endforeach; ?>
</ul>
<a class="all-notification" href="<?=site_url('my/notification')?>"><?= lang("App.notification_bell_btn") ?> <i class="ti-arrow-right"></i></a>
</div>
</li>
<li class="nav-item dropdown header-profile">
<a class="nav-link" href="#" role="button" data-toggle="dropdown">
<i class="fas fa-globe-americas"></i>
</a>
<div class="dropdown-menu dropdown-menu-right">
<a href="<?= site_url('lang/en'); ?>" class="dropdown-item">
<img src="<?=site_url('assets/flags/us_32_circle.png')?>">
<span class="ml-2"><?= lang("App.lang_en") ?></span>
</a>
<a href="<?= site_url('lang/es'); ?>" class="dropdown-item">
<img src="<?=site_url('assets/flags/es_32_circle.png')?>">
<span class="ml-2"><?= lang("App.lang_es") ?></span>
</a>
<a href="<?= site_url('lang/pt'); ?>" class="dropdown-item">
<img src="<?=site_url('assets/flags/br_32_circle.png')?>">
<span class="ml-2"><?= lang("App.lang_pt") ?></span>
</a>
</div>
</li>
<li class="nav-item dropdown header-profile">
<a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<img src="<?= $picture??''?>" class="btn-circle btn-circle-sm" style="width: 50px ; height: 50px;">
</a>
<div class="dropdown-menu dropdown-menu-right">
<a href="<?= site_url('profile'); ?>" class="dropdown-item">
<i class="fas fa-user"></i>
<span class="ml-2"><?= lang("App.menu_profile") ?></span>
</a>
<a href="<?= site_url('activity'); ?>" class="dropdown-item">
<i class="fas fa-list"></i>
<span class="ml-2"><?= lang("App.menu_activity") ?></span>
</a>
<a href="<?= site_url('login/logout'); ?>" class="dropdown-item">
<i class="fas fa-sign-out-alt"></i>
<span class="ml-2"><?= lang("App.menu_logout") ?></span>
</a>
</div>
</li>
</ul>
</div>
</nav>
</div>
</div>
<?php include "menu.php" ?>

View File

@ -1,61 +0,0 @@
<?php $menus = getMenuControl(); ?>
<!--Sidebar-->
<div class="quixnav">
<div class="quixnav-scroll">
<ul class="metismenu" id="menu">
<li><a href="/" aria-expanded="false"><i class="fas fa-th-large"></i><span class="nav-text"><?= lang("App.menu_dashboard") ?></span></a></li>
<?php if (count(getArrayItem($menus,'name','User')) > 0): ?>
<li class="nav-label"><?= lang("App.menu_registration") ?></li>
<li><a class="has-arrow" href="javascript:void()" aria-expanded="false"><i class="fas fa-user-friends"></i><span class="nav-text"><?= lang("App.menu_users") ?></span></a>
<ul aria-expanded="false">
<?php if (count(getArrayItem($menus,'methods','index',true)) > 0): ?>
<li><a href="/user"><?= lang("App.menu_list") ?></a></li>
<?php endif; ?>
<?php if (count(getArrayItem($menus,'methods','add',true)) > 0): ?>
<li><a href="/user/add"><?= lang("App.menu_add") ?></a></li>
<?php endif; ?>
</ul>
</li>
<?php endif; ?>
<?php if (count(getArrayItem($menus,'name','Group')) > 0): ?>
<li><a class="has-arrow" href="javascript:void()" aria-expanded="false"><i class="fas fa-user-lock"></i><span class="nav-text"><?= lang("App.menu_permission_group") ?></span></a>
<ul aria-expanded="false">
<?php if (count(getArrayItem($menus,'methods','index',true)) > 0): ?>
<li><a href="/group"><?= lang("App.menu_list") ?></a></li>
<?php endif; ?>
<?php if (count(getArrayItem($menus,'methods','add',true)) > 0): ?>
<li><a href="/group/add"><?= lang("App.menu_add") ?></a></li>
<?php endif; ?>
</ul>
</li>
<?php endif; ?>
<?php if (count(getArrayItem($menus,'name','Notification')) > 0): ?>
<li><a class="has-arrow" href="javascript:void()" aria-expanded="false"><i class="fas fa-bell"></i><span class="nav-text"><?= lang("App.menu_notification") ?></span></a>
<ul aria-expanded="false">
<?php if (count(getArrayItem($menus,'methods','index',true)) > 0): ?>
<li><a href="/notification"><?= lang("App.menu_list") ?></a></li>
<?php endif; ?>
<?php if (count(getArrayItem($menus,'methods','add',true)) > 0): ?>
<li><a href="/notification/add"><?= lang("App.menu_add") ?></a></li>
<?php endif; ?>
</ul>
</li>
<?php endif; ?>
<?php if (count(getArrayItem($menus,'name','Settings')) > 0): ?>
<li class="nav-label"><?= lang("App.menu_settings") ?></li>
<?php if (count(getArrayItem($menus,'methods','index',true)) > 0): ?>
<li><a href="/settings" aria-expanded="false"><i class="fas fa-sliders-h"></i><span class="nav-text"><?= lang("App.menu_general") ?></span></a></li>
<?php endif; ?>
<?php if (count(getArrayItem($menus,'methods','template',true)) > 0): ?>
<li><a href="/settings/template" aria-expanded="false"><i class="fas fa-mail-bulk"></i><span class="nav-text"><?= lang("App.menu_template") ?></span></a></li>
<?php endif; ?>
<?php endif; ?>
<li class="nav-label"></li>
<?php if (count(getArrayItem($menus,'name','Activity')) > 0): ?>
<li><a href="/activity" aria-expanded="false"><i class="fas fa-list"></i><span class="nav-text"><?= lang("App.menu_activity") ?></span></a></li>
<?php endif; ?>
<li><a href="/login/logout" aria-expanded="false"><i class="fas fa-sign-out-alt"></i><span class="nav-text"><?= lang("App.menu_logout") ?></span></a></li>
</ul>
</div>
</div>