Actualizar usuarios.html

This commit is contained in:
2026-02-23 08:06:57 +00:00
parent bce96ed805
commit 688ab929aa

View File

@@ -10,7 +10,7 @@
/* VARIABLES CORPORATIVAS DINÁMICAS */
:root {
--primary: #2563eb;
--secondary: #10b981; /* Verde base para algunas acciones */
--secondary: #10b981;
--app-bg: #f8fafc;
}
@@ -23,8 +23,6 @@
.text-primary-dynamic { color: var(--primary) !important; }
.bg-primary-dynamic { background-color: var(--primary) !important; }
.border-primary-dynamic { border-color: var(--primary) !important; }
.ring-primary-dynamic { --tw-ring-color: var(--primary) !important; }
.focus\:ring-primary-dynamic:focus { --tw-ring-color: var(--primary) !important; }
</style>
</head>
<body class="text-slate-800 font-sans antialiased text-left">
@@ -46,7 +44,7 @@
</div>
<div class="flex flex-col md:flex-row gap-6 text-left">
<form onsubmit="addGuild(event)" class="flex gap-3 h-12 w-full md:w-1/2 text-left">
<input type="text" id="newGuildName" placeholder="NUEVO GREMIO (EJ. LIMPIEZA)" required class="flex-1 px-4 py-3 border border-slate-200 rounded-xl focus:ring-2 focus:ring-primary-dynamic focus:border-primary-dynamic outline-none text-sm font-bold uppercase transition-all bg-slate-50">
<input type="text" id="newGuildName" placeholder="NUEVO GREMIO (EJ. LIMPIEZA)" required class="flex-1 px-4 py-3 border border-slate-200 rounded-xl outline-none text-sm font-bold uppercase transition-all bg-slate-50 focus:border-blue-500 focus:ring-2 focus:ring-blue-200">
<button type="submit" class="bg-primary-dynamic text-white px-5 rounded-xl hover:opacity-90 font-black shadow-md transition-all active:scale-95 flex items-center justify-center"><i data-lucide="plus" class="w-5 h-5"></i></button>
</form>
<div class="w-full md:w-1/2 border border-slate-200 rounded-xl bg-slate-50 p-3 max-h-40 overflow-y-auto space-y-2 no-scrollbar" id="guildsList"></div>
@@ -81,10 +79,11 @@
</div>
<div class="flex gap-4 text-left">
<div class="w-1/2">
<label class="block text-[10px] font-black text-slate-400 uppercase tracking-widest mb-1.5 ml-1">Rol</label>
<select id="uRole" class="w-full px-4 py-3 bg-slate-50 border border-slate-200 rounded-xl focus:ring-2 focus:ring-emerald-500/30 focus:border-emerald-500 outline-none font-bold text-sm transition-all shadow-inner uppercase tracking-wider text-slate-600 appearance-none cursor-pointer">
<option value="operario">Operario</option>
<option value="facturacion">Facturación</option>
<label class="block text-[10px] font-black text-slate-400 uppercase tracking-widest mb-1.5 ml-1">Rol / Permisos</label>
<select id="uRole" class="w-full px-4 py-3 bg-slate-50 border border-slate-200 rounded-xl focus:ring-2 focus:ring-emerald-500/30 focus:border-emerald-500 outline-none font-bold text-xs transition-all shadow-inner uppercase tracking-wider text-slate-600 appearance-none cursor-pointer">
<option value="operario">Op. Normal (Puede coger de la bolsa)</option>
<option value="operario_cerrado">Op. Cerrado (Solo asignados por oficina)</option>
<option value="facturacion">Facturación / Oficina</option>
<option value="admin">Administrador</option>
</select>
</div>
@@ -425,6 +424,7 @@
document.getElementById('uEmail').value = "";
document.getElementById('uPhone').value = "";
document.getElementById('uPass').value = "";
document.getElementById('uRole').value = "operario"; // Reset al valor por defecto
tempUserZones = [];
renderTempZones();
document.getElementById('formTitle').innerText = "2. Nueva Ficha de Usuario";
@@ -468,6 +468,20 @@
return `<div class="mb-1.5 last:mb-0"><span class="font-black ${isActive ? 'text-primary-dynamic' : 'text-slate-400'} text-[10px] uppercase tracking-wider"><i data-lucide="map-pin" class="w-3 h-3 inline"></i> ${city}</span> <span class="text-slate-500 text-[9px] font-bold">(${groupedZones[city].join(", ")})</span></div>`;
}).join("") || '<span class="text-[9px] text-slate-400 font-bold italic">Sin zona</span>';
let roleBadge = "OP. NORMAL";
let roleColor = "bg-blue-50 text-blue-600 border-blue-100";
if (u.role === 'operario_cerrado') {
roleBadge = "OP. CERRADO (SIN BOLSA)";
roleColor = "bg-amber-50 text-amber-600 border-amber-200";
} else if (u.role === 'admin') {
roleBadge = "ADMINISTRADOR";
roleColor = "bg-purple-50 text-purple-600 border-purple-200";
} else if (u.role === 'facturacion') {
roleBadge = "FACTURACIÓN";
roleColor = "bg-emerald-50 text-emerald-600 border-emerald-200";
}
tbody.innerHTML += `
<tr class="${isActive ? 'bg-white' : 'bg-slate-50 opacity-70'} hover:bg-slate-50/80 transition-colors border-b border-slate-100">
<td class="p-4">
@@ -482,7 +496,7 @@
</td>
<td class="p-4 font-black ${isActive ? 'text-emerald-600' : 'text-slate-400'} text-xs">${u.phone}</td>
<td class="p-4">
<span class="${isActive ? 'bg-blue-50 text-blue-600 border border-blue-100' : 'bg-slate-200 text-slate-500 border border-slate-300'} px-2.5 py-1 rounded-lg text-[9px] font-black uppercase tracking-widest">${u.role}</span>
<span class="${!isActive ? 'bg-slate-200 text-slate-500 border-slate-300' : roleColor} px-2.5 py-1 rounded-lg text-[9px] font-black uppercase tracking-widest border">${roleBadge}</span>
<p class="text-[9px] text-slate-500 mt-2 uppercase font-bold tracking-wider leading-tight">${uGuildNames || '-'}</p>
</td>
<td class="p-4 text-left"><div class="max-h-24 overflow-y-auto no-scrollbar">${uZonesHtml}</div></td>