trabajando en la lista de tickets

This commit is contained in:
2025-02-15 17:54:49 +01:00
parent a616ec7ba7
commit 4a8aaf906c
15 changed files with 473 additions and 64 deletions

View 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;