Actualizar automatizaciones.html
This commit is contained in:
@@ -87,10 +87,9 @@
|
||||
function renderCards(activeServices) {
|
||||
const container = document.getElementById('automation-list');
|
||||
if (activeServices.length === 0) {
|
||||
container.innerHTML = `
|
||||
<div class="col-span-full py-12 text-center border-2 border-dashed border-gray-200 rounded-2xl">
|
||||
container.innerHTML = `<div class="col-span-full py-12 text-center border-2 border-dashed border-gray-200 rounded-2xl">
|
||||
<i data-lucide="ghost" class="w-12 h-12 text-gray-300 mx-auto mb-3"></i>
|
||||
<p class="text-gray-400 font-bold uppercase text-xs">No hay automatismos en curso ahora</p>
|
||||
<p class="text-gray-400 font-bold uppercase text-xs">No hay automatismos en curso</p>
|
||||
</div>`;
|
||||
lucide.createIcons();
|
||||
return;
|
||||
@@ -98,15 +97,21 @@
|
||||
|
||||
container.innerHTML = activeServices.map(s => {
|
||||
const raw = s.raw_data;
|
||||
// Calculamos el tiempo restante para la barra de progreso
|
||||
const now = new Date();
|
||||
const expires = new Date(s.token_expires_at);
|
||||
const diff = Math.max(0, Math.floor((expires - now) / 1000));
|
||||
const percent = Math.min(100, (diff / 300) * 100); // 300 seg = 5 min
|
||||
|
||||
return `
|
||||
<div class="bg-white rounded-2xl border-2 border-blue-50 shadow-sm overflow-hidden flex flex-col">
|
||||
<div class="bg-white rounded-2xl border-2 border-blue-50 shadow-sm overflow-hidden flex flex-col fade-in">
|
||||
<div class="p-5 border-b border-gray-50 bg-blue-50/30">
|
||||
<div class="flex justify-between items-start mb-2">
|
||||
<span class="text-[10px] font-black bg-blue-600 text-white px-2 py-0.5 rounded uppercase">${s.provider}</span>
|
||||
<span class="text-xs font-black text-blue-600">Ref: ${s.service_ref}</span>
|
||||
</div>
|
||||
<h4 class="font-black text-slate-800 uppercase truncate">${raw["Nombre Cliente"] || 'Sin nombre'}</h4>
|
||||
<p class="text-[10px] text-gray-500 font-bold uppercase tracking-tighter">📍 CP: ${raw["Código Postal"]} | ${raw["Gremio"] || 'Gremio'}</p>
|
||||
<h4 class="font-black text-slate-800 uppercase truncate">${raw["Nombre Cliente"] || raw["CLIENTE"] || 'Sin nombre'}</h4>
|
||||
<p class="text-[10px] text-gray-500 font-bold uppercase tracking-tighter">📍 CP: ${raw["Código Postal"] || raw["C.P."] || '---'}</p>
|
||||
</div>
|
||||
|
||||
<div class="p-5 flex-1 space-y-4">
|
||||
@@ -116,23 +121,24 @@
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-[10px] text-gray-400 font-bold uppercase leading-none">Turno actual:</p>
|
||||
<p class="font-black text-slate-700 uppercase">Marco Rincón</p> </div>
|
||||
<p class="font-black text-slate-700 uppercase">${s.current_worker_name || 'Buscando...'}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="space-y-1">
|
||||
<div class="flex justify-between text-[10px] font-bold uppercase tracking-widest text-blue-500">
|
||||
<span>Tiempo de espera</span>
|
||||
<span>5m</span>
|
||||
<span>Respuesta en</span>
|
||||
<span>${Math.floor(diff / 60)}m ${diff % 60}s</span>
|
||||
</div>
|
||||
<div class="w-full bg-gray-100 h-1.5 rounded-full overflow-hidden">
|
||||
<div class="bg-blue-500 h-full progress-bar" style="width: 45%"></div>
|
||||
<div class="bg-blue-500 h-full progress-bar" style="width: ${percent}%"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="p-3 bg-gray-50 flex gap-2">
|
||||
<button onclick="stopAutomation(${s.id})" class="flex-1 bg-white border border-red-200 text-red-500 py-2 rounded-lg text-[10px] font-black uppercase hover:bg-red-50 transition-colors">
|
||||
Detener rueda
|
||||
Abortar Rueda
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user