This commit is contained in:
Lizandro Guarnizo
2026-05-18 23:45:11 -05:00
parent 25f21be966
commit bbe83c79ba
8 changed files with 188 additions and 47 deletions
+19 -2
View File
@@ -29,7 +29,7 @@
<!-- Lista -->
<div x-show="!loading" class="space-y-3">
<template x-for="t in tickets" :key="t.ID">
<div class="bg-white border border-slate-200 rounded-xl overflow-hidden shadow-sm">
<div :id="'ticket-' + t.ID" class="bg-white border border-slate-200 rounded-xl overflow-hidden shadow-sm">
<!-- Cabecera del ticket -->
<div class="p-4 flex items-start gap-4 cursor-pointer" @click="t._open = !t._open">
<!-- Indicador de estado -->
@@ -124,7 +124,12 @@ function ticketsAdmin() {
{ val: 'cerrado', label: 'Cerrados' },
],
async init() { await this.load(); },
async init() {
const params = new URLSearchParams(window.location.search);
if (params.get('ticket')) this.filtro = 'todos';
await this.load();
this.openTicketFromQuery();
},
async load() {
this.loading = true;
@@ -136,6 +141,18 @@ function ticketsAdmin() {
}
},
openTicketFromQuery() {
const ticketId = new URLSearchParams(window.location.search).get('ticket');
if (!ticketId) return;
const t = this.tickets.find(x => String(x.ID) === String(ticketId));
if (!t) return;
t._open = true;
this.$nextTick(() => {
const el = document.getElementById('ticket-' + t.ID);
if (el) el.scrollIntoView({ behavior: 'smooth', block: 'start' });
});
},
async cambiarEstado(t, estado) {
await axios.put(`/app/tickets/${t.ID}/estado`, { estado });
t.estado = estado;