CoolFace
Apppublic

fmatituy/selectospromanager

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
informe_asistente.py60 linesDownload Raw Back to inventario
1from nicegui import ui
2from services.auth import require_auth, get_current_user
3from modules.layout import SelectosLayout
4from database.db import DB_PATH
5import sqlite3
6
7@ui.page('/inventario/informe-asistente')
8@require_auth
9def informe_inventario_asistente_page():
10    user = get_current_user()
11    
12    def get_herramientas():
13        conn = sqlite3.connect(DB_PATH)
14        c = conn.cursor()
15        c.execute("SELECT id, nombre, estado FROM inventario_herramientas")
16        res = c.fetchall()
17        conn.close()
18        return res
19
20    herramientas = get_herramientas()
21
22    with SelectosLayout('Informe de Inventario Técnico'):
23        with ui.column().classes('w-full max-w-4xl mx-auto gap-8'):
24            # Header
25            with ui.row().classes('w-full justify-between items-center bg-slate-900 p-8 rounded-[2rem] shadow-xl'):
26                with ui.column().classes('gap-1'):
27                    ui.label('CONTROL DE ACTIVOS').classes('text-[10px] font-black text-slate-400 tracking-[0.4em]')
28                    ui.label('Informe Diario/Semanal de Inventario').classes('text-2xl font-black text-white')
29                ui.icon('inventory', size='48px', color='white').classes('opacity-20')
30
31            with ui.card().classes('w-full p-8 rounded-[2rem] border-none shadow-lg bg-white'):
32                ui.label('ESTADO DE HERRAMIENTAS Y EQUIPOS').classes('text-xs font-black text-slate-400 mb-6 tracking-widest uppercase')
33                
34                with ui.column().classes('w-full gap-4'):
35                    for hid, nombre, estado_act in herramientas:
36                        with ui.card().classes('p-4 rounded-xl border border-slate-100 flex-row items-center gap-4 bg-slate-50/50'):
37                            ui.icon('build', color='slate-400', size='sm')
38                            ui.label(nombre).classes('font-bold text-slate-800 flex-1')
39                            
40                            # Checklist de estado
41                            with ui.row().classes('gap-4'):
42                                ui.select(['Operativo', 'Falla Leve', 'Dañado'], value=estado_act, label='Estado').props('dense flat color=indigo').classes('w-32')
43                                ui.checkbox('Cerrado/Limpio').props('color=indigo')
44
45                ui.label('RESUMEN DE CONSUMIBLES (STOCK)').classes('text-xs font-black text-slate-400 mt-10 mb-6 tracking-widest uppercase')
46                
47                # Ejemplo de materiales para reporte rápido
48                MATERIALES_COMUNES = ["Cemento", "Arena", "Puntas 2\"", "Discos de Corte"]
49                with ui.row().classes('w-full grid grid-cols-1 md:grid-cols-2 gap-4'):
50                    for mat in MATERIALES_COMUNES:
51                        with ui.card().classes('p-4 rounded-xl border border-slate-100 flex-row items-center gap-4'):
52                            ui.label(mat).classes('font-bold text-slate-700 flex-1')
53                            ui.number('Cant. Restante', value=0).props('dense outlined rounded-lg').classes('w-24')
54
55                def guardar_reporte():
56                    ui.notify('INFORME DE INVENTARIO REGISTRADO EXITOSAMENTE', type='positive', position='top')
57                    ui.label('Reporte guardado. La administración y almacén han sido notificados.').classes('text-slate-500 font-bold mt-4')
58
59                ui.button('ENVIAR INFORME TÉCNICO', icon='task_alt', on_click=guardar_reporte).props('unelevated rounded-2xl color=slate-900 px-10 h-14').classes('w-full font-black mt-10 shadow-xl')
60