fmatituy/selectospromanager
0
1from nicegui import ui2from services.auth import require_auth, get_current_user3from modules.layout import SelectosLayout4from modules.sst_industrial import sst_top_navigation, CORP_BLUE, CORP_GREEN, CORP_RED, CORP_ORANGE, CORP_GRAY, CORP_BG5 6@ui.page('/sst/operacion/loto')7@require_auth8def sst_loto_page():9 user = get_current_user()10 with SelectosLayout('Bloqueo y Etiquetado (LOTO)'):11 ui.query('body').style(f'background-color: {CORP_BG}')12 sst_top_navigation('/sst/operacion')13 14 with ui.column().classes('w-full max-w-7xl mx-auto p-4 md:p-8 gap-8'):15 16 # --- HEADER ---17 with ui.row().classes('w-full justify-between items-center bg-white p-8 rounded-xl shadow-sm border-b-4').style(f'border-color: {CORP_ORANGE}'):18 with ui.column().classes('gap-1'):19 ui.label('CONTROL DE ENERGÍAS PELIGROSAS').classes('text-[10px] font-black text-slate-500 tracking-widest')20 ui.label('Bloqueo y Etiquetado (LOTO)').classes(f'text-4xl font-bold text-[{CORP_GRAY}] tracking-tight')21 ui.label('Protocolo de seguridad para desenergización de equipos y maquinaria.').classes('text-sm text-slate-400 font-medium')22 23 ui.button('SOLICITAR BLOQUEO', icon='lock_person').props('unelevated rounded-lg').style(f'background-color: {CORP_ORANGE}').classes('px-8 py-4 font-bold text-white shadow-md text-[10px] tracking-widest')24 25 # --- ESTADO DE BLOQUEOS ---26 with ui.row().classes('w-full grid grid-cols-1 md:grid-cols-2 gap-8'):27 with ui.card().classes('p-6 rounded-xl bg-white border border-slate-200 shadow-sm'):28 ui.label('EQUIPOS BLOQUEADOS ACTUALMENTE').classes('text-[10px] font-black text-slate-500 tracking-widest mb-6 uppercase')29 30 locked_items = [31 ('Tablero Eléctrico Principal - Sede Norte', 'ELÉCTRICA', 'Juan Pérez', '09:30 AM'),32 ('Bomba Hidráulica P-201', 'HIDRÁULICA', 'Carlos Ruiz', '07:15 AM'),33 ]34 for machine, type_e, owner, time in locked_items:35 with ui.row().classes('w-full p-4 bg-orange-50 border border-orange-100 rounded-lg items-center gap-4 mb-3'):36 ui.icon('lock', color='orange-9', size='20px')37 with ui.column().classes('flex-1 gap-0'):38 ui.label(machine).classes('text-sm font-black text-orange-900')39 ui.label(f"Responsable: {owner} | {time}").classes('text-[10px] text-orange-700 font-bold')40 ui.badge(type_e).props('unelevated color=orange-9').classes('text-[8px] font-black px-2')41 42 with ui.card().classes('p-6 rounded-xl bg-white border border-slate-200 shadow-sm'):43 ui.label('LISTA DE CHEQUEO LOTO').classes('text-[10px] font-black text-slate-500 tracking-widest mb-6 uppercase')44 steps = [45 ('Identificar fuentes de energía', True),46 ('Notificar a personal afectado', True),47 ('Apagado de equipo', True),48 ('Aislamiento y Bloqueo (Padlocks)', False),49 ('Liberación de energía residual', False),50 ('Verificación de energía cero', False),51 ]52 for step, done in steps:53 with ui.row().classes('w-full items-center gap-3 py-2'):54 ui.checkbox(value=done).props('dense color=orange-9')55 ui.label(step).classes(f'text-xs font-bold {"text-slate-400 line-through" if done else "text-slate-700"}')56 57@ui.page('/sst/operacion/emergencias')58@require_auth59def sst_emergencias_page():60 with SelectosLayout('Gestión de Emergencias y Brigadas'):61 ui.query('body').style(f'background-color: {CORP_BG}')62 sst_top_navigation('/sst/operacion')63 64 with ui.column().classes('w-full max-w-7xl mx-auto p-4 md:p-8 gap-8'):65 66 # --- HEADER ---67 with ui.row().classes('w-full justify-between items-center bg-white p-8 rounded-xl shadow-sm border-b-4').style(f'border-color: {CORP_RED}'):68 with ui.column().classes('gap-1'):69 ui.label('PLAN DE RESPUESTA').classes('text-[10px] font-black text-slate-500 tracking-widest')70 ui.label('Gestión de Emergencias').classes(f'text-4xl font-bold text-[{CORP_GRAY}] tracking-tight')71 ui.label('Coordinación de brigadas, simulacros y puntos de encuentro.').classes('text-sm text-slate-400 font-medium')72 73 ui.button('ACTIVAR BOTÓN SOS', icon='emergency').props('unelevated rounded-lg').style(f'background-color: {CORP_RED}').classes('px-8 py-4 font-bold text-white shadow-md text-[10px] tracking-widest animate-pulse')74 75 # --- BRIGADAS Y RECURSOS ---76 with ui.row().classes('w-full grid grid-cols-1 md:grid-cols-3 gap-6'):77 brigades = [78 ('PRIMEROS AUXILIOS', '5 Integrantes', 'medical_services', 'emerald'),79 ('CONTRA INCENDIO', '3 Integrantes', 'fire_truck', 'red'),80 ('EVACUACIÓN', '8 Integrantes', 'directions_run', 'blue')81 ]82 for name, count, icon, color in brigades:83 with ui.card().classes('p-6 rounded-xl bg-white border border-slate-200 shadow-sm text-center'):84 ui.icon(icon, color=f'{color}-500', size='48px').classes('mb-4')85 ui.label(name).classes('text-sm font-black text-slate-800 tracking-tighter')86 ui.label(count).classes('text-[10px] text-slate-400 font-bold uppercase')87 ui.button('VER PERSONAL', icon='groups').props('flat color=primary size=xs').classes('w-full mt-4 font-black')88 