Añadido clientes by Ozar y primeros fixes

This commit is contained in:
imnavajas
2023-07-10 10:05:06 +02:00
parent f67ba91b79
commit 42a20b93b0
25 changed files with 2737 additions and 52 deletions

View File

@ -104,6 +104,22 @@ $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']);

View File

@ -1,50 +1,340 @@
<?php
namespace App\Controllers\Clientes;
use App\Controllers\BaseController;
<?php namespace App\Controllers\Clientes;
class Cliente extends BaseController
{
function __construct()
use App\Controllers\GoBaseResourceController;
use App\Models\Collection;
use App\Entities\Clientes\ClienteEntity;
use App\Models\Clientes\ClienteModel;
use App\Models\Configuracion\FormasPagoModel;
use App\Models\Configuracion\PaisModel;
class Cliente extends \App\Controllers\GoBaseResourceController
{
protected $modelName = ClienteModel::class;
protected $format = 'json';
protected static $singularObjectName = 'Cliente';
protected static $singularObjectNameCc = 'cliente';
protected static $pluralObjectName = 'Clientes';
protected static $pluralObjectNameCc = 'clientes';
protected static $controllerSlug = 'clientes';
protected static $viewPath = 'themes/backend/vuexy/form/clientes/';
protected $indexRoute = 'clienteList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
$this->viewData['pageTitle'] = lang('Cliente.moduleTitle');
$this->viewData['usingSweetAlert'] = true;
// Breadcrumbs
$this->viewData['breadcrumb'] = [
['title' => lang("App.menu_clientes"), 'route' => "", 'active' => false],
['title' => lang("App.menu_cliente"), 'route' => site_url('clientes/cliente'), 'active' => true]
];
parent::initController($request, $response, $logger);
}
public function index()
{
$uri = service('uri');
$data['page_name'] = "Cliente";
$data['url'] = base_url() . $uri->getSegment(1) . '/' . $uri->getSegment(2);
echo view(getenv('theme.path').'main/demo_view', $data);
}
$viewData = [
'currentModule' => static::$controllerSlug,
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Cliente.cliente')]),
'clienteEntity' => new ClienteEntity(),
'usingServerSideDataTable' => true,
];
public function delete()
{
$uri = service('uri');
$data['page_name'] = "Cliente";
$data['url'] = base_url() . $uri->getSegment(1) . '/' . $uri->getSegment(2);
echo view(getenv('theme.path').'main/demo_view', $data);
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
return view(static::$viewPath . 'viewClienteList', $viewData);
}
public function add()
{
$uri = service('uri');
$data['page_name'] = "Cliente";
$data['url'] = base_url() . $uri->getSegment(1) . '/' . $uri->getSegment(2);
echo view(getenv('theme.path').'main/demo_view', $data);
$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('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
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 = 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['clienteEntity'] = isset($sanitizedData) ? new ClienteEntity($sanitizedData) : new ClienteEntity();
$this->viewData['paisList'] = $this->getPaisListItems();
$this->viewData['formaPagoList'] = $this->getFormaPagoListItems();
$this->viewData['formAction'] = route_to('createCliente');
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Cliente.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);
$clienteEntity = $this->model->find($id);
if ($clienteEntity == false) :
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Cliente.cliente')), $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);
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;
}
$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('Cliente.cliente'))]);
$this->session->setFlashdata('formErrors', $this->model->errors());
endif;
$clienteEntity->fill($sanitizedData);
$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 = 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['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');
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 = ClienteModel::SORTABLE[$requestedOrder > 0 ? $requestedOrder : 1];
$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;
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getResource()->countAllResults(),
$this->model->getResource($search)->countAllResults()
));
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function edit()
public function allItemsSelect()
{
$uri = service('uri');
$data['page_name'] = "Cliente";
$data['url'] = base_url() . $uri->getSegment(1) . '/' . $uri->getSegment(2);
echo view(getenv('theme.path').'main/demo_view', $data);
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 getFormaPagoListItems()
{
$formasPagoModel = model('App\Models\Configuracion\FormasPagoModel');
$onlyActiveOnes = true;
$data = $formasPagoModel->getAllForMenu('id, nombre', 'nombre', $onlyActiveOnes);
return $data;
}
protected function getPaisListItems()
{
$paisModel = model('App\Models\Configuracion\PaisModel');
$onlyActiveOnes = true;
$data = $paisModel->getAllForMenu('id, nombre', 'nombre', $onlyActiveOnes);
return $data;
}
}

View File

@ -0,0 +1,284 @@
<?php namespace App\Controllers\Configuracion;
use App\Controllers\GoBaseResourceController;
use App\Models\Collection;
use App\Entities\Configuracion\ComunidadesAutonomasEntity;
use App\Models\Configuracion\ComunidadesAutonomasModel;
use App\Models\Configuracion\PaisModel;
class Comunidadesautonomas extends \App\Controllers\GoBaseResourceController {
protected $modelName = ComunidadesAutonomasModel::class;
protected $format = 'json';
protected static $singularObjectName = 'Comunidad Autonoma';
protected static $singularObjectNameCc = 'comunidadAutonoma';
protected static $pluralObjectName = 'Comunidades Autonomas';
protected static $pluralObjectNameCc = 'comunidadesAutonomas';
protected static $controllerSlug = 'comunidadesautonomas';
protected static $viewPath = 'themes/backend/vuexy/form/configuracion/comunidades-autonomas/';
protected $indexRoute = 'comunidadAutonomaList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
$this->viewData['pageTitle'] = lang('ComunidadesAutonomas.moduleTitle');
$this->viewData['usingSweetAlert'] = true;
parent::initController($request, $response, $logger);
}
public function index() {
$viewData = [
'currentModule' => static::$controllerSlug,
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('ComunidadesAutonomas.comunidadAutonoma')]),
'comunidadesAutonomasEntity' => new ComunidadesAutonomasEntity(),
'usingServerSideDataTable' => true,
];
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
return view(static::$viewPath.'viewComunidadAutonomaList', $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('ComunidadesAutonomas.comunidadAutonoma'))]);
$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('ComunidadesAutonomas.comunidadAutonoma'))]).'.';
$message .= anchor( "admin/comunidadesautonomas/{$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['comunidadesAutonomasEntity'] = isset($sanitizedData) ? new ComunidadesAutonomasEntity($sanitizedData) : new ComunidadesAutonomasEntity();
$this->viewData['paisList'] = $this->getPaisListItems();
$this->viewData['formAction'] = route_to('createComunidadAutonoma');
$this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('ComunidadesAutonomas.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);
$comunidadesAutonomasEntity = $this->model->find($id);
if ($comunidadesAutonomasEntity == false) :
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('ComunidadesAutonomas.comunidadAutonoma')), $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('ComunidadesAutonomas.comunidadAutonoma'))]);
$this->session->setFlashdata('formErrors', $this->model->errors());
endif;
$comunidadesAutonomasEntity->fill($sanitizedData);
$thenRedirect = true;
endif;
if ($noException && $successfulResult) :
$id = $comunidadesAutonomasEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('ComunidadesAutonomas.comunidadAutonoma'))]).'.';
$message .= anchor( "admin/comunidadesautonomas/{$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['comunidadesAutonomasEntity'] = $comunidadesAutonomasEntity;
$this->viewData['paisList'] = $this->getPaisListItems();
$this->viewData['formAction'] = route_to('updateComunidadAutonoma', $id);
$this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('ComunidadesAutonomas.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 = ComunidadesAutonomasModel::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() {
$paisModel = model('App\Models\Configuracion\PaisModel');
$onlyActiveOnes = true;
$data = $paisModel->getAllForMenu('id, nombre','nombre', $onlyActiveOnes );
return $data;
}
}

View File

@ -1,35 +1,232 @@
<?php
namespace App\Controllers\Configuracion;
use App\Controllers\BaseController;
<?php namespace App\Controllers\Configuracion;
class Formaspago extends BaseController
{
function __construct()
{
use App\Entities\Configuracion\FormasPagoEntity;
class Formaspago extends \App\Controllers\GoBaseController {
use \CodeIgniter\API\ResponseTrait;
protected static $primaryModelName = 'App\Models\Configuracion\FormasPagoModel';
protected static $singularObjectNameCc = 'formaPago';
protected static $singularObjectName = 'Forma Pago';
protected static $pluralObjectName = 'Formas Pago';
protected static $controllerSlug = 'formaspago';
protected static $viewPath = 'themes/backend/vuexy/form/configuracion/formas-pago/';
protected $indexRoute = 'formaPagoList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
$this->viewData['pageTitle'] = lang('FormasPagoes.moduleTitle');
parent::initController($request, $response, $logger);
$this->viewData['usingSweetAlert'] = true;
if (session('errorMessage')) {
$this->session->setFlashData('sweet-error', session('errorMessage'));
}
if (session('successMessage')) {
$this->session->setFlashData('sweet-success', session('successMessage'));
}
}
public function index() {
$this->viewData['usingClientSideDataTable'] = true;
$this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('FormasPagoes.formaPago')]);
parent::index();
}
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) ) :
}
public function index()
{
echo 'Formas de pago';
}
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.formaPago'))]);
$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) :
public function edit()
{
$id = $this->model->db->insertID();
}
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('FormasPagoes.formaPago'))]).'.';
$message .= anchor(route_to('editFormaPago', $id), lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
public function add()
{
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['formasPagoEntity'] = isset($sanitizedData) ? new FormasPagoEntity($sanitizedData) : new FormasPagoEntity();
$this->viewData['formAction'] = route_to('createFormaPago');
$this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('FormasPagoes.formaPago').' '.lang('Basic.global.addNewSuffix');
}
public function delete()
{
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);
$formasPagoEntity = $this->model->find($id);
if ($formasPagoEntity == false) :
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('FormasPagoes.formaPago')), $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.formaPago'))]);
$this->session->setFlashdata('formErrors', $this->model->errors());
endif;
$formasPagoEntity->fill($sanitizedData);
$thenRedirect = true;
endif;
if ($noException && $successfulResult) :
$id = $formasPagoEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('FormasPagoes.formaPago'))]).'.';
$message .= anchor(route_to('editFormaPago', $id), 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['formasPagoEntity'] = $formasPagoEntity;
$this->viewData['formAction'] = route_to('updateFormaPago', $id);
$this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('FormasPagoes.formaPago').' '.lang('Basic.global.edit3');
return $this->displayForm(__METHOD__, $id);
} // end function edit(...)
public function allItemsSelect() {
if ($this->request->isAJAX()) {
$onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id';
$menu = $this->model->getAllForMenu($reqVal.', nombre', 'nombre', $onlyActiveOnes, false);
$nonItem = new \stdClass;
$nonItem->id = '';
$nonItem->nombre = '- '.lang('Basic.global.None').' -';
array_unshift($menu , $nonItem);
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data = [
'menu' => $menu,
$csrfTokenName => $newTokenHash
];
return $this->respond($data);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function menuItems() {
if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0];
$reqText = goSanitize($this->request->getPost('text'))[0];
$onlyActiveOnes = false;
$columns2select = [$reqId ?? 'id', $reqText ?? 'nombre'];
$onlyActiveOnes = false;
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
$nonItem = new \stdClass;
$nonItem->id = '';
$nonItem->text = '- '.lang('Basic.global.None').' -';
array_unshift($menu , $nonItem);
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data = [
'menu' => $menu,
$csrfTokenName => $newTokenHash
];
return $this->respond($data);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
}

View File

@ -0,0 +1,80 @@
<?php
namespace App\Entities\Clientes;
use CodeIgniter\Entity;
class ClienteEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"nombre" => null,
"alias" => null,
"direccion" => null,
"ciudad" => null,
"comunidad_autonoma_id" => null,
"provincia" => null,
"cp" => null,
"pais_id" => null,
"telefono" => null,
"email" => null,
"salesman_id" => 1,
"soporte_id" => null,
"forma_pago_id" => null,
"vencimiento" => 15,
"fechaVencimiento" => 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,
"ccc" => null,
"ccc_customer" => null,
"num_cuenta" => null,
"disponible_fe" => false,
"message_tracking" => true,
"message_production_start" => true,
"tirada_flexible" => false,
"descuento_tirada_flexible" => 20.0,
"comentarios_tirada_flexible" => null,
"saturacion" => 100.0,
"tienda_id" => null,
"margen_plantilla_id" => null,
"comentarios_produccion" => null,
"ps_customer_id" => null,
"lineasEnvioFactura" => true,
"comentarios" => null,
"created_at" => null,
"updated_at" => null,
"user_created_id" => 1,
"user_update_id" => 1,
];
protected $casts = [
"comunidad_autonoma_id" => "?int",
"pais_id" => "?int",
"salesman_id" => "int",
"soporte_id" => "?int",
"forma_pago_id" => "?int",
"vencimiento" => "int",
"margen" => "float",
"margen_pod" => "?float",
"descuento" => "float",
"limite_credito" => "float",
"limite_credito_user_id" => "int",
"creditoAsegurado" => "?boolean",
"disponible_fe" => "boolean",
"message_tracking" => "boolean",
"message_production_start" => "boolean",
"tirada_flexible" => "boolean",
"descuento_tirada_flexible" => "float",
"saturacion" => "float",
"tienda_id" => "?int",
"margen_plantilla_id" => "?int",
"ps_customer_id" => "?int",
"lineasEnvioFactura" => "boolean",
"user_created_id" => "int",
"user_update_id" => "int",
];
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\Entities\Configuracion;
use CodeIgniter\Entity;
class ComunidadesAutonomasEntity 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 FormasPagoEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"nombre" => null,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [];
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Entities\Configuracion;
use CodeIgniter\Entity;
class PaisEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"nombre" => null,
"code" => null,
"code3" => null,
"moneda" => null,
"url_erp" => null,
"user_erp" => null,
"key_erp" => null,
"show_erp" => false,
];
protected $casts = [
"show_erp" => "boolean",
];
}

View File

@ -646,7 +646,7 @@ return [
"permisos_catalogo" => "Catálogo",
"permisos_clientes" => "Clientes",
"permisos_clientes" => "Cliente",
"permisos_tarifacliente" => "Tarifas cliente",
"permisos_proveedores" => "Proveedores",
@ -672,6 +672,7 @@ return [
"menu_dashboard" => "Panel de control",
"menu_clientes" => "Clientes",
"menu_cliente" => "Cliente",
"menu_clientes_nuevo" => "Nuevo",
"menu_tarifacliente" => "Tarifas",

View File

@ -0,0 +1,250 @@
<?php
return [
'alias' => 'Alias',
'ccc' => 'Ccc',
'cccCustomer' => 'Ccc Customer',
'ciudad' => 'Ciudad',
'cliente' => 'Cliente',
'clienteList' => 'Listado de Clientes',
'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',
'deletedAt' => 'Deleted At',
'descuento' => 'Descuento',
'descuentoTiradaFlexible' => 'Descuento Tirada Flexible',
'direccion' => 'Dirección',
'disponibleFe' => 'Disponible Fe',
'email' => 'Email',
'fechavencimiento' => 'Fecha Vencimiento',
'formaPagoId' => 'Forma Pago',
'id' => 'ID',
'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' => 'Número de Cuenta',
'paisId' => 'País',
'provincia' => 'Provincia',
'psCustomerId' => 'Ps Customer ID',
'salesmanId' => 'Comercial Asignado',
'saturacion' => 'Saturación',
'soporteId' => 'Soporte Asignado',
'telefono' => 'Teléfono',
'tiendaId' => 'Tienda ID',
'tiradaFlexible' => 'Tirada Flexible',
'updatedAt' => 'Updated At',
'userCreatedId' => 'User Created ID',
'userUpdateId' => 'User Update ID',
'vencimiento' => 'Vencimiento',
'validation' => [
'ccc' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
],
'ccc_customer' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
],
'ciudad' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
],
'comentarios' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
],
'comentarios_produccion' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
],
'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' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
],
'direccion' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
],
'fechaVencimiento' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
],
'margen_plantilla_id' => [
'integer' => 'El campo {field} debe contener un número entero.',
],
'margen_pod' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
],
'num_cuenta' => [
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
],
'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.',
],
'tienda_id' => [
'integer' => 'El campo {field} debe contener un número entero.',
],
'alias' => [
'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.',
],
'descuento' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
'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.',
],
'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.',
],
'limite_credito' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
'required' => 'El campo {field} es obligatorio.',
],
'limite_credito_change_at' => [
'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.',
],
'margen' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
'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.',
],
'saturacion' => [
'decimal' => 'El campo {field} debe contener un número decimal.',
'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.',
],
'user_update_id' => [
'integer' => 'El campo {field} debe contener un número entero.',
'required' => 'El campo {field} es obligatorio.',
],
'vencimiento' => [
'integer' => 'El campo {field} debe contener un número entero.',
'required' => 'El campo {field} es obligatorio.',
],
],
];

View File

@ -0,0 +1,29 @@
<?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.',
],
'nombre' => [
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
'required' => 'The {field} field is required.',
],
],
];

View File

@ -0,0 +1,27 @@
<?php
return [
'createdAt' => 'Created At',
'formaPago' => 'Forma Pago',
'formaPagoList' => 'Listado de Formas Pago',
'formas-pago' => 'Formas de Pago',
'formasPago' => 'Formas Pago',
'formasPagoList' => 'Listado de Formas Pago',
'formaspago' => 'Formas de Pago',
'id' => 'ID',
'moduleTitle' => 'Formas de Pago',
'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

@ -84,7 +84,7 @@ return [
],
'papel_generico_id' => [
'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

@ -0,0 +1,373 @@
<?php
namespace App\Models\Clientes;
class ClienteModel extends \App\Models\GoBaseModel
{
protected $table = "clientes";
/**
* Whether primary key uses auto increment.
*
* @var bool
*/
protected $useAutoIncrement = true;
const SORTABLE = [
0 => "t1.nombre",
1 => "t1.alias",
2 => "t1.email",
3 => "t1.salesman_id",
4 => "t1.forma_pago_id",
5 => "t1.vencimiento",
];
protected $allowedFields = [
"nombre",
"alias",
"direccion",
"ciudad",
"comunidad_autonoma_id",
"provincia",
"cp",
"pais_id",
"telefono",
"email",
"salesman_id",
"soporte_id",
"forma_pago_id",
"vencimiento",
"fechaVencimiento",
"margen",
"margen_pod",
"descuento",
"limite_credito",
"limite_credito_user_id",
"limite_credito_change_at",
"creditoSolunion",
"creditoAsegurado",
"ccc",
"ccc_customer",
"num_cuenta",
"disponible_fe",
"message_tracking",
"message_production_start",
"tirada_flexible",
"descuento_tirada_flexible",
"comentarios_tirada_flexible",
"saturacion",
"tienda_id",
"margen_plantilla_id",
"comentarios_produccion",
"ps_customer_id",
"lineasEnvioFactura",
"comentarios",
"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";
public static $labelField = "nombre";
protected $validationRules = [
"alias" => [
"label" => "Cliente.alias",
"rules" => "trim|required|max_length[255]",
],
"ccc" => [
"label" => "Cliente.ccc",
"rules" => "trim|max_length[100]",
],
"ccc_customer" => [
"label" => "Cliente.cccCustomer",
"rules" => "trim|max_length[100]",
],
"ciudad" => [
"label" => "Cliente.ciudad",
"rules" => "trim|max_length[100]",
],
"comentarios" => [
"label" => "Cliente.comentarios",
"rules" => "trim|max_length[16313]",
],
"comentarios_produccion" => [
"label" => "Cliente.comentariosProduccion",
"rules" => "trim|max_length[16313]",
],
"comentarios_tirada_flexible" => [
"label" => "Cliente.comentariosTiradaFlexible",
"rules" => "trim|required|max_length[16313]",
],
"cp" => [
"label" => "Cliente.cp",
"rules" => "trim|max_length[10]",
],
"creditoSolunion" => [
"label" => "Cliente.creditosolunion",
"rules" => "trim|max_length[100]",
],
"descuento" => [
"label" => "Cliente.descuento",
"rules" => "required|decimal",
],
"descuento_tirada_flexible" => [
"label" => "Cliente.descuentoTiradaFlexible",
"rules" => "required|decimal",
],
"direccion" => [
"label" => "Cliente.direccion",
"rules" => "trim|max_length[300]",
],
"email" => [
"label" => "Cliente.email",
"rules" => "trim|max_length[150]|valid_email|permit_empty",
],
"fechaVencimiento" => [
"label" => "Cliente.fechavencimiento",
"rules" => "trim|max_length[100]",
],
"limite_credito" => [
"label" => "Cliente.limiteCredito",
"rules" => "required|decimal",
],
"limite_credito_change_at" => [
"label" => "Cliente.limiteCreditoChangeAt",
"rules" => "required|valid_date",
],
"limite_credito_user_id" => [
"label" => "Cliente.limiteCreditoUserId",
"rules" => "required|integer",
],
"margen" => [
"label" => "Cliente.margen",
"rules" => "required|decimal",
],
"margen_plantilla_id" => [
"label" => "Cliente.margenPlantillaId",
"rules" => "integer|permit_empty",
],
"margen_pod" => [
"label" => "Cliente.margenPod",
"rules" => "decimal|permit_empty",
],
"nombre" => [
"label" => "Cliente.nombre",
"rules" => "trim|required|max_length[255]",
],
"num_cuenta" => [
"label" => "Cliente.numCuenta",
"rules" => "trim|max_length[10]",
],
"provincia" => [
"label" => "Cliente.provincia",
"rules" => "trim|max_length[100]",
],
"ps_customer_id" => [
"label" => "Cliente.psCustomerId",
"rules" => "integer|permit_empty",
],
"salesman_id" => [
"label" => "Cliente.salesmanId",
"rules" => "required|integer",
],
"saturacion" => [
"label" => "Cliente.saturacion",
"rules" => "required|decimal",
],
"soporte_id" => [
"label" => "Cliente.soporteId",
"rules" => "integer|permit_empty",
],
"telefono" => [
"label" => "Cliente.telefono",
"rules" => "trim|max_length[60]",
],
"tienda_id" => [
"label" => "Cliente.tiendaId",
"rules" => "integer|permit_empty",
],
"user_created_id" => [
"label" => "Cliente.userCreatedId",
"rules" => "required|integer",
],
"user_update_id" => [
"label" => "Cliente.userUpdateId",
"rules" => "required|integer",
],
"vencimiento" => [
"label" => "Cliente.vencimiento",
"rules" => "required|integer",
],
];
protected $validationMessages = [
"alias" => [
"max_length" => "Cliente.validation.alias.max_length",
"required" => "Cliente.validation.alias.required",
],
"ccc" => [
"max_length" => "Cliente.validation.ccc.max_length",
],
"ccc_customer" => [
"max_length" => "Cliente.validation.ccc_customer.max_length",
],
"ciudad" => [
"max_length" => "Cliente.validation.ciudad.max_length",
],
"comentarios" => [
"max_length" => "Cliente.validation.comentarios.max_length",
],
"comentarios_produccion" => [
"max_length" => "Cliente.validation.comentarios_produccion.max_length",
],
"comentarios_tirada_flexible" => [
"max_length" => "Cliente.validation.comentarios_tirada_flexible.max_length",
"required" => "Cliente.validation.comentarios_tirada_flexible.required",
],
"cp" => [
"max_length" => "Cliente.validation.cp.max_length",
],
"creditoSolunion" => [
"max_length" => "Cliente.validation.creditoSolunion.max_length",
],
"descuento" => [
"decimal" => "Cliente.validation.descuento.decimal",
"required" => "Cliente.validation.descuento.required",
],
"descuento_tirada_flexible" => [
"decimal" => "Cliente.validation.descuento_tirada_flexible.decimal",
"required" => "Cliente.validation.descuento_tirada_flexible.required",
],
"direccion" => [
"max_length" => "Cliente.validation.direccion.max_length",
],
"email" => [
"max_length" => "Cliente.validation.email.max_length",
"valid_email" => "Cliente.validation.email.valid_email",
],
"fechaVencimiento" => [
"max_length" => "Cliente.validation.fechaVencimiento.max_length",
],
"limite_credito" => [
"decimal" => "Cliente.validation.limite_credito.decimal",
"required" => "Cliente.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",
],
"limite_credito_user_id" => [
"integer" => "Cliente.validation.limite_credito_user_id.integer",
"required" => "Cliente.validation.limite_credito_user_id.required",
],
"margen" => [
"decimal" => "Cliente.validation.margen.decimal",
"required" => "Cliente.validation.margen.required",
],
"margen_plantilla_id" => [
"integer" => "Cliente.validation.margen_plantilla_id.integer",
],
"margen_pod" => [
"decimal" => "Cliente.validation.margen_pod.decimal",
],
"nombre" => [
"max_length" => "Cliente.validation.nombre.max_length",
"required" => "Cliente.validation.nombre.required",
],
"num_cuenta" => [
"max_length" => "Cliente.validation.num_cuenta.max_length",
],
"provincia" => [
"max_length" => "Cliente.validation.provincia.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",
],
"saturacion" => [
"decimal" => "Cliente.validation.saturacion.decimal",
"required" => "Cliente.validation.saturacion.required",
],
"soporte_id" => [
"integer" => "Cliente.validation.soporte_id.integer",
],
"telefono" => [
"max_length" => "Cliente.validation.telefono.max_length",
],
"tienda_id" => [
"integer" => "Cliente.validation.tienda_id.integer",
],
"user_created_id" => [
"integer" => "Cliente.validation.user_created_id.integer",
"required" => "Cliente.validation.user_created_id.required",
],
"user_update_id" => [
"integer" => "Cliente.validation.user_update_id.integer",
"required" => "Cliente.validation.user_update_id.required",
],
"vencimiento" => [
"integer" => "Cliente.validation.vencimiento.integer",
"required" => "Cliente.validation.vencimiento.required",
],
];
public function findAllWithAllRelations(string $selcols = "*", int $limit = null, int $offset = 0)
{
$sql =
"SELECT t1." .
$selcols .
", t2.nombre AS pais, t3.nombre AS forma_pago 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";
if (!is_null($limit) && intval($limit) > 0) {
$sql .= " LIMIT " . intval($limit);
}
if (!is_null($offset) && intval($offset) > 0) {
$sql .= " OFFSET " . intval($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.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");
return empty($search)
? $builder
: $builder
->groupStart()
->like("t1.nombre", $search)
->orLike("t1.alias", $search)
->orLike("t1.email", $search)
->orLike("t1.salesman_id", $search)
->orLike("t1.vencimiento", $search)
->orLike("t1.fechaVencimiento", $search)
->groupEnd();
}
}

View File

@ -0,0 +1,97 @@
<?php
namespace App\Models\Configuracion;
class ComunidadesAutonomasModel 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.nombre",
];
protected $allowedFields = ["nombre", "pais_id"];
protected $returnType = "App\Entities\Configuracion\ComunidadesAutonomasEntity";
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.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.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.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.nombre", $search)
->groupEnd();
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace App\Models\Configuracion;
class FormasPagoModel extends \App\Models\GoBaseModel
{
protected $table = "lg_formas_pago";
/**
* Whether primary key uses auto increment.
*
* @var bool
*/
protected $useAutoIncrement = true;
protected $allowedFields = ["nombre"];
protected $returnType = "App\Entities\Configuracion\FormasPagoEntity";
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",
],
];
}

View File

@ -0,0 +1,373 @@
<div class="row">
<div class="col-md-12 col-lg-6 px-4">
<div class="mb-3">
<label for="nombre" class="form-label">
<?= lang('Clientes.nombre') ?>*
</label>
<input type="text" id="nombre" name="nombre" required maxLength="255" class="form-control"
value="<?= old('nombre', $clienteEntity->nombre) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="alias" class="form-label">
<?= lang('Clientes.alias') ?>*
</label>
<input type="text" id="alias" name="alias" required maxLength="255" class="form-control"
value="<?= old('alias', $clienteEntity->alias) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="direccion" class="form-label">
<?= lang('Clientes.direccion') ?>
</label>
<textarea rows="3" id="direccion" name="direccion" style="height: 10em;"
class="form-control"><?= old('direccion', $clienteEntity->direccion) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="ciudad" class="form-label">
<?= lang('Clientes.ciudad') ?>
</label>
<input type="text" id="ciudad" name="ciudad" maxLength="100" class="form-control"
value="<?= old('ciudad', $clienteEntity->ciudad) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<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>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="provincia" class="form-label">
<?= lang('Clientes.provincia') ?>
</label>
<input type="text" id="provincia" name="provincia" maxLength="100" class="form-control"
value="<?= old('provincia', $clienteEntity->provincia) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="cp" class="form-label">
<?= lang('Clientes.cp') ?>
</label>
<input type="text" id="cp" name="cp" maxLength="10" class="form-control"
value="<?= old('cp', $clienteEntity->cp) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<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>
<?php foreach ($paisList as $item) : ?>
<option value="<?= $item->id ?>"<?= $item->id == $clienteEntity->pais_id ? ' selected' : '' ?>>
<?= $item->nombre ?>
</option>
<?php endforeach; ?>
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="telefono" class="form-label">
<?= lang('Clientes.telefono') ?>
</label>
<input type="text" id="telefono" name="telefono" maxLength="60" class="form-control"
value="<?= old('telefono', $clienteEntity->telefono) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="email" class="form-label">
<?= lang('Clientes.email') ?>
</label>
<input type="email" id="email" name="email" maxLength="150" class="form-control"
value="<?= old('email', $clienteEntity->email) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="salesmanId" class="form-label">
<?= lang('Clientes.salesmanId') ?>*
</label>
<input type="number" id="salesmanId" name="salesman_id" required placeholder="1" maxLength="10"
class="form-control" value="<?= old('salesman_id', $clienteEntity->salesman_id) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="soporteId" class="form-label">
<?= lang('Clientes.soporteId') ?>
</label>
<input type="number" id="soporteId" name="soporte_id" maxLength="10" class="form-control"
value="<?= old('soporte_id', $clienteEntity->soporte_id) ?>">
</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 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; ?>
</select>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="vencimiento" class="form-label">
<?= lang('Clientes.vencimiento') ?>*
</label>
<input type="number" id="vencimiento" name="vencimiento" required placeholder="15" maxLength="10"
class="form-control" value="<?= old('vencimiento', $clienteEntity->vencimiento) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<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) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="margen" class="form-label">
<?= lang('Clientes.margen') ?>*
</label>
<input type="number" id="margen" name="margen" required placeholder="40.00" maxLength="8" step="0.01"
class="form-control" value="<?= old('margen', $clienteEntity->margen) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="margenPod" class="form-label">
<?= lang('Clientes.margenPod') ?>
</label>
<input type="number" id="margenPod" name="margen_pod" maxLength="8" step="0.01" class="form-control"
value="<?= old('margen_pod', $clienteEntity->margen_pod) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="descuento" class="form-label">
<?= lang('Clientes.descuento') ?>*
</label>
<input type="number" id="descuento" name="descuento" required placeholder="0.00" maxLength="8" step="0.01"
class="form-control" value="<?= old('descuento', $clienteEntity->descuento) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="limiteCredito" class="form-label">
<?= lang('Clientes.limiteCredito') ?>*
</label>
<input type="number" id="limiteCredito" name="limite_credito" required placeholder="0.00" maxLength="8"
step="0.01" class="form-control"
value="<?= old('limite_credito', $clienteEntity->limite_credito) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="limiteCreditoUserId" class="form-label">
<?= lang('Clientes.limiteCreditoUserId') ?>*
</label>
<input type="number" id="limiteCreditoUserId" name="limite_credito_user_id" required placeholder="1"
maxLength="10" class="form-control"
value="<?= old('limite_credito_user_id', $clienteEntity->limite_credito_user_id) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="limiteCreditoChangeAt" class="form-label">
<?= lang('Clientes.limiteCreditoChangeAt') ?>*
</label>
<input type="text" id="limiteCreditoChangeAt" name="limite_credito_change_at" required
placeholder="2017-02-13 12:38:03" maxLength="20" class="form-control"
value="<?= old('limite_credito_change_at', $clienteEntity->limite_credito_change_at) ?>">
</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>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="ccc" class="form-label">
<?= lang('Clientes.ccc') ?>
</label>
<input type="text" id="ccc" name="ccc" maxLength="100" class="form-control"
value="<?= old('ccc', $clienteEntity->ccc) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="cccCustomer" class="form-label">
<?= lang('Clientes.cccCustomer') ?>
</label>
<input type="text" id="cccCustomer" name="ccc_customer" maxLength="100" class="form-control"
value="<?= old('ccc_customer', $clienteEntity->ccc_customer) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="numCuenta" class="form-label">
<?= lang('Clientes.numCuenta') ?>
</label>
<input type="text" id="numCuenta" name="num_cuenta" maxLength="10" class="form-control"
value="<?= old('num_cuenta', $clienteEntity->num_cuenta) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="disponibleFe" class="form-check-label">
<input type="checkbox" id="disponibleFe" name="disponible_fe" value="1"
class="form-check-input"<?= $clienteEntity->disponible_fe == true ? 'checked' : ''; ?>>
<?= lang('Clientes.disponibleFe') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="messageTracking" class="form-check-label">
<input type="checkbox" id="messageTracking" name="message_tracking" value="1"
class="form-check-input"<?= $clienteEntity->message_tracking == true ? 'checked' : ''; ?>>
<?= lang('Clientes.messageTracking') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="messageProductionStart" class="form-check-label">
<input type="checkbox" id="messageProductionStart" name="message_production_start" value="1"
class="form-check-input"<?= $clienteEntity->message_production_start == true ? 'checked' : ''; ?>>
<?= lang('Clientes.messageProductionStart') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="tiradaFlexible" class="form-check-label">
<input type="checkbox" id="tiradaFlexible" name="tirada_flexible" value="1"
class="form-check-input"<?= $clienteEntity->tirada_flexible == true ? 'checked' : ''; ?>>
<?= lang('Clientes.tiradaFlexible') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="descuentoTiradaFlexible" class="form-label">
<?= lang('Clientes.descuentoTiradaFlexible') ?>*
</label>
<input type="number" id="descuentoTiradaFlexible" name="descuento_tirada_flexible" required
placeholder="20.00" maxLength="8" step="0.01" class="form-control"
value="<?= old('descuento_tirada_flexible', $clienteEntity->descuento_tirada_flexible) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="comentariosTiradaFlexible" class="form-label">
<?= lang('Clientes.comentariosTiradaFlexible') ?>*
</label>
<textarea rows="3" id="comentariosTiradaFlexible" name="comentarios_tirada_flexible" required
style="height: 10em;"
class="form-control"><?= old('comentarios_tirada_flexible', $clienteEntity->comentarios_tirada_flexible) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="saturacion" class="form-label">
<?= lang('Clientes.saturacion') ?>*
</label>
<input type="number" id="saturacion" name="saturacion" required placeholder="100.00" maxLength="8"
step="0.01" class="form-control" value="<?= old('saturacion', $clienteEntity->saturacion) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="tiendaId" class="form-label">
<?= lang('Clientes.tiendaId') ?>
</label>
<input type="number" id="tiendaId" name="tienda_id" maxLength="10" class="form-control"
value="<?= old('tienda_id', $clienteEntity->tienda_id) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="margenPlantillaId" class="form-label">
<?= lang('Clientes.margenPlantillaId') ?>
</label>
<input type="number" id="margenPlantillaId" name="margen_plantilla_id" maxLength="10" class="form-control"
value="<?= old('margen_plantilla_id', $clienteEntity->margen_plantilla_id) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="comentariosProduccion" class="form-label">
<?= lang('Clientes.comentariosProduccion') ?>
</label>
<textarea rows="3" id="comentariosProduccion" name="comentarios_produccion" style="height: 10em;"
class="form-control"><?= old('comentarios_produccion', $clienteEntity->comentarios_produccion) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="psCustomerId" class="form-label">
<?= lang('Clientes.psCustomerId') ?>
</label>
<input type="number" id="psCustomerId" name="ps_customer_id" maxLength="10" class="form-control"
value="<?= old('ps_customer_id', $clienteEntity->ps_customer_id) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<div class="form-check">
<label for="lineasenviofactura" class="form-check-label">
<input type="checkbox" id="lineasenviofactura" name="lineasEnvioFactura" value="1"
class="form-check-input"<?= $clienteEntity->lineasEnvioFactura == true ? 'checked' : ''; ?>>
<?= lang('Clientes.lineasenviofactura') ?>
</label>
</div><!--//.form-check -->
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="comentarios" class="form-label">
<?= lang('Clientes.comentarios') ?>
</label>
<textarea rows="3" id="comentarios" name="comentarios" style="height: 10em;"
class="form-control"><?= old('comentarios', $clienteEntity->comentarios) ?></textarea>
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="userCreatedId" class="form-label">
<?= lang('Clientes.userCreatedId') ?>*
</label>
<input type="number" id="userCreatedId" name="user_created_id" required placeholder="1" maxLength="10"
class="form-control" value="<?= old('user_created_id', $clienteEntity->user_created_id) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="userUpdateId" class="form-label">
<?= lang('Clientes.userUpdateId') ?>*
</label>
<input type="number" id="userUpdateId" name="user_update_id" required placeholder="1" maxLength="10"
class="form-control" value="<?= old('user_update_id', $clienteEntity->user_update_id) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -0,0 +1,27 @@
<?= $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" 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/_clienteFormItems") ?>
</div><!-- /.card-body -->
<div class="card-footer">
<?= anchor(route_to("clienteList"), 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() ?>

View File

@ -0,0 +1,157 @@
<?=$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>
</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.email') ?></th>
<th><?= lang('Clientes.salesmanId') ?></th>
<th><?= lang('FormasPago.formaPago') ?></th>
<th><?= lang('Clientes.vencimiento') ?></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('newCliente'), lang('Basic.global.addNew').' '.lang('Clientes.cliente'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-footer -->
</div><!--//.card -->
</div><!--//.col -->
</div><!--//.row -->
<?=$this->endSection() ?>
<?=$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">
<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`;
});
$(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') ?>',
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('clienteList') ?>/${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.bootstrap5.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.bootstrap5.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,27 @@
<div class="row">
<div class="col-md-12 col-lg-12 px-4">
<div class="mb-3">
<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) ?>">
</div><!--//.mb-3 -->
<div class="mb-3">
<label for="paisId" class="form-label">
<?=lang('ComunidadesAutonomas.pais') ?>*
</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>
<?php foreach ($paisList as $item) : ?>
<option value="<?=$item->id ?>"<?=$item->id==$comunidadesAutonomasEntity->pais_id ? ' selected':'' ?>>
<?=$item->nombre ?>
</option>
<?php endforeach; ?>
</select>
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -0,0 +1,28 @@
<?= $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="comunidadAutonomaForm" 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/comunidades-autonomas/_comunidadAutonomaFormItems") ?>
</div><!-- /.card-body -->
<div class="card-footer">
<?= anchor(route_to("comunidadAutonomaList"), 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() ?>

View File

@ -0,0 +1,159 @@
<?=$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('ComunidadesAutonomas.comunidadAutonomaList') ?></h3>
</div><!--//.card-header -->
<div class="card-body">
<?= view('Themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableOfComunidadesautonomas" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
<th><?=lang('ComunidadesAutonomas.id')?></th>
<th><?= lang('ComunidadesAutonomas.nombre') ?></th>
<th><?= lang('Paises.pais') ?></th>
<th><?= lang('ComunidadesAutonomas.createdAt') ?></th>
<th><?= lang('ComunidadesAutonomas.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('newComunidadAutonoma'), lang('Basic.global.addNew').' '.lang('ComunidadesAutonomas.comunidadAutonoma'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-footer -->
</div><!--//.card -->
</div><!--//.col -->
</div><!--//.row -->
<?=$this->endSection() ?>
<?=$this->section('additionalInlineJs') ?>
const lastColNr = $('#tableOfComunidadesautonomas').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 = $('#tableOfComunidadesautonomas').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,
stateSave: true,
order: [[1, 'asc']],
language: {
url: "/assets/dt/<?= config('Basics')->languages[$currentLocale] ?? config('Basics')->i18n ?>.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfComunidadesAutonomas') ?>',
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': 'pais' },
{ 'data': 'created_at' },
{ 'data': 'updated_at' },
{ 'data': actionBtns }
]
});
theTable.on( 'draw.dt', function () {
const dateCols = [4, 5];
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('comunidadAutonomaList') ?>/${$(this).attr('data-id')}/edit`;
});
$(document).on('click', '.btn-delete', function(e) {
Swal.fire({
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('ComunidadesAutonomas.comunidad autonoma'))]) ?>',
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('comunidadAutonomaList') ?>/${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() ?>

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', $formasPagoEntity->nombre) ?>">
</div><!--//.mb-3 -->
</div><!--//.col -->
</div><!-- //.row -->

View File

@ -0,0 +1,26 @@
<?= $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="formaPagoForm" 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/formas-pago/_formaPagoFormItems") ?>
</div><!-- /.card-body -->
<div class="card-footer">
<?= anchor(route_to("formaPagoList2"), 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() ?>

View File

@ -0,0 +1,144 @@
<?=$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.formaPagoList') ?></h3>
</div><!--//.card-header -->
<div class="card-body">
<?= view('Themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableOfFormaspago" class="table table-striped table-hover using-exportable-data-table" 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>
<?php foreach ($formaPagoList as $item ) : ?>
<tr>
<td class="align-middle text-center text-nowrap">
<?=anchor(route_to('editFormaPago', $item->id), lang('Basic.global.edit'), ['class'=>'btn btn-sm btn-warning btn-edit me-1', 'data-id'=>$item->id,]); ?>
<?=anchor('#confirm2delete', lang('Basic.global.Delete'), ['class'=>'btn btn-sm btn-danger btn-delete ms-1', 'data-href'=>route_to('deleteFormaPago', $item->id)]); ?>
</td>
<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 text-nowrap">
<?= empty($item->created_at) ? '' : date('mm/dd/YYYY H:i', strtotime($item->created_at)) ?>
</td>
<td class="align-middle text-nowrap">
<?= empty($item->updated_at) ? '' : date('mm/dd/YYYY H:i', strtotime($item->updated_at)) ?>
</td>
<td class="align-middle text-center text-nowrap">
<?=anchor(route_to('editFormaPago', $item->id), lang('Basic.global.edit'), ['class'=>'btn btn-sm btn-warning btn-edit me-1', 'data-id'=>$item->id,]); ?>
<?=anchor('#confirm2delete', lang('Basic.global.Delete'), ['class'=>'btn btn-sm btn-danger btn-delete ms-1', 'data-href'=>route_to('deleteFormaPago', $item->id)]); ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div><!--//.card-body -->
<div class="card-footer">
<?=anchor(route_to('newFormaPago'), lang('Basic.global.addNew').' '.lang('FormasPagoes.formaPago'), ['class'=>'btn btn-primary float-end']); ?>
</div><!--//.card-footer -->
</div><!--//.card -->
</div><!--//.col -->
</div><!--//.row -->
<?=$this->endSection() ?>
<?=$this->section('additionalInlineJs') ?>
const lastColNr2 = $(".using-exportable-data-table").find("tr:first th").length - 1;
theTable = $('.using-exportable-data-table').DataTable({
"responsive": true,
"paging": true,
"lengthMenu": [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
"pageLength": 10,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": 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'
}
],
"autoWidth": true,
"scrollX": true,
"stateSave": true,
"language": {
url: "/assets/dt/<?= config('Basics')->languages[$currentLocale] ?? config('Basics')->i18n ?>.json"
},
"columnDefs": [
{
orderable: false,
searchable: false,
targets: [0,lastColNr2]
}
]
});
$(document).on('click', '.btn-delete', function(e) {
e.preventDefault();
const dataHref = $(this).data('href');
Swal.fire({
title: "<?= lang('Basic.global.sweet.sureToDeleteTitle', [lang('FormasPagoes.forma 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) => {
if (result.value) {
window.location.href = `${dataHref}`;
}
});
});
<?=$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() ?>