up
This commit is contained in:
@@ -166,7 +166,7 @@
|
||||
<!-- Lista de tickets -->
|
||||
<div class="space-y-3">
|
||||
<template x-for="t in tickets" :key="t.ID">
|
||||
<div class="bg-white rounded-xl border overflow-hidden" :class="t._noLeidos > 0 ? 'border-[#8eb02f]' : 'border-slate-200'">
|
||||
<div :id="'portal-ticket-' + t.ID" class="bg-white rounded-xl border overflow-hidden" :class="t._noLeidos > 0 ? 'border-[#8eb02f]' : 'border-slate-200'">
|
||||
<div class="p-4 flex items-start justify-between cursor-pointer" @click="abrirTicket(t)">
|
||||
<div>
|
||||
<div class="flex items-center gap-2 mb-1">
|
||||
@@ -261,12 +261,22 @@ function portalProyecto() {
|
||||
facturasNoLeidas: 0,
|
||||
|
||||
async init() {
|
||||
// Soporte de URL param ?tab=Facturas
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const tabParam = params.get('tab');
|
||||
if (tabParam) this.activeTab = tabParam;
|
||||
await this.loadTickets();
|
||||
// Si la tab activa es Facturas, marcar como leídas automáticamente
|
||||
const ticketId = params.get('ticket');
|
||||
if (ticketId) {
|
||||
this.activeTab = 'Tickets';
|
||||
const t = this.tickets.find(x => String(x.ID) === String(ticketId));
|
||||
if (t) {
|
||||
t._open = true;
|
||||
this.$nextTick(() => {
|
||||
const el = document.getElementById('portal-ticket-' + t.ID);
|
||||
if (el) el.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
});
|
||||
}
|
||||
}
|
||||
if (this.activeTab === 'Facturas') {
|
||||
this.marcarFacturasLeidas();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user