Release v1.7.1 - Mejoras en SLA, Auditoria y Multi-tenant
✨ Características Nuevas: - Cálculo automático de SLA en tickets basado en categoría - Auto-asignación de tickets según configuración de categoría - Auditoría completa en operaciones de categorías (create/update/delete) - Visualización de estado SLA en listado y detalle de tickets 🐛 Correcciones: - Fix actualización de status en tenants (manejo correcto de enum TenantStatus) - Corrección de campos contact_phone y contact_email en tenants - Corrección de modelo TicketResponse (agregar campos SLA y usar ConfigDict) - Eliminación de archivo changelog duplicado 🔧 Mejoras de Infraestructura: - Agregar montaje de backend en workers y beat para imports correctos - Mejorar path handling en sla_tasks.py para Docker - Scripts de testing integrados (test_frontend_integration, test_manual, test_tenant_update) - Agregar database.py en workers/app/core para sesiones async 📝 Frontend: - Actualizar UI de tenants con nuevos campos (email, teléfono, status enum) - Agregar columna de SLA en listado de tickets - Mostrar información detallada de SLA en vista de ticket individual - Indicadores visuales de estado de SLA (vencido, cumplido, en plazo)
This commit is contained in:
@@ -14,7 +14,9 @@
|
||||
name: '',
|
||||
slug: '',
|
||||
domain: '',
|
||||
is_active: true
|
||||
contact_phone: '',
|
||||
contact_email: '',
|
||||
status: 'active'
|
||||
};
|
||||
|
||||
async function loadTenants() {
|
||||
@@ -30,27 +32,30 @@
|
||||
|
||||
function openCreateModal() {
|
||||
editingTenant = null;
|
||||
formData = { name: '', slug: '', domain: '', is_active: true };
|
||||
formData = { name: '', slug: '', domain: '', contact_phone: '', contact_email: '', status: 'active' };
|
||||
showModal = true;
|
||||
}
|
||||
|
||||
function openEditModal(tenant) {
|
||||
editingTenant = tenant;
|
||||
formData = { ...tenant };
|
||||
formData = {
|
||||
name: tenant.name,
|
||||
slug: tenant.slug,
|
||||
domain: tenant.domain || '',
|
||||
contact_phone: tenant.contact_phone || '',
|
||||
contact_email: tenant.contact_email || '',
|
||||
status: tenant.status || 'active'
|
||||
};
|
||||
showModal = true;
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
if (editingTenant) {
|
||||
// Asegurarse de enviar el campo "status" correctamente
|
||||
const updatedData = { ...formData, status: formData.is_active ? 'active' : 'inactive' };
|
||||
await api.put(`/tenants/${editingTenant.id}`, updatedData);
|
||||
toast.success(`Cliente ${formData.is_active ? 'activado' : 'desactivado'} correctamente`);
|
||||
await api.put(`/tenants/${editingTenant.id}`, formData);
|
||||
toast.success('Cliente actualizado correctamente');
|
||||
} else {
|
||||
// Asegurarse de enviar el campo "status" al crear un cliente
|
||||
const newData = { ...formData, status: formData.is_active ? 'active' : 'inactive' };
|
||||
await api.post('/tenants/', newData);
|
||||
await api.post('/tenants/', formData);
|
||||
toast.success('Cliente creado correctamente');
|
||||
}
|
||||
showModal = false;
|
||||
@@ -89,7 +94,8 @@
|
||||
<tr>
|
||||
<th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">Nombre</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Slug</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Dominio</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Email Contacto</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Teléfono</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Estado</th>
|
||||
<th scope="col" class="relative py-3.5 pl-3 pr-4 sm:pr-6">
|
||||
<span class="sr-only">Acciones</span>
|
||||
@@ -98,18 +104,19 @@
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200 bg-white">
|
||||
{#if isLoading}
|
||||
<tr><td colspan="5" class="text-center py-4">Cargando...</td></tr>
|
||||
<tr><td colspan="6" class="text-center py-4">Cargando...</td></tr>
|
||||
{:else if tenants.length === 0}
|
||||
<tr><td colspan="5" class="text-center py-4">No hay clientes registrados</td></tr>
|
||||
<tr><td colspan="6" class="text-center py-4">No hay clientes registrados</td></tr>
|
||||
{:else}
|
||||
{#each tenants as tenant}
|
||||
<tr>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6">{tenant.name}</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{tenant.slug}</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{tenant.domain || '-'}</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{tenant.contact_email || '-'}</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{tenant.contact_phone || '-'}</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
|
||||
<span class:bg-green-100={tenant.is_active} class:text-green-800={tenant.is_active} class:bg-red-100={!tenant.is_active} class:text-red-800={!tenant.is_active} class="inline-flex rounded-full px-2 text-xs font-semibold leading-5">
|
||||
{tenant.is_active ? 'Activo' : 'Inactivo'}
|
||||
<span class:bg-green-100={tenant.status === 'active'} class:text-green-800={tenant.status === 'active'} class:bg-yellow-100={tenant.status === 'suspended'} class:text-yellow-800={tenant.status === 'suspended'} class:bg-red-100={tenant.status === 'inactive'} class:text-red-800={tenant.status === 'inactive'} class="inline-flex rounded-full px-2 text-xs font-semibold leading-5">
|
||||
{tenant.status === 'active' ? 'Activo' : tenant.status === 'suspended' ? 'Suspendido' : 'Inactivo'}
|
||||
</span>
|
||||
</td>
|
||||
<td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
|
||||
@@ -144,9 +151,23 @@
|
||||
<input type="text" id="domain" bind:value={formData.domain} class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm border p-2">
|
||||
</div>
|
||||
|
||||
<div class="flex items-center">
|
||||
<input type="checkbox" id="is_active" bind:checked={formData.is_active} class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500">
|
||||
<label for="is_active" class="ml-2 block text-sm text-gray-900">Activo</label>
|
||||
<div>
|
||||
<label for="contact_email" class="block text-sm font-medium text-gray-700">Email de Contacto</label>
|
||||
<input type="email" id="contact_email" bind:value={formData.contact_email} class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm border p-2">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="contact_phone" class="block text-sm font-medium text-gray-700">Teléfono de Contacto</label>
|
||||
<input type="text" id="contact_phone" bind:value={formData.contact_phone} class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm border p-2">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="status" class="block text-sm font-medium text-gray-700">Estado</label>
|
||||
<select id="status" bind:value={formData.status} class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm border p-2">
|
||||
<option value="active">Activo</option>
|
||||
<option value="suspended">Suspendido</option>
|
||||
<option value="inactive">Inactivo</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mt-5 sm:mt-6 sm:grid sm:grid-cols-2 sm:gap-3 sm:grid-flow-row-dense">
|
||||
|
||||
@@ -291,6 +291,7 @@
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Asunto</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Estado</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Prioridad</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">SLA</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Categoría</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Asignado a</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Creado</th>
|
||||
@@ -301,9 +302,9 @@
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200 bg-white">
|
||||
{#if isLoading}
|
||||
<tr><td colspan="8" class="text-center py-4">Cargando...</td></tr>
|
||||
<tr><td colspan="9" class="text-center py-4">Cargando...</td></tr>
|
||||
{:else if tickets.length === 0}
|
||||
<tr><td colspan="8" class="text-center py-4">No hay tickets registrados</td></tr>
|
||||
<tr><td colspan="9" class="text-center py-4">No hay tickets registrados</td></tr>
|
||||
{:else}
|
||||
{#each tickets as ticket}
|
||||
<tr
|
||||
@@ -327,6 +328,25 @@
|
||||
{getPriorityBadge(ticket.priority).label}
|
||||
</span>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
|
||||
{#if ticket.sla_resolution_due}
|
||||
{#if new Date(ticket.sla_resolution_due) < new Date() && !ticket.sla_resolution_met}
|
||||
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-red-100 text-red-800">
|
||||
⚠️ Vencido
|
||||
</span>
|
||||
{:else if ticket.sla_resolution_met}
|
||||
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-800">
|
||||
✓ OK
|
||||
</span>
|
||||
{:else}
|
||||
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-blue-100 text-blue-800">
|
||||
⏳ En plazo
|
||||
</span>
|
||||
{/if}
|
||||
{:else}
|
||||
<span class="text-gray-400">-</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
|
||||
{getCategoryName(ticket.category_id)}
|
||||
</td>
|
||||
|
||||
@@ -394,6 +394,57 @@
|
||||
<dt class="text-sm font-medium text-gray-500">Última actualización</dt>
|
||||
<dd class="text-sm text-gray-900">{formatDate(ticket.updated_at)}</dd>
|
||||
</div>
|
||||
|
||||
<!-- SLA Information -->
|
||||
{#if ticket.sla_response_due || ticket.sla_resolution_due}
|
||||
<div class="pt-4 border-t border-gray-200">
|
||||
<h4 class="text-sm font-semibold text-gray-900 mb-3">⏱️ SLA (Acuerdos de Nivel de Servicio)</h4>
|
||||
|
||||
{#if ticket.sla_response_due}
|
||||
<div class="mb-3">
|
||||
<dt class="text-xs font-medium text-gray-500">Tiempo de Respuesta</dt>
|
||||
<dd class="text-sm text-gray-900 mt-1">
|
||||
{formatDate(ticket.sla_response_due)}
|
||||
{#if new Date(ticket.sla_response_due) < new Date() && !ticket.sla_response_met}
|
||||
<span class="ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-red-100 text-red-800">
|
||||
⚠️ Vencido
|
||||
</span>
|
||||
{:else if ticket.sla_response_met}
|
||||
<span class="ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-800">
|
||||
✓ Cumplido
|
||||
</span>
|
||||
{:else}
|
||||
<span class="ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-blue-100 text-blue-800">
|
||||
⏳ En plazo
|
||||
</span>
|
||||
{/if}
|
||||
</dd>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if ticket.sla_resolution_due}
|
||||
<div>
|
||||
<dt class="text-xs font-medium text-gray-500">Tiempo de Resolución</dt>
|
||||
<dd class="text-sm text-gray-900 mt-1">
|
||||
{formatDate(ticket.sla_resolution_due)}
|
||||
{#if new Date(ticket.sla_resolution_due) < new Date() && !ticket.sla_resolution_met}
|
||||
<span class="ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-red-100 text-red-800">
|
||||
⚠️ Vencido
|
||||
</span>
|
||||
{:else if ticket.sla_resolution_met}
|
||||
<span class="ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-800">
|
||||
✓ Cumplido
|
||||
</span>
|
||||
{:else}
|
||||
<span class="ml-2 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-blue-100 text-blue-800">
|
||||
⏳ En plazo
|
||||
</span>
|
||||
{/if}
|
||||
</dd>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user