mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'dev/cliente_usuarios' into 'main'
Dev/cliente usuarios See merge request jjimenez/safekat!225
This commit is contained in:
@ -370,8 +370,8 @@ $routes->group('clienteprecios', ['namespace' => 'App\Controllers\Clientes'], fu
|
|||||||
$routes->post('datatable', 'Clienteprecios::datatable', ['as' => 'dataTableOfClienteprecios']);
|
$routes->post('datatable', 'Clienteprecios::datatable', ['as' => 'dataTableOfClienteprecios']);
|
||||||
$routes->post('datatable_editor', 'Clienteprecios::datatable_editor', ['as' => 'editorOfClienteprecios']);
|
$routes->post('datatable_editor', 'Clienteprecios::datatable_editor', ['as' => 'editorOfClienteprecios']);
|
||||||
});
|
});
|
||||||
$routes->resource('clienteprecios', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'Clienteprecios', 'except' => 'show,new,create,update']);
|
|
||||||
|
|
||||||
|
$routes->resource('clienteprecios', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'Clienteprecios', 'except' => 'show,new,create,update']);
|
||||||
|
|
||||||
$routes->group('clienteplantillaprecios', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
|
$routes->group('clienteplantillaprecios', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
|
||||||
$routes->get('', 'Clienteplantillaprecios::index', ['as' => 'clienteplantillapreciosList']);
|
$routes->get('', 'Clienteplantillaprecios::index', ['as' => 'clienteplantillapreciosList']);
|
||||||
@ -391,6 +391,10 @@ $routes->group('clienteplantillaprecioslineas', ['namespace' => 'App\Controllers
|
|||||||
});
|
});
|
||||||
$routes->resource('clienteplantillaprecioslineas', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'clienteplantillaprecioslineas', 'except' => 'show,new,create,update']);
|
$routes->resource('clienteplantillaprecioslineas', ['namespace' => 'App\Controllers\Clientes', 'controller' => 'clienteplantillaprecioslineas', 'except' => 'show,new,create,update']);
|
||||||
|
|
||||||
|
$routes->group('clienteusuarios', ['namespace' => 'App\Controllers\Clientes'], function ($routes) {
|
||||||
|
$routes->post('datatable', 'Clienteusuarios::datatable', ['as' => 'dataTableOfClienteUsuarios']);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
$routes->group('formas-pagos', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
$routes->group('formas-pagos', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||||
$routes->get('', 'Formaspagos::index', ['as' => 'formaDePagoList']);
|
$routes->get('', 'Formaspagos::index', ['as' => 'formaDePagoList']);
|
||||||
@ -512,6 +516,7 @@ $routes->group('clientecontactos', ['namespace' => 'App\Controllers\Clientes'],
|
|||||||
$routes->post('(:num)/edit', 'Clientecontactos::edit/$1', ['as' => 'updateClienteContactos']);
|
$routes->post('(:num)/edit', 'Clientecontactos::edit/$1', ['as' => 'updateClienteContactos']);
|
||||||
$routes->post('datatable', 'Clientecontactos::datatable', ['as' => 'dataTableOfClienteContactos']);
|
$routes->post('datatable', 'Clientecontactos::datatable', ['as' => 'dataTableOfClienteContactos']);
|
||||||
$routes->post('datatable_editor', 'Clientecontactos::datatable_editor', ['as' => 'editorOfClienteContactos']);
|
$routes->post('datatable_editor', 'Clientecontactos::datatable_editor', ['as' => 'editorOfClienteContactos']);
|
||||||
|
$routes->get('delete/(:num)', 'Clientecontactos::delete/$1', ['as' => 'deleteClienteContactos']);
|
||||||
$routes->post('allmenuitems', 'Clientecontactos::allItemsSelect', ['as' => 'select2ItemsOfClienteContactos']);
|
$routes->post('allmenuitems', 'Clientecontactos::allItemsSelect', ['as' => 'select2ItemsOfClienteContactos']);
|
||||||
$routes->post('menuitems', 'Clientecontactos::menuItems', ['as' => 'menuItemsOfClienteContactos']);
|
$routes->post('menuitems', 'Clientecontactos::menuItems', ['as' => 'menuItemsOfClienteContactos']);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -60,7 +60,6 @@ class Clientecontactos extends \App\Controllers\GoBaseResourceController
|
|||||||
public function add()
|
public function add()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
$requestMethod = $this->request->getMethod();
|
$requestMethod = $this->request->getMethod();
|
||||||
|
|
||||||
if ($requestMethod === 'post') :
|
if ($requestMethod === 'post') :
|
||||||
|
|||||||
77
ci4/app/Controllers/Clientes/Clienteusuarios.php
Normal file
77
ci4/app/Controllers/Clientes/Clienteusuarios.php
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?php namespace App\Controllers\Clientes;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Controllers\GoBaseResourceController;
|
||||||
|
|
||||||
|
use App\Models\Clientes\ClienteUsuariosModel;
|
||||||
|
use App\Models\Collection;
|
||||||
|
|
||||||
|
use App\Entities\Clientes\ClienteContactoEntity;
|
||||||
|
|
||||||
|
use App\Models\Clientes\ClienteModel;
|
||||||
|
|
||||||
|
use App\Models\Clientes\ClienteContactoModel;
|
||||||
|
use DataTables\Editor;
|
||||||
|
use DataTables\Editor\Field;
|
||||||
|
use DataTables\Editor\Validate;
|
||||||
|
|
||||||
|
class Clienteusuarios extends \App\Controllers\GoBaseResourceController
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $modelName = ClienteUsuariosModel::class;
|
||||||
|
protected $format = 'json';
|
||||||
|
|
||||||
|
protected static $singularObjectName = 'Contacto de cliente';
|
||||||
|
protected static $singularObjectNameCc = 'contactoDeCliente';
|
||||||
|
protected static $pluralObjectName = 'Contactos de cliente';
|
||||||
|
protected static $pluralObjectNameCc = 'contactosDeCliente';
|
||||||
|
|
||||||
|
protected static $controllerSlug = 'cliente-contactos';
|
||||||
|
|
||||||
|
protected static $viewPath = 'themes/backend/vuexy/form/clientes/usuarios/';
|
||||||
|
|
||||||
|
protected $indexRoute = 'contactoDeClienteList';
|
||||||
|
|
||||||
|
|
||||||
|
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||||
|
{
|
||||||
|
$this->viewData['pageTitle'] = lang('ClienteContactos.moduleTitle');
|
||||||
|
$this->viewData['usingSweetAlert'] = true;
|
||||||
|
parent::initController($request, $response, $logger);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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 = ClienteUsuariosModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
|
||||||
|
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||||
|
|
||||||
|
$id_C = $reqData['id_cliente'] ?? -1;
|
||||||
|
|
||||||
|
$resourceData = $this->model->getResource("", $id_C)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||||
|
|
||||||
|
return $this->respond(Collection::datatable(
|
||||||
|
$resourceData,
|
||||||
|
$this->model->getResource()->countAllResults(),
|
||||||
|
$this->model->getResource("", $id_C)->countAllResults()
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
return $this->failUnauthorized('Invalid request', 403);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -130,8 +130,8 @@ return [
|
|||||||
"profile_subtitle_tfa" => "Autenticación de dos factores (2FA)",
|
"profile_subtitle_tfa" => "Autenticación de dos factores (2FA)",
|
||||||
"profile_first_name" => "Nombre",
|
"profile_first_name" => "Nombre",
|
||||||
"profile_first_name_ph" => "Escriba su nombre",
|
"profile_first_name_ph" => "Escriba su nombre",
|
||||||
"profile_last_name" => "Apellido",
|
"profile_last_name" => "Apellidos",
|
||||||
"profile_last_name_ph" => "Escriba su apellido",
|
"profile_last_name_ph" => "Escriba sus apellidos",
|
||||||
"profile_email" => "Correo Electrónico",
|
"profile_email" => "Correo Electrónico",
|
||||||
"profile_email_ph" => "Escriba su correo electrónico",
|
"profile_email_ph" => "Escriba su correo electrónico",
|
||||||
"profile_mobile" => "Teléfono Móvil",
|
"profile_mobile" => "Teléfono Móvil",
|
||||||
|
|||||||
@ -24,6 +24,11 @@ return [
|
|||||||
'libroCosidoTapaDura' => "Cosido Tapa Dura",
|
'libroCosidoTapaDura' => "Cosido Tapa Dura",
|
||||||
'libroFresadoTapaBlanda' => "Fresado Tapa Blanda",
|
'libroFresadoTapaBlanda' => "Fresado Tapa Blanda",
|
||||||
'libroFresadoTapaDura' => "Fresado Tapa Dura",
|
'libroFresadoTapaDura' => "Fresado Tapa Dura",
|
||||||
|
'libroEspiralTapaDura' => "Espiral Tapa Dura",
|
||||||
|
'libroEspiralTapaBlanda' => "Espiral Tapa Blanda",
|
||||||
|
'libroWireoTapaDura' => "Wire-o Tapa Dura",
|
||||||
|
'libroWireoTapaBlanda' => "Wire-o Tapa Blanda",
|
||||||
|
'libroGrapado' => "Grapado",
|
||||||
|
|
||||||
'datosPresupuesto' => 'Datos generales del presupuesto',
|
'datosPresupuesto' => 'Datos generales del presupuesto',
|
||||||
'datosLibro' => 'Datos del libro',
|
'datosLibro' => 'Datos del libro',
|
||||||
|
|||||||
110
ci4/app/Models/Clientes/ClienteUsuariosModel.php
Normal file
110
ci4/app/Models/Clientes/ClienteUsuariosModel.php
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Clientes;
|
||||||
|
|
||||||
|
class ClienteUsuariosModel extends \App\Models\GoBaseModel
|
||||||
|
{
|
||||||
|
protected $table = "auth_user";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether primary key uses auto increment.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $useAutoIncrement = true;
|
||||||
|
|
||||||
|
const SORTABLE = [
|
||||||
|
0 => "t1.first_name",
|
||||||
|
1 => "t1.last_name",
|
||||||
|
2 => "t1.email",
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $allowedFields = ["id", "first_name", "last_name", "email"];
|
||||||
|
protected $returnType = "App\Entities\Usuarios\UserEntity";
|
||||||
|
|
||||||
|
protected $useTimestamps = true;
|
||||||
|
protected $useSoftDeletes = false;
|
||||||
|
|
||||||
|
protected $createdField = "created_at";
|
||||||
|
|
||||||
|
protected $updatedField = "updated_at";
|
||||||
|
|
||||||
|
public static $labelField = "nombre";
|
||||||
|
|
||||||
|
protected $validationRules = [
|
||||||
|
"last_name" => [
|
||||||
|
"label" => "ClienteContactos.apellidos",
|
||||||
|
"rules" => "trim|max_length[500]",
|
||||||
|
],
|
||||||
|
"email" => [
|
||||||
|
"label" => "ClienteContactos.email",
|
||||||
|
"rules" => "trim|max_length[150]|valid_email|permit_empty",
|
||||||
|
],
|
||||||
|
"first_name" => [
|
||||||
|
"label" => "ClienteContactos.nombre",
|
||||||
|
"rules" => "trim|max_length[100]",
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $validationMessages = [
|
||||||
|
"last_name" => [
|
||||||
|
"max_length" => "ClienteContactos.validation.apellidos.max_length",
|
||||||
|
],
|
||||||
|
|
||||||
|
"email" => [
|
||||||
|
"max_length" => "ClienteContactos.validation.email.max_length",
|
||||||
|
"valid_email" => "ClienteContactos.validation.email.valid_email",
|
||||||
|
],
|
||||||
|
"first_name" => [
|
||||||
|
"max_length" => "ClienteContactos.validation.nombre.max_length",
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
public function findAllWithClientes(string $selcols = "*", int $limit = null, int $offset = 0)
|
||||||
|
{
|
||||||
|
$sql =
|
||||||
|
"SELECT t1." .
|
||||||
|
$selcols .
|
||||||
|
", t2.nombre AS cliente_id FROM " .
|
||||||
|
$this->table .
|
||||||
|
" t1 LEFT JOIN clientes t2 ON t1.cliente_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 = "", $cliente_id = -1)
|
||||||
|
{
|
||||||
|
$builder = $this->db
|
||||||
|
->table($this->table . " t1")
|
||||||
|
->select(
|
||||||
|
"t1.id_user AS id, t1.first_name AS nombre, t1.last_name AS apellidos, t1.email AS email"
|
||||||
|
);
|
||||||
|
|
||||||
|
$builder->where('t1.id_user', $cliente_id);
|
||||||
|
|
||||||
|
return empty($search)
|
||||||
|
? $builder
|
||||||
|
: $builder
|
||||||
|
->groupStart()
|
||||||
|
->like("t1.first_name", $search)
|
||||||
|
->orLike("t1.last_name", $search)
|
||||||
|
->orLike("t1.email", $search)
|
||||||
|
->groupEnd();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -564,7 +564,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php if ($formAction !== site_url('cliente/add')){ ?>
|
<?php if ($formAction !== site_url('cliente/add')){ ?>
|
||||||
<div class="tab-pane fade" id="tarifascliente" role="tabpanel">
|
<div class="tab-pane fade" id="tarifascliente" role="tabpanel">
|
||||||
<?= view("themes/backend/vuexy/form/clientes/cliente/convert2templateModal") ?>
|
<?= view("themes/backend/vuexy/form/clientes/cliente/convert2templateModal") ?>
|
||||||
@ -610,7 +609,6 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="tab-pane fade" id="contactos" role="tabpanel">
|
<div class="tab-pane fade" id="contactos" role="tabpanel">
|
||||||
<table id="tableOfClienteContactos"
|
<table id="tableOfClienteContactos"
|
||||||
class="table table-striped table-hover" style="width: 100%;">
|
class="table table-striped table-hover" style="width: 100%;">
|
||||||
@ -629,7 +627,6 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="tab-pane fade" id="domicilio-entrega" role="tabpanel">
|
<div class="tab-pane fade" id="domicilio-entrega" role="tabpanel">
|
||||||
<?= view("themes/backend/vuexy/form/clientes/cliente/_clienteDireccionesForm") ?>
|
<?= view("themes/backend/vuexy/form/clientes/cliente/_clienteDireccionesForm") ?>
|
||||||
<table id="tableOfDireccionesEnvio" class="table dt-responsive dataTable" style="width: 100%;">
|
<table id="tableOfDireccionesEnvio" class="table dt-responsive dataTable" style="width: 100%;">
|
||||||
@ -662,7 +659,20 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane fade" id="usuarios" role="tabpanel">
|
<div class="tab-pane fade" id="usuarios" role="tabpanel">
|
||||||
<h3>Proximanente</h3>
|
<table id="tableOfClienteUsuarios" class="table table-striped table-hover" style="width: 100%;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th><?= lang('App.profile_first_name') ?></th>
|
||||||
|
<th><?= lang('App.profile_last_name') ?></th>
|
||||||
|
<th><?= lang('App.profile_email') ?></th>
|
||||||
|
<th class="text-nowrap" style="min-width:100px"><?= lang('Basic.global.Action') ?></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@ -673,27 +683,6 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php /* A implementar en el controller
|
|
||||||
<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 -->
|
|
||||||
|
|
||||||
*/ ?>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php if ($formAction !== site_url('cliente/add')){ ?>
|
<?php if ($formAction !== site_url('cliente/add')){ ?>
|
||||||
@ -701,6 +690,12 @@
|
|||||||
/****************************************
|
/****************************************
|
||||||
Funcionamiento general
|
Funcionamiento general
|
||||||
*****************************************/
|
*****************************************/
|
||||||
|
const url = window.location.href;
|
||||||
|
const url_parts = url.split('/');
|
||||||
|
let id = -1;
|
||||||
|
if(url_parts[url_parts.length-2] == 'edit'){
|
||||||
|
id = url_parts[url_parts.length-1];
|
||||||
|
}
|
||||||
|
|
||||||
$(document).on('click', '.btn-remove', function(e) {
|
$(document).on('click', '.btn-remove', function(e) {
|
||||||
|
|
||||||
@ -718,18 +713,21 @@ $(document).on('click', '.btn-remove', function(e) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
<?=$this->endSection() ?>
|
<?=$this->endSection() ?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?= $this->section("additionalInlineJs") ?>
|
<?= $this->section("additionalInlineJs") ?>
|
||||||
|
/****************************************
|
||||||
|
Contactos
|
||||||
|
*****************************************/
|
||||||
|
|
||||||
const lastColNr = $('#tableOfClienteContactos').find("tr:first th").length - 1;
|
const lastColNr = $('#tableOfClienteContactos').find("tr:first th").length - 1;
|
||||||
|
|
||||||
const actionBtns = function(data) {
|
const actionBtns = function(data) {
|
||||||
return `
|
return `
|
||||||
<span class="edit"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a></span>
|
<span class="edit"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a></span>
|
||||||
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
|
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-deleted mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
|
||||||
<span class="cancel"></span>
|
<span class="cancel"></span>
|
||||||
`;
|
`;
|
||||||
};
|
};
|
||||||
@ -779,7 +777,6 @@ $(document).on('click', '.btn-remove', function(e) {
|
|||||||
|
|
||||||
|
|
||||||
editor.on( 'postSubmit', function ( e, json, data, action ) {
|
editor.on( 'postSubmit', function ( e, json, data, action ) {
|
||||||
|
|
||||||
yeniden(json.<?= csrf_token() ?>);
|
yeniden(json.<?= csrf_token() ?>);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -803,33 +800,27 @@ $(document).on('click', '.btn-remove', function(e) {
|
|||||||
);
|
);
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
||||||
// Delete row
|
// Delete row
|
||||||
$('#tableOfClienteContactos').on( 'click', 'tbody span.remove', function (e) {
|
$(document).on('click', '.btn-deleted', function(e) {
|
||||||
|
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
|
||||||
|
});
|
||||||
|
|
||||||
Swal.fire({
|
$(document).on('click', '.btn-remove', function(e) {
|
||||||
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Basic.global.sweet.line'))]) ?>',
|
const dataId = $(this).attr('data-id');
|
||||||
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
|
const row = $(this).closest('tr');
|
||||||
icon: 'warning',
|
if ($.isNumeric(dataId)) {
|
||||||
showCancelButton: true,
|
$.ajax({
|
||||||
confirmButtonColor: '#3085d6',
|
url: `/clientecontactos/delete/${dataId}`,
|
||||||
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
|
method: 'GET',
|
||||||
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
|
}).done((data, textStatus, jqXHR) => {
|
||||||
cancelButtonColor: '#d33'
|
$('#confirm2delete').modal('toggle');
|
||||||
})
|
theTable.clearPipeline();
|
||||||
.then((result) => {
|
theTable.row($(row)).invalidate().draw();
|
||||||
const dataId = $(this).data('id');
|
popSuccessAlert(data.msg ?? jqXHR.statusText);
|
||||||
const row = $(this).closest('tr');
|
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||||
if (result.value) {
|
popErrorAlert(jqXHR.responseJSON.messages.error)
|
||||||
editor
|
})
|
||||||
.create( false )
|
}
|
||||||
.edit( this.parentNode, false)
|
|
||||||
.set( 'deleted_at', new Date().toISOString().slice(0, 19).replace('T', ' ') )
|
|
||||||
.set( 'is_deleted', 1 )
|
|
||||||
.submit();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var theTable = $('#tableOfClienteContactos').DataTable( {
|
var theTable = $('#tableOfClienteContactos').DataTable( {
|
||||||
@ -1457,6 +1448,67 @@ function delete_direccion_envio(dataId){
|
|||||||
|
|
||||||
<?=$this->endSection() ?>
|
<?=$this->endSection() ?>
|
||||||
|
|
||||||
|
<?= $this->section("additionalInlineJs") ?>
|
||||||
|
/****************************************
|
||||||
|
Contactos
|
||||||
|
*****************************************/
|
||||||
|
|
||||||
|
const lastColNrCU = $('#tableOfClienteUsuarios').find("tr:first th").length - 1;
|
||||||
|
|
||||||
|
var theTableCU = $('#tableOfClienteUsuarios').DataTable( {
|
||||||
|
serverSide: true,
|
||||||
|
processing: true,
|
||||||
|
autoWidth: true,
|
||||||
|
responsive: true,
|
||||||
|
lengthMenu: [ 5, 10, 25],
|
||||||
|
order: [[ 0, "asc" ], [ 1, "asc" ]],
|
||||||
|
pageLength: 10,
|
||||||
|
lengthChange: true,
|
||||||
|
searching: false,
|
||||||
|
paging: true,
|
||||||
|
info: false,
|
||||||
|
dom: '<"mt-4"><"float-end"B><"float-start"l><t><"mt-4 mb-3"p>',
|
||||||
|
ajax : $.fn.dataTable.pipeline( {
|
||||||
|
url: '<?= route_to('dataTableOfClienteUsuarios') ?>',
|
||||||
|
data: {
|
||||||
|
//id_cliente: id,
|
||||||
|
id_cliente: 1,
|
||||||
|
},
|
||||||
|
method: 'POST',
|
||||||
|
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||||
|
async: true,
|
||||||
|
}),
|
||||||
|
columns: [
|
||||||
|
{ 'data': 'id' },
|
||||||
|
{ 'data': 'nombre' },
|
||||||
|
{ 'data': 'apellidos' },
|
||||||
|
{ 'data': 'email' },
|
||||||
|
{
|
||||||
|
data: actionBtns,
|
||||||
|
className: 'row-edit dt-center'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
columnDefs: [
|
||||||
|
{
|
||||||
|
orderable: false,
|
||||||
|
searchable: false,
|
||||||
|
targets: [lastColNrCU]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"orderData": [ 0, 1 ],
|
||||||
|
"targets": 0
|
||||||
|
},
|
||||||
|
|
||||||
|
],
|
||||||
|
language: {
|
||||||
|
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
<?=$this->endSection() ?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?=$this->section('css') ?>
|
<?=$this->section('css') ?>
|
||||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/datatables-editor/editor.bootstrap5.min.css') ?>">
|
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/datatables-editor/editor.bootstrap5.min.css') ?>">
|
||||||
|
|||||||
@ -49,7 +49,7 @@
|
|||||||
$('#saveForm').click();
|
$('#saveForm').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('#soporteId').select2({
|
$('#soporteId').select2({
|
||||||
@ -230,11 +230,9 @@
|
|||||||
|
|
||||||
|
|
||||||
<?=$this->section('css') ?>
|
<?=$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/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") ?>">
|
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
|
||||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/sk-datatables.css') ?>">
|
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/sk-datatables.css') ?>">
|
||||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/safekat.css') ?>">
|
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/safekat.css') ?>">
|
||||||
|
|
||||||
<?=$this->endSection() ?>
|
<?=$this->endSection() ?>
|
||||||
|
|
||||||
|
|||||||
@ -121,6 +121,11 @@ $('#tableOfPresupuestos thead tr:eq(1) th').each(function (i) {
|
|||||||
selector.append('<option value="libroCosidoTapaDura"><?= lang('Presupuestos.libroCosidoTapaDura') ?></option>');
|
selector.append('<option value="libroCosidoTapaDura"><?= lang('Presupuestos.libroCosidoTapaDura') ?></option>');
|
||||||
selector.append('<option value="libroFresadoTapaBlanda"><?= lang('Presupuestos.libroFresadoTapaBlanda') ?></option>');
|
selector.append('<option value="libroFresadoTapaBlanda"><?= lang('Presupuestos.libroFresadoTapaBlanda') ?></option>');
|
||||||
selector.append('<option value="libroFresadoTapaDura"><?= lang('Presupuestos.libroFresadoTapaDura') ?></option>');
|
selector.append('<option value="libroFresadoTapaDura"><?= lang('Presupuestos.libroFresadoTapaDura') ?></option>');
|
||||||
|
selector.append('<option value="libroEspiralTapaDura"><?= lang('Presupuestos.libroEspiralTapaDura') ?></option>');
|
||||||
|
selector.append('<option value="libroEspiralTapaBlanda"><?= lang('Presupuestos.libroEspiralTapaBlanda') ?></option>');
|
||||||
|
selector.append('<option value="libroWireoTapaDura"><?= lang('Presupuestos.libroWireoTapaDura') ?></option>');
|
||||||
|
selector.append('<option value="libroWireoTapaBlanda"><?= lang('Presupuestos.libroWireoTapaBlanda') ?></option>');
|
||||||
|
selector.append('<option value="libroGrapado"><?= lang('Presupuestos.libroGrapado') ?></option>');
|
||||||
|
|
||||||
selector.on('change', function () {
|
selector.on('change', function () {
|
||||||
var val = $.fn.dataTable.util.escapeRegex(
|
var val = $.fn.dataTable.util.escapeRegex(
|
||||||
@ -207,6 +212,27 @@ theTable = $('#tableOfPresupuestos').DataTable({
|
|||||||
return '<?= lang('Presupuestos.libroFresadoTapaDura') ?>';
|
return '<?= lang('Presupuestos.libroFresadoTapaDura') ?>';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case "libroEspiralTapaDura":
|
||||||
|
return '<?= lang('Presupuestos.libroEspiralTapaDura') ?>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "libroEspiralTapaBlanda":
|
||||||
|
return '<?= lang('Presupuestos.libroEspiralTapaBlanda') ?>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "libroWireoTapaDura":
|
||||||
|
return '<?= lang('Presupuestos.libroWireoTapaDura') ?>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "libroWireoTapaBlanda":
|
||||||
|
return '<?= lang('Presupuestos.libroWireoTapaBlanda') ?>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "libroGrapado":
|
||||||
|
return '<?= lang('Presupuestos.libroGrapado') ?>';
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return data; // Debug
|
return data; // Debug
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user