mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en la lista de tickets
This commit is contained in:
98
httpdocs/assets/js/safekat/pages/soporte/tickets.js
Normal file
98
httpdocs/assets/js/safekat/pages/soporte/tickets.js
Normal file
@ -0,0 +1,98 @@
|
||||
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 {
|
||||
|
||||
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") {
|
||||
|
||||
}
|
||||
else if (this.action == "list") {
|
||||
this.#initDatatable();
|
||||
}
|
||||
}
|
||||
|
||||
#initDatatable() {
|
||||
|
||||
const self = this;
|
||||
|
||||
const actions = ['view'];
|
||||
const columns = [
|
||||
{ 'data': 'id' },
|
||||
{ 'data': 'categoria_id' },
|
||||
{ 'data': 'seccion_id' },
|
||||
{ 'data': 'estado_id' },
|
||||
{ 'data': 'prioridad' },
|
||||
{ 'data': 'titulo' },
|
||||
{ 'data': 'usuario_id' },
|
||||
{ 'data': 'user_soporte_id' },
|
||||
{ 'data': 'created_at' },
|
||||
];
|
||||
|
||||
this.table = new Table(
|
||||
$('#tableOfTickets'),
|
||||
'tickets',
|
||||
'/soporte/ticketlist',
|
||||
columns,
|
||||
);
|
||||
|
||||
this.table.init({
|
||||
actions: actions,
|
||||
buttonsExport: true,
|
||||
});
|
||||
|
||||
|
||||
this.tableTarifas.table.on('init.dt', function () {
|
||||
self.tableTarifas.table.page.len(50).draw();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
const locale = document.querySelector('meta[name="locale"]').getAttribute('content');
|
||||
|
||||
new Ajax('/translate/getTranslation', { locale: locale, translationFile: ['Tickets'] }, {},
|
||||
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