mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
terminado tickets. faltan respuestas
This commit is contained in:
@ -924,7 +924,10 @@ $routes->group('soporte', ['namespace' => 'App\Controllers\Soporte'], function (
|
|||||||
$routes->get('', 'Ticketcontroller::index', ['as' => 'TicketIndex']);
|
$routes->get('', 'Ticketcontroller::index', ['as' => 'TicketIndex']);
|
||||||
$routes->get('add', 'Ticketcontroller::add', ['as' => 'NewTicket']);
|
$routes->get('add', 'Ticketcontroller::add', ['as' => 'NewTicket']);
|
||||||
$routes->post('add', 'Ticketcontroller::add', ['as' => 'createTicket']);
|
$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->post('ticketlist', 'Ticketcontroller::datatable');
|
||||||
|
$routes->get('image/(:segment)', 'Ticketcontroller::image/$1');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,16 +2,21 @@
|
|||||||
|
|
||||||
namespace App\Controllers\Soporte;
|
namespace App\Controllers\Soporte;
|
||||||
|
|
||||||
use App\Models\TicketModel;
|
use App\Models\Soporte\TicketModel;
|
||||||
use App\Models\CategoriaModel;
|
use App\Models\CategoriaModel;
|
||||||
use App\Models\EstadoModel;
|
use App\Models\EstadoModel;
|
||||||
use CodeIgniter\Controller;
|
use CodeIgniter\Controller;
|
||||||
use App\Entities\Soporte\TicketEntity;
|
use App\Entities\Soporte\TicketEntity;
|
||||||
use App\Models\Soporte\ticketFileModel;
|
use App\Models\Soporte\ticketFileModel;
|
||||||
|
|
||||||
class Ticketcontroller extends \App\Controllers\GoBaseController
|
|
||||||
|
use App\Models\Collection;
|
||||||
|
|
||||||
|
class Ticketcontroller extends \App\Controllers\BaseResourceController
|
||||||
{
|
{
|
||||||
protected static $primaryModelName = 'App\Models\Soporte\ticketModel';
|
|
||||||
|
protected $modelName = TicketModel::class;
|
||||||
|
protected $format = 'json';
|
||||||
|
|
||||||
protected static $singularObjectNameCc = 'ticket';
|
protected static $singularObjectNameCc = 'ticket';
|
||||||
protected static $singularObjectName = 'Ticket';
|
protected static $singularObjectName = 'Ticket';
|
||||||
@ -34,17 +39,22 @@ class Ticketcontroller extends \App\Controllers\GoBaseController
|
|||||||
];
|
];
|
||||||
|
|
||||||
parent::initController($request, $response, $logger);
|
parent::initController($request, $response, $logger);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
//checkPermission('tickets.menu');
|
//checkPermission('tickets.menu');
|
||||||
|
|
||||||
$this->viewData['usingClientSideDataTable'] = true;
|
$viewData = [
|
||||||
|
'currentModule' => static::$controllerSlug,
|
||||||
|
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Tickets.tickets')]),
|
||||||
|
'usingServerSideDataTable' => true,
|
||||||
|
'userType' => auth()->user()->can('tickets.edit')? 1:0,
|
||||||
|
];
|
||||||
|
|
||||||
$this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('Tickets.tickets')]);
|
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
|
||||||
parent::index();
|
|
||||||
|
return view(static::$viewPath . 'viewTicketList', $viewData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +119,7 @@ class Ticketcontroller extends \App\Controllers\GoBaseController
|
|||||||
'nombre' => $originalName,
|
'nombre' => $originalName,
|
||||||
'ticket_id' => $id,
|
'ticket_id' => $id,
|
||||||
'hash' => $fileHash,
|
'hash' => $fileHash,
|
||||||
'path' => 'uploads/' . $newFileName
|
'path' => 'uploads/tickets/' . $newFileName
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,7 +149,7 @@ class Ticketcontroller extends \App\Controllers\GoBaseController
|
|||||||
$this->viewData['estados'] = $this->model->getEstados();
|
$this->viewData['estados'] = $this->model->getEstados();
|
||||||
$this->viewData['secciones'] = $this->model->getSecciones();
|
$this->viewData['secciones'] = $this->model->getSecciones();
|
||||||
|
|
||||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Tarifaextra.tarifaextra') . ' ' . lang('Basic.global.addNewSuffix');
|
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Tickets.ticket') . ' ' . lang('Basic.global.addNewSuffix');
|
||||||
|
|
||||||
|
|
||||||
return $this->displayForm(__METHOD__);
|
return $this->displayForm(__METHOD__);
|
||||||
@ -147,32 +157,22 @@ class Ticketcontroller extends \App\Controllers\GoBaseController
|
|||||||
|
|
||||||
public function edit($requestedId = null)
|
public function edit($requestedId = null)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
checkPermission('tarifa-extra.edit', $this->indexRoute);
|
|
||||||
|
|
||||||
if ($requestedId == null) :
|
if ($requestedId == null) :
|
||||||
return $this->redirect2listView();
|
return $this->redirect2listView();
|
||||||
endif;
|
endif;
|
||||||
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
|
||||||
$tarifaextraEntity = $this->model->find($id);
|
$ticket = $this->model->find($id);
|
||||||
|
|
||||||
if ($tarifaextraEntity == false) :
|
if ($ticket == false) :
|
||||||
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Tarifaextra.tarifaextra')), $id]);
|
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Tickets.ticket')), $id]);
|
||||||
return $this->redirect2listView('errorMessage', $message);
|
return $this->redirect2listView('errorMessage', $message);
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ($this->request->getPost()) :
|
if ($this->request->getPost()) :
|
||||||
|
|
||||||
$postData = $this->request->getPost();
|
$postData = $this->request->getPost();
|
||||||
$sanitizedData = $this->sanitized($postData, true);
|
$sanitizedData = $this->sanitized($postData, false);
|
||||||
|
|
||||||
// JJO
|
|
||||||
if (isset($this->model->user_updated_id)) {
|
|
||||||
$sanitizedData['user_updated_id'] = auth()->user()->id;
|
|
||||||
}
|
|
||||||
if ($this->request->getPost('mostrar_en_presupuesto') == null) {
|
|
||||||
$sanitizedData['mostrar_en_presupuesto'] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$noException = true;
|
$noException = true;
|
||||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||||
@ -184,17 +184,17 @@ class Ticketcontroller extends \App\Controllers\GoBaseController
|
|||||||
$this->dealWithException($e);
|
$this->dealWithException($e);
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Tarifaextra.tarifaextra'))]);
|
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('Tickets.ticket'))]);
|
||||||
$this->session->setFlashdata('formErrors', $this->model->errors());
|
$this->session->setFlashdata('formErrors', $this->model->errors());
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
$tarifaextraEntity->fill($sanitizedData);
|
$ticket->fill($sanitizedData);
|
||||||
|
|
||||||
$thenRedirect = false;
|
$thenRedirect = false;
|
||||||
endif;
|
endif;
|
||||||
if ($noException && $successfulResult) :
|
if ($noException && $successfulResult) :
|
||||||
$id = $tarifaextraEntity->id ?? $id;
|
$id = $ticket->id ?? $id;
|
||||||
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
|
||||||
|
|
||||||
if ($thenRedirect) :
|
if ($thenRedirect) :
|
||||||
@ -210,15 +210,37 @@ class Ticketcontroller extends \App\Controllers\GoBaseController
|
|||||||
endif; // $noException && $successfulResult
|
endif; // $noException && $successfulResult
|
||||||
endif; // ($requestMethod === 'post')
|
endif; // ($requestMethod === 'post')
|
||||||
|
|
||||||
$this->viewData['tarifaextraEntity'] = $tarifaextraEntity;
|
$this->viewData['ticket'] = $ticket;
|
||||||
|
|
||||||
$this->viewData['formAction'] = route_to('updateTarifaextra', $id);
|
$this->viewData['formAction'] = route_to('updateTicket', $id);
|
||||||
|
|
||||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Tarifaextra.tarifaextra') . ' ' . lang('Basic.global.edit3');
|
$this->viewData['categorias'] = $this->model->getCategorias();
|
||||||
|
$this->viewData['estados'] = $this->model->getEstados();
|
||||||
|
$this->viewData['secciones'] = $this->model->getSecciones();
|
||||||
|
$defatulSoporteUserId = model('App\Models\Configuracion\ConfigVariableModel')->getVariable('default_soporte_user_id')->value;
|
||||||
|
$this->viewData['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)
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
$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);
|
return $this->displayForm(__METHOD__, $id);
|
||||||
*/
|
|
||||||
} // end function edit(...)
|
} // end function edit(...)
|
||||||
|
|
||||||
public function datatable()
|
public function datatable()
|
||||||
@ -237,7 +259,7 @@ class Ticketcontroller extends \App\Controllers\GoBaseController
|
|||||||
|
|
||||||
$searchValues = get_filter_datatables_columns($reqData);
|
$searchValues = get_filter_datatables_columns($reqData);
|
||||||
|
|
||||||
$resourceData = $this->model->getResource($searchValues, $cliente_id);
|
$resourceData = $this->model->getResource($searchValues);
|
||||||
foreach ($requestedOrder as $order) {
|
foreach ($requestedOrder as $order) {
|
||||||
$column = $order['column'] ?? 0;
|
$column = $order['column'] ?? 0;
|
||||||
$dir = $order['dir'] ?? 'asc';
|
$dir = $order['dir'] ?? 'asc';
|
||||||
@ -258,4 +280,47 @@ class Ticketcontroller extends \App\Controllers\GoBaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,8 @@ return [
|
|||||||
'pedidos' => 'Pedidos',
|
'pedidos' => 'Pedidos',
|
||||||
'facturacion' => 'Facturación',
|
'facturacion' => 'Facturación',
|
||||||
'logistica' => 'Logística',
|
'logistica' => 'Logística',
|
||||||
|
'configuracion' => 'Configuración',
|
||||||
|
'general' => 'General',
|
||||||
|
|
||||||
// estados
|
// estados
|
||||||
'abierto' => 'Abierto',
|
'abierto' => 'Abierto',
|
||||||
@ -42,6 +44,7 @@ return [
|
|||||||
|
|
||||||
// FIcheros
|
// FIcheros
|
||||||
'adjuntos' => 'Adjuntar imágenes',
|
'adjuntos' => 'Adjuntar imágenes',
|
||||||
'adjuntos_main_text' => 'Arrastra y suelta las imágenes aquí o haz clic para subirlas',
|
'adjuntos_ticket' => 'Imágenes adjuntas',
|
||||||
|
'adjuntos_respuesta' => 'Imágenes adjuntos de la respuesta',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@ -12,6 +12,8 @@ class TicketModel extends \App\Models\BaseModel
|
|||||||
|
|
||||||
protected $useTimestamps = true;
|
protected $useTimestamps = true;
|
||||||
|
|
||||||
|
protected $returnType = "App\Entities\Soporte\TicketEntity";
|
||||||
|
|
||||||
const SORTABLE = [
|
const SORTABLE = [
|
||||||
0 => "t1.categoria_id",
|
0 => "t1.categoria_id",
|
||||||
1 => "t1.seccion_id",
|
1 => "t1.seccion_id",
|
||||||
@ -75,14 +77,16 @@ class TicketModel extends \App\Models\BaseModel
|
|||||||
->table($this->table . " t1")
|
->table($this->table . " t1")
|
||||||
->select(
|
->select(
|
||||||
"t1.id as id, t1.usuario_id AS usuario_id, CONCAT(t2.first_name, ' ', t2.last_name) AS usuario,
|
"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(t2.first_name, ' ', t2.last_name) AS user_soporte,
|
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, t1.estado_id AS estado_id,
|
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
|
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 t2", "t1.usuario_id = t2.id", "left");
|
||||||
$builder->join("users t2", "t1.user_soporte_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_categorias t3", "t1.categoria_id = t3.id", "left");
|
||||||
$builder->join("tickets_estados t4", "t1.estado_id = t4.id", "left");
|
$builder->join("tickets_estados t4", "t1.estado_id = t4.id", "left");
|
||||||
$builder->join("tickets_secciones t5", "t1.seccion_id = t5.id", "left");
|
$builder->join("tickets_secciones t5", "t1.seccion_id = t5.id", "left");
|
||||||
@ -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
|
// Método para comprobar si el email ya está registrado
|
||||||
public function isEmailUnique($email)
|
public function isEmailUnique($email)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,21 +1,40 @@
|
|||||||
|
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
|
||||||
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
|
||||||
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
|
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
|
||||||
<?= $this->section('content'); ?>
|
<?= $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="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h4><?= lang("Tickets.createTicket") ?></h4>
|
<h4><?= $boxTitle ?></h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form method="post" class="card-body" action="<?= $formAction ?>" enctype="multipart/form-data">
|
<form method="post" class="card-body" action="<?= $formAction ?>" enctype="multipart/form-data">
|
||||||
<?= csrf_field(); ?>
|
<?= csrf_field(); ?>
|
||||||
|
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
|
||||||
|
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="mb-3 col-9">
|
<div class="mb-3 col-9">
|
||||||
<label class="form-label"><?= lang("Tickets.asunto") ?></label>
|
<label class="form-label"><?= lang("Tickets.asunto") ?></label>
|
||||||
<input type="text" name="titulo" class="form-control" required>
|
<input type="text" name="titulo" class="form-control"
|
||||||
|
<?= ($formAction === route_to('updateTicket', $ticket->id))?"readonly":"" ?>
|
||||||
|
value="<?= old('titulo', $ticket->titulo) ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -23,9 +42,11 @@
|
|||||||
|
|
||||||
<div class="col-3 mb-3">
|
<div class="col-3 mb-3">
|
||||||
<label class="form-label"><?= lang("Tickets.tipo") ?></label>
|
<label class="form-label"><?= lang("Tickets.tipo") ?></label>
|
||||||
<select id="categoria" name="categoria_id" class="form-control select2">
|
<select id="categoria" name="categoria_id" class="form-control select2"
|
||||||
|
<?= ($formAction === route_to('updateTicket', $ticket->id) && !auth()->user()->can('tickets.edit'))?"disabled":"" ?>>
|
||||||
<?php foreach ($categorias as $categoria): ?>
|
<?php foreach ($categorias as $categoria): ?>
|
||||||
<option value="<?= $categoria['id']; ?>"><?= $categoria['text']; ?></option>
|
<option value="<?= $categoria['id']; ?>" <?= $categoria['id'] == $ticket->categoria_id ? ' selected' : '' ?>> <?= $categoria['text']; ?>
|
||||||
|
</option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -33,18 +54,25 @@
|
|||||||
|
|
||||||
<div class="col-3 mb-3">
|
<div class="col-3 mb-3">
|
||||||
<label class="form-label"><?= lang("Tickets.seccion") ?></label>
|
<label class="form-label"><?= lang("Tickets.seccion") ?></label>
|
||||||
<select id="seccion" name="seccion_id" class="form-control select2">
|
<select id="seccion" name="seccion_id" class="form-control select2"
|
||||||
|
<?= ($formAction === route_to('updateTicket', $ticket->id) && !auth()->user()->can('tickets.edit'))?"disabled":"" ?>>
|
||||||
<?php foreach ($secciones as $seccion): ?>
|
<?php foreach ($secciones as $seccion): ?>
|
||||||
<option value="<?= $seccion['id']; ?>"><?= $seccion['text']; ?></option>
|
<option value="<?= $seccion['id']; ?>" <?= $seccion['id'] == $ticket->seccion_id ? ' selected' : '' ?>><?= $seccion['text']; ?>
|
||||||
|
</option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-3 mb-3">
|
<div class="col-3 mb-3">
|
||||||
<label class="form-label"><?= lang("Tickets.estado") ?></label>
|
<label class="form-label"><?= lang("Tickets.estado") ?></label>
|
||||||
<select id="estado" name="estado_id" class="form-control select2" disabled>
|
<?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): ?>
|
<?php foreach ($estados as $estado): ?>
|
||||||
<option value="<?= $estado['id']; ?>"><?= $estado['text']; ?></option>
|
<option value="<?= $estado['id']; ?>" <?= $estado['id'] == $ticket->estado_id ? ' selected' : '' ?>><?= $estado['text']; ?>
|
||||||
|
</option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -57,15 +85,25 @@
|
|||||||
<div class="mb-3 col-3">
|
<div class="mb-3 col-3">
|
||||||
<label class="form-label"><?= lang('Tickets.prioridad') ?></label>
|
<label class="form-label"><?= lang('Tickets.prioridad') ?></label>
|
||||||
<select id="prioridad" name="prioridad" class="form-control">
|
<select id="prioridad" name="prioridad" class="form-control">
|
||||||
<option value="alta"><?= lang('Tickets.alta') ?></option>
|
<option value="baja" <?= $ticket->prioridad == 'baja' ? ' selected' : '' ?>>
|
||||||
<option value="media" selected><?= lang('Tickets.media') ?></option>
|
<?= lang('Tickets.alta') ?>
|
||||||
<option value="baja"><?= lang('Tickets.baja') ?></option>
|
</option>
|
||||||
|
<option value="media" <?= $ticket->prioridad == 'media' ? ' selected' : '' ?>>
|
||||||
|
<?= lang('Tickets.media') ?>
|
||||||
|
</option>
|
||||||
|
<option value="alta" <?= $ticket->prioridad == 'alta' ? ' selected' : '' ?>>
|
||||||
|
<?= lang('Tickets.baja') ?>
|
||||||
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3 col-3">
|
<div class="mb-3 col-3">
|
||||||
<label class="form-label"><?= lang('Tickets.asignarTo') ?></label>
|
<label class="form-label"><?= lang('Tickets.asignarTo') ?></label>
|
||||||
<select id="supportUser" name="supportUser" class="form-control">
|
<select id="supportUser" name="supportUser" 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>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -75,63 +113,51 @@
|
|||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label"><?= lang("Tickets.descripcion") ?></label>
|
<label class="form-label"><?= lang("Tickets.descripcion") ?></label>
|
||||||
<textarea id="descripcion" name="descripcion" class="form-control" rows="4" required></textarea>
|
<textarea id="descripcion" name="descripcion" class="form-control"
|
||||||
|
<?= ($formAction === route_to('updateTicket', $ticket->id))?"readonly":"" ?>
|
||||||
|
rows="4"><?= old('descripcion', $ticket->descripcion) ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ($formAction === route_to('NewTicket')): ?>
|
<?php if ($formAction === route_to('NewTicket')): ?>
|
||||||
|
|
||||||
|
<h4><?= lang("Tickets.adjuntos") ?></h4>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="filesInput" class="form-label"><?=lang("Tickets.adjuntos")?></label>
|
<label for="filesInput" class="form-label"><?= lang("Tickets.adjuntos") ?></label>
|
||||||
<input name="files[]" class="form-control" type="file" id="filesInput" multiple accept="image/*">
|
<input name="files[]" class="form-control" type="file" id="filesInput" multiple
|
||||||
|
accept="image/*">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php else: /*?>
|
<?php else: ?>
|
||||||
<div id="carouselInput" class="carousel slide" data-bs-ride="carousel">
|
<h4><?= lang("Tickets.adjuntos_ticket") ?></h4>
|
||||||
<div class="carousel-inner">
|
<div class="container">
|
||||||
<div class="carousel-item active">
|
<?php foreach ($imagesTicket as $image): ?>
|
||||||
<a href="ruta-imagen-1.jpg" data-bs-toggle="lightbox">
|
<div class="row">
|
||||||
<img src="ruta-imagen-1.jpg" class="d-block w-100" alt="Imagen 1">
|
<div class="col-md-3 mb-3">
|
||||||
</a>
|
<img src="<?= esc($image['path']) ?>" class="img-thumbnail img-fluid gallery-img"
|
||||||
</div>
|
data-bs-toggle="modal" data-bs-target="#imageModal" data-src="<?= esc($image['path']) ?>"
|
||||||
<div class="carousel-item">
|
style="cursor:pointer;">
|
||||||
<a href="ruta-imagen-2.jpg" data-bs-toggle="lightbox">
|
</div>
|
||||||
<img src="ruta-imagen-2.jpg" class="d-block w-100" alt="Imagen 2">
|
</div>
|
||||||
</a>
|
<?php endforeach; ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="carousel-item">
|
|
||||||
<a href="ruta-imagen-3.jpg" data-bs-toggle="lightbox">
|
|
||||||
<img src="ruta-imagen-3.jpg" class="d-block w-100" alt="Imagen 3">
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Controles del carrusel -->
|
<?php endif; ?>
|
||||||
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExample"
|
|
||||||
data-bs-slide="prev">
|
|
||||||
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
|
|
||||||
</button>
|
|
||||||
<button class="carousel-control-next" type="button" data-bs-target="#carouselExample"
|
|
||||||
data-bs-slide="next">
|
|
||||||
<span class="carousel-control-next-icon" aria-hidden="true"></span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Lightbox (usando Bootstrap Modal) -->
|
<div class="pt-4">
|
||||||
<div id="lightboxModal" class="modal fade" tabindex="-1">
|
<?php if ($formAction === route_to('NewTicket') ||
|
||||||
<div class="modal-dialog modal-dialog-centered">
|
($formAction === route_to('updateTicket', $ticket->id) && auth()->user()->can('tickets.edit'))): ?>
|
||||||
<div class="modal-content">
|
<input
|
||||||
<div class="modal-body">
|
type="submit"
|
||||||
<img id="lightboxImage" src="" class="img-fluid">
|
class="btn btn-primary float-start me-sm-3 me-1"
|
||||||
</div>
|
name="save"
|
||||||
</div>
|
value="<?= lang("Basic.global.Save") ?>"
|
||||||
</div>
|
/>
|
||||||
</div>
|
<?php endif; ?>
|
||||||
|
<?= anchor(route_to("TicketIndex"), lang("Basic.global.back"), ["class" => "btn btn-secondary"]) ?>
|
||||||
|
|
||||||
<?php */ endif; ?>
|
</div>
|
||||||
|
|
||||||
<button type="submit" class="btn btn-primary"><?= lang("Tickets.createTicket") ?></button>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
|
||||||
|
|
||||||
<table id="tableOfTieckets" class="table table-striped table-hover using-exportable-data-table"
|
<table id="tableOfTickets" class="table table-striped table-hover using-exportable-data-table"
|
||||||
style="width: 100%;">
|
style="width: 100%;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -21,10 +21,10 @@
|
|||||||
<th><?= lang('Tickets.tipo') ?></th>
|
<th><?= lang('Tickets.tipo') ?></th>
|
||||||
<th><?= lang('Tickets.seccion') ?></th>
|
<th><?= lang('Tickets.seccion') ?></th>
|
||||||
<th><?= lang('Tickets.estado') ?></th>
|
<th><?= lang('Tickets.estado') ?></th>
|
||||||
<th><?= lang('Tickets.prioridad') ?></th>
|
<th style="display: none;"><?= lang('Tickets.prioridad') ?></th>
|
||||||
<th><?= lang('Tickets.asunto') ?></th>
|
<th><?= lang('Tickets.asunto') ?></th>
|
||||||
<th><?= lang('Tickets.usuario') ?></th>
|
<th style="display: none;"><?= lang('Tickets.usuario') ?></th>
|
||||||
<th><?= lang('Tickets.asignarTo') ?></th>
|
<th style="display: none;"><?= lang('Tickets.asignarTo') ?></th>
|
||||||
<th><?= lang('Tickets.fechaCreacion') ?></th>
|
<th><?= lang('Tickets.fechaCreacion') ?></th>
|
||||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -49,6 +49,11 @@
|
|||||||
|
|
||||||
|
|
||||||
<?= $this->section('additionalExternalJs') ?>
|
<?= $this->section('additionalExternalJs') ?>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
window.userType = <?= $userType ?>;
|
||||||
|
</script>
|
||||||
|
|
||||||
<script
|
<script
|
||||||
src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
|
src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
|
||||||
<script
|
<script
|
||||||
@ -59,6 +64,7 @@
|
|||||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>"
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>"
|
||||||
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
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/pdfmake/vfs_fonts.js") ?>"></script>
|
||||||
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.colVis.min.js") ?>"></script>
|
||||||
|
|
||||||
<script type="module" src="<?= site_url('assets/js/safekat/pages/soporte/tickets.js') ?>"></script>
|
<script type="module" src="<?= site_url('assets/js/safekat/pages/soporte/tickets.js') ?>"></script>
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|||||||
@ -1,20 +1,6 @@
|
|||||||
import Table from '../../components/table.js';
|
import Table from '../../components/table.js';
|
||||||
import Ajax from '../../components/ajax.js';
|
import Ajax from '../../components/ajax.js';
|
||||||
|
|
||||||
/*$(function () {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
document.querySelectorAll('[data-bs-toggle="lightbox"]').forEach(anchor => {
|
|
||||||
anchor.addEventListener('click', function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
const imgSrc = this.getAttribute('href');
|
|
||||||
document.getElementById('lightboxImage').src = imgSrc;
|
|
||||||
new bootstrap.Modal(document.getElementById('lightboxModal')).show();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});*/
|
|
||||||
|
|
||||||
|
|
||||||
class Ticket {
|
class Ticket {
|
||||||
@ -38,6 +24,12 @@ class Ticket {
|
|||||||
|
|
||||||
if(this.action == "edit") {
|
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") {
|
else if (this.action == "list") {
|
||||||
this.#initDatatable();
|
this.#initDatatable();
|
||||||
@ -51,16 +43,44 @@ class Ticket {
|
|||||||
const actions = ['view'];
|
const actions = ['view'];
|
||||||
const columns = [
|
const columns = [
|
||||||
{ 'data': 'id' },
|
{ 'data': 'id' },
|
||||||
{ 'data': 'categoria_id' },
|
{ 'data': 'categoria_id',
|
||||||
{ 'data': 'seccion_id' },
|
render: function (data, type, row) {
|
||||||
{ 'data': 'estado_id' },
|
return window.language.Tickets[row.categoria];
|
||||||
{ 'data': 'prioridad' },
|
}
|
||||||
|
},
|
||||||
|
{ '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];
|
||||||
|
},
|
||||||
|
visible: false,
|
||||||
|
},
|
||||||
{ 'data': 'titulo' },
|
{ 'data': 'titulo' },
|
||||||
{ 'data': 'usuario_id' },
|
{ 'data': 'usuario_id' ,
|
||||||
{ 'data': 'user_soporte_id' },
|
render: function (data, type, row) {
|
||||||
|
return row.usuario;
|
||||||
|
},
|
||||||
|
visible: false,
|
||||||
|
},
|
||||||
|
{ 'data': 'user_soporte_id',
|
||||||
|
render: function (data, type, row) {
|
||||||
|
return row.user_soporte;
|
||||||
|
},
|
||||||
|
visible: false,
|
||||||
|
},
|
||||||
{ 'data': 'created_at' },
|
{ 'data': 'created_at' },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
this.table = new Table(
|
this.table = new Table(
|
||||||
$('#tableOfTickets'),
|
$('#tableOfTickets'),
|
||||||
'tickets',
|
'tickets',
|
||||||
@ -68,15 +88,29 @@ class Ticket {
|
|||||||
columns,
|
columns,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
this.table.init({
|
this.table.init({
|
||||||
actions: actions,
|
actions: actions,
|
||||||
buttonsExport: true,
|
buttonsExport: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.table.table.on('init.dt', function () {
|
||||||
|
self.table.table.page.len(50).draw();
|
||||||
|
if(window.userType==1){
|
||||||
|
|
||||||
this.tableTarifas.table.on('init.dt', function () {
|
self.table.table.column(4).visible(true);
|
||||||
self.tableTarifas.table.page.len(50).draw();
|
self.table.table.column(6).visible(true);
|
||||||
|
self.table.table.column(7).visible(true);
|
||||||
|
|
||||||
|
self.table.table.column(4).header().style.display = 'table-cell';
|
||||||
|
self.table.table.column(6).header().style.display = 'table-cell';
|
||||||
|
self.table.table.column(7).header().style.display = 'table-cell';
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.table.setEditCallback(function(id){
|
||||||
|
window.location.href = '/soporte/edit/' + id;
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user