terminado tickets. faltan respuestas

This commit is contained in:
2025-02-16 18:52:56 +01:00
parent 4a8aaf906c
commit aff79ec3d6
8 changed files with 273 additions and 119 deletions

View File

@ -924,7 +924,10 @@ $routes->group('soporte', ['namespace' => 'App\Controllers\Soporte'], function (
$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');
});

View File

@ -2,16 +2,21 @@
namespace App\Controllers\Soporte;
use App\Models\TicketModel;
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;
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 $singularObjectName = 'Ticket';
@ -34,17 +39,22 @@ class Ticketcontroller extends \App\Controllers\GoBaseController
];
parent::initController($request, $response, $logger);
}
public function index()
{
//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')]);
parent::index();
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
return view(static::$viewPath . 'viewTicketList', $viewData);
}
@ -109,7 +119,7 @@ class Ticketcontroller extends \App\Controllers\GoBaseController
'nombre' => $originalName,
'ticket_id' => $id,
'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['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__);
@ -147,32 +157,22 @@ class Ticketcontroller extends \App\Controllers\GoBaseController
public function edit($requestedId = null)
{
/*
checkPermission('tarifa-extra.edit', $this->indexRoute);
if ($requestedId == null) :
return $this->redirect2listView();
endif;
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
$tarifaextraEntity = $this->model->find($id);
$ticket = $this->model->find($id);
if ($tarifaextraEntity == false) :
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Tarifaextra.tarifaextra')), $id]);
if ($ticket == false) :
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Tickets.ticket')), $id]);
return $this->redirect2listView('errorMessage', $message);
endif;
if ($this->request->getPost()) :
$postData = $this->request->getPost();
$sanitizedData = $this->sanitized($postData, true);
// 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;
}
$sanitizedData = $this->sanitized($postData, false);
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
@ -184,17 +184,17 @@ class Ticketcontroller extends \App\Controllers\GoBaseController
$this->dealWithException($e);
}
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());
endif;
$tarifaextraEntity->fill($sanitizedData);
$ticket->fill($sanitizedData);
$thenRedirect = false;
endif;
if ($noException && $successfulResult) :
$id = $tarifaextraEntity->id ?? $id;
$id = $ticket->id ?? $id;
$message = lang('Basic.global.updateSuccess', [lang('Basic.global.record')]) . '.';
if ($thenRedirect) :
@ -210,15 +210,37 @@ class Ticketcontroller extends \App\Controllers\GoBaseController
endif; // $noException && $successfulResult
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);
*/
} // end function edit(...)
public function datatable()
@ -237,7 +259,7 @@ class Ticketcontroller extends \App\Controllers\GoBaseController
$searchValues = get_filter_datatables_columns($reqData);
$resourceData = $this->model->getResource($searchValues, $cliente_id);
$resourceData = $this->model->getResource($searchValues);
foreach ($requestedOrder as $order) {
$column = $order['column'] ?? 0;
$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;
}
}

View File

@ -28,6 +28,8 @@ return [
'pedidos' => 'Pedidos',
'facturacion' => 'Facturación',
'logistica' => 'Logística',
'configuracion' => 'Configuración',
'general' => 'General',
// estados
'abierto' => 'Abierto',
@ -42,6 +44,7 @@ return [
// FIcheros
'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',
];

View File

@ -12,6 +12,8 @@ class TicketModel extends \App\Models\BaseModel
protected $useTimestamps = true;
protected $returnType = "App\Entities\Soporte\TicketEntity";
const SORTABLE = [
0 => "t1.categoria_id",
1 => "t1.seccion_id",
@ -75,14 +77,16 @@ class TicketModel extends \App\Models\BaseModel
->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(t2.first_name, ' ', t2.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.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 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_estados t4", "t1.estado_id = t4.id", "left");
$builder->join("tickets_secciones t5", "t1.seccion_id = t5.id", "left");

View File

@ -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)
{

View File

@ -1,21 +1,40 @@
<?= $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><?= lang("Tickets.createTicket") ?></h4>
<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" required>
<input type="text" name="titulo" class="form-control"
<?= ($formAction === route_to('updateTicket', $ticket->id))?"readonly":"" ?>
value="<?= old('titulo', $ticket->titulo) ?>">
</div>
</div>
@ -23,9 +42,11 @@
<div class="col-3 mb-3">
<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): ?>
<option value="<?= $categoria['id']; ?>"><?= $categoria['text']; ?></option>
<option value="<?= $categoria['id']; ?>" <?= $categoria['id'] == $ticket->categoria_id ? ' selected' : '' ?>> <?= $categoria['text']; ?>
</option>
<?php endforeach; ?>
</select>
</div>
@ -33,18 +54,25 @@
<div class="col-3 mb-3">
<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): ?>
<option value="<?= $seccion['id']; ?>"><?= $seccion['text']; ?></option>
<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>
<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): ?>
<option value="<?= $estado['id']; ?>"><?= $estado['text']; ?></option>
<option value="<?= $estado['id']; ?>" <?= $estado['id'] == $ticket->estado_id ? ' selected' : '' ?>><?= $estado['text']; ?>
</option>
<?php endforeach; ?>
</select>
</div>
@ -57,15 +85,25 @@
<div class="mb-3 col-3">
<label class="form-label"><?= lang('Tickets.prioridad') ?></label>
<select id="prioridad" name="prioridad" class="form-control">
<option value="alta"><?= lang('Tickets.alta') ?></option>
<option value="media" selected><?= lang('Tickets.media') ?></option>
<option value="baja"><?= lang('Tickets.baja') ?></option>
<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="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>
</div>
@ -75,63 +113,51 @@
<div class="mb-3">
<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>
<?php if ($formAction === route_to('NewTicket')): ?>
<h4><?= lang("Tickets.adjuntos") ?></h4>
<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/*">
<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 else: /*?>
<div id="carouselInput" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<a href="ruta-imagen-1.jpg" data-bs-toggle="lightbox">
<img src="ruta-imagen-1.jpg" class="d-block w-100" alt="Imagen 1">
</a>
</div>
<div class="carousel-item">
<a href="ruta-imagen-2.jpg" data-bs-toggle="lightbox">
<img src="ruta-imagen-2.jpg" class="d-block w-100" alt="Imagen 2">
</a>
</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>
<?php else: ?>
<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>
<!-- Controles del carrusel -->
<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>
<?php endif; ?>
<!-- Lightbox (usando Bootstrap Modal) -->
<div id="lightboxModal" class="modal fade" tabindex="-1">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-body">
<img id="lightboxImage" src="" class="img-fluid">
</div>
</div>
</div>
</div>
<div class="pt-4">
<?php if ($formAction === route_to('NewTicket') ||
($formAction === route_to('updateTicket', $ticket->id) && 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"]) ?>
<?php */ endif; ?>
<button type="submit" class="btn btn-primary"><?= lang("Tickets.createTicket") ?></button>
</div>
</form>
</div>
</div>

View File

@ -13,7 +13,7 @@
<div class="card-body">
<?= 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%;">
<thead>
<tr>
@ -21,10 +21,10 @@
<th><?= lang('Tickets.tipo') ?></th>
<th><?= lang('Tickets.seccion') ?></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.usuario') ?></th>
<th><?= lang('Tickets.asignarTo') ?></th>
<th style="display: none;"><?= lang('Tickets.usuario') ?></th>
<th style="display: none;"><?= lang('Tickets.asignarTo') ?></th>
<th><?= lang('Tickets.fechaCreacion') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
@ -49,6 +49,11 @@
<?= $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
@ -59,6 +64,7 @@
<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 type="module" src="<?= site_url('assets/js/safekat/pages/soporte/tickets.js') ?>"></script>
<?= $this->endSection() ?>

View File

@ -1,20 +1,6 @@
import Table from '../../components/table.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 {
@ -37,6 +23,12 @@ class Ticket {
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") {
@ -51,16 +43,44 @@ class Ticket {
const actions = ['view'];
const columns = [
{ 'data': 'id' },
{ 'data': 'categoria_id' },
{ 'data': 'seccion_id' },
{ 'data': 'estado_id' },
{ 'data': 'prioridad' },
{ '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];
},
visible: false,
},
{ 'data': 'titulo' },
{ 'data': 'usuario_id' },
{ 'data': 'user_soporte_id' },
{ 'data': 'usuario_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' },
];
this.table = new Table(
$('#tableOfTickets'),
'tickets',
@ -68,15 +88,29 @@ class Ticket {
columns,
);
this.table.init({
actions: actions,
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.tableTarifas.table.page.len(50).draw();
self.table.table.column(4).visible(true);
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;
})
}
}