diff --git a/app_new/core/routes/admin.py b/app_new/core/routes/admin.py index bb5d50b..adfb664 100644 --- a/app_new/core/routes/admin.py +++ b/app_new/core/routes/admin.py @@ -488,20 +488,44 @@ def template_debug_preview(): class DemoValue(str): """Valeur vide pouvant aussi être appelée par un template.""" def __call__(self, *args, **kwargs): - return False + return '' + + class DemoField(DemoValue): + @property + def label(self): + return DemoField(self or 'Champ') + + @property + def errors(self): + return [] + + def __getattr__(self, name): + return DemoField('') class DemoObject(SimpleNamespace): def __getattr__(self, name): return DemoValue('') + class DemoForm(DemoObject): + def __getattr__(self, name): + return DemoField(name.replace('_', ' ').capitalize()) + + class DemoCollection(list): + def count(self): + return len(self) + demo_room = DemoObject(id=12, name='B102', code='B102', full_name='Bâtiment principal — Zone Anglais — B102') + demo_user = DemoObject(id=1, username='demo.admin', full_name='Administrateur démo', role='admin', role_label='Administrateur système', is_authenticated=True, is_admin=lambda: True) demo_equipment = DemoObject( id=42, name='Luminaire LED central', code='ECL-0042', full_path='Bâtiment principal / Zone Anglais / B102 / Éclairage', room=demo_room, status='en_service', status_label='En service', ) + demo_meter = DemoObject(id=5, name='Compteur pages', unit='pages', equipment=demo_equipment, equipment_id=demo_equipment.id) + demo_child = DemoObject(id=43, individual_number=1, code='CH-0043', position='Rangée centrale', status='en_service', has_active_curative=False, interventions=DemoCollection()) + demo_staff = DemoObject(id=8, full_name='Alex Martin', first_name='Alex', last_name='Martin', function='Agent polyvalent', department='Maintenance', email='alex.martin@example.fr', phone='01 60 00 00 00', is_active=True, intervention_count=12, open_intervention_count=2) preview_context.update({ - 'current_user': DemoObject(id=1, username='demo.admin', full_name='Administrateur démo', role='admin', role_label='Administrateur système', is_authenticated=True, is_admin=lambda: True), + 'current_user': demo_user, 'stats': DemoObject(alerts_unread=3, interventions_pending=4, equipments=128), 'unread': 3, 'alerts': [DemoObject(id=1, title='Luminaire défaillant', message='Une intervention est à traiter.', level='warning')], @@ -517,6 +541,16 @@ def template_debug_preview(): 'tasks': [DemoObject(id=7, name='Contrôle mensuel des luminaires', periodicity='Mensuelle', duration_minutes=30)], 'lots': [DemoObject(id=3, name='Éclairage intérieur', category=DemoObject(name='Éclairage'))], 'companies': [DemoObject(id=2, name='Entreprise Démo Maintenance')], + 'form': DemoForm(), + 'manual_form': DemoForm(), + 'statuses': {'en_service': 'En service', 'en_panne': 'En panne', 'a_jeter': 'À jeter'}, + 'equipment': demo_equipment, + 'meter': demo_meter, + 'readings': [DemoObject(date=None, value=1250, comment='Relevé de démonstration', user=demo_user)], + 'parts': [DemoObject(id=4, name='Cartouche noire', reference='DEMO-001')], + 'group': DemoObject(id=50, name='Chaises salle B102', full_path=demo_room.full_name, children_count=10, total_children=12, tracked_individually=True), + 'children': [demo_child], + 'staff': demo_staff, }) rendered = template.render(**preview_context) except (TemplateNotFound, Exception) as exc: diff --git a/app_new/ent/templates/ent/inbox.html b/app_new/ent/templates/ent/inbox.html index 54839e3..60e7618 100644 --- a/app_new/ent/templates/ent/inbox.html +++ b/app_new/ent/templates/ent/inbox.html @@ -7,17 +7,12 @@