mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'main' into feat/wiki
This commit is contained in:
@ -6,7 +6,7 @@ use CodeIgniter\Config\BaseConfig;
|
||||
|
||||
class Email extends BaseConfig
|
||||
{
|
||||
public string $fromEmail = 'safekat@imnavajas.es';
|
||||
public string $fromEmail = 'soporte_erp@safekat.es';
|
||||
public string $fromName = 'Safekat ERP';
|
||||
public string $recipients = '';
|
||||
|
||||
@ -28,27 +28,27 @@ class Email extends BaseConfig
|
||||
/**
|
||||
* SMTP Server Hostname
|
||||
*/
|
||||
public string $SMTPHost = 'imnavajas.es';
|
||||
public string $SMTPHost = 'smtp.ionos.es';
|
||||
|
||||
/**
|
||||
* SMTP Username
|
||||
*/
|
||||
public string $SMTPUser = 'safekat@imnavajas.es';
|
||||
public string $SMTPUser = 'soporte_erp@safekat.es';
|
||||
|
||||
/**
|
||||
* SMTP Password
|
||||
*/
|
||||
public string $SMTPPass = 'Etkd9~448';
|
||||
public string $SMTPPass = 'H%5&qDkDkWnfLTGN';
|
||||
|
||||
/**
|
||||
* SMTP Port
|
||||
*/
|
||||
public int $SMTPPort = 25;
|
||||
public int $SMTPPort = 465;
|
||||
|
||||
/**
|
||||
* SMTP Timeout (in seconds)
|
||||
*/
|
||||
public int $SMTPTimeout = 5;
|
||||
public int $SMTPTimeout = 15;
|
||||
|
||||
/**
|
||||
* Enable persistent SMTP connections
|
||||
|
||||
@ -1,6 +1,182 @@
|
||||
<?php
|
||||
const SK_PERMISSION_MATRIX = [
|
||||
"admin" => [
|
||||
"clientes.create",
|
||||
"clientes.edit",
|
||||
"clientes.delete",
|
||||
"clientes.menu",
|
||||
"plantilla-tarifa.create",
|
||||
"plantilla-tarifa.edit",
|
||||
"plantilla-tarifa.delete",
|
||||
"plantilla-tarifa.menu",
|
||||
"direcciones.create",
|
||||
"direcciones.edit",
|
||||
"direcciones.delete",
|
||||
"direcciones.menu",
|
||||
"presupuesto.create",
|
||||
"presupuesto.edit",
|
||||
"presupuesto.delete",
|
||||
"presupuesto.menu",
|
||||
"presupuesto-cliente.create",
|
||||
"presupuesto-cliente.edit",
|
||||
"presupuesto-cliente.delete",
|
||||
"presupuesto-cliente.menu",
|
||||
"pedidos-activos.view",
|
||||
"pedidos-activos.menu",
|
||||
"pedidos-finalizados.view",
|
||||
"pedidos-finalizados.menu",
|
||||
"pedidos-cancelados.view",
|
||||
"pedidos-cancelados.menu",
|
||||
"pedidos-todos.view",
|
||||
"pedidos-todos.menu",
|
||||
"tarifa-preimpresion.create",
|
||||
"tarifa-preimpresion.edit",
|
||||
"tarifa-preimpresion.delete",
|
||||
"tarifa-preimpresion.menu",
|
||||
"tarifa-manipulado.create",
|
||||
"tarifa-manipulado.edit",
|
||||
"tarifa-manipulado.delete",
|
||||
"tarifa-manipulado.menu",
|
||||
"tarifa-acabado.create",
|
||||
"tarifa-acabado.edit",
|
||||
"tarifa-acabado.delete",
|
||||
"tarifa-acabado.menu",
|
||||
"tarifa-encuadernacion.create",
|
||||
"tarifa-encuadernacion.edit",
|
||||
"tarifa-encuadernacion.delete",
|
||||
"tarifa-encuadernacion.menu",
|
||||
"tarifa-envio.create",
|
||||
"tarifa-envio.edit",
|
||||
"tarifa-envio.delete",
|
||||
"tarifa-envio.menu",
|
||||
"proveedores.create",
|
||||
"proveedores.edit",
|
||||
"proveedores.delete",
|
||||
"proveedores.menu",
|
||||
"ajustes.create",
|
||||
"ajustes.edit",
|
||||
"ajustes.delete",
|
||||
"ajustes.menu",
|
||||
"actividad.create",
|
||||
"actividad.edit",
|
||||
"actividad.delete",
|
||||
"actividad.menu",
|
||||
"paises.create",
|
||||
"paises.edit",
|
||||
"paises.delete",
|
||||
"paises.menu",
|
||||
"maquinas.create",
|
||||
"maquinas.edit",
|
||||
"maquinas.delete",
|
||||
"maquinas.menu",
|
||||
"maquinas-defecto.create",
|
||||
"maquinas-defecto.edit",
|
||||
"maquinas-defecto.delete",
|
||||
"maquinas-defecto.menu",
|
||||
"papel-generico.create",
|
||||
"papel-generico.edit",
|
||||
"papel-generico.delete",
|
||||
"papel-generico.menu",
|
||||
"papel-impresion.create",
|
||||
"papel-impresion.edit",
|
||||
"papel-impresion.delete",
|
||||
"papel-impresion.menu",
|
||||
"usuarios.create",
|
||||
"usuarios.edit",
|
||||
"usuarios.delete",
|
||||
"usuarios.menu",
|
||||
"roles-permisos.create",
|
||||
"roles-permisos.edit",
|
||||
"roles-permisos.delete",
|
||||
"roles-permisos.menu",
|
||||
"tickets.create",
|
||||
"tickets.edit",
|
||||
"tickets.menu",
|
||||
],
|
||||
"cliente-admin" => [
|
||||
"presupuesto-cliente.create",
|
||||
"presupuesto-cliente.edit",
|
||||
"presupuesto-cliente.delete",
|
||||
"presupuesto-cliente.menu",
|
||||
"pedidos-activos.view",
|
||||
"pedidos-activos.menu",
|
||||
"pedidos-finalizados.view",
|
||||
"pedidos-finalizados.menu",
|
||||
"pedidos-cancelados.view",
|
||||
"pedidos-cancelados.menu",
|
||||
"pedidos-todos.view",
|
||||
"pedidos-todos.menu",
|
||||
],
|
||||
"cliente-editor" => [
|
||||
"presupuesto-cliente.create",
|
||||
"presupuesto-cliente.edit",
|
||||
"presupuesto-cliente.menu",
|
||||
"pedidos-activos.view",
|
||||
"pedidos-activos.menu",
|
||||
"pedidos-finalizados.view",
|
||||
"pedidos-finalizados.menu",
|
||||
"pedidos-cancelados.view",
|
||||
"pedidos-cancelados.menu",
|
||||
"pedidos-todos.view",
|
||||
"pedidos-todos.menu",
|
||||
],
|
||||
"comercial" => [
|
||||
"clientes.create",
|
||||
"clientes.edit",
|
||||
"clientes.menu",
|
||||
"direcciones.create",
|
||||
"direcciones.edit",
|
||||
"direcciones.menu",
|
||||
"presupuesto.create",
|
||||
"presupuesto.edit",
|
||||
"presupuesto.delete",
|
||||
"presupuesto.menu",
|
||||
"presupuesto-cliente.create",
|
||||
"presupuesto-cliente.edit",
|
||||
"presupuesto-cliente.menu",
|
||||
"pedidos-activos.view",
|
||||
"pedidos-activos.menu",
|
||||
"pedidos-finalizados.view",
|
||||
"pedidos-finalizados.menu",
|
||||
"pedidos-cancelados.view",
|
||||
"pedidos-cancelados.menu",
|
||||
"pedidos-todos.view",
|
||||
"pedidos-todos.menu",
|
||||
],
|
||||
"produccion" => [
|
||||
"clientes.create",
|
||||
"clientes.edit",
|
||||
"clientes.menu",
|
||||
"direcciones.create",
|
||||
"direcciones.edit",
|
||||
"direcciones.menu",
|
||||
"presupuesto.create",
|
||||
"presupuesto.edit",
|
||||
"presupuesto.menu",
|
||||
],
|
||||
"maquina" => [
|
||||
"token.token",
|
||||
"token.menu",
|
||||
],
|
||||
"maquetador" => [
|
||||
"token.token",
|
||||
"token.menu",
|
||||
],
|
||||
"director" => [
|
||||
"token.token",
|
||||
"token.menu",
|
||||
],
|
||||
"contabilidad" => [
|
||||
"token.token",
|
||||
"token.menu",
|
||||
],
|
||||
"editor" => [
|
||||
"token.token",
|
||||
"token.menu",
|
||||
"Profile.index",
|
||||
"Profile.menu",
|
||||
],
|
||||
"beta" => [
|
||||
"clientes.create",
|
||||
"clientes.edit",
|
||||
"clientes.delete",
|
||||
@ -93,159 +269,8 @@ const SK_PERMISSION_MATRIX = [
|
||||
"roles-permisos.edit",
|
||||
"roles-permisos.delete",
|
||||
"roles-permisos.menu",
|
||||
],
|
||||
"cliente-admin" => [
|
||||
"presupuesto-cliente.create",
|
||||
"presupuesto-cliente.edit",
|
||||
"presupuesto-cliente.delete",
|
||||
"presupuesto-cliente.menu",
|
||||
"pedidos-activos.view",
|
||||
"pedidos-activos.menu",
|
||||
"pedidos-finalizados.view",
|
||||
"pedidos-finalizados.menu",
|
||||
"pedidos-cancelados.view",
|
||||
"pedidos-cancelados.menu",
|
||||
"pedidos-todos.view",
|
||||
"pedidos-todos.menu",
|
||||
],
|
||||
"cliente-editor" => [
|
||||
"presupuesto-cliente.create",
|
||||
"presupuesto-cliente.edit",
|
||||
"presupuesto-cliente.menu",
|
||||
"pedidos-activos.view",
|
||||
"pedidos-activos.menu",
|
||||
"pedidos-finalizados.view",
|
||||
"pedidos-finalizados.menu",
|
||||
"pedidos-cancelados.view",
|
||||
"pedidos-cancelados.menu",
|
||||
"pedidos-todos.view",
|
||||
"pedidos-todos.menu",
|
||||
],
|
||||
"comercial" => [
|
||||
"token.token",
|
||||
"token.menu",
|
||||
],
|
||||
"produccion" => [
|
||||
"clientes.create",
|
||||
"clientes.edit",
|
||||
"clientes.menu",
|
||||
"direcciones.create",
|
||||
"direcciones.edit",
|
||||
"direcciones.menu",
|
||||
"presupuesto.create",
|
||||
"presupuesto.edit",
|
||||
"presupuesto.menu",
|
||||
],
|
||||
"maquina" => [
|
||||
"token.token",
|
||||
"token.menu",
|
||||
],
|
||||
"maquetador" => [
|
||||
"token.token",
|
||||
"token.menu",
|
||||
],
|
||||
"director" => [
|
||||
"token.token",
|
||||
"token.menu",
|
||||
],
|
||||
"contabilidad" => [
|
||||
"token.token",
|
||||
"token.menu",
|
||||
],
|
||||
"editor" => [
|
||||
"token.token",
|
||||
"token.menu",
|
||||
"Profile.index",
|
||||
"Profile.menu",
|
||||
],
|
||||
"beta" => [
|
||||
"clientes.create",
|
||||
"clientes.edit",
|
||||
"clientes.delete",
|
||||
"clientes.menu",
|
||||
"plantilla-tarifa.create",
|
||||
"plantilla-tarifa.edit",
|
||||
"plantilla-tarifa.delete",
|
||||
"plantilla-tarifa.menu",
|
||||
"direcciones.create",
|
||||
"direcciones.edit",
|
||||
"direcciones.delete",
|
||||
"direcciones.menu",
|
||||
"presupuesto.create",
|
||||
"presupuesto.edit",
|
||||
"presupuesto.delete",
|
||||
"presupuesto.menu",
|
||||
"presupuesto-cliente.create",
|
||||
"presupuesto-cliente.edit",
|
||||
"presupuesto-cliente.delete",
|
||||
"presupuesto-cliente.menu",
|
||||
"pedidos-activos.view",
|
||||
"pedidos-activos.menu",
|
||||
"pedidos-finalizados.view",
|
||||
"pedidos-finalizados.menu",
|
||||
"pedidos-cancelados.view",
|
||||
"pedidos-cancelados.menu",
|
||||
"pedidos-todos.view",
|
||||
"pedidos-todos.menu",
|
||||
"tarifa-preimpresion.create",
|
||||
"tarifa-preimpresion.edit",
|
||||
"tarifa-preimpresion.delete",
|
||||
"tarifa-preimpresion.menu",
|
||||
"tarifa-manipulado.create",
|
||||
"tarifa-manipulado.edit",
|
||||
"tarifa-manipulado.delete",
|
||||
"tarifa-manipulado.menu",
|
||||
"tarifa-acabado.create",
|
||||
"tarifa-acabado.edit",
|
||||
"tarifa-acabado.delete",
|
||||
"tarifa-acabado.menu",
|
||||
"tarifa-encuadernacion.create",
|
||||
"tarifa-encuadernacion.edit",
|
||||
"tarifa-encuadernacion.delete",
|
||||
"tarifa-encuadernacion.menu",
|
||||
"tarifa-envio.create",
|
||||
"tarifa-envio.edit",
|
||||
"tarifa-envio.delete",
|
||||
"tarifa-envio.menu",
|
||||
"proveedores.create",
|
||||
"proveedores.edit",
|
||||
"proveedores.delete",
|
||||
"proveedores.menu",
|
||||
"ajustes.create",
|
||||
"ajustes.edit",
|
||||
"ajustes.delete",
|
||||
"ajustes.menu",
|
||||
"actividad.create",
|
||||
"actividad.edit",
|
||||
"actividad.delete",
|
||||
"actividad.menu",
|
||||
"paises.create",
|
||||
"paises.edit",
|
||||
"paises.delete",
|
||||
"paises.menu",
|
||||
"maquinas.create",
|
||||
"maquinas.edit",
|
||||
"maquinas.delete",
|
||||
"maquinas.menu",
|
||||
"maquinas-defecto.create",
|
||||
"maquinas-defecto.edit",
|
||||
"maquinas-defecto.delete",
|
||||
"maquinas-defecto.menu",
|
||||
"papel-generico.create",
|
||||
"papel-generico.edit",
|
||||
"papel-generico.delete",
|
||||
"papel-generico.menu",
|
||||
"papel-impresion.create",
|
||||
"papel-impresion.edit",
|
||||
"papel-impresion.delete",
|
||||
"papel-impresion.menu",
|
||||
"usuarios.create",
|
||||
"usuarios.edit",
|
||||
"usuarios.delete",
|
||||
"usuarios.menu",
|
||||
"roles-permisos.create",
|
||||
"roles-permisos.edit",
|
||||
"roles-permisos.delete",
|
||||
"roles-permisos.menu",
|
||||
"tickets.create",
|
||||
"tickets.edit",
|
||||
"tickets.menu",
|
||||
],
|
||||
];
|
||||
|
||||
@ -93,4 +93,7 @@ const SK_PERMISSIONS = [
|
||||
'roles-permisos.edit' => 'Can edit',
|
||||
'roles-permisos.delete' => 'Can delete',
|
||||
'roles-permisos.menu' => 'Menu shall be visualize',
|
||||
'tickets.create' => 'Can create',
|
||||
'tickets.edit' => 'Can edit',
|
||||
'tickets.menu' => 'Menu shall be visualize',
|
||||
];
|
||||
|
||||
@ -886,8 +886,8 @@ $routes->group('chat', ['namespace' => 'App\Controllers\Chat'], function ($route
|
||||
$routes->get('department/factura/(:num)/(:num)', 'ChatController::get_chat_factura/$1/$2', ['as' => 'getChatFactura']);
|
||||
$routes->get('department/(:num)/users', 'ChatController::get_chat_department_users/$1', ['as' => 'getChatDepartmentUsers']);
|
||||
|
||||
|
||||
$routes->get('(:num)', 'ChatController::get_chat/$1', ['as' => 'getChat']);
|
||||
$routes->post('message/error/presupuesto', 'ChatController::store_chat_error_message', ['as' => 'storeChatErrorMessage']);
|
||||
$routes->post('message/presupuesto', 'ChatController::store_chat_message_presupuesto', ['as' => 'storeChatMessagePresupuesto']);
|
||||
$routes->post('message/pedido', 'ChatController::store_chat_message_pedido', ['as' => 'storeChatMessagePedido']);
|
||||
$routes->post('message/factura', 'ChatController::store_chat_message_factura', ['as' => 'storeChatMessageFactura']);
|
||||
@ -909,6 +909,27 @@ $routes->group('chat', ['namespace' => 'App\Controllers\Chat'], function ($route
|
||||
});
|
||||
|
||||
|
||||
$routes->group('messages', ['namespace' => 'App\Controllers\Chat'], function ($routes) {
|
||||
$routes->get('datatable', 'ChatController::datatable_messages', ['as' => 'getDatatableMessages']);
|
||||
$routes->get('datatable/presupuesto', 'ChatController::datatable_presupuesto_messages', ['as' => 'getDatatablePresupuestoMessages']);
|
||||
$routes->get('datatable/pedido', 'ChatController::datatable_pedido_messages', ['as' => 'getDatatablePedidoMessages']);
|
||||
$routes->get('datatable/factura', 'ChatController::datatable_factura_messages', ['as' => 'getDatatableFacturaMessages']);
|
||||
|
||||
$routes->post('direct', 'ChatController::store_new_direct_message', ['as' => 'storeNewDirectMessage']);
|
||||
$routes->post('direct/client', 'ChatController::store_new_direct_message_client', ['as' => 'storeNewDirectMessageClient']);
|
||||
});
|
||||
|
||||
|
||||
$routes->group('soporte', ['namespace' => 'App\Controllers\Soporte'], function ($routes) {
|
||||
$routes->get('', 'Ticketcontroller::index', ['as' => 'TicketIndex']);
|
||||
$routes->get('add', 'Ticketcontroller::add', ['as' => 'NewTicket']);
|
||||
$routes->post('add', 'Ticketcontroller::add', ['as' => 'createTicket']);
|
||||
$routes->get('edit/(:num)', 'Ticketcontroller::edit/$1', ['as' => 'editTicket']);
|
||||
$routes->post('edit/(:num)', 'Ticketcontroller::edit/$1', ['as' => 'updateTicket']);
|
||||
$routes->post('ticketlist', 'Ticketcontroller::datatable');
|
||||
$routes->get('image/(:segment)', 'Ticketcontroller::image/$1');
|
||||
});
|
||||
|
||||
|
||||
$routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], function ($routes) {
|
||||
$routes->group('ordentrabajo', ['namespace' => 'App\Controllers\Produccion'], function ($routes) {
|
||||
@ -949,7 +970,7 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
$routes->post('auth/jwt', '\App\Controllers\Sistema\AuthAPIController::jwtLogin');
|
||||
|
||||
|
||||
$routes->group(
|
||||
'api',
|
||||
[
|
||||
@ -963,13 +984,8 @@ $routes->group(
|
||||
'filter' => 'cors'
|
||||
]);
|
||||
|
||||
$routes->options('items', static function () { });
|
||||
$routes->options('items/(:any)', static function () { });
|
||||
|
||||
$routes->post("calcular", 'ImprimelibrosApi::calcular');
|
||||
|
||||
|
||||
|
||||
$routes->post("guardar", 'ImprimelibrosApi::guardar');
|
||||
// ...
|
||||
}
|
||||
);
|
||||
|
||||
@ -4,6 +4,7 @@ namespace Config;
|
||||
|
||||
use App\Services\FTPService;
|
||||
use App\Services\MaquinaService;
|
||||
use App\Services\MessageService;
|
||||
use App\Services\PapelImpresionService;
|
||||
use CodeIgniter\Config\BaseService;
|
||||
use App\Services\ProductionService;
|
||||
@ -48,4 +49,8 @@ class Services extends BaseService
|
||||
{
|
||||
return new MaquinaService();
|
||||
}
|
||||
public static function messages()
|
||||
{
|
||||
return new MessageService();
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,111 +25,74 @@ class ImprimelibrosApi extends ResourceController
|
||||
{
|
||||
helper(['form']);
|
||||
|
||||
$jsonData = json_decode($this->request->getBody(), true);
|
||||
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
return $this->respond(
|
||||
[
|
||||
'status' => 400,
|
||||
'error' => 'Invalid JSON format'
|
||||
],
|
||||
400
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Access the entire POST data
|
||||
$post_data = $jsonData;
|
||||
|
||||
//return $this->respond(var_dump($post_data));
|
||||
|
||||
// Instancia de presupuesto cliente
|
||||
$presupuestocliente = new Presupuestocliente();
|
||||
$response = $presupuestocliente->calcular($post_data);
|
||||
|
||||
if (isset($response['tiradas'])) {
|
||||
|
||||
$response = [
|
||||
'status' => 200,
|
||||
'error' => null,
|
||||
'data' => [
|
||||
'tiradas' => $response['tiradas'],
|
||||
'precios' => $response['precio_u']
|
||||
]
|
||||
];
|
||||
}else{
|
||||
$response = [
|
||||
'status' => 400,
|
||||
'error' => $response
|
||||
];
|
||||
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
|
||||
public function guardar()
|
||||
{
|
||||
helper(['form']);
|
||||
|
||||
// Access the entire POST data
|
||||
$post_data = $this->request->getJSON(true);
|
||||
|
||||
//return $this->respond(var_dump($post_data));
|
||||
|
||||
$data_tmp = array
|
||||
(
|
||||
'clienteId' => 1870,
|
||||
'tamanio' => array
|
||||
(
|
||||
'ancho' => 170,
|
||||
'alto' => 240
|
||||
),
|
||||
'tirada' => array
|
||||
(
|
||||
'0' => 50,
|
||||
'1' => 100,
|
||||
|
||||
),
|
||||
'paginas' => 320,
|
||||
'paginasColor' => 0,
|
||||
'pagColorConsecutivas' => 0,
|
||||
'papelInteriorDiferente' => 0,
|
||||
'paginasCuadernillo' => 32,
|
||||
'tipo' => 'cosido',
|
||||
'isColor' => 0,
|
||||
'isHq' => 0,
|
||||
'interior' => array
|
||||
(
|
||||
'papelInterior' => 3,
|
||||
'gramajeInterior' => 80
|
||||
),
|
||||
'guardas' => array
|
||||
(
|
||||
'papel' => 'OFF1',
|
||||
'gramaje' => 170,
|
||||
'caras' => 8
|
||||
),
|
||||
'posPaginasColor' => null,
|
||||
'prototipo' => 0,
|
||||
'ferro' => 0,
|
||||
'ferroDigital' => 0,
|
||||
'marcapaginas' => 0,
|
||||
'retractilado' => 0,
|
||||
'retractilado5' => 0,
|
||||
'eb' => 10.5,
|
||||
'cubierta' => array
|
||||
(
|
||||
'tipoCubierta' => 'tapaDura',
|
||||
'papelCubierta' => 2,
|
||||
'gramajeCubierta' => 170,
|
||||
'cabezada' => 'WHI',
|
||||
'acabado' => 1,
|
||||
'carasImpresion' => 2,
|
||||
'lomoRedondo' => 0,
|
||||
'solapas' => 0,
|
||||
),
|
||||
'sobrecubierta' => false,
|
||||
'faja' => false,
|
||||
'excluirRotativa' => 0,
|
||||
'ivaReducido' => 1,
|
||||
'servicios' => array
|
||||
(
|
||||
'prototipo' => 0,
|
||||
'ferro' => 0,
|
||||
'ferroDigital' => 0,
|
||||
'marcapaginas' => 0,
|
||||
'retractilado' => 0,
|
||||
'retractilado5' => 0
|
||||
),
|
||||
'entrega_taller' => 1,
|
||||
'id' => 334
|
||||
);
|
||||
|
||||
// Crear el cliente HTTP
|
||||
$client = \Config\Services::curlrequest();
|
||||
|
||||
// Instancia de presupuesto cliente
|
||||
$presupuestocliente = new Presupuestocliente();
|
||||
$response = $presupuestocliente->calcular($post_data);
|
||||
$response = $presupuestocliente->guardar($post_data);
|
||||
|
||||
return $this->respond($response);
|
||||
|
||||
$response = [
|
||||
'status' => 200,
|
||||
'error' => null,
|
||||
'messages' => [
|
||||
'precio' => $response['precio_u']
|
||||
'data' => [
|
||||
'tiradas' => $response['tiradas'],
|
||||
'precios' => $response['precio_u']
|
||||
]
|
||||
];
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
public function delete($id = null)
|
||||
{
|
||||
$model = new ItemModel();
|
||||
$find = $model->find(['id' => $id]);
|
||||
if (!$find)
|
||||
return $this->failNotFound('No Data Found');
|
||||
$model->delete($id);
|
||||
|
||||
$response = [
|
||||
'status' => 200,
|
||||
'error' => null,
|
||||
'messages' => [
|
||||
'success' => 'Data deleted'
|
||||
]
|
||||
];
|
||||
return $this->respond($response);
|
||||
}
|
||||
}
|
||||
|
||||
@ -766,4 +766,11 @@ class ChatController extends BaseController
|
||||
$this->chatModel->setAsUnviewedChatUserNotifications($chat_id, auth()->user()->id);
|
||||
return $this->response->setJSON(["message" => "ok", "status" => true]);
|
||||
}
|
||||
public function store_chat_error_message()
|
||||
{
|
||||
$bodyData = $this->request->getPost();
|
||||
$messageService = service('messages');
|
||||
$r = $messageService->createErrorMessagePresupuesto("Error",$bodyData['presupuesto_id']);
|
||||
return $this->response->setJSON(["message" => "ok","data" => $r]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,6 +156,9 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
if ($this->request->getPost('show_in_client') == null) {
|
||||
$sanitizedData['show_in_client'] = false;
|
||||
}
|
||||
if ($this->request->getPost('activo') == null) {
|
||||
$sanitizedData['activo'] = false;
|
||||
}
|
||||
if ($this->request->getPost('show_in_client_special') == null) {
|
||||
$sanitizedData['show_in_client_special'] = false;
|
||||
}
|
||||
@ -163,6 +166,9 @@ class Papelesgenericos extends \App\Controllers\BaseResourceController
|
||||
if ($sanitizedData['show_in_client_special']) {
|
||||
$sanitizedData['show_in_client'] = true;
|
||||
}
|
||||
if ($sanitizedData['activo']) {
|
||||
$sanitizedData['activo'] = true;
|
||||
}
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()): // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
@ -230,6 +230,9 @@ class Presupuestoadmin extends \App\Controllers\BaseResourceController
|
||||
$sanitizedData['solapas_sobrecubierta'] = 0;
|
||||
}
|
||||
|
||||
$tipoImpresionModel = new TipoPresupuestoModel();
|
||||
$sanitizedData['cosido'] = $tipoImpresionModel->get_isCosido($sanitizedData['tipo_impresion_id']);
|
||||
|
||||
$noException = true;
|
||||
if (
|
||||
$sanitizedData['papel_formato_id'] == null && $sanitizedData['papel_formato_ancho'] == null
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -32,4 +32,29 @@ class Intranet extends Controller
|
||||
|
||||
}
|
||||
|
||||
function tickets($resource_name)
|
||||
{
|
||||
helper('file');
|
||||
|
||||
$resource_path = WRITEPATH . 'uploads/tickets/' . $resource_name;
|
||||
|
||||
if (file_exists($resource_path)) {
|
||||
// Get the mime type of the file
|
||||
$mime_type = mime_content_type($resource_path);
|
||||
|
||||
// Get an instance of the Response class
|
||||
$response = service('response');
|
||||
|
||||
// Set the content type
|
||||
$response->setContentType($mime_type);
|
||||
|
||||
// Set the output
|
||||
$response->setBody(file_get_contents($resource_path));
|
||||
|
||||
// Send the response to the browser
|
||||
$response->send();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
429
ci4/app/Controllers/Soporte/Ticketcontroller.php
Normal file
429
ci4/app/Controllers/Soporte/Ticketcontroller.php
Normal file
@ -0,0 +1,429 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Soporte;
|
||||
|
||||
use App\Models\Sistema\SettingsModel;
|
||||
use App\Models\Soporte\TicketModel;
|
||||
use App\Models\CategoriaModel;
|
||||
use App\Models\EstadoModel;
|
||||
use CodeIgniter\Controller;
|
||||
use App\Entities\Soporte\TicketEntity;
|
||||
use App\Models\Soporte\ticketFileModel;
|
||||
|
||||
|
||||
use App\Models\Collection;
|
||||
|
||||
class Ticketcontroller extends \App\Controllers\BaseResourceController
|
||||
{
|
||||
|
||||
protected $modelName = TicketModel::class;
|
||||
protected $format = 'json';
|
||||
|
||||
protected static $singularObjectNameCc = 'ticket';
|
||||
protected static $singularObjectName = 'Ticket';
|
||||
protected static $pluralObjectName = 'Tickets';
|
||||
protected static $controllerSlug = 'ticket';
|
||||
|
||||
protected static $viewPath = 'themes/vuexy/form/soporte/';
|
||||
|
||||
protected $indexRoute = 'TicketIndex';
|
||||
|
||||
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
$this->viewData['pageTitle'] = lang('Tickets.moduleTitle');
|
||||
|
||||
// Breadcrumbs
|
||||
$this->viewData['breadcrumb'] = [
|
||||
['title' => lang("App.menu_soporte"), 'route' => "javascript:void(0);", 'active' => false],
|
||||
['title' => lang("App.menu_soporte_ticket_list"), 'route' => route_to('TicketIndex'), 'active' => true]
|
||||
];
|
||||
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
//checkPermission('tickets.menu');
|
||||
|
||||
$viewData = [
|
||||
'currentModule' => static::$controllerSlug,
|
||||
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Tickets.tickets')]),
|
||||
'usingServerSideDataTable' => true,
|
||||
'userType' => auth()->user()->can('tickets.edit') ? 1 : 0,
|
||||
];
|
||||
|
||||
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
|
||||
|
||||
return view(static::$viewPath . 'viewTicketList', $viewData);
|
||||
}
|
||||
|
||||
private function sendMail($subject, $body, $recipient)
|
||||
{
|
||||
$settings_model = new SettingsModel();
|
||||
$config = $settings_model->first()->toArray();
|
||||
$gateway = $config['email_gateway'];
|
||||
$body = html_entity_decode($body);
|
||||
|
||||
if ($gateway == 'smtp') {
|
||||
try {
|
||||
//https://codeigniter.com/user_guide/libraries/email.html
|
||||
$email = \Config\Services::email();
|
||||
$config['protocol'] = $config['email_gateway'];
|
||||
$config['SMTPHost'] = $config['email_smtp'];
|
||||
$config['SMTPUser'] = $config['email_address'];
|
||||
$config['SMTPPass'] = $config['email_pass'];
|
||||
$config['SMTPPort'] = intval($config['email_port']);
|
||||
$config['SMTPCrypto'] = $config['email_cert'] == 'none' ? '' : $config['email_cert'];
|
||||
$config['SMTPTimeout'] = 15;
|
||||
$config['mailType'] = 'html';
|
||||
$config['wordWrap'] = true;
|
||||
|
||||
$email->initialize($config);
|
||||
|
||||
$email->setFrom($config['email_address'], $config['email_name']);
|
||||
$email->setTo($recipient);
|
||||
|
||||
$email->setSubject($subject);
|
||||
$email->setMessage($body);
|
||||
|
||||
if (!$email->send()) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
|
||||
//checkPermission('tickets.create', $this->indexRoute);
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$nullIfEmpty = false; // !(phpversion() >= '8.1');
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
// get user id
|
||||
$postData['usuario_id'] = auth()->user()->id;
|
||||
$postData['user_soporte_id'] = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('default_soporte_user_id')->value;
|
||||
|
||||
$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', [lang('Basic.global.record')]);
|
||||
$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();
|
||||
|
||||
$this->saveImages($id, $this->request->getFiles());
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
$userModel = new \App\Models\UserModel();
|
||||
|
||||
$this->sendMail(lang('Tickets.newTicket'), lang('Tickets.newTicketBody') . base_url(route_to('editTicket', $id)), $userModel->find($sanitizedData['user_soporte_id'])->email);
|
||||
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('successMessage', $message);
|
||||
else:
|
||||
return $this->redirect2listView('successMessage', $message);
|
||||
endif;
|
||||
else:
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['ticket'] = isset($sanitizedData) ? new TicketEntity($sanitizedData) : new TicketEntity();
|
||||
|
||||
$this->viewData['formAction'] = route_to('NewTicket');
|
||||
|
||||
$this->viewData['categorias'] = $this->model->getCategorias();
|
||||
$this->viewData['estados'] = $this->model->getEstados();
|
||||
$this->viewData['secciones'] = $this->model->getSecciones();
|
||||
|
||||
$this->viewData['supportUsers'] = $this->getSupportUsers();
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Tickets.ticket') . ' ' . lang('Basic.global.addNewSuffix');
|
||||
|
||||
|
||||
return $this->displayForm(__METHOD__);
|
||||
} // end function add()
|
||||
|
||||
public function edit($requestedId = null)
|
||||
{
|
||||
$modelRespuesta = new \App\Models\Soporte\TicketRespuestaModel();
|
||||
|
||||
if ($requestedId == null):
|
||||
return $this->redirect2listView();
|
||||
endif;
|
||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||
$ticket = $this->model->find($id);
|
||||
|
||||
if ($ticket == false):
|
||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Tickets.ticket')), $id]);
|
||||
return $this->redirect2listView('errorMessage', $message);
|
||||
endif;
|
||||
|
||||
if (!auth()->user()->can('Tickets.edit') && auth()->user()->id != $ticket->usuario_id) {
|
||||
return redirect()->to(route_to('TicketIndex'))->with('errorMessage', lang('Basic.global.noPermission'));
|
||||
}
|
||||
|
||||
if ($this->request->getPost()):
|
||||
|
||||
$oldUserSupport = $ticket->user_soporte_id;
|
||||
$oldState = $ticket->estado_id;
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
$sanitizedData = $this->sanitized($postData, 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);
|
||||
|
||||
$this->saveImages($id, $this->request->getFiles());
|
||||
|
||||
if (auth()->user()->can('Tickets.edit')) {
|
||||
|
||||
$respuesta = $modelRespuesta->where('ticket_id', $id)->first();
|
||||
if ($respuesta == null) {
|
||||
$modelRespuesta->insert([
|
||||
'ticket_id' => $id,
|
||||
'usuario_id' => auth()->user()->id,
|
||||
'mensaje' => $sanitizedData['respuesta_mensaje']
|
||||
]);
|
||||
} else {
|
||||
$modelRespuesta->update($respuesta->id, [
|
||||
'mensaje' => $sanitizedData['respuesta_mensaje'],
|
||||
'usuario_id' => auth()->user()->id,
|
||||
]);
|
||||
}
|
||||
|
||||
// envio de correos
|
||||
$userModel = new \App\Models\UserModel();
|
||||
if ($oldUserSupport != $sanitizedData['user_soporte_id']) {
|
||||
$this->sendMail(lang('Tickets.asgignToChanged'), lang('Tickets.asgignToChangedBody') . base_url(route_to('editTicket', $id)), $userModel->find($sanitizedData['user_soporte_id'])->email);
|
||||
}
|
||||
|
||||
if ($oldState != $sanitizedData['estado_id']) {
|
||||
$this->sendMail(lang('Tickets.stateChange'), lang('Tickets.stateChangeBody') . base_url(route_to('editTicket', $id)), $userModel->find($ticket->usuario_id)->email);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$noException = false;
|
||||
$this->dealWithException($e);
|
||||
}
|
||||
else:
|
||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Tickets.ticket'))]);
|
||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||
|
||||
endif;
|
||||
|
||||
$ticket->fill($sanitizedData);
|
||||
|
||||
$thenRedirect = false;
|
||||
endif;
|
||||
if ($noException && $successfulResult):
|
||||
$id = $ticket->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect):
|
||||
if (!empty($this->indexRoute)):
|
||||
return redirect()->to(route_to($this->indexRoute))->with('successMessage', $message);
|
||||
else:
|
||||
return $this->redirect2listView('successMessage', $message);
|
||||
endif;
|
||||
else:
|
||||
return redirect()->to(route_to("editTicket", $id))->with('successMessage', $message);
|
||||
//$this->session->setFlashData('sweet-success', $message);
|
||||
endif;
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['ticket'] = $ticket;
|
||||
$this->viewData['respuesta'] = $modelRespuesta->where('ticket_id', $id)->first();
|
||||
|
||||
$this->viewData['formAction'] = route_to('updateTicket', $id);
|
||||
|
||||
$this->viewData['categorias'] = $this->model->getCategorias();
|
||||
$this->viewData['estados'] = $this->model->getEstados();
|
||||
$this->viewData['secciones'] = $this->model->getSecciones();
|
||||
$this->viewData['supportUsers'] = $this->getSupportUsers();
|
||||
|
||||
$this->viewData['imagesTicket'] = $this->getImages('ticket', $id);
|
||||
$this->viewData['imagesRespuesta'] = $this->getImages('respuesta', $id);
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Tickets.ticket') . ' ' . 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;
|
||||
|
||||
$requestedOrder = $reqData['order'] ?? [];
|
||||
|
||||
$searchValues = get_filter_datatables_columns($reqData);
|
||||
|
||||
if (auth()->user()->can('tickets.edit')) {
|
||||
$user_id = null;
|
||||
} else {
|
||||
$user_id = auth()->user()->id;
|
||||
}
|
||||
|
||||
$resourceData = $this->model->getResource($searchValues, $user_id);
|
||||
foreach ($requestedOrder as $order) {
|
||||
$column = $order['column'] ?? 0;
|
||||
$dir = $order['dir'] ?? 'asc';
|
||||
$orderColumn = $this->model::SORTABLE[$column] ?? null;
|
||||
if ($orderColumn) {
|
||||
$resourceData->orderBy($orderColumn, $dir);
|
||||
}
|
||||
}
|
||||
$resourceData = $resourceData->limit($length, $start)->get()->getResultObject();
|
||||
|
||||
return $this->respond(Collection::datatable(
|
||||
$resourceData,
|
||||
$this->model->getResource($searchValues)->countAllResults(),
|
||||
$this->model->getResource($searchValues)->countAllResults()
|
||||
));
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function image($imageName)
|
||||
{
|
||||
$filePath = WRITEPATH . "uploads/tickets/" . $imageName;
|
||||
|
||||
if (!file_exists($filePath)) {
|
||||
return $this->response->setStatusCode(404, 'Imagen no encontrada');
|
||||
}
|
||||
|
||||
$mimeType = mime_content_type($filePath);
|
||||
|
||||
return $this->response
|
||||
->setHeader('Content-Type', $mimeType)
|
||||
->setBody(file_get_contents($filePath));
|
||||
}
|
||||
|
||||
private function saveImages($ticket_id, $files = [])
|
||||
{
|
||||
$uploadPath = WRITEPATH . 'uploads/tickets/';
|
||||
|
||||
$fileModel = new ticketFileModel();
|
||||
|
||||
if ($files && isset($files['files'])) {
|
||||
foreach ($files['files'] as $file) {
|
||||
if ($file->isValid() && !$file->hasMoved()) {
|
||||
$originalName = $file->getClientName();
|
||||
$fileExt = $file->getExtension();
|
||||
|
||||
// Generar hash SHA-256 basado en el contenido del archivo
|
||||
$fileHash = hash_file("sha256", $file->getTempName());
|
||||
$newFileName = $fileHash . '.' . $fileExt;
|
||||
|
||||
// Mover el archivo con el nombre basado en el hash
|
||||
$file->move($uploadPath, $newFileName);
|
||||
|
||||
// Guardar en la base de datos
|
||||
$fileModel->insert([
|
||||
'nombre' => $originalName,
|
||||
'ticket_id' => $ticket_id,
|
||||
'hash' => $fileHash,
|
||||
'path' => 'uploads/tickets/' . $newFileName
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function getImages($tipo = 'ticket', $id = null)
|
||||
{
|
||||
$images = [];
|
||||
|
||||
$model = new ticketFileModel();
|
||||
if ($tipo == 'ticket') {
|
||||
$files = $model->where('ticket_id', $id)->findAll();
|
||||
foreach ($files as $file) {
|
||||
$ext = pathinfo($file['nombre'], PATHINFO_EXTENSION);
|
||||
array_push($images, array(
|
||||
"path" => '/soporte/image/' . $file['hash'] . "." . $ext,
|
||||
"name" => $file['nombre']
|
||||
));
|
||||
}
|
||||
} else {
|
||||
$files = $model->where('respuesta_id', $id)->findAll();
|
||||
foreach ($files as $file) {
|
||||
$ext = pathinfo($file['nombre'], PATHINFO_EXTENSION);
|
||||
array_push($images, array(
|
||||
"path" => '/soporte/image/' . $file['hash'] . "." . $ext,
|
||||
"name" => $file['nombre']
|
||||
));
|
||||
}
|
||||
}
|
||||
return $images;
|
||||
}
|
||||
|
||||
private function getSupportUsers()
|
||||
{
|
||||
$defatulSoporteUserId = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('default_soporte_user_id')->value;
|
||||
$supportUsers = array(
|
||||
array(
|
||||
'id' => $defatulSoporteUserId,
|
||||
'name' => model('App\Models\UserModel')->getFullName($defatulSoporteUserId)
|
||||
),
|
||||
array(
|
||||
'id' => 2,
|
||||
'name' => model('App\Models\UserModel')->getFullName(2)
|
||||
),
|
||||
array(
|
||||
'id' => 1,
|
||||
'name' => model('App\Models\UserModel')->getFullName(1)
|
||||
),
|
||||
);
|
||||
|
||||
return $supportUsers;
|
||||
}
|
||||
}
|
||||
@ -348,7 +348,7 @@ class TarifaAcabados extends BaseResourceController
|
||||
)->where("deleted_at", null);
|
||||
if ($this->request->getGet("q")) {
|
||||
$query->groupStart()
|
||||
->orLike("lg_tarifas_acabado.nombre", $this->request->getGet("q"))
|
||||
->orLike("lg_tarifa_acabado.nombre", $this->request->getGet("q"))
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
|
||||
@ -65,7 +65,9 @@ class Tarifaextra extends \App\Controllers\GoBaseController
|
||||
if ($this->request->getPost('mostrar_en_presupuesto') == null) {
|
||||
$sanitizedData['mostrar_en_presupuesto'] = false;
|
||||
}
|
||||
|
||||
if ($this->request->getPost('mostrar_en_presupuesto_cliente') == null) {
|
||||
$sanitizedData['mostrar_en_presupuesto_cliente'] = false;
|
||||
}
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
@ -142,7 +144,9 @@ class Tarifaextra extends \App\Controllers\GoBaseController
|
||||
if ($this->request->getPost('mostrar_en_presupuesto') == null) {
|
||||
$sanitizedData['mostrar_en_presupuesto'] = false;
|
||||
}
|
||||
|
||||
if ($this->request->getPost('mostrar_en_presupuesto_cliente') == null) {
|
||||
$sanitizedData['mostrar_en_presupuesto_cliente'] = false;
|
||||
}
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
if ($this->canValidate()) :
|
||||
|
||||
@ -63,7 +63,9 @@ class Tarifapreimpresion extends \App\Controllers\GoBaseController
|
||||
if ($this->request->getPost('mostrar_en_presupuesto') == null) {
|
||||
$sanitizedData['mostrar_en_presupuesto'] = false;
|
||||
}
|
||||
|
||||
if ($this->request->getPost('mostrar_en_presupuesto_cliente') == null) {
|
||||
$sanitizedData['mostrar_en_presupuesto_cliente'] = false;
|
||||
}
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
@ -144,7 +146,9 @@ class Tarifapreimpresion extends \App\Controllers\GoBaseController
|
||||
if ($this->request->getPost('mostrar_en_presupuesto') == null) {
|
||||
$sanitizedData['mostrar_en_presupuesto'] = false;
|
||||
}
|
||||
|
||||
if ($this->request->getPost('mostrar_en_presupuesto_cliente') == null) {
|
||||
$sanitizedData['mostrar_en_presupuesto_cliente'] = false;
|
||||
}
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
if ($this->canValidate()) :
|
||||
|
||||
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class CreateTicketsSystem extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
// Tabla de Categorías
|
||||
$this->forge->addField([
|
||||
'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'keyword' => ['type' => 'VARCHAR', 'constraint' => 100, 'unique' => true],
|
||||
]);
|
||||
$this->forge->addPrimaryKey('id');
|
||||
$this->forge->createTable('tickets_categorias');
|
||||
|
||||
// Tabla de secciones
|
||||
$this->forge->addField([
|
||||
'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'keyword' => ['type' => 'VARCHAR', 'constraint' => 100, 'unique' => true],
|
||||
]);
|
||||
$this->forge->addPrimaryKey('id');
|
||||
$this->forge->createTable('tickets_secciones');
|
||||
|
||||
// Tabla de Estados
|
||||
$this->forge->addField([
|
||||
'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'keyword' => ['type' => 'VARCHAR', 'constraint' => 100, 'unique' => true],
|
||||
]);
|
||||
$this->forge->addPrimaryKey('id');
|
||||
$this->forge->createTable('tickets_estados');
|
||||
|
||||
// Tabla de Tickets
|
||||
$this->forge->addField([
|
||||
'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'usuario_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true],
|
||||
'user_soporte_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true],
|
||||
'categoria_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true],
|
||||
'seccion_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true],
|
||||
'estado_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'default' => 1],
|
||||
'prioridad' => ['type' => 'ENUM', 'constraint' => ['alta', 'media', 'baja'], 'default' => 'media'],
|
||||
'titulo' => ['type' => 'VARCHAR', 'constraint' => 255],
|
||||
'descripcion' => ['type' => 'TEXT'],
|
||||
'created_at' => ['type' => 'DATETIME', 'null' => true],
|
||||
'updated_at' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addPrimaryKey('id');
|
||||
$this->forge->addForeignKey('usuario_id', 'users', 'id', 'NO ACTION', 'NO ACTION');
|
||||
$this->forge->addForeignKey('user_soporte_id', 'users', 'id', 'NO ACTION', 'NO ACTION');
|
||||
$this->forge->addForeignKey('categoria_id', 'tickets_categorias', 'id', 'NO ACTION', 'NO ACTION');
|
||||
$this->forge->addForeignKey('seccion_id', 'tickets_secciones', 'id', 'NO ACTION', 'NO ACTION');
|
||||
$this->forge->addForeignKey('estado_id', 'tickets_estados', 'id', 'NO ACTION', 'NO ACTION');
|
||||
$this->forge->createTable('tickets');
|
||||
|
||||
// Tabla de Respuestas
|
||||
$this->forge->addField([
|
||||
'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'ticket_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true],
|
||||
'usuario_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true],
|
||||
'mensaje' => ['type' => 'TEXT'],
|
||||
'created_at' => ['type' => 'DATETIME', 'null' => true],
|
||||
'updated_at' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addPrimaryKey('id');
|
||||
$this->forge->addForeignKey('ticket_id', 'tickets', 'id', '', 'NO ACTION');
|
||||
$this->forge->addForeignKey('usuario_id', 'users', 'id', 'NO ACTION', 'NO ACTION');
|
||||
$this->forge->createTable('tickets_respuestas');
|
||||
|
||||
// Tabla de Adjuntos
|
||||
$this->forge->addField([
|
||||
'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'ticket_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => true],
|
||||
'respuesta_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => true],
|
||||
'nombre' => ['type' => 'VARCHAR', 'constraint' => 255],
|
||||
'hash' => ['type' => 'VARCHAR', 'constraint' => 255],
|
||||
'path' => ['type' => 'VARCHAR', 'constraint' => 255],
|
||||
'created_at' => ['type' => 'DATETIME', 'null' => true],
|
||||
'updated_at' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addPrimaryKey('id');
|
||||
$this->forge->addForeignKey('ticket_id', 'tickets', 'id', 'NO ACTION', 'NO ACTION');
|
||||
$this->forge->addForeignKey('respuesta_id', 'tickets_respuestas', 'id', 'NO ACTION', 'NO ACTION');
|
||||
$this->forge->createTable('tickets_adjuntos');
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropTable('tickets_adjuntos');
|
||||
$this->forge->dropTable('tickets_respuestas');
|
||||
$this->forge->dropTable('tickets');
|
||||
$this->forge->dropTable('tickets_categorias');
|
||||
$this->forge->dropTable('tickets_estados');
|
||||
$this->forge->dropTable('tickets_secciones');
|
||||
|
||||
$this->db->table('config_variables_app')->where('name', 'default_soporte_user_id')->delete();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class AlterTableTarifasCheckPresupuestoClienteMigration extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$field = [
|
||||
'mostrar_en_presupuesto_cliente' => [
|
||||
'type' => 'BOOLEAN',
|
||||
'default' => false,
|
||||
]
|
||||
];
|
||||
$this->forge->addColumn('lg_tarifa_acabado',$field);
|
||||
$this->forge->addColumn('lg_tarifa_manipulado',$field);
|
||||
$this->forge->addColumn('tarifa_encuadernacion',$field);
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropColumn('lg_tarifa_acabado','mostrar_en_presupuesto_cliente');
|
||||
$this->forge->dropColumn('lg_tarifa_manipulado','mostrar_en_presupuesto_cliente');
|
||||
$this->forge->dropColumn('tarifa_encuadernacion','mostrar_en_presupuesto_cliente');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class AlterAddColumnActivoPapelGenerico extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$field = [
|
||||
'activo' => [
|
||||
'type' => 'BOOLEAN',
|
||||
'default' => true,
|
||||
]
|
||||
];
|
||||
$this->forge->addColumn('lg_papel_generico',$field);
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropColumn('lg_papel_generico','activo');
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class AlterTableTarifasExtraPreimpresionCheckPresupuestoClienteMigration extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$field = [
|
||||
'mostrar_en_presupuesto_cliente' => [
|
||||
'type' => 'BOOLEAN',
|
||||
'default' => false,
|
||||
]
|
||||
];
|
||||
$this->forge->addColumn('tarifa_extra',$field);
|
||||
$this->forge->addColumn('lg_tarifa_preimpresion',$field);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropColumn('tarifa_extra','mostrar_en_presupuesto_cliente');
|
||||
$this->forge->dropColumn('lg_tarifa_preimpresion','mostrar_en_presupuesto_cliente');
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
76
ci4/app/Database/Seeds/TicketsSeeder.php
Normal file
76
ci4/app/Database/Seeds/TicketsSeeder.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Seeds;
|
||||
|
||||
use CodeIgniter\Database\Seeder;
|
||||
|
||||
|
||||
class TicketsSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
// categorias
|
||||
$data = [
|
||||
[
|
||||
'keyword' => 'errores',
|
||||
],
|
||||
[
|
||||
'keyword' => 'consultas',
|
||||
],
|
||||
[
|
||||
'keyword' => 'sugerencias',
|
||||
],
|
||||
];
|
||||
$this->db->table('tickets_categorias')->insertBatch($data);
|
||||
|
||||
// secciones
|
||||
$data = [
|
||||
[
|
||||
'keyword' => 'presupuestos',
|
||||
],
|
||||
[
|
||||
'keyword' => 'pedidos',
|
||||
],
|
||||
[
|
||||
'keyword' => 'facturacion',
|
||||
],
|
||||
[
|
||||
'keyword' => 'logistica',
|
||||
],
|
||||
[
|
||||
'keyword' => 'configuracion',
|
||||
],
|
||||
[
|
||||
'keyword' => 'general',
|
||||
],
|
||||
];
|
||||
$this->db->table('tickets_secciones')->insertBatch($data);
|
||||
|
||||
// estados
|
||||
$data = [
|
||||
[
|
||||
'keyword' => 'abierto',
|
||||
],
|
||||
[
|
||||
'keyword' => 'en_proceso',
|
||||
],
|
||||
[
|
||||
'keyword' => 'resuelto',
|
||||
],
|
||||
[
|
||||
'keyword' => 'archivado',
|
||||
],
|
||||
];
|
||||
$this->db->table('tickets_estados')->insertBatch($data);
|
||||
|
||||
// config variables
|
||||
$data = [
|
||||
[
|
||||
'name' => 'default_soporte_user_id',
|
||||
'value' => '10',
|
||||
'description' => 'ID del usuario por defecto para asignar tickets',
|
||||
],
|
||||
];
|
||||
$this->db->table('config_variables_app')->insertBatch($data);
|
||||
}
|
||||
}
|
||||
@ -13,11 +13,13 @@ class PapelGenerico extends \CodeIgniter\Entity\Entity
|
||||
"show_in_client" => false,
|
||||
"show_in_client_special" => false,
|
||||
"is_deleted" => 0,
|
||||
"activo" => false,
|
||||
"created_at" => null,
|
||||
"updated_at" => null,
|
||||
];
|
||||
protected $casts = [
|
||||
"show_in_client" => "boolean",
|
||||
"activo" => "boolean",
|
||||
"show_in_client_special" => "boolean",
|
||||
"is_deleted" => "int",
|
||||
];
|
||||
|
||||
52
ci4/app/Entities/Soporte/TicketEntity.php
Normal file
52
ci4/app/Entities/Soporte/TicketEntity.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Soporte;
|
||||
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
class TicketEntity extends Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
'id' => null,
|
||||
'usuario_id' => null,
|
||||
'tecnico_id' => null,
|
||||
'categoria_id'=> null,
|
||||
'estado_id' => null,
|
||||
'prioridad' => 'media',
|
||||
'titulo' => '',
|
||||
'descripcion' => '',
|
||||
'created_at' => null,
|
||||
'updated_at' => null,
|
||||
];
|
||||
|
||||
protected $dates = ['created_at', 'updated_at'];
|
||||
|
||||
public function setTitulo(string $titulo)
|
||||
{
|
||||
$this->attributes['titulo'] = ucfirst($titulo); // Capitaliza el título
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDescripcion(string $descripcion)
|
||||
{
|
||||
$this->attributes['descripcion'] = ucfirst($descripcion);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPrioridad(): string
|
||||
{
|
||||
return ucfirst($this->attributes['prioridad']);
|
||||
}
|
||||
|
||||
public function asignarTecnico(int $tecnicoId)
|
||||
{
|
||||
$this->attributes['tecnico_id'] = $tecnicoId;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function cambiarEstado(int $estadoId)
|
||||
{
|
||||
$this->attributes['estado_id'] = $estadoId;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
20
ci4/app/Entities/Soporte/TicketRespuestaEntity.php
Normal file
20
ci4/app/Entities/Soporte/TicketRespuestaEntity.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Soporte;
|
||||
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
class TicketRespuestaEntity extends Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
'id' => null,
|
||||
'ticket_id' => null,
|
||||
'usuario_id' => null,
|
||||
'mensaje' => null,
|
||||
'created_at' => null,
|
||||
'updated_at' => null,
|
||||
];
|
||||
|
||||
protected $dates = ['created_at', 'updated_at'];
|
||||
|
||||
}
|
||||
@ -13,6 +13,7 @@ class TarifaAcabadoEntity extends \CodeIgniter\Entity\Entity
|
||||
"precio_min" => 0,
|
||||
"importe_fijo" => 0,
|
||||
"mostrar_en_presupuesto" => 1,
|
||||
"mostrar_en_presupuesto_cliente" => 0,
|
||||
"acabado_cubierta" => 0,
|
||||
"acabado_sobrecubierta" => 0,
|
||||
"user_created_id" => 0,
|
||||
|
||||
@ -11,6 +11,7 @@ class TarifaEncuadernacionEntity extends \CodeIgniter\Entity\Entity
|
||||
"nombre" => null,
|
||||
"code" => null,
|
||||
"mostrar_en_presupuesto" => 1,
|
||||
"mostrar_en_presupuesto_cliente" => 0,
|
||||
"tipo_encuadernacion" => 0,
|
||||
"servicio_encuadernacion" => 0,
|
||||
"por_horas" => 0,
|
||||
@ -23,6 +24,7 @@ class TarifaEncuadernacionEntity extends \CodeIgniter\Entity\Entity
|
||||
];
|
||||
protected $casts = [
|
||||
"mostrar_en_presupuesto" => "int",
|
||||
"mostrar_en_presupuesto_cliente" => "bool",
|
||||
"code" => "string",
|
||||
"tipo_encuadernacion" => "int",
|
||||
"servicio_encuadernacion" => "int",
|
||||
|
||||
@ -14,6 +14,7 @@ class TarifaManipuladoEntity extends \CodeIgniter\Entity\Entity
|
||||
"precio_min" => 0,
|
||||
"importe_fijo" => 0,
|
||||
"mostrar_en_presupuesto" => 1,
|
||||
"mostrar_en_presupuesto_cliente" => 0,
|
||||
"user_created_id" => 0,
|
||||
"user_updated_id" => 0,
|
||||
"is_deleted" => 0,
|
||||
@ -27,6 +28,7 @@ class TarifaManipuladoEntity extends \CodeIgniter\Entity\Entity
|
||||
"code" => "string",
|
||||
"comment" => "string",
|
||||
"mostrar_en_presupuesto" => "int",
|
||||
"mostrar_en_presupuesto_cliente" => "bool",
|
||||
"user_created_id" => "int",
|
||||
"user_updated_id" => "int",
|
||||
"is_deleted" => "int",
|
||||
|
||||
@ -13,6 +13,7 @@ class TarifaextraEntity extends \CodeIgniter\Entity\Entity
|
||||
"precio" => null,
|
||||
"margen" => 0,
|
||||
"mostrar_en_presupuesto" => 1,
|
||||
"mostrar_en_presupuesto_cliente" => false,
|
||||
"user_created_id" => 1,
|
||||
"user_update_id" => 1,
|
||||
"is_deleted" => 0,
|
||||
@ -26,6 +27,7 @@ class TarifaextraEntity extends \CodeIgniter\Entity\Entity
|
||||
"comment" => "string",
|
||||
"margen" => "float",
|
||||
"mostrar_en_presupuesto" => "int",
|
||||
"mostrar_en_presupuesto_cliente" => "bool",
|
||||
"user_created_id" => "int",
|
||||
"user_update_id" => "int",
|
||||
"is_deleted" => "int",
|
||||
|
||||
@ -13,6 +13,7 @@ class TarifapreimpresionEntity extends \CodeIgniter\Entity\Entity
|
||||
"precio" => null,
|
||||
"margen" => 0,
|
||||
"mostrar_en_presupuesto" => 1,
|
||||
"mostrar_en_presupuesto_cliente" => false,
|
||||
"user_created_id" => 1,
|
||||
"user_update_id" => 1,
|
||||
"is_deleted" => 0,
|
||||
@ -26,6 +27,7 @@ class TarifapreimpresionEntity extends \CodeIgniter\Entity\Entity
|
||||
"code" => "string",
|
||||
"comment" => "string",
|
||||
"mostrar_en_presupuesto" => "int",
|
||||
"mostrar_en_presupuesto_cliente" => "bool",
|
||||
"user_created_id" => "int",
|
||||
"user_update_id" => "int",
|
||||
"is_deleted" => "int",
|
||||
|
||||
@ -818,5 +818,9 @@ return [
|
||||
"menu_oauth" => "Autenticaciones",
|
||||
"menu_template" => "Plantillas",
|
||||
|
||||
"menu_soporte" => "Soporte",
|
||||
"menu_soporte_new_ticket" => "Crear ticket",
|
||||
"menu_soporte_ticket_list" => "Mis tickets",
|
||||
|
||||
|
||||
];
|
||||
@ -88,6 +88,7 @@ return [
|
||||
'line' => 'la línea',
|
||||
'error_tittle' => 'Error',
|
||||
],
|
||||
'noPermission' => 'No tiene permiso para acceder a esta página.',
|
||||
'ok' => 'Ok',
|
||||
'wait' => 'Espere',
|
||||
'yes' => 'Si',
|
||||
|
||||
@ -8,6 +8,7 @@ return [
|
||||
'createdAt' => 'Creado el',
|
||||
'deletedAt' => 'Deleted At',
|
||||
'id' => 'ID',
|
||||
'activo' => 'Activo',
|
||||
'isDeleted' => 'Is Deleted',
|
||||
'moduleTitle' => 'Papel Genérico',
|
||||
'nombre' => 'Nombre',
|
||||
|
||||
@ -155,7 +155,7 @@ return [
|
||||
'totalClicks' => 'Total clicks',
|
||||
'horas' => 'Horas máquina',
|
||||
'precioHora' => 'Precio hora',
|
||||
'precioImpresion' => 'Precio impresión',
|
||||
'precioImpresion' => 'Total horas',
|
||||
'precioPagNegro' => 'Precio pág. negro',
|
||||
'precioPagColor' => 'Precio pág. color',
|
||||
'totalTinta' => 'Total tinta',
|
||||
@ -228,7 +228,7 @@ return [
|
||||
'totalClicks' => 'Total Clicks',
|
||||
'totalTinta' => 'Total Tinta',
|
||||
'totalCorte' => 'Total Corte',
|
||||
'totalImpresion' => 'TOTAL IMPRES.',
|
||||
'totalImpresion' => 'Total máquina',
|
||||
'velocidadCorte' => 'Velocidad corte',
|
||||
'precioHoraCorte' => 'Precio hora corte',
|
||||
'tiempoCorte' => 'Tiempo corte',
|
||||
|
||||
@ -55,7 +55,7 @@ return [
|
||||
'ajustesSection' => 'Ajustes',
|
||||
'actividadSection' => 'Accesos',
|
||||
|
||||
|
||||
"ticketsSection" => "Tickets",
|
||||
|
||||
'validation' => [
|
||||
'id' => [
|
||||
|
||||
@ -13,6 +13,7 @@ return [
|
||||
'precioMin' => 'Precio Mínimo',
|
||||
'importeFijo' => 'Importe Fijo',
|
||||
'mostrar_en_presupuesto' => 'Mostrar en presupuesto',
|
||||
'mostrar_en_presupuesto_cliente' => 'Mostrar en presupuesto (cliente)',
|
||||
"acabado_cubierta" => "Acabado cubierta",
|
||||
"acabado_sobrecubierta" => "Acabado sobrecubierta",
|
||||
'tarifaacabado' => 'Tarifa Acabado',
|
||||
|
||||
@ -23,6 +23,7 @@ return [
|
||||
'tiradaMax' => 'Tirada Max',
|
||||
'tiradaMin' => 'Tirada Min',
|
||||
'mostrar_en_presupuesto' => 'Mostrar en presupuesto',
|
||||
'mostrar_en_presupuesto_cliente' => 'Mostrar en presupuesto (cliente)',
|
||||
'tipo_encuadernacion' => 'Tipo encuardernación',
|
||||
'servicio_encuadernacion' => 'Servicio encuardernación',
|
||||
'updatedAt' => 'Actualizado en',
|
||||
|
||||
@ -14,6 +14,7 @@ return [
|
||||
'precioMin' => 'Precio Mínimo',
|
||||
'importeFijo' => 'Importe Fijo',
|
||||
'mostrar_en_presupuesto' => 'Mostrar en presupuesto',
|
||||
'mostrar_en_presupuesto_cliente' => 'Mostrar en presupuesto (Cliente)',
|
||||
'margen' => 'Margen',
|
||||
'tarifaextra' => 'Tarifa Servicios Extra',
|
||||
'tarifaextraList' => 'Lista Tarifas Servicios Extra',
|
||||
|
||||
@ -18,6 +18,7 @@ return [
|
||||
'precioMin' => 'Precio T. Máx',
|
||||
'importeFijo' => 'Importe Fijo',
|
||||
'mostrar_en_presupuesto' => 'Mostrar en presupuesto',
|
||||
'mostrar_en_presupuesto_cliente' => 'Mostrar en presupuesto (cliente)',
|
||||
'tarifamanipulado' => 'Tarifa Manipulado',
|
||||
'tarifamanipuladoList' => 'Lista Tarifas Manipulado',
|
||||
'tarifasmanipulado' => 'Tarifas Manipulado',
|
||||
|
||||
@ -14,6 +14,7 @@ return [
|
||||
'precioMin' => 'Precio Mínimo',
|
||||
'importeFijo' => 'Importe Fijo',
|
||||
'mostrar_en_presupuesto' => 'Mostrar en presupuesto',
|
||||
'mostrar_en_presupuesto_cliente' => 'Mostrar en presupuesto (Cliente)',
|
||||
'margen' => 'Margen',
|
||||
'tarifapreimpresion' => 'Tarifa Preimpresión',
|
||||
'tarifapreimpresionList' => 'Lista Tarifas Preimpresión',
|
||||
|
||||
70
ci4/app/Language/es/Tickets.php
Normal file
70
ci4/app/Language/es/Tickets.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
return [
|
||||
'ticket' => 'Ticket',
|
||||
'tickets' => 'Tickets',
|
||||
'moduleTitle' => 'Tickets',
|
||||
|
||||
"asunto" => "Asunto",
|
||||
"tipo" => "Tipo",
|
||||
"seccion" => "Sección",
|
||||
"estado" => "Estado",
|
||||
"prioridad" => "Prioridad",
|
||||
"descripcion" => "Descripción",
|
||||
"asignarTo" => "Asignado a",
|
||||
"usuario" => "Creado por",
|
||||
"createTicket" => "Crear Ticket",
|
||||
"fechaCreacion" => "Fecha de creación",
|
||||
"respuesta" => "Respuesta",
|
||||
|
||||
// categorías
|
||||
'errores' => 'Errores',
|
||||
'consultas' => 'Consultas',
|
||||
'sugerencias' => 'Sugerencias',
|
||||
|
||||
// secciones
|
||||
'presupuestos' => 'Presupuestos',
|
||||
'pedidos' => 'Pedidos',
|
||||
'facturacion' => 'Facturación',
|
||||
'logistica' => 'Logística',
|
||||
'configuracion' => 'Configuración',
|
||||
'general' => 'General',
|
||||
|
||||
// estados
|
||||
'abierto' => 'Abierto',
|
||||
'en_proceso' => 'En proceso',
|
||||
'resuelto' => 'Resuelto',
|
||||
'archivado' => 'Archivado',
|
||||
|
||||
//Prioridades
|
||||
'alta' => 'Alta',
|
||||
'media' => 'Media',
|
||||
'baja' => 'Baja',
|
||||
|
||||
// FIcheros
|
||||
'adjuntos' => 'Adjuntar imágenes',
|
||||
'adjuntos_ticket' => 'Imágenes adjuntas',
|
||||
|
||||
// Mail
|
||||
'newTicket' => 'Nuevo Ticket en ERP Safekat',
|
||||
'stateChange' => 'Cambio de estado en ticket en ERP Safekat',
|
||||
'asgignToChanged' => 'Asignado ticket en ERP Safekat',
|
||||
'newTicketBody' => '<p>Se ha creado un nuevo ticket en el sistema de soporte de Safekat ERP. <br><br>Puede verlo en el siguiente enlace:</p>',
|
||||
'stateChangeBody' => '<p>El estado de un ticket en el sistema de soporte de Safekat ERP ha cambiado. <br><br>Puede verlo en el siguiente enlace:</p>',
|
||||
'asgignToChangedBody' => '<p>Se le ha asignado un ticket en el sistema de soporte de Safekat ERP. <br><br>Puede verlo en el siguiente enlace:</p>',
|
||||
|
||||
'validation' => [
|
||||
'titulo' => [
|
||||
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
'descripcion' => [
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
],
|
||||
];
|
||||
@ -22,7 +22,7 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
4 => "t1.show_in_client_special",
|
||||
];
|
||||
|
||||
protected $allowedFields = ["nombre", "code", "code_ot", "show_in_client", "show_in_client_special", "deleted_at", "is_deleted"];
|
||||
protected $allowedFields = ["nombre", "code", "code_ot", "show_in_client", "show_in_client_special", "deleted_at", "is_deleted", "activo"];
|
||||
protected $returnType = "App\Entities\Configuracion\PapelGenerico";
|
||||
|
||||
protected $useTimestamps = true;
|
||||
@ -120,25 +120,28 @@ class PapelGenericoModel extends \App\Models\BaseModel
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS id, t1.nombre AS nombre, t1.code AS code, t1.code_ot AS code_ot,
|
||||
t1.show_in_client AS show_in_client, t1.show_in_client_special AS show_in_client_special"
|
||||
->select("t1.id AS id, t1.nombre AS nombre,
|
||||
t1.code AS code,
|
||||
t1.code_ot AS code_ot,
|
||||
t1.activo AS activo,
|
||||
t1.show_in_client AS show_in_client,
|
||||
t1.show_in_client_special AS show_in_client_special"
|
||||
)
|
||||
->where("is_deleted", 0);
|
||||
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
->groupStart()
|
||||
->like("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code_ot", $search)
|
||||
->orLike("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code_ot", $search)
|
||||
->groupEnd();
|
||||
->groupStart()
|
||||
->like("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code_ot", $search)
|
||||
->orLike("t1.id", $search)
|
||||
->orLike("t1.nombre", $search)
|
||||
->orLike("t1.code", $search)
|
||||
->orLike("t1.code_ot", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -450,12 +450,12 @@ class PresupuestoModel extends \App\Models\BaseModel
|
||||
'comparador_json_data' => $this->generateJson($data),
|
||||
|
||||
'faja_color' => is_array($data['faja']) ? 1 : 0,
|
||||
'solapas_ancho_faja_color' => is_array($data['faja']) ? $data['faja']['solapas'] : 60,
|
||||
'alto_faja_color' => is_array($data['faja']) ? $data['faja']['alto'] : 50,
|
||||
'solapas_ancho_faja_color' => is_array($data['faja']) && $data['faja'] !== [] ? $data['faja']['solapas'] : 60,
|
||||
'alto_faja_color' => is_array($data['faja']) && $data['faja'] !== [] ? $data['faja']['alto'] : 50,
|
||||
|
||||
'acabado_cubierta_id' => $data['cubierta']['acabado'],
|
||||
'acabado_sobrecubierta_id' => !$data['sobrecubierta'] ? 0 : $data['sobrecubierta']['acabado'],
|
||||
'acabado_faja_id' => is_array($data['faja']) ? $data['faja']['acabado'] : 0,
|
||||
'acabado_faja_id' => is_array($data['faja']) && $data['faja'] !== [] ? $data['faja']['acabado'] : 0,
|
||||
|
||||
'comp_tipo_impresion' => $data['isHq'] ? ($data['isColor'] ? 'colorhq' : 'negrohq') : ($data['isColor'] ? 'color' : 'negro'),
|
||||
|
||||
@ -582,7 +582,7 @@ class PresupuestoModel extends \App\Models\BaseModel
|
||||
}
|
||||
|
||||
// -- Faja --
|
||||
if ($data['faja'] != 0) {
|
||||
if ($data['faja'] != 0 && $data['faja'] !== []) {
|
||||
$values['faja'] = array(
|
||||
'papel_id' => intval($data['faja']['papel']),
|
||||
'gramaje' => intval($data['faja']['gramaje']),
|
||||
|
||||
@ -154,7 +154,7 @@ class PresupuestoServiciosExtraModel extends \App\Models\BaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id AS id, t1.tarifa_extra_id AS tarifa_extra_id, t1.precio AS precio, t1.margen AS margen, t2.nombre AS nombre"
|
||||
"t1.id AS id, t1.tarifa_extra_id AS tarifa_extra_id, t1.tarifa_extra_id AS tarifa_id, t1.precio AS precio, t1.margen AS margen, t2.nombre AS nombre"
|
||||
);
|
||||
|
||||
$builder->where('t1.presupuesto_id', $presupuesto_id);
|
||||
|
||||
165
ci4/app/Models/Soporte/TicketModel.php
Normal file
165
ci4/app/Models/Soporte/TicketModel.php
Normal file
@ -0,0 +1,165 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Soporte;
|
||||
|
||||
|
||||
class TicketModel extends \App\Models\BaseModel
|
||||
{
|
||||
|
||||
protected $table = 'tickets';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = ['usuario_id', 'user_soporte_id', 'seccion_id', 'categoria_id', 'estado_id', 'prioridad', 'titulo', 'descripcion', 'created_at', 'updated_at'];
|
||||
|
||||
protected $useTimestamps = true;
|
||||
|
||||
protected $returnType = "App\Entities\Soporte\TicketEntity";
|
||||
|
||||
const SORTABLE = [
|
||||
0 => "t1.id",
|
||||
1 => "t1.categoria_id",
|
||||
2 => "t1.seccion_id",
|
||||
3 => "t1.estado_id",
|
||||
4 => "t1.prioridad",
|
||||
5 => "t1.titulo",
|
||||
6 => "t1.usuario_id",
|
||||
7 => "t1.usuario_soporte_id",
|
||||
8 => "t1.created_at",
|
||||
];
|
||||
|
||||
protected $validationRules = [
|
||||
"titulo" => [
|
||||
"label" => "Tickets.asunto",
|
||||
"rules" => "trim|required|max_length[255]",
|
||||
],
|
||||
"descripcion" => [
|
||||
"label" => "Tickets.descripcion",
|
||||
"rules" => "trim|required",
|
||||
],
|
||||
];
|
||||
|
||||
protected $validationMessages = [
|
||||
"titulo" => [
|
||||
"max_length" => "Tickets.validation.titulo.max_length",
|
||||
"required" => "Tickets.validation.titulo.required",
|
||||
],
|
||||
"descripcion" => [
|
||||
"decimal" => "Tickets.validation.descripcion.decimal",
|
||||
"required" => "Tickets.validation.descripcion.required",
|
||||
],
|
||||
];
|
||||
|
||||
public function getEstados()
|
||||
{
|
||||
$values = $this->db->table('tickets_estados')->get()->getResultArray();
|
||||
|
||||
for ($i = 0; $i < count($values); $i++) {
|
||||
$values[$i]['text'] = lang("Tickets." . $values[$i]['keyword']);
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
public function getCategorias()
|
||||
{
|
||||
$values = $this->db->table('tickets_categorias')->get()->getResultArray();
|
||||
|
||||
for ($i = 0; $i < count($values); $i++) {
|
||||
$values[$i]['text'] = lang("Tickets." . $values[$i]['keyword']);
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
public function getSecciones()
|
||||
{
|
||||
$values = $this->db->table('tickets_secciones')->get()->getResultArray();
|
||||
|
||||
for ($i = 0; $i < count($values); $i++) {
|
||||
$values[$i]['text'] = lang("Tickets." . $values[$i]['keyword']);
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
public function getTickets($id = null)
|
||||
{
|
||||
if ($id === null) {
|
||||
return $this->select('tickets.*, users.nombre as usuario, categorias.nombre as categoria, estados.nombre as estado')
|
||||
->join('users', 'users.id = tickets.usuario_id')
|
||||
->join('categorias', 'categorias.id = tickets.categoria_id')
|
||||
->join('estados', 'estados.id = tickets.estado_id')
|
||||
->findAll();
|
||||
}
|
||||
|
||||
return $this->find($id);
|
||||
}
|
||||
|
||||
public function getResource($search = [], $user_id = null)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.id as id, t1.usuario_id AS usuario_id, CONCAT(t2.first_name, ' ', t2.last_name) AS usuario,
|
||||
t1.user_soporte_id AS user_soporte_id, CONCAT(t6.first_name, ' ', t6.last_name) AS user_soporte,
|
||||
t1.categoria_id AS categoria_id, t3.keyword AS categoria,
|
||||
t1.seccion_id AS seccion_id, t5.keyword AS seccion,
|
||||
t1.estado_id AS estado_id, t4.keyword AS estado,
|
||||
t1.prioridad AS prioridad, t1.titulo AS titulo, t1.created_at AS created_at
|
||||
"
|
||||
);
|
||||
|
||||
$builder->join("users t2", "t1.usuario_id = t2.id", "left");
|
||||
$builder->join("users t6", "t1.user_soporte_id = t6.id", "left");
|
||||
$builder->join("tickets_categorias t3", "t1.categoria_id = t3.id", "left");
|
||||
$builder->join("tickets_estados t4", "t1.estado_id = t4.id", "left");
|
||||
$builder->join("tickets_secciones t5", "t1.seccion_id = t5.id", "left");
|
||||
|
||||
if ($user_id !== null)
|
||||
$builder->where("t1.usuario_id", $user_id);
|
||||
|
||||
if (empty($search))
|
||||
return $builder;
|
||||
else {
|
||||
$builder->groupStart();
|
||||
foreach ($search as $col_search) {
|
||||
if ($col_search[1] == "seccion_id") {
|
||||
$id = $this->getIdFromKeyword("tickets_secciones", $col_search[2]);
|
||||
$builder->where("t1." . $col_search[1], $id);
|
||||
} else if ($col_search[1] == "categoria_id") {
|
||||
$id = $this->getIdFromKeyword("tickets_categorias", $col_search[2]);
|
||||
$builder->where("t1." . $col_search[1], $id);
|
||||
} else if ($col_search[1] == "estado_id") {
|
||||
$id = $this->getIdFromKeyword("tickets_estados", $col_search[2]);
|
||||
$builder->where("t1." . $col_search[1], $id);
|
||||
} else if ($col_search[1] == "prioridad") {
|
||||
$builder->where("t1." . $col_search[1], $col_search[2]);
|
||||
} else if ($col_search[1] == "created_at") {
|
||||
$dates = explode(" ", $col_search[2]);
|
||||
$builder->where("t1." . $col_search[1] . ">=", $dates[0]);
|
||||
$builder->where("t1." . $col_search[1] . "<=", $dates[1]);
|
||||
} else if ($col_search[1] == "usuario_id") {
|
||||
$builder->like("t2.first_name", $col_search[2]);
|
||||
$builder->orLike("t2.last_name", $col_search[2]);
|
||||
} else if ($col_search[1] == "user_soporte_id") {
|
||||
$builder->like("t6.first_name", $col_search[2]);
|
||||
$builder->orLike("t6.last_name", $col_search[2]);
|
||||
}
|
||||
else
|
||||
$builder->like("t1." . $col_search[1], $col_search[2]);
|
||||
}
|
||||
$builder->groupEnd();
|
||||
return $builder;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private function getIdFromKeyword($table, $keyword)
|
||||
{
|
||||
$subquery = $this->db->table($table)
|
||||
->select('id')
|
||||
->where('keyword', $keyword)
|
||||
->get()
|
||||
->getRow();
|
||||
return $subquery->id;
|
||||
}
|
||||
}
|
||||
17
ci4/app/Models/Soporte/TicketRespuestaModel.php
Normal file
17
ci4/app/Models/Soporte/TicketRespuestaModel.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Soporte;
|
||||
|
||||
|
||||
class TicketRespuestaModel extends \App\Models\BaseModel
|
||||
{
|
||||
|
||||
protected $table = 'tickets_respuestas';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = ['ticket_id', 'usuario_id', 'mensaje' ,'createt_at', 'updated_at'];
|
||||
|
||||
protected $useTimestamps = true;
|
||||
|
||||
protected $returnType = "App\Entities\Soporte\TicketRespuestaEntity";
|
||||
|
||||
}
|
||||
11
ci4/app/Models/Soporte/ticketFileModel.php
Normal file
11
ci4/app/Models/Soporte/ticketFileModel.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Soporte;
|
||||
|
||||
class ticketFileModel extends \App\Models\BaseModel
|
||||
{
|
||||
protected $table = 'tickets_adjuntos';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = ['ticket_id','respuesta_id', 'nombre', 'hash', 'path', 'created_at', 'updated_at'];
|
||||
protected $useTimestamps = true;
|
||||
}
|
||||
@ -26,6 +26,7 @@ class TarifaAcabadoModel extends \App\Models\BaseModel
|
||||
"precio_min",
|
||||
"importe_fijo",
|
||||
"mostrar_en_presupuesto",
|
||||
"mostrar_en_presupuesto_cliente",
|
||||
"acabado_cubierta",
|
||||
"acabado_sobrecubierta",
|
||||
"deleted_at",
|
||||
@ -86,7 +87,7 @@ class TarifaAcabadoModel extends \App\Models\BaseModel
|
||||
{
|
||||
$builder = $this->db->table($this->table . " t1")->select(
|
||||
"t1.id AS id, t1.nombre AS nombre,t1.code AS code, t1.precio_min AS precio_min, t1.importe_fijo AS importe_fijo,
|
||||
t1.mostrar_en_presupuesto AS mostrar_en_presupuesto, t1.acabado_cubierta AS acabado_cubierta, t1.acabado_sobrecubierta AS acabado_sobrecubierta"
|
||||
t1.mostrar_en_presupuesto AS mostrar_en_presupuesto,t1.mostrar_en_presupuesto_cliente AS mostrar_en_presupuesto_cliente, t1.acabado_cubierta AS acabado_cubierta, t1.acabado_sobrecubierta AS acabado_sobrecubierta"
|
||||
);
|
||||
|
||||
//JJO
|
||||
|
||||
@ -25,6 +25,7 @@ class TarifaEncuadernacionModel extends \App\Models\BaseModel
|
||||
"code",
|
||||
"comment",
|
||||
"mostrar_en_presupuesto",
|
||||
"mostrar_en_presupuesto_cliente",
|
||||
"tipo_encuadernacion",
|
||||
"servicio_encuadernacion",
|
||||
"por_horas",
|
||||
@ -69,6 +70,7 @@ class TarifaEncuadernacionModel extends \App\Models\BaseModel
|
||||
{
|
||||
$builder = $this->db->table($this->table . " t1")->select("t1.id AS id, t1.nombre AS nombre, t1.code AS code,
|
||||
t1.mostrar_en_presupuesto AS mostrar_en_presupuesto,
|
||||
t1.mostrar_en_presupuesto_cliente AS mostrar_en_presupuesto_cliente,
|
||||
t1.tipo_encuadernacion AS tipo_encuadernacion, t1.servicio_encuadernacion AS servicio_encuadernacion,
|
||||
t1.por_horas AS por_horas");
|
||||
|
||||
|
||||
@ -29,7 +29,8 @@ class TarifaManipuladoModel extends \App\Models\BaseModel
|
||||
"deleted_at",
|
||||
"is_deleted",
|
||||
"user_created_id",
|
||||
"user_updated_id"
|
||||
"user_updated_id",
|
||||
"mostrar_en_presupuesto_cliente"
|
||||
];
|
||||
protected $returnType = "App\Entities\Tarifas\TarifaManipuladoEntity";
|
||||
|
||||
@ -83,7 +84,7 @@ class TarifaManipuladoModel extends \App\Models\BaseModel
|
||||
public function getResource(string $search = "")
|
||||
{
|
||||
$builder = $this->db->table($this->table . " t1")->select("t1.id AS id,t1.code AS code, t1.nombre AS nombre, t1.precio_min AS precio_min, t1.importe_fijo AS importe_fijo
|
||||
,t1.mostrar_en_presupuesto AS mostrar_en_presupuesto");
|
||||
,t1.mostrar_en_presupuesto AS mostrar_en_presupuesto,t1.mostrar_en_presupuesto_cliente AS mostrar_en_presupuesto_cliente");
|
||||
|
||||
//JJO
|
||||
$builder->where("t1.is_deleted", 0);
|
||||
|
||||
@ -19,6 +19,7 @@ class TarifaextraModel extends \App\Models\BaseModel
|
||||
"precio",
|
||||
"margen",
|
||||
"mostrar_en_presupuesto",
|
||||
"mostrar_en_presupuesto_cliente",
|
||||
"deleted_at",
|
||||
"is_deleted",
|
||||
"user_created_id",
|
||||
|
||||
@ -19,6 +19,7 @@ class TarifapreimpresionModel extends \App\Models\BaseModel
|
||||
"precio",
|
||||
"margen",
|
||||
"mostrar_en_presupuesto",
|
||||
"mostrar_en_presupuesto_cliente",
|
||||
"deleted_at",
|
||||
"is_deleted",
|
||||
"user_created_id",
|
||||
|
||||
@ -122,6 +122,19 @@ class UserModel extends ShieldUserModel
|
||||
|
||||
}
|
||||
|
||||
public function getFullName($id=0){
|
||||
$builder = $this->db
|
||||
->table("users" . " t1")
|
||||
->select(
|
||||
"CONCAT(t1.first_name, ' ', t1.last_name) AS name"
|
||||
);
|
||||
|
||||
$builder->where('t1.deleted_at', null);
|
||||
$builder->where('t1.id', $id);
|
||||
|
||||
return $builder->get()->getRow()->name;
|
||||
}
|
||||
|
||||
// Método para comprobar si el email ya está registrado
|
||||
public function isEmailUnique($email)
|
||||
{
|
||||
|
||||
62
ci4/app/Services/MessageService.php
Normal file
62
ci4/app/Services/MessageService.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Controllers\Configuracion\ConfigVariables;
|
||||
use App\Models\Chat\ChatDeparmentModel;
|
||||
use App\Models\Chat\ChatMessageModel;
|
||||
use App\Models\Chat\ChatModel;
|
||||
use App\Models\ChatNotification;
|
||||
use App\Models\ChatUser;
|
||||
use App\Models\Configuracion\ConfigVariableModel;
|
||||
use App\Models\Presupuestos\PresupuestoModel;
|
||||
use CodeIgniter\Config\BaseService;
|
||||
|
||||
|
||||
|
||||
class MessageService extends BaseService
|
||||
{
|
||||
protected ChatModel $chatModel;
|
||||
protected ChatMessageModel $chatMessageModel;
|
||||
protected ChatUser $chatUserModel;
|
||||
protected ChatNotification $chatNotificationModel;
|
||||
protected PresupuestoModel $presupuestoModel;
|
||||
protected ChatDeparmentModel $chatDepartmentModel;
|
||||
protected ConfigVariableModel $configVariables;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->chatModel = model(ChatModel::class);
|
||||
$this->chatMessageModel = model(ChatMessageModel::class);
|
||||
$this->chatNotificationModel = model(ChatNotification::class);
|
||||
$this->chatUserModel = model(ChatUser::class);
|
||||
$this->presupuestoModel = model(PresupuestoModel::class);
|
||||
$this->chatDepartmentModel = model(ChatDeparmentModel::class);
|
||||
$this->configVariables = model(ConfigVariableModel::class);
|
||||
}
|
||||
public function createErrorMessagePresupuesto(string $error, int $presupuesto_id)
|
||||
{
|
||||
$dataResponse = null;
|
||||
$chat_department_name = $this->configVariables->getVariable('send_error_to_chat_department_name')?->value;
|
||||
$chat_department_id = $this->chatDepartmentModel->where('name', $chat_department_name)->first()?->id;
|
||||
if ($chat_department_id) {
|
||||
$existChat = $this->chatModel->existChatPresupuesto($chat_department_id, $presupuesto_id);
|
||||
if ($existChat == false) {
|
||||
$chatId = $this->chatModel->createChatPresupuesto($chat_department_id, $presupuesto_id);
|
||||
} else {
|
||||
$chat = $this->chatModel->getChatPresupuesto($chat_department_id, $presupuesto_id);
|
||||
$chatId = $chat->id;
|
||||
}
|
||||
$chat_message_id = $this->chatMessageModel->insert(["chat_id" => $chatId, "sender_id" => auth()->user()->id, "message" => $error]);
|
||||
$dataResponse = $this->chatMessageModel->find($chat_message_id);
|
||||
$chatDepartmentUsers = $this->chatDepartmentModel->getChatDepartmentUsers($chat_department_id);
|
||||
foreach ($chatDepartmentUsers as $user) {
|
||||
if ($user->id != auth()->user()->id) {
|
||||
$this->chatNotificationModel->insert(["chat_message_id" => $chat_message_id, "user_id" => $user->id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $dataResponse;
|
||||
|
||||
}
|
||||
}
|
||||
@ -423,7 +423,7 @@
|
||||
decimalCharacter: ",",
|
||||
digitGroupSeparator: ".",
|
||||
allowDecimalPadding : 'floats',
|
||||
decimalPlaces: 2,
|
||||
decimalPlaces: 6,
|
||||
unformatOnSubmit: true,
|
||||
});
|
||||
})
|
||||
@ -543,7 +543,7 @@
|
||||
return '<?= lang('MaquinasTarifasImpresions.colorhq') ?>';
|
||||
}
|
||||
},
|
||||
{ 'data': 'precio',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{ 'data': 'precio',render : (d) => `<span class="autonumeric-decimal" data-decimal-places="6">${d}</span>` },
|
||||
{ 'data': 'margen',render : (d) => `<span class="autonumeric">${d}</span>` },
|
||||
{
|
||||
data: actionBtns,
|
||||
|
||||
@ -23,7 +23,15 @@
|
||||
<input type="text" id="codeOt" name="code_ot" maxLength="5" class="form-control"
|
||||
value="<?= old('code_ot', $papelGenerico->code_ot) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<label for="activo_papel_generico" class="form-check-label">
|
||||
<?= lang('PapelGenerico.activo') ?>
|
||||
</label>
|
||||
<input type="checkbox" id="activo_papel_generico" name="activo" value="1"
|
||||
class="form-check-input" <?= $papelGenerico->activo == true ? 'checked' : ''; ?>>
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
|
||||
|
||||
@ -144,6 +144,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
<?=$this->endSection() ?>
|
||||
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
<th><?= lang('PapelGenerico.codeOt') ?></th>
|
||||
<th><?= lang('PapelGenerico.showInClient') ?></th>
|
||||
<th><?= lang('PapelGenerico.showInClientSpecial') ?></th>
|
||||
<th><?= lang('PapelGenerico.activo') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -92,13 +93,14 @@
|
||||
{ 'data': 'code_ot' },
|
||||
{ 'data': 'show_in_client' },
|
||||
{ 'data': 'show_in_client_special' },
|
||||
{ 'data': 'activo' },
|
||||
{ 'data': actionBtns }
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
theTable.on( 'draw.dt', function () {
|
||||
const boolCols = [3, 4];
|
||||
const boolCols = [3, 4, 5];
|
||||
for (let coln of boolCols) {
|
||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||
|
||||
@ -64,7 +64,9 @@ const actionBtns = function(data) {
|
||||
<td class="text-right py-0 align-middle">
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
|
||||
<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>
|
||||
<?php if(auth()->user()->can('presupuesto.delete')): ?>
|
||||
<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>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>`;
|
||||
}
|
||||
@ -240,7 +242,7 @@ $(document).on('click', '.btn-remove', function(e) {
|
||||
const row = $(this).closest('tr');
|
||||
if ($.isNumeric(dataId)) {
|
||||
$.ajax({
|
||||
url: `/presupuestoadmin/delete/${dataId}`,
|
||||
url: `/presupuestos/presupuestocliente/delete/${dataId}`,
|
||||
method: 'GET',
|
||||
}).done((data, textStatus, jqXHR) => {
|
||||
$('#confirm2delete').modal('toggle');
|
||||
|
||||
@ -55,7 +55,9 @@ const actionBtns = function(data) {
|
||||
<td class="text-right py-0 align-middle">
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
|
||||
<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>
|
||||
<?php if(auth()->user()->can('presupuesto.delete')): ?>
|
||||
<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>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>`;
|
||||
};
|
||||
@ -287,13 +289,13 @@ $(document).on('click', '.btn-edit', function(e) {
|
||||
window.location.href = `/presupuestoadmin/edit/${$(this).attr('data-id')}/`;
|
||||
});
|
||||
|
||||
theTable.on('click', 'tr', function () {
|
||||
var data = theTable.row(this).data();
|
||||
console.log(data);
|
||||
theTable.on('click', 'tbody td:not(:last-child)', function () {
|
||||
var data = theTable.row($(this).closest('tr')).data();
|
||||
var url = '/presupuestoadmin/edit/' + data['id'];
|
||||
window.location.href = url;
|
||||
});
|
||||
|
||||
|
||||
$(document).on('click', '.btn-delete', function(e) {
|
||||
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
|
||||
});
|
||||
@ -304,7 +306,7 @@ $(document).on('click', '.btn-remove', function(e) {
|
||||
const row = $(this).closest('tr');
|
||||
if ($.isNumeric(dataId)) {
|
||||
$.ajax({
|
||||
url: `/presupuestoadmin/delete/${dataId}`,
|
||||
url: `/presupuestos/presupuestocliente/delete/${dataId}`,
|
||||
method: 'GET',
|
||||
}).done((data, textStatus, jqXHR) => {
|
||||
$('#confirm2delete').modal('toggle');
|
||||
|
||||
@ -50,21 +50,25 @@
|
||||
|
||||
const lastColNr = $('#tableOfPresupuestos').find("tr:first th").length - 1;
|
||||
const actionBtns = function(data) {
|
||||
if(data.estado == 'borrador')
|
||||
if(data.estado == 'borrador'){
|
||||
return `
|
||||
<td class="text-right py-0 align-middle">
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
|
||||
<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>
|
||||
<?php if(auth()->user()->can('presupuesto-cliente.delete')): ?>
|
||||
<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>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>`;
|
||||
else
|
||||
}
|
||||
else{
|
||||
return `
|
||||
<td class="text-right py-0 align-middle">
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="javascript:void(0);"><i class="ti ti-eye ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
|
||||
</div>
|
||||
</td>`;
|
||||
}
|
||||
};
|
||||
|
||||
// Setup - add a text input to each footer cell
|
||||
@ -292,8 +296,8 @@ theTable = $('#tableOfPresupuestos').DataTable({
|
||||
]
|
||||
});
|
||||
|
||||
theTable.on('click', 'tr', function () {
|
||||
var data = theTable.row(this).data();
|
||||
theTable.on('click', 'tbody td:not(:last-child)', function () {
|
||||
var data = theTable.row($(this).closest('tr')).data();
|
||||
var url = '/presupuestos/presupuestocliente/edit/' + data['id'];
|
||||
window.location.href = url;
|
||||
});
|
||||
|
||||
192
ci4/app/Views/themes/vuexy/form/soporte/viewTicketForm.php
Normal file
192
ci4/app/Views/themes/vuexy/form/soporte/viewTicketForm.php
Normal file
@ -0,0 +1,192 @@
|
||||
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
|
||||
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
||||
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
|
||||
<?= $this->section('content'); ?>
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="imageModal" tabindex="-1" aria-labelledby="imageModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="imageModalLabel">Vista Previa</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Cerrar"></button>
|
||||
</div>
|
||||
<div class="modal-body text-center">
|
||||
<img src="" id="modalImage" class="img-fluid rounded">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4><?= $boxTitle ?></h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="post" class="card-body" action="<?= $formAction ?>" enctype="multipart/form-data">
|
||||
<?= csrf_field(); ?>
|
||||
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
|
||||
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
|
||||
<div class="row">
|
||||
<div class="mb-3 col-9">
|
||||
<label class="form-label"><?= lang("Tickets.asunto") ?></label>
|
||||
<input type="text" name="titulo" class="form-control"
|
||||
<?= ($formAction !== route_to('NewTicket', $ticket->id)) ? "readonly" : "" ?>
|
||||
value="<?= old('titulo', $ticket->titulo) ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<label class="form-label"><?= lang("Tickets.tipo") ?></label>
|
||||
<select id="categoria" name="categoria_id" class="form-control select2"
|
||||
<?= ($formAction !== route_to('NewTicket', $ticket->id) && !auth()->user()->can('tickets.edit')) ? "disabled" : "" ?>>
|
||||
<?php foreach ($categorias as $categoria): ?>
|
||||
<option value="<?= $categoria['id']; ?>" <?= $categoria['id'] == $ticket->categoria_id ? ' selected' : '' ?>> <?= $categoria['text']; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<label class="form-label"><?= lang("Tickets.seccion") ?></label>
|
||||
<select id="seccion" name="seccion_id" class="form-control select2"
|
||||
<?= ($formAction !== route_to('NewTicket', $ticket->id) && !auth()->user()->can('tickets.edit')) ? "disabled" : "" ?>>
|
||||
<?php foreach ($secciones as $seccion): ?>
|
||||
<option value="<?= $seccion['id']; ?>" <?= $seccion['id'] == $ticket->seccion_id ? ' selected' : '' ?>><?= $seccion['text']; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<label class="form-label"><?= lang("Tickets.estado") ?></label>
|
||||
<?php if ($formAction !== route_to('NewTicket') && auth()->user()->can('tickets.edit')): ?>
|
||||
<select id="estado" name="estado_id" class="form-control select2">
|
||||
<?php else: ?>
|
||||
<select id="estado" name="estado_id" class="form-control select2" disabled>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($estados as $estado): ?>
|
||||
<option value="<?= $estado['id']; ?>" <?= $estado['id'] == $ticket->estado_id ? ' selected' : '' ?>><?= $estado['text']; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php if (auth()->user()->can('tickets.edit')): ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="mb-3 col-3">
|
||||
<label class="form-label"><?= lang('Tickets.prioridad') ?></label>
|
||||
<select id="prioridad" name="prioridad" class="form-control">
|
||||
<option value="baja" <?= $ticket->prioridad == 'baja' ? ' selected' : '' ?>>
|
||||
<?= lang('Tickets.alta') ?>
|
||||
</option>
|
||||
<option value="media" <?= $ticket->prioridad == 'media' ? ' selected' : '' ?>>
|
||||
<?= lang('Tickets.media') ?>
|
||||
</option>
|
||||
<option value="alta" <?= $ticket->prioridad == 'alta' ? ' selected' : '' ?>>
|
||||
<?= lang('Tickets.baja') ?>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 col-3">
|
||||
<label class="form-label"><?= lang('Tickets.asignarTo') ?></label>
|
||||
<select id="user_soporte_id" name="user_soporte_id" class="form-control">
|
||||
<?php foreach ($supportUsers as $supportUser): ?>
|
||||
<option value="<?= $supportUser['id']; ?>" <?= $supportUser['id'] == $ticket->user_soporte_id ? ' selected' : '' ?>><?= $supportUser['name']; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label"><?= lang("Tickets.descripcion") ?></label>
|
||||
<textarea id="descripcion" name="descripcion" class="form-control"
|
||||
<?= ($formAction !== route_to('NewTicket', $ticket->id)) ? "readonly" : "" ?>
|
||||
rows="4"><?= old('descripcion', $ticket->descripcion) ?></textarea>
|
||||
</div>
|
||||
|
||||
<?php if (isset($respuesta) || ($formAction !== route_to('NewTicket') && auth()->user()->can('tickets.edit'))) : ?>
|
||||
|
||||
<h4><?= lang("Tickets.respuesta") ?></h4>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label"><?= lang("Tickets.respuesta") ?></label>
|
||||
<textarea id="respuestaMensaje" name="respuesta_mensaje" class="form-control"
|
||||
<?= !auth()->user()->can('tickets.edit') ? "readonly" : "" ?>
|
||||
rows="4"><?= isset($respuesta) ? old('respuestaMensaje', $respuesta->mensaje) : "" ?></textarea>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($formAction === route_to('NewTicket') || ($formAction !== route_to('NewTicket') && auth()->user()->can('tickets.edit'))): ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="mb-3">
|
||||
<label for="filesInput" class="form-label"><?= lang("Tickets.adjuntos") ?></label>
|
||||
<input name="files[]" class="form-control" type="file" id="filesInput" multiple
|
||||
accept="image/*">
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($formAction !== route_to('NewTicket')): ?>
|
||||
<h4><?= lang("Tickets.adjuntos_ticket") ?></h4>
|
||||
<div class="container">
|
||||
<?php foreach ($imagesTicket as $image): ?>
|
||||
<div class="row">
|
||||
<div class="col-md-3 mb-3">
|
||||
<img src="<?= esc($image['path']) ?>" class="img-thumbnail img-fluid gallery-img"
|
||||
data-bs-toggle="modal" data-bs-target="#imageModal" data-src="<?= esc($image['path']) ?>"
|
||||
style="cursor:pointer;">
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="pt-4">
|
||||
<?php if (
|
||||
$formAction === route_to('NewTicket') ||
|
||||
($formAction !== route_to('NewTicket') && auth()->user()->can('tickets.edit'))
|
||||
): ?>
|
||||
<input
|
||||
type="submit"
|
||||
class="btn btn-primary float-start me-sm-3 me-1"
|
||||
name="save"
|
||||
value="<?= lang("Basic.global.Save") ?>" />
|
||||
<?php endif; ?>
|
||||
<?= anchor(route_to("TicketIndex"), lang("Basic.global.back"), ["class" => "btn btn-secondary"]) ?>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?= $this->endSection(); ?>
|
||||
|
||||
<?= $this->section('css') ?>
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/dropzone/dropzone.css') ?>" />
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
<?= $this->section('additionalExternalJs') ?>
|
||||
<script src="<?= site_url("themes/vuexy/vendor/libs/dropzone/dropzone.js") ?>"></script>
|
||||
<script type="module" src="<?= site_url('assets/js/safekat/pages/soporte/tickets.js') ?>"></script>
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
76
ci4/app/Views/themes/vuexy/form/soporte/viewTicketList.php
Normal file
76
ci4/app/Views/themes/vuexy/form/soporte/viewTicketList.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
||||
<?= $this->extend('themes/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('Tickets.moduleTitle') ?></h3>
|
||||
<?= anchor(route_to('NewTicket'), lang('Basic.global.addNew') . ' ' . lang('Tickets.ticket'), ['class' => 'btn btn-primary float-end']); ?>
|
||||
</div><!--//.card-header -->
|
||||
<div class="card-body">
|
||||
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
||||
|
||||
<table id="tableOfTickets" class="table table-striped table-hover using-exportable-data-table"
|
||||
style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th><?= lang('Tickets.tipo') ?></th>
|
||||
<th><?= lang('Tickets.seccion') ?></th>
|
||||
<th><?= lang('Tickets.estado') ?></th>
|
||||
<?php if ($userType == 1) : ?>
|
||||
<th><?= lang('Tickets.prioridad') ?></th>
|
||||
<?php endif; ?>
|
||||
<th><?= lang('Tickets.asunto') ?></th>
|
||||
<?php if ($userType == 1) : ?>
|
||||
<th><?= lang('Tickets.usuario') ?></th>
|
||||
<th><?= lang('Tickets.asignarTo') ?></th>
|
||||
<?php endif; ?>
|
||||
<th><?= lang('Tickets.fechaCreacion') ?></th>
|
||||
<th class="text-nowrap noFilter"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div><!--//.card-body -->
|
||||
<div class="card-footer">
|
||||
|
||||
</div><!--//.card-footer -->
|
||||
</div><!--//.card -->
|
||||
</div><!--//.col -->
|
||||
</div><!--//.row -->
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
<?= $this->section('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/bootstrap-daterangepicker/bootstrap-daterangepicker.css') ?>" />
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
<?= $this->section('additionalExternalJs') ?>
|
||||
|
||||
<script>
|
||||
window.userType = <?= $userType ?>;
|
||||
</script>
|
||||
|
||||
<script
|
||||
src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
|
||||
<script
|
||||
src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/jszip/jszip.min.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>"
|
||||
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
|
||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.colVis.min.js") ?>"></script>
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/bootstrap-daterangepicker/bootstrap-daterangepicker.js') ?>"></script>
|
||||
|
||||
<script type="module" src="<?= site_url('assets/js/safekat/pages/soporte/tickets.js') ?>"></script>
|
||||
<?= $this->endSection() ?>
|
||||
@ -54,7 +54,16 @@
|
||||
<?= lang('Tarifaacabado.mostrar_en_presupuesto') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
|
||||
</div><!--//.mb-3 -->
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<label for="mostrar_en_presupuesto_cliente" class="form-check-label">
|
||||
<input type="checkbox" id="mostrar_en_presupuesto_cliente" name="mostrar_en_presupuesto_cliente" value="1" class="form-check-input" <?= $tarifaacabadoEntity->mostrar_en_presupuesto_cliente == true ? 'checked' : ''; ?>>
|
||||
<?= lang('Tarifaencuadernacion.mostrar_en_presupuesto_cliente') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<label for="acabado_cubierta" class="form-check-label">
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
<th><?= lang('Tarifaacabado.precioMin') ?></th>
|
||||
<th><?= lang('Tarifaacabado.importeFijo') ?></th>
|
||||
<th><?= lang('Tarifaacabado.mostrar_en_presupuesto') ?></th>
|
||||
<th><?= lang('Tarifaacabado.mostrar_en_presupuesto_cliente') ?></th>
|
||||
<th><?= lang('Tarifaacabado.acabado_cubierta') ?></th>
|
||||
<th><?= lang('Tarifaacabado.acabado_sobrecubierta') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
@ -95,6 +96,7 @@
|
||||
{ 'data': 'precio_min' },
|
||||
{ 'data': 'importe_fijo' },
|
||||
{ 'data': 'mostrar_en_presupuesto' },
|
||||
{ 'data': 'mostrar_en_presupuesto_cliente' },
|
||||
{ 'data': 'acabado_cubierta' },
|
||||
{ 'data': 'acabado_sobrecubierta' },
|
||||
{ 'data': actionBtns }
|
||||
@ -102,7 +104,7 @@
|
||||
});
|
||||
|
||||
theTable.on( 'draw.dt', function () {
|
||||
const boolCols = [3, 4, 5];
|
||||
const boolCols = [3, 4, 5,6,7];
|
||||
for (let coln of boolCols) {
|
||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||
|
||||
@ -46,6 +46,14 @@
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<label for="mostrar_en_presupuesto_cliente" class="form-check-label">
|
||||
<input type="checkbox" id="mostrar_en_presupuesto_cliente" name="mostrar_en_presupuesto_cliente" value="1" class="form-check-input" <?= $tarifaEncuadernacionEntity->mostrar_en_presupuesto_cliente == true ? 'checked' : ''; ?>>
|
||||
<?= lang('Tarifaencuadernacion.mostrar_en_presupuesto_cliente') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!-- //.col -->
|
||||
|
||||
<div class="col-md-12 col-lg-4 px-4">
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
<th><?= lang('Tarifaencuadernacion.nombre') ?></th>
|
||||
<th><?= lang('Tarifaencuadernacion.code') ?></th>
|
||||
<th><?= lang('Tarifaencuadernacion.mostrar_en_presupuesto') ?></th>
|
||||
<th><?= lang('Tarifaencuadernacion.mostrar_en_presupuesto_cliente') ?></th>
|
||||
<th><?= lang('Tarifaencuadernacion.tipo_encuadernacion') ?></th>
|
||||
<th><?= lang('Tarifaencuadernacion.servicio_encuadernacion') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
@ -91,6 +92,7 @@
|
||||
{ 'data': 'nombre' },
|
||||
{ 'data': 'code' },
|
||||
{ 'data': 'mostrar_en_presupuesto' },
|
||||
{ 'data': 'mostrar_en_presupuesto_cliente' },
|
||||
{ 'data': 'tipo_encuadernacion' },
|
||||
{ 'data': 'servicio_encuadernacion' },
|
||||
{ 'data': actionBtns }
|
||||
@ -98,7 +100,7 @@
|
||||
});
|
||||
|
||||
theTable.on( 'draw.dt', function () {
|
||||
const boolCols = [1,2,3, 4];
|
||||
const boolCols = [1,2,3,4,5];
|
||||
for (let coln of boolCols) {
|
||||
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
|
||||
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
|
||||
|
||||
@ -81,7 +81,19 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox"
|
||||
id="mostrar_en_presupuesto_cliente"
|
||||
name="mostrar_en_presupuesto_cliente"
|
||||
value="1"
|
||||
class="form-check-input"<?= $tarifaextraEntity->mostrar_en_presupuesto_cliente == true ? 'checked' : ''; ?>
|
||||
>
|
||||
<label for="mostrar_en_presupuesto_cliente" class="form-check-label">
|
||||
<?= lang('Tarifaextra.mostrar_en_presupuesto_cliente') ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
</div><!-- //.row -->
|
||||
@ -1,6 +1,6 @@
|
||||
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
|
||||
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
|
||||
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
|
||||
<?= $this->extend('themes/vuexy/main/defaultlayout')?>
|
||||
<?= $this->section("content") ?>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?=$this->include('themes/_commonPartialsBs/datatables') ?>
|
||||
<?=$this->extend('themes/vuexy/main/defaultlayout') ?>
|
||||
<?=$this->section('content'); ?>
|
||||
<?=$this->section('content')?>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
<th><?= lang('Tarifaextra.precio') ?></th>
|
||||
<th><?= lang('Tarifaextra.margen') ?></th>
|
||||
<th><?= lang('Tarifaextra.mostrar_en_presupuesto') ?></th>
|
||||
<th><?= lang('Tarifaextra.mostrar_en_presupuesto_cliente') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -46,6 +47,9 @@
|
||||
<td class="align-middle">
|
||||
<?= esc($item->mostrar_en_presupuesto)==1?'<i class="ti ti-check"></i>':"" ?>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<?= esc($item->mostrar_en_presupuesto_cliente)==1?'<i class="ti ti-check"></i>':"" ?>
|
||||
</td>
|
||||
<td class="align-middle text-center text-nowrap">
|
||||
<?=anchor(route_to('editTarifaextra', $item->id), "<i class='ti ti-pencil ti-sm mx-2'></i>", ['class'=>'text-body', 'data-id'=>$item->id,]); ?>
|
||||
<?=anchor('#confirm2delete', "<i class='ti ti-trash ti-sm mx-2'></i>", ['class'=>'text-body', 'data-href'=>route_to('deleteTarifaextra', $item->id), 'data-bs-toggle'=>'modal', 'data-bs-target'=>'#confirm2delete']); ?>
|
||||
|
||||
@ -52,7 +52,14 @@
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<label for="mostrar_en_presupuesto_cliente" class="form-check-label">
|
||||
<input type="checkbox" id="mostrar_en_presupuesto_cliente" name="mostrar_en_presupuesto_cliente" value="1" class="form-check-input" <?= $tarifaManipuladoEntity->mostrar_en_presupuesto_cliente == true ? 'checked' : ''; ?>>
|
||||
<?= lang('Tarifaencuadernacion.mostrar_en_presupuesto_cliente') ?>
|
||||
</label>
|
||||
</div><!--//.form-check -->
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
</div><!-- //.row -->
|
||||
@ -21,6 +21,7 @@
|
||||
<th><?= lang('Tarifamanipulado.importeMinimo') ?></th>
|
||||
<th><?= lang('Tarifamanipulado.importeFijo') ?></th>
|
||||
<th><?= lang('Tarifamanipulado.mostrar_en_presupuesto') ?></th>
|
||||
<th><?= lang('Tarifamanipulado.mostrar_en_presupuesto_cliente') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -91,7 +92,8 @@
|
||||
{ 'data': 'code' },
|
||||
{ 'data': 'precio_min' },
|
||||
{ 'data': 'importe_fijo' },
|
||||
{ 'data': 'mostrar_en_presupuesto' },
|
||||
{ 'data': 'mostrar_en_presupuesto',render : (d) => d == true ? '<i class="ti ti-check"></i>' : "" },
|
||||
{ 'data': 'mostrar_en_presupuesto_cliente',render : (d) => d == true ? '<i class="ti ti-check"></i>' : "" },
|
||||
{ 'data': actionBtns }
|
||||
]
|
||||
});
|
||||
|
||||
@ -81,6 +81,19 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox"
|
||||
id="mostrar_en_presupuesto_cliente"
|
||||
name="mostrar_en_presupuesto_cliente"
|
||||
value="1"
|
||||
class="form-check-input"<?= $tarifapreimpresionEntity->mostrar_en_presupuesto_cliente == true ? 'checked' : ''; ?>
|
||||
>
|
||||
<label for="mostrar_en_presupuesto_cliente" class="form-check-label">
|
||||
<?= lang('Tarifaextra.mostrar_en_presupuesto_cliente') ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div><!--//.col -->
|
||||
|
||||
</div><!-- //.row -->
|
||||
@ -20,6 +20,7 @@
|
||||
<th><?= lang('Tarifapreimpresion.precio') ?></th>
|
||||
<th><?= lang('Tarifapreimpresion.margen') ?></th>
|
||||
<th><?= lang('Tarifapreimpresion.mostrar_en_presupuesto') ?></th>
|
||||
<th><?= lang('Tarifapreimpresion.mostrar_en_presupuesto_cliente') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -45,6 +46,9 @@
|
||||
<td class="align-middle">
|
||||
<?= esc($item->mostrar_en_presupuesto)==1?'<i class="ti ti-check"></i>':"" ?>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<?= esc($item->mostrar_en_presupuesto_cliente)==1?'<i class="ti ti-check"></i>':"" ?>
|
||||
</td>
|
||||
<td class="align-middle text-center text-nowrap">
|
||||
<?=anchor(route_to('editTarifapreimpresion', $item->id), "<i class='ti ti-pencil ti-sm mx-2'></i>", ['class'=>'text-body', 'data-id'=>$item->id,]); ?>
|
||||
<?=anchor('#confirm2delete', "<i class='ti ti-trash ti-sm mx-2'></i>", ['class'=>'text-body', 'data-href'=>route_to('deleteTarifapreimpresion', $item->id), 'data-bs-toggle'=>'modal', 'data-bs-target'=>'#confirm2delete']); ?>
|
||||
|
||||
@ -50,6 +50,8 @@
|
||||
|
||||
require "menus/wiki_menu.php";
|
||||
|
||||
require "menus/soporte_menu.php";
|
||||
|
||||
require "menus/sistema_menu.php";
|
||||
|
||||
|
||||
|
||||
@ -2,19 +2,16 @@
|
||||
/**
|
||||
* MENU PRESUPUESTOS VISTA CLIENTES
|
||||
*/
|
||||
if (auth()->user()->inGroup('cliente-admin')
|
||||
|| auth()->user()->inGroup('cliente-editor')
|
||||
|| auth()->user()->inGroup('admin')
|
||||
) {
|
||||
|
||||
if (auth()->user()->can('presupuesto-cliente.menu') || auth()->user()->inGroup('admin')) {
|
||||
if(auth()->user()->can('presupuesto-cliente.menu')){
|
||||
|
||||
?>
|
||||
<li class="menu-item">
|
||||
<a href="javascript:void(0);" class="menu-link menu-toggle">
|
||||
<i class="menu-icon tf-icons ti ti-currency-dollar"></i>
|
||||
<?php
|
||||
echo(
|
||||
auth()->user()->inGroup('admin') ?
|
||||
auth()->user()->can('presupuesto.menu') ?
|
||||
lang("App.menu_presupuestos_clientes") :
|
||||
lang("App.menu_presupuestos")
|
||||
);
|
||||
@ -38,6 +35,6 @@ if (auth()->user()->inGroup('cliente-admin')
|
||||
</ul>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
|
||||
} ?>
|
||||
|
||||
|
||||
22
ci4/app/Views/themes/vuexy/main/menus/soporte_menu.php
Normal file
22
ci4/app/Views/themes/vuexy/main/menus/soporte_menu.php
Normal file
@ -0,0 +1,22 @@
|
||||
<!-- Soporte -->
|
||||
<li class="menu-item">
|
||||
<a href="javascript:void(0);" class="menu-link menu-toggle">
|
||||
<i class="menu-icon tf-icons ti ti-help"></i>
|
||||
<?= lang("App.menu_soporte") ?>
|
||||
</a>
|
||||
<ul class="menu-sub">
|
||||
|
||||
<li class="menu-item">
|
||||
<a href="<?= route_to("NewTicket") ?>" class="menu-link">
|
||||
<?= lang("App.menu_soporte_new_ticket") ?>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="menu-item">
|
||||
<a href="<?= route_to("TicketIndex") ?>" class="menu-link">
|
||||
<?= lang("App.menu_soporte_ticket_list") ?>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@ -1,11 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -26,6 +26,19 @@ export const initAutonumeric = () => {
|
||||
});
|
||||
}
|
||||
})
|
||||
$("span.autonumeric-decimal").each(function () {
|
||||
let autoNumericInstance = AutoNumeric.getAutoNumericElement(this)
|
||||
if (!autoNumericInstance) {
|
||||
new AutoNumeric(this, {
|
||||
digitGroupSeparator: ".",
|
||||
decimalCharacter: ",",
|
||||
allowDecimalPadding : 'floats',
|
||||
decimalPlaces: $(this).data('decimal-places'),
|
||||
unformatOnSubmit: true,
|
||||
|
||||
});
|
||||
}
|
||||
})
|
||||
// $(':input[type="number"]').each(function(){
|
||||
// $(this).attr('type','text')
|
||||
// let autoNumericInstance = AutoNumeric.getAutoNumericElement(this)
|
||||
|
||||
@ -1,37 +1,37 @@
|
||||
|
||||
|
||||
|
||||
export const alertConfirmationDelete = (title,type="primary") => {
|
||||
return Swal.fire({
|
||||
title: '¿Está seguro?',
|
||||
text: "Esta acción es irreversible.",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Sí',
|
||||
cancelButtonText: 'Cancelar',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-danger me-1',
|
||||
cancelButton: 'btn btn-label-secondary'
|
||||
},
|
||||
buttonsStyling: false
|
||||
})
|
||||
}
|
||||
|
||||
export const alertSuccessMessage = (title,type="primary") => {
|
||||
return Swal.fire({
|
||||
showCancelButton: false,
|
||||
showConfirmButton : false,
|
||||
title: title,
|
||||
text: title,
|
||||
icon: "success",
|
||||
timer : 2000
|
||||
export const alertConfirmationDelete = (title, type = "primary") => {
|
||||
return Swal.fire({
|
||||
title: '¿Está seguro?',
|
||||
text: "Esta acción es irreversible.",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Sí',
|
||||
cancelButtonText: 'Cancelar',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-danger me-1',
|
||||
cancelButton: 'btn btn-label-secondary'
|
||||
},
|
||||
buttonsStyling: false
|
||||
})
|
||||
}
|
||||
|
||||
export const alertWarningMessage = (title,message,type="primary") => {
|
||||
return Swal.fire({
|
||||
export const alertSuccessMessage = (title, type = "primary") => {
|
||||
return Swal.fire({
|
||||
showCancelButton: false,
|
||||
showConfirmButton: false,
|
||||
title: title,
|
||||
text: title,
|
||||
icon: "success",
|
||||
timer: 2000
|
||||
})
|
||||
}
|
||||
|
||||
export const alertWarningMessage = (title, message, type = "primary") => {
|
||||
return Swal.fire({
|
||||
title: title,
|
||||
text: message,
|
||||
icon: "warning",
|
||||
@ -40,4 +40,27 @@ export const alertWarningMessage = (title,message,type="primary") => {
|
||||
},
|
||||
buttonsStyling: false
|
||||
})
|
||||
}
|
||||
|
||||
export const toastPresupuestoSummary = (value, target = 'body') => {
|
||||
return Swal.mixin({
|
||||
toast: true,
|
||||
position: 'bottom-end',
|
||||
html: `
|
||||
<div class="d-flex flex-column p-0 m-0">
|
||||
<p class="m-0">Total presupuesto</p>
|
||||
<span class="badge badge-label-primary fs-small">${value}</span>
|
||||
</div>`,
|
||||
customClass: {
|
||||
popup: 'bg-primary text-white',
|
||||
},
|
||||
target: target,
|
||||
width : "200px",
|
||||
padding : '1px',
|
||||
allowEscapeKey: false,
|
||||
showConfirmButton: false,
|
||||
timer: 0,
|
||||
timerProgressBar: false,
|
||||
stopKeydownPropagation: false,
|
||||
})
|
||||
}
|
||||
@ -12,20 +12,31 @@ class previewFormas {
|
||||
this.lomo = datos.lomo;
|
||||
this.lomoSobrecubierta = datos.lomoSobrecubierta;
|
||||
|
||||
if (datos.solapas == undefined || datos.solapas == null || datos.solapas == false) {
|
||||
let solapaTemp = null;
|
||||
let solapaSobrecubiertaTemp = null;
|
||||
if(typeof this.lomo === 'function') {
|
||||
solapaTemp = datos.solapas ? datos.solapas() : null;
|
||||
solapaSobrecubiertaTemp = datos.solapas_sobrecubierta ? datos.solapas_sobrecubierta(): null;
|
||||
}
|
||||
else {
|
||||
solapaTemp = datos.solapas? datos.solapas : null;
|
||||
solapaSobrecubiertaTemp = datos.solapas_sobrecubierta? datos.solapas_sobrecubierta : null;
|
||||
}
|
||||
|
||||
if (solapaTemp == undefined || solapaTemp == null || solapaTemp == false) {
|
||||
this.solapa = 0;
|
||||
this.offsetSolapa = 0.0;
|
||||
}
|
||||
else {
|
||||
this.solapa = datos.solapas;
|
||||
this.solapa = solapaTemp;
|
||||
this.offsetSolapa = 3.0;
|
||||
}
|
||||
if (datos.solapas_sobrecubierta == undefined || datos.solapas_sobrecubierta == null || datos.solapas_sobrecubierta == false) {
|
||||
if (solapaSobrecubiertaTemp == undefined || solapaSobrecubiertaTemp == null || solapaSobrecubiertaTemp == false) {
|
||||
this.solapas_sobrecubierta = 0;
|
||||
this.offsetSolapa_sobrecubierta = 0.0;
|
||||
}
|
||||
else {
|
||||
this.solapa_sobrecubierta = datos.solapas_sobrecubierta;
|
||||
this.solapa_sobrecubierta = solapaSobrecubiertaTemp;
|
||||
this.offsetSolapa_sobrecubierta = 3.0;
|
||||
}
|
||||
this.lomoRedondo = datos.lomoRedondo;
|
||||
@ -45,14 +56,33 @@ class previewFormas {
|
||||
this.lomo = datos.lomo;
|
||||
this.lomoSobrecubierta = datos.lomoSobrecubierta;
|
||||
|
||||
if (datos.solapas == undefined || datos.solapas == null || datos.solapas == false) {
|
||||
let solapaTemp = null;
|
||||
let solapaSobrecubiertaTemp = null;
|
||||
if(typeof this.lomo === 'function') {
|
||||
solapaTemp = datos.solapas ? datos.solapas() : null;
|
||||
solapaSobrecubiertaTemp = datos.solapas_sobrecubierta ? datos.solapas_sobrecubierta(): null;
|
||||
}
|
||||
else {
|
||||
solapaTemp = datos.solapas? datos.solapas : null;
|
||||
solapaSobrecubiertaTemp = datos.solapas_sobrecubierta? datos.solapas_sobrecubierta : null;
|
||||
}
|
||||
|
||||
if (solapaTemp == undefined || solapaTemp == null || solapaTemp == false) {
|
||||
this.solapa = 0;
|
||||
this.offsetSolapa = 0.0;
|
||||
}
|
||||
else {
|
||||
this.solapa = datos.solapas;
|
||||
this.solapa = solapaTemp;
|
||||
this.offsetSolapa = 3.0;
|
||||
}
|
||||
if (solapaSobrecubiertaTemp == undefined || solapaSobrecubiertaTemp == null || solapaSobrecubiertaTemp == false) {
|
||||
this.solapas_sobrecubierta = 0;
|
||||
this.offsetSolapa_sobrecubierta = 0.0;
|
||||
}
|
||||
else {
|
||||
this.solapa_sobrecubierta = solapaSobrecubiertaTemp;
|
||||
this.offsetSolapa_sobrecubierta = 3.0;
|
||||
}
|
||||
this.lomoRedondo = datos.lomoRedondo;
|
||||
}
|
||||
|
||||
@ -486,7 +516,6 @@ class previewFormas {
|
||||
this.ancho = this.ancho();
|
||||
this.alto = this.alto();
|
||||
this.lomoRedondo = this.lomoRedondo();
|
||||
this.solapa = this.solapa();
|
||||
}
|
||||
|
||||
let styleCotas = { size: 12, family: 'Public Sans' };
|
||||
|
||||
@ -404,7 +404,9 @@ class PresupuestoAdminEdit {
|
||||
}
|
||||
|
||||
// Funciones para detectar cambios en el formulario
|
||||
this.#checkChangesPresupuesto();
|
||||
setTimeout(() => {
|
||||
this.#checkChangesPresupuesto();
|
||||
}, 500);
|
||||
$('#bc-save').on("click", function () {
|
||||
showBreadCrumbSaveButton(false);
|
||||
$('#saveForm').trigger('click');
|
||||
@ -530,45 +532,57 @@ class PresupuestoAdminEdit {
|
||||
|
||||
|
||||
#checkChangesPresupuesto() {
|
||||
|
||||
const self = this;
|
||||
// Detectar cambios en inputs de texto
|
||||
$('input[type="text"]').on('change', function () {
|
||||
showBreadCrumbSaveButton(true);
|
||||
if (!self.cargandoPresupuesto)
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
// Detectar cambios en inputs de texto
|
||||
$('input[type="number"]').on('change', function () {
|
||||
showBreadCrumbSaveButton(true);
|
||||
if (!self.cargandoPresupuesto)
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
// Detectar cambios en select
|
||||
$('select').on('change', function () {
|
||||
showBreadCrumbSaveButton(true);
|
||||
if (!self.cargandoPresupuesto)
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
$('.select2bs').on('change', function (e) {
|
||||
showBreadCrumbSaveButton(true);
|
||||
if (!self.cargandoPresupuesto)
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
// Detectar cambios en checkboxes
|
||||
$('input[type="checkbox"]').change(function () {
|
||||
showBreadCrumbSaveButton(true);
|
||||
if (!self.cargandoPresupuesto)
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
// Detectar cambios en textareas
|
||||
$('textarea').on('input', function () {
|
||||
showBreadCrumbSaveButton(true);
|
||||
if (!self.cargandoPresupuesto)
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
// Detectar cambios en otros tipos de input
|
||||
$('input[type="radio"]').change(function () {
|
||||
showBreadCrumbSaveButton(true);
|
||||
if (!self.cargandoPresupuesto)
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
|
||||
// Detectar cambios en otros tipos de input
|
||||
$('input:not([type])').on('input', function () {
|
||||
showBreadCrumbSaveButton(true);
|
||||
if (!self.cargandoPresupuesto)
|
||||
showBreadCrumbSaveButton(true);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
downloadPreviewImage() {
|
||||
$(document).on("click", ".download-shape", (event) => {
|
||||
let parentDiv = $(event.currentTarget).parent().parent();
|
||||
|
||||
@ -1045,7 +1045,7 @@ class LineasPresupuesto {
|
||||
data.totalClicksPedido = isNaN(parseFloat(row.precio_click_pedido)) ? "" : parseFloat(row.precio_click_pedido).toFixed(2)
|
||||
data.totalTinta = isNaN(parseFloat(row.precio_tinta)) ? "" : parseFloat(row.precio_tinta).toFixed(2)
|
||||
|
||||
data.totalImpresion = isNaN(parseFloat(row.precio_click_pedido + row.precio_tinta + data.totalCorte)) ? "" : parseFloat(row.precio_click_pedido + row.precio_tinta + data.totalCorte).toFixed(2)
|
||||
data.totalImpresion = isNaN(parseFloat(row.precio_click_pedido) + parseFloat(row.precio_tinta) + parseFloat(row.total_corte)) ? "" : (parseFloat(row.precio_click_pedido) + parseFloat(row.precio_tinta) + parseFloat(row.total_corte)).toFixed(2)
|
||||
|
||||
data.gTintaNegroPed = isNaN(parseFloat(row.peso_gotas_negro_pedido)) ? "" : parseFloat(row.peso_gotas_negro_pedido).toFixed(2)
|
||||
data.gTintaCyanPed = isNaN(parseFloat(row.peso_gotas_cyan_pedido)) ? "" : parseFloat(row.peso_gotas_cyan_pedido).toFixed(2)
|
||||
@ -1553,7 +1553,7 @@ class LineasPresupuesto {
|
||||
datos.paginas_color = parseInt($('#compPaginasColor').val())
|
||||
}
|
||||
else {
|
||||
let paginas_color = isNaN(parseInt($('#lp_rot_color_numPagColor').val())) ? input_data.paginas : parseInt($('#lp_rot_color_numPagColor').val())
|
||||
let paginas_color = isNaN(parseInt($('#lp_rot_color_numPagColor').val())) ? 0 : parseInt($('#lp_rot_color_numPagColor').val())
|
||||
datos.paginas_negro = input_data.paginas - paginas_color;
|
||||
datos.paginas_color = paginas_color;
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import { toastPresupuestoSummary } from "../../../components/alerts/sweetAlert.js";
|
||||
|
||||
class Resumen {
|
||||
|
||||
constructor() {
|
||||
@ -7,7 +9,7 @@ class Resumen {
|
||||
init() {
|
||||
|
||||
const self = this;
|
||||
|
||||
this.toastPresupuestoTotal = null
|
||||
$(".update-totales").on("change", function () {
|
||||
self.updateTotales(true, true, true)
|
||||
});
|
||||
@ -16,6 +18,7 @@ class Resumen {
|
||||
await self.updateTotales();
|
||||
$(document).trigger('update-totales-completed');
|
||||
});
|
||||
$("#totalDespuesDecuento").on('change',this.updateToastSummary.bind(this))
|
||||
}
|
||||
|
||||
cargar(resumen) {
|
||||
@ -44,7 +47,7 @@ class Resumen {
|
||||
$("#totalAntesDescuento").text(resumen.total_antes_descuento + "€" || "0€");
|
||||
$("#total_descuentoPercent").val(resumen.total_descuentoPercent || "0");
|
||||
$("#descuentoTotal").text(resumen.total_descuento + "€" || "0€");
|
||||
$("#totalDespuesDecuento").text(resumen.total_presupuesto + "€" || "0€");
|
||||
$("#totalDespuesDecuento").text(resumen.total_presupuesto + "€" || "0€").trigger("change")
|
||||
$("#precioUnidadPresupuesto").text(resumen.total_precio_unidad + "€" || "0€");
|
||||
$("#factor").text(resumen.total_factor || "0");
|
||||
$("#factor_ponderado").text(resumen.total_factor_ponderado || "0");
|
||||
@ -52,7 +55,7 @@ class Resumen {
|
||||
if (resumen.total_aceptado !== undefined) {
|
||||
$("#totalAceptado").val(resumen.total_aceptado + "€" || "0€");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
update() {
|
||||
@ -101,6 +104,7 @@ class Resumen {
|
||||
let sumForFactorPonderado = 0.0;
|
||||
|
||||
|
||||
let costeMaquinaHoras = 0.0;
|
||||
let margenPorHoras = 0.0;
|
||||
|
||||
if (updateLP) {
|
||||
@ -113,31 +117,31 @@ class Resumen {
|
||||
totalPapel += parseFloat($('#' + rowData.row_id + '_totalPapelPedido').val())
|
||||
margenPapel += parseFloat($('#' + rowData.row_id + '_margenPapelPedido').val())
|
||||
|
||||
sumForFactor += parseFloat($('#' + rowData.row_id + '_totalPapelPedido').val())
|
||||
sumForFactor -= parseFloat($('#' + rowData.row_id + '_margenPapelPedido').val())
|
||||
//sumForFactor += parseFloat($('#' + rowData.row_id + '_totalPapelPedido').val())
|
||||
//sumForFactor -= parseFloat($('#' + rowData.row_id + '_margenPapelPedido').val())
|
||||
|
||||
}
|
||||
if (rowData.check_impresion_total) {
|
||||
|
||||
totalImpresion += parseFloat($('#' + rowData.row_id + '_precioImpresion').val())
|
||||
costeMaquinaHoras += parseFloat($('#' + rowData.row_id + '_precioImpresion').val())
|
||||
margenPorHoras += parseFloat($('#' + rowData.row_id + '_margenImpresion').val())
|
||||
totalImpresion += parseFloat($('#' + rowData.row_id + '_totalClicks').val())
|
||||
margenImpresion += parseFloat($('#' + rowData.row_id + '_margenClicks').val())
|
||||
|
||||
sumForFactor += parseFloat($('#' + rowData.row_id + '_totalClicks').val())
|
||||
//sumForFactor += parseFloat($('#' + rowData.row_id + '_totalClicks').val())
|
||||
|
||||
if (rowData.maquinaTipo == 'inkjet') {
|
||||
totalImpresion += parseFloat(rowData.totalTinta)
|
||||
totalImpresion += parseFloat(rowData.totalCorte)?? 0;
|
||||
sumForFactor += (parseFloat(rowData.totalTinta) + parseFloat(rowData.totalCorte))
|
||||
//sumForFactor += (parseFloat(rowData.totalTinta) + parseFloat(rowData.totalCorte))
|
||||
}
|
||||
|
||||
sumForFactor -= parseFloat($('#' + rowData.row_id + '_margenClicks').val())
|
||||
//sumForFactor -= parseFloat($('#' + rowData.row_id + '_margenClicks').val())
|
||||
|
||||
if (!isNaN(parseFloat($('#' + rowData.row_id + '_totalTinta').val()))) {
|
||||
/*if (!isNaN(parseFloat($('#' + rowData.row_id + '_totalTinta').val()))) {
|
||||
totalImpresion += parseFloat($('#' + rowData.row_id + '_totalTinta').val())
|
||||
sumForFactor += parseFloat($('#' + rowData.row_id + '_totalTinta').val())
|
||||
}
|
||||
}*/
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -145,7 +149,10 @@ class Resumen {
|
||||
totalImpresion -= parseFloat(margenImpresion);
|
||||
totalPapel -= parseFloat(margenPapel);
|
||||
|
||||
margenImpresion += parseFloat(margenPorHoras);
|
||||
margenImpresion += parseFloat(margenPorHoras) + parseFloat(costeMaquinaHoras);
|
||||
|
||||
sumForFactor += totalImpresion;
|
||||
sumForFactor += totalPapel;
|
||||
|
||||
let porcentajeMargenPapel = isNaN(margenPapel / (totalPapel) * 100.0) ? 0 : margenPapel / (totalPapel) * 100.0
|
||||
$('#porcentajeMargenPapel').text(porcentajeMargenPapel.toFixed(0) + '%')
|
||||
@ -211,7 +218,7 @@ class Resumen {
|
||||
$('#tableOfServiciosExtra').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
|
||||
let rowData = this.data();
|
||||
let total_servicio = self.roundToTwoDecimals(parseFloat(rowData.precio));
|
||||
let coste_servicio = self.roundToTwoDecimals(parseFloat(rowData.coste));
|
||||
let coste_servicio = self.roundToTwoDecimals(parseFloat(rowData.margen));
|
||||
totalServicios += total_servicio
|
||||
margenServicios += total_servicio - coste_servicio;
|
||||
});
|
||||
@ -300,7 +307,7 @@ class Resumen {
|
||||
$('#descuentoTotal').attr('val', (totalDescuento).toFixed(2))
|
||||
$('#totalDespuesDecuento').attr('val', (totalPresupuesto).toFixed(2))
|
||||
$('#precioUnidadPresupuesto').attr('val', (precioUnidad).toFixed(4))
|
||||
|
||||
$('#totalDespuesDecuento').trigger("change")
|
||||
|
||||
$('#factor').text(this.addSeparatorsNF(((totalPresupuesto - totalEnvios - margenEnvios) / sumForFactor).toFixed(2), ".", ",", "."))
|
||||
$('#factor').attr('val', ((totalPresupuesto - totalEnvios - margenEnvios) / sumForFactor).toFixed(2))
|
||||
@ -313,37 +320,37 @@ class Resumen {
|
||||
getData(){
|
||||
|
||||
let data = {
|
||||
'total_coste_papel': $('#totalCostePapel').text().replace('€', ''),
|
||||
'total_margen_papel': $('#margenPapel').text().replace('€', ''),
|
||||
'total_margenPercent_papel': $('#porcentajeMargenPapel').text().replace('%', ''),
|
||||
'total_coste_papel': $('#totalCostePapel').text().replace('€', '').replace('.', '').replace(',', '.'),
|
||||
'total_margen_papel': $('#margenPapel').text().replace('€', '').replace('.', '').replace(',', '.'),
|
||||
'total_margenPercent_papel': $('#porcentajeMargenPapel').text().replace('%', '').replace('.', '').replace(',', '.'),
|
||||
|
||||
'total_coste_impresion': $('#totalCosteImpresion').text().replace('€', ''),
|
||||
'total_margen_impresion': $('#margenImpresion').text().replace('€', ''),
|
||||
'total_margenPercent_impresion': $('#porcentajeMargenImpresion').text().replace('%', ''),
|
||||
'total_coste_impresion': $('#totalCosteImpresion').text().replace('€', '').replace('.', '').replace(',', '.'),
|
||||
'total_margen_impresion': $('#margenImpresion').text().replace('€', '').replace('.', '').replace(',', '.'),
|
||||
'total_margenPercent_impresion': $('#porcentajeMargenImpresion').text().replace('%', '').replace('.', '').replace(',', '.'),
|
||||
|
||||
'total_coste_servicios': $('#totalServicios').text().replace('€', ''),
|
||||
'total_margen_servicios': $('#margenServicios').text().replace('€', ''),
|
||||
'total_margenPercent_servicios': $('#porcentajeMargenServicios').text().replace('%', ''),
|
||||
'total_coste_servicios': $('#totalServicios').text().replace('€', '').replace('.', '').replace(',', '.'),
|
||||
'total_margen_servicios': $('#margenServicios').text().replace('€', '').replace('.', '').replace(',', '.'),
|
||||
'total_margenPercent_servicios': $('#porcentajeMargenServicios').text().replace('%', '').replace('.', '').replace(',', '.'),
|
||||
|
||||
'total_coste_envios': $('#totalEnvios').text().replace('€', ''),
|
||||
'total_margen_envios': $('#margenEnvios').text().replace('€', ''),
|
||||
'total_coste_envios': $('#totalEnvios').text().replace('€', '').replace('.', '').replace(',', '.'),
|
||||
'total_margen_envios': $('#margenEnvios').text().replace('€', '').replace('.', '').replace(',', '.'),
|
||||
|
||||
'total_costes': $('#totalCostes').text().replace('€', ''),
|
||||
'total_margenes': $('#totalMargenes').text().replace('€', ''),
|
||||
'total_costes': $('#totalCostes').text().replace('€', '').replace('.', '').replace(',', '.'),
|
||||
'total_margenes': $('#totalMargenes').text().replace('€', '').replace('.', '').replace(',', '.'),
|
||||
|
||||
'total_antes_descuento': $('#totalAntesDescuento').text().replace('€', ''),
|
||||
'total_descuento': $('#descuentoTotal').text().replace('€', ''),
|
||||
'total_descuentoPercent': $('#total_descuentoPercent').val().replace('€', ''),
|
||||
'total_presupuesto': $('#totalDespuesDecuento').text().replace('€', ''),
|
||||
'total_precio_unidad': $('#precioUnidadPresupuesto').text().replace('€', ''),
|
||||
'total_antes_descuento': $('#totalAntesDescuento').text().replace('€', '').replace('.', '').replace(',', '.'),
|
||||
'total_descuento': $('#descuentoTotal').text().replace('€', '').replace('.', '').replace(',', '.'),
|
||||
'total_descuentoPercent': $('#total_descuentoPercent').val().replace('€', '').replace('.', '').replace(',', '.'),
|
||||
'total_presupuesto': $('#totalDespuesDecuento').text().replace('€', '').replace('.', '').replace(',', '.'),
|
||||
'total_precio_unidad': $('#precioUnidadPresupuesto').text().replace('€', '').replace('.', '').replace(',', '.'),
|
||||
|
||||
'total_factor': $('#factor').text().replace(/,/g, '.'),
|
||||
'total_factor_ponderado': $('#factor_ponderado').text().replace(/,/g, '.'),
|
||||
'total_factor_ponderado': $('#factor_ponderado').text().replace(/,/g, '.')
|
||||
};
|
||||
|
||||
if($('#confirmar_presupuesto').prop('checked')){
|
||||
data.confirmar = '1';
|
||||
data.total_aceptado = $('#totalDespuesDecuento').text().replace('€', '');
|
||||
data.total_aceptado = $('#totalDespuesDecuento').text().replace('€', '').replace('.', '').replace(',', '.');
|
||||
}
|
||||
|
||||
return data;
|
||||
@ -352,6 +359,25 @@ class Resumen {
|
||||
roundToTwoDecimals(num) {
|
||||
return parseFloat(num.toFixed(2));
|
||||
}
|
||||
updateToastSummary()
|
||||
{
|
||||
if(this.toastPresupuestoTotal){
|
||||
this.toastPresupuestoTotal.close()
|
||||
}
|
||||
|
||||
this.toastPresupuestoTotal = toastPresupuestoSummary($("#totalDespuesDecuento").text() ?? 0)
|
||||
this.toastPresupuestoTotal.fire().then((result) => {
|
||||
if(result.isDismissed && result.dismiss == 'close'){
|
||||
this.updateToastSummary()
|
||||
$('html, body').animate(
|
||||
{
|
||||
scrollTop: $("#totalDespuesDecuento").offset().top
|
||||
},
|
||||
1000)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export default Resumen;
|
||||
309
httpdocs/assets/js/safekat/pages/soporte/tickets.js
Normal file
309
httpdocs/assets/js/safekat/pages/soporte/tickets.js
Normal file
@ -0,0 +1,309 @@
|
||||
import Table from '../../components/table.js';
|
||||
import Ajax from '../../components/ajax.js';
|
||||
|
||||
|
||||
|
||||
class Ticket {
|
||||
|
||||
constructor() {
|
||||
|
||||
// check if url includes "add"
|
||||
this.action = 'list';
|
||||
if (window.location.href.includes("add"))
|
||||
this.action = "add";
|
||||
else if (window.location.href.includes("edit"))
|
||||
this.action = "edit";
|
||||
|
||||
this.table = null;
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
|
||||
init() {
|
||||
|
||||
if (this.action == "edit") {
|
||||
|
||||
$('.gallery-img').on('click', function () {
|
||||
let imageUrl = $(this).data('src'); // Obtiene la URL de la imagen
|
||||
$('#modalImage').attr('src', imageUrl); // Cambia la imagen en el modal
|
||||
$('#imageModal').modal('show'); // Muestra el modal
|
||||
});
|
||||
|
||||
}
|
||||
else if (this.action == "list") {
|
||||
this.#initDatatable();
|
||||
}
|
||||
}
|
||||
|
||||
#initDatatable() {
|
||||
|
||||
const self = this;
|
||||
|
||||
self.#headerSearcher();
|
||||
|
||||
const actions = ['view'];
|
||||
|
||||
let columns = [];
|
||||
if (window.userType == 1) {
|
||||
columns = [
|
||||
{ 'data': 'id' },
|
||||
{
|
||||
'data': 'categoria_id',
|
||||
render: function (data, type, row) {
|
||||
return window.language.Tickets[row.categoria];
|
||||
}
|
||||
},
|
||||
{
|
||||
'data': 'seccion_id',
|
||||
render: function (data, type, row) {
|
||||
return window.language.Tickets[row.seccion];
|
||||
}
|
||||
},
|
||||
{
|
||||
'data': 'estado_id',
|
||||
render: function (data, type, row) {
|
||||
return window.language.Tickets[row.estado];
|
||||
}
|
||||
},
|
||||
{
|
||||
'data': 'prioridad',
|
||||
render: function (data, type, row) {
|
||||
return window.language.Tickets[data];
|
||||
},
|
||||
},
|
||||
{ 'data': 'titulo' },
|
||||
{
|
||||
'data': 'usuario_id',
|
||||
render: function (data, type, row) {
|
||||
return row.usuario;
|
||||
},
|
||||
},
|
||||
{
|
||||
'data': 'user_soporte_id',
|
||||
render: function (data, type, row) {
|
||||
return row.user_soporte;
|
||||
},
|
||||
},
|
||||
{ 'data': 'created_at' },
|
||||
];
|
||||
}
|
||||
else {
|
||||
columns = [
|
||||
{ 'data': 'id' },
|
||||
{
|
||||
'data': 'categoria_id',
|
||||
render: function (data, type, row) {
|
||||
return window.language.Tickets[row.categoria];
|
||||
}
|
||||
},
|
||||
{
|
||||
'data': 'seccion_id',
|
||||
render: function (data, type, row) {
|
||||
return window.language.Tickets[row.seccion];
|
||||
}
|
||||
},
|
||||
{
|
||||
'data': 'estado_id',
|
||||
render: function (data, type, row) {
|
||||
return window.language.Tickets[row.estado];
|
||||
}
|
||||
},
|
||||
{ 'data': 'titulo' },
|
||||
{ 'data': 'created_at' },
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
this.table = new Table(
|
||||
$('#tableOfTickets'),
|
||||
'tickets',
|
||||
'/soporte/ticketlist',
|
||||
columns,
|
||||
);
|
||||
|
||||
|
||||
this.table.init({
|
||||
actions: actions,
|
||||
buttonsExport: true,
|
||||
});
|
||||
|
||||
this.table.table.on('init.dt', function () {
|
||||
|
||||
self.table.table.page.len(100).draw();
|
||||
self.table.table.draw();
|
||||
|
||||
});
|
||||
|
||||
this.table.setEditCallback(function (id) {
|
||||
window.location.href = '/soporte/edit/' + id;
|
||||
})
|
||||
}
|
||||
|
||||
#headerSearcher() {
|
||||
const self = this;
|
||||
|
||||
$('#tableOfTickets thead tr.search-header').remove();
|
||||
let searchRow = $('#tableOfTickets thead tr').first().clone(true);
|
||||
searchRow.addClass('search-header').appendTo('#tableOfTickets thead');
|
||||
|
||||
$('#tableOfTickets thead tr:eq(1) th').each(function (i) {
|
||||
if (!$(this).hasClass("noFilter")) {
|
||||
var title = $(this).text();
|
||||
if (title == window.language.Tickets.fechaCreacion) {
|
||||
|
||||
$(this).html('<input id="bs-rangepicker-range" type="text" class="form-control " style="min-width:100px;max-width:120px;font-size:0.8rem !important;" />');
|
||||
var bsRangePickerRange = $('#bs-rangepicker-range')
|
||||
bsRangePickerRange.daterangepicker({
|
||||
ranges: {
|
||||
[window.language.datePicker.hoy]: [moment(), moment()],
|
||||
[window.language.datePicker.ayer]: [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
[window.language.datePicker.ultimos7]: [moment().subtract(6, 'days'), moment()],
|
||||
[window.language.datePicker.ultimos30]: [moment().subtract(29, 'days'), moment()],
|
||||
[window.language.datePicker.esteMes]: [moment().startOf('month'), moment().endOf('month')],
|
||||
[window.language.datePicker.ultimoMes]: [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
||||
},
|
||||
opens: 'right',
|
||||
language: $('html').attr('lang'),
|
||||
"locale": {
|
||||
"customRangeLabel": window.language.datePicker.personalizar,
|
||||
"format": "YYYY-MM-DD",
|
||||
"separator": " ",
|
||||
"applyLabel": window.language.datePicker.aplicar,
|
||||
"cancelLabel": window.language.datePicker.limpiar,
|
||||
|
||||
},
|
||||
"alwaysShowCalendars": true,
|
||||
autoUpdateInput: false,
|
||||
|
||||
});
|
||||
|
||||
bsRangePickerRange.on('apply.daterangepicker', function (ev, picker) {
|
||||
$(this).val(picker.startDate.format('YYYY-MM-DD') + ' ' + picker.endDate.format('YYYY-MM-DD'));
|
||||
self.table.table
|
||||
.column(i)
|
||||
.search(this.value)
|
||||
.draw();
|
||||
});
|
||||
|
||||
bsRangePickerRange.on('cancel.daterangepicker', function (ev, picker) {
|
||||
$(this).val('');
|
||||
self.table.table
|
||||
.column(i)
|
||||
.search(this.value)
|
||||
.draw();
|
||||
});
|
||||
|
||||
}
|
||||
else if (title == window.language.Tickets.tipo) {
|
||||
// Agregar un selector en la tercera columna
|
||||
$(this).html('<select class="form-control" style="min-width:100px;max-width:120px;font-size:0.8rem !important;"></select>');
|
||||
|
||||
// Agregar opciones al selector
|
||||
var selectorTipo = $('select', this);
|
||||
selectorTipo.append('<option value="">Todos</option>'); // Opción vacía
|
||||
selectorTipo.append('<option value="errores">' + window.language.Tickets.errores + '</option>');
|
||||
selectorTipo.append('<option value="consultas">' + window.language.Tickets.consultas + '</option>');
|
||||
selectorTipo.append('<option value="sugerencias">' + window.language.Tickets.sugerencias + '</option>');
|
||||
|
||||
selectorTipo.on('change', function () {
|
||||
var val = $.fn.dataTable.util.escapeRegex(
|
||||
$(this).val()
|
||||
);
|
||||
self.table.table.column(i).search(val).draw();
|
||||
});
|
||||
}
|
||||
|
||||
else if (title == window.language.Tickets.seccion) {
|
||||
// Agregar un selector en la tercera columna
|
||||
$(this).html('<select class="form-control" style="min-width:100px;max-width:120px;font-size:0.8rem !important;"></select>');
|
||||
|
||||
// Agregar opciones al selector
|
||||
var selectorSeccion = $('select', this);
|
||||
selectorSeccion.append('<option value="">Todos</option>'); // Opción vacía
|
||||
selectorSeccion.append('<option value="presupuestos">' + window.language.Tickets.presupuestos + '</option>');
|
||||
selectorSeccion.append('<option value="pedidos">' + window.language.Tickets.pedidos + '</option>');
|
||||
selectorSeccion.append('<option value="facturacion">' + window.language.Tickets.facturacion + '</option>');
|
||||
selectorSeccion.append('<option value="logistica">' + window.language.Tickets.logistica + '</option>');
|
||||
selectorSeccion.append('<option value="configuracion">' + window.language.Tickets.configuracion + '</option>');
|
||||
selectorSeccion.append('<option value="general">' + window.language.Tickets.general + '</option>');
|
||||
|
||||
selectorSeccion.on('change', function () {
|
||||
var val = $.fn.dataTable.util.escapeRegex(
|
||||
$(this).val()
|
||||
);
|
||||
self.table.table.column(i).search(val).draw();
|
||||
});
|
||||
}
|
||||
else if (title == window.language.Tickets.estado) {
|
||||
// Agregar un selector en la tercera columna
|
||||
$(this).html('<select class="form-control" style="min-width:100px;max-width:120px;font-size:0.8rem !important;"></select>');
|
||||
|
||||
// Agregar opciones al selector
|
||||
var selectorEstado = $('select', this);
|
||||
selectorEstado.append('<option value="">Todos</option>'); // Opción vacía
|
||||
selectorEstado.append('<option value="abierto">' + window.language.Tickets.abierto + '</option>');
|
||||
selectorEstado.append('<option value="en_proceso">' + window.language.Tickets.en_proceso + '</option>');
|
||||
selectorEstado.append('<option value="resuelto">' + window.language.Tickets.resuelto + '</option>');
|
||||
|
||||
selectorEstado.on('change', function () {
|
||||
var val = $.fn.dataTable.util.escapeRegex(
|
||||
$(this).val()
|
||||
);
|
||||
self.table.table.column(i).search(val).draw();
|
||||
});
|
||||
}
|
||||
else if (title == window.language.Tickets.prioridad) {
|
||||
// Agregar un selector en la tercera columna
|
||||
$(this).html('<select class="form-control" style="min-width:100px;max-width:120px;font-size:0.8rem !important;"></select>');
|
||||
|
||||
// Agregar opciones al selector
|
||||
var selectorPrioridad = $('select', this);
|
||||
selectorPrioridad.append('<option value="">Todos</option>'); // Opción vacía
|
||||
selectorPrioridad.append('<option value="baja">' + window.language.Tickets.baja + '</option>');
|
||||
selectorPrioridad.append('<option value="media">' + window.language.Tickets.media + '</option>');
|
||||
selectorPrioridad.append('<option value="baja">' + window.language.Tickets.alta + '</option>');
|
||||
|
||||
selectorPrioridad.on('change', function () {
|
||||
var val = $.fn.dataTable.util.escapeRegex(
|
||||
$(this).val()
|
||||
);
|
||||
self.table.table.column(i).search(val).draw();
|
||||
});
|
||||
}
|
||||
else {
|
||||
$(this).html('<input type="text" class="form-control " style="min-width:100px;max-width:120px;font-size:0.8rem !important;" />');
|
||||
|
||||
$('input', this).on('change clear', function () {
|
||||
if (self.table.table.column(i).search() !== this.value) {
|
||||
self.table.table
|
||||
.column(i)
|
||||
.search(this.value)
|
||||
.draw();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
$(this).html('<span></span>');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
|
||||
|
||||
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Tickets', 'datePicker'] }, {},
|
||||
function (translations) {
|
||||
window.language = JSON.parse(translations);
|
||||
new Ticket();
|
||||
},
|
||||
function (error) {
|
||||
console.log("Error getting translations:", error);
|
||||
}
|
||||
).post();
|
||||
});
|
||||
|
||||
export default Ticket;
|
||||
Reference in New Issue
Block a user