mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'fix/añadir_cliente' into 'main'
modificado formulario cliente. Añadida migracion para la bbdd See merge request jjimenez/safekat!386
This commit is contained in:
@ -77,14 +77,7 @@ $routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion']
|
||||
$routes->post('menuitemsFacturas', 'SeriesFacturas::menuItemsFacturas', ['as' => 'menuItemsOfSeriesFacturas']);
|
||||
});
|
||||
|
||||
/* Formas de Pago */
|
||||
$routes->group('formas-pago', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'FormasPago::index', ['as' => 'formasPagoList']);
|
||||
$routes->match(['get', 'post'], 'add', 'FormasPago::add', ['as' => 'formasPagoAdd']);
|
||||
$routes->match(['get', 'post'], 'edit/(:num)', 'FormasPago::edit/$1', ['as' => 'formasPagoEdit']);
|
||||
$routes->get('delete/(:num)', 'FormasPago::delete/$1', ['as' => 'formasPagoDelete']);
|
||||
$routes->post('datatable', 'FormasPago::datatable', ['as' => 'formasPagoDT']);
|
||||
});
|
||||
|
||||
$routes->group("variables", ["namespace" => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'ConfigVariables::index', ['as' => 'variablesIndex']);
|
||||
$routes->get('find/(:num)', 'ConfigVariables::get/$1', ['as' => 'variablesFind']);
|
||||
@ -113,8 +106,10 @@ $routes->group('users', ['namespace' => 'App\Controllers\Configuracion'], functi
|
||||
$routes->get('delete/(:num)', 'Users::delete/$1', ['as' => 'deleteUser']);
|
||||
$routes->post('allmenuitems', 'Users::allItemsSelect', ['as' => 'select2ItemsOfUsers']);
|
||||
$routes->post('menuitems', 'Users::menuItems', ['as' => 'menuItemsOfUsers']);
|
||||
$routes->post('getMenuComerciales', 'Users::getMenuComerciales', ['as' => 'menuItemsComerciales']);
|
||||
$routes->get('getMenuComerciales', 'Users::getMenuComerciales', ['as' => 'menuItemsComerciales']);
|
||||
});
|
||||
$routes->resource('users', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Users', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('group', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'Group::index', ['as' => 'userGroupList']);
|
||||
@ -332,10 +327,22 @@ $routes->group('comunidades-autonomas', ['namespace' => 'App\Controllers\Configu
|
||||
$routes->post('datatable', 'Comunidadesautonomas::datatable', ['as' => 'dataTableOfComunidadesAutonomas']);
|
||||
$routes->post('allmenuitems', 'Comunidadesautonomas::allItemsSelect', ['as' => 'select2ItemsOfComunidadesAutonomas']);
|
||||
$routes->post('menuitems', 'Comunidadesautonomas::menuItems', ['as' => 'menuItemsOfComunidadesAutonomas']);
|
||||
$routes->get('menuitems2', 'Comunidadesautonomas::menuItems2', ['as' => 'menuItemsOfComunidadesAutonomas2']);
|
||||
});
|
||||
$routes->resource('comunidades-autonomas', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Comunidadesautonomas', 'except' => 'show,new,create,update']);
|
||||
|
||||
|
||||
$routes->group('formas-pago', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||
$routes->get('', 'FormasPago::index', ['as' => 'formasPagoList']);
|
||||
$routes->match(['get', 'post'], 'add', 'FormasPago::add', ['as' => 'formasPagoAdd']);
|
||||
$routes->match(['get', 'post'], 'edit/(:num)', 'FormasPago::edit/$1', ['as' => 'formasPagoEdit']);
|
||||
$routes->get('delete/(:num)', 'FormasPago::delete/$1', ['as' => 'formasPagoDelete']);
|
||||
$routes->post('datatable', 'FormasPago::datatable', ['as' => 'formasPagoDT']);
|
||||
$routes->get('menuitems', 'FormasPago::menuItems', ['as' => 'menuItemsOfFormasDePagos']);
|
||||
});
|
||||
$routes->resource('formas-pago', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'FormasPago', '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']);
|
||||
@ -346,6 +353,7 @@ $routes->group('paises', ['namespace' => 'App\Controllers\Configuracion'], funct
|
||||
$routes->post('datatable', 'Paises::datatable', ['as' => 'dataTableOfPaises']);
|
||||
$routes->post('allmenuitems', 'Paises::allItemsSelect', ['as' => 'select2ItemsOfPaises']);
|
||||
$routes->post('menuitems', 'Paises::menuItems', ['as' => 'menuItemsOfPaises']);
|
||||
$routes->get('menuitems2', 'Paises::menuItems2', ['as' => 'menuItemsOfPaises2']);
|
||||
});
|
||||
$routes->resource('paises', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Paises', 'except' => 'show,new,create,update']);
|
||||
|
||||
@ -360,6 +368,7 @@ $routes->group('provincias', ['namespace' => 'App\Controllers\Configuracion'], f
|
||||
$routes->post('datatable', 'Provincias::datatable', ['as' => 'dataTableOfProvincias']);
|
||||
$routes->post('allmenuitems', 'Provincias::allItemsSelect', ['as' => 'select2ItemsOfProvincias']);
|
||||
$routes->post('menuitems', 'Provincias::menuItems', ['as' => 'menuItemsOfProvincias']);
|
||||
$routes->get('menuitems2', 'Provincias::menuItems2', ['as' => 'menuItemsOfProvincias2']);
|
||||
});
|
||||
$routes->resource('provincias', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Provincias', 'except' => 'show,new,create,update']);
|
||||
|
||||
@ -420,18 +429,6 @@ $routes->group('misdirecciones', ['namespace' => 'App\Controllers\Clientes'], fu
|
||||
});
|
||||
|
||||
|
||||
$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']);
|
||||
|
||||
$routes->group('tarifasencuadernacion', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) {
|
||||
$routes->get('', 'Tarifasencuadernacion::index', ['as' => 'tarifaEncuadernacionList']);
|
||||
|
||||
@ -271,6 +271,27 @@ class Comunidadesautonomas extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
public function menuItems2()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"nombre as name"
|
||||
]
|
||||
)->orderBy("nombre", "asc");
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("lg_comunidades_autonomas.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function getPaisListItems($selId = null)
|
||||
{
|
||||
|
||||
@ -230,25 +230,19 @@ class FormasPago extends \App\Controllers\BaseResourceController
|
||||
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);
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"nombre as name"
|
||||
]
|
||||
)->orderBy("nombre", "asc");
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("formas_pago.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
|
||||
@ -269,4 +269,25 @@ class Paises extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
public function menuItems2()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"nombre as name"
|
||||
]
|
||||
)->orderBy("nombre", "asc");
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("lg_paises.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -271,6 +271,27 @@ class Provincias extends \App\Controllers\BaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
public function menuItems2()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$query = $this->model->builder()->select(
|
||||
[
|
||||
"id",
|
||||
"nombre as name"
|
||||
]
|
||||
)->orderBy("nombre", "asc");
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("lg_provincias.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
return $this->response->setJSON($query->get()->getResultObject());
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function getPaisListItems($selId = null)
|
||||
{
|
||||
|
||||
@ -372,13 +372,7 @@ class Users extends \App\Controllers\GoBaseController
|
||||
if ($this->request->isAJAX()) {
|
||||
$comerciales = $this->model->getComerciales();
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'menu' => $comerciales,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
return $this->respond($comerciales);
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ class UserModel extends ShieldUserModel
|
||||
$builder = $this->db
|
||||
->table("users" . " t1")
|
||||
->select(
|
||||
"t1.id AS id, CONCAT(t1.first_name, ' ', t1.last_name) AS text"
|
||||
"t1.id AS id, CONCAT(t1.first_name, ' ', t1.last_name) AS name"
|
||||
);
|
||||
|
||||
$builder->where('t1.deleted_at', null);
|
||||
|
||||
@ -158,11 +158,6 @@
|
||||
<?= lang('Clientes.paisId') ?>
|
||||
</label>
|
||||
<select id="paisId" name="pais_id" class="form-control select2bs" style="width: 100%;" >
|
||||
<?php foreach ($paisList as $item) : ?>
|
||||
<option value="<?=$item->id ?>"<?=$item->id==$clienteEntity->pais_id ? ' selected':'' ?>>
|
||||
<?=$item->nombre ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
@ -34,201 +34,6 @@
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
$(document).keypress(function (e) {
|
||||
var key = e.which;
|
||||
if(key == 13) // the enter key code
|
||||
{ e.preventDefault()
|
||||
if($('#addressForm').hasClass('show')){
|
||||
$("#saveAdd").click();
|
||||
}
|
||||
else if ($('#convert2Template').hasClass('show')){
|
||||
$("#saveTemplate").click();
|
||||
}
|
||||
else{
|
||||
$('#saveForm').click();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#soporteId').select2({
|
||||
allowClear: false,
|
||||
ajax: {
|
||||
url: '<?= route_to("menuItemsComerciales") ?>',
|
||||
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("menuItemsComerciales") ?>',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
|
||||
data: function (params) {
|
||||
return {
|
||||
id: 'id',
|
||||
text: 'text',
|
||||
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() ?>
|
||||
|
||||
|
||||
<?=$this->section('css') ?>
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/datatables-editor/editor.dataTables.min.css') ?>">
|
||||
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
|
||||
@ -236,3 +41,7 @@
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/safekat.css') ?>">
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
|
||||
<?= $this->section("additionalExternalJs") ?>
|
||||
<script type="module" src="<?= site_url('assets/js/safekat/pages/cliente/cliente.js?'. 'token' . '='. (csrf_token() ?? "token")) ?>"></script>
|
||||
<?= $this->endSection() ?>
|
||||
@ -1,6 +1,4 @@
|
||||
import ClassSelect from '../../components/select2.js';
|
||||
import tarjetaTiradasPrecio from './tarjetaTiradasPrecio.js';
|
||||
|
||||
|
||||
class DatosGenerales {
|
||||
|
||||
|
||||
@ -11,38 +11,7 @@ import tarjetaTiradasPrecio from './tarjetaTiradasPrecio.js';
|
||||
class PresupuestoCliente {
|
||||
|
||||
constructor() {
|
||||
/*
|
||||
// Seleccionar el header y el contenedor del offcanvas
|
||||
var stepperHeader = document.querySelector('#sharedStepper');
|
||||
var offcanvasBody = document.querySelector('#menu-offcanvas .offcanvas-body');
|
||||
|
||||
// Función para verificar el tamaño de la pantalla y mover el contenido
|
||||
function adjustStepperLocation() {
|
||||
if (window.innerWidth < 768) {
|
||||
// Si es un dispositivo móvil o tablet, mover el stepper al offcanvas
|
||||
if (offcanvasBody && stepperHeader) {
|
||||
// Verificar si el stepper ya está en el offcanvas
|
||||
if (!offcanvasBody.contains(stepperHeader)) {
|
||||
offcanvasBody.appendChild(stepperHeader); // Mover al offcanvas
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Si es un dispositivo grande, dejar el stepper en su lugar original
|
||||
var originalContainer = document.querySelector('.bs-stepper-header').parentNode;
|
||||
if (originalContainer && !originalContainer.contains(stepperHeader)) {
|
||||
originalContainer.appendChild(stepperHeader); // Mover de vuelta al contenedor original
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Llamar a la función para ajustar la ubicación al cargar
|
||||
adjustStepperLocation();
|
||||
|
||||
// También ejecutar la función cuando cambie el tamaño de la ventana
|
||||
window.addEventListener('resize', function () {
|
||||
adjustStepperLocation();
|
||||
});
|
||||
*/
|
||||
|
||||
this.clientePresupuestoWizard = document.querySelector('#wizard-presupuesto-cliente');
|
||||
|
||||
this.validationStepper = new Stepper(this.clientePresupuestoWizard, {
|
||||
|
||||
Reference in New Issue
Block a user