From 799b1ee8cacf2aa42c88fe62b01d1db8a22eddf7 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 21 Aug 2026 12:29:45 +0000 Subject: [PATCH] =?UTF-8?q?Corriger=20les=20aper=C3=A7us=20des=20templates?= =?UTF-8?q?=20obsol=C3=A8tes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app_new/core/routes/admin.py | 38 +++++++++++++++++++-- app_new/ent/templates/ent/inbox.html | 27 +++------------ app_new/ent/templates/ent/staff.html | 10 ++---- app_new/ent/templates/ent/staff_detail.html | 7 ++-- app_new/ent/templates/ent/staff_form.html | 4 +-- app_new/templates/ent/inbox.html | 27 +++------------ app_new/templates/ent/staff_detail.html | 7 ++-- app_new/templates/ent/staff_form.html | 4 +-- 8 files changed, 55 insertions(+), 69 deletions(-) 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 @@

Boîte de réception ENT77

-
- -
-
+
-
+ {{ manual_form.hidden_tag() }} -
- {% if msg.intervention_id %} -
- -
- {% endif %}
@@ -150,4 +131,4 @@
{% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app_new/ent/templates/ent/staff.html b/app_new/ent/templates/ent/staff.html index c0da82e..a5354f3 100644 --- a/app_new/ent/templates/ent/staff.html +++ b/app_new/ent/templates/ent/staff.html @@ -56,9 +56,7 @@ {% if not s.email and not s.phone %}{% endif %} - - - + {% endfor %} @@ -96,9 +94,7 @@ {{ s.function or '—' }} {{ s.intervention_count }} - - - + {% endfor %} @@ -108,4 +104,4 @@ {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app_new/ent/templates/ent/staff_detail.html b/app_new/ent/templates/ent/staff_detail.html index 462d9a2..eda7831 100644 --- a/app_new/ent/templates/ent/staff_detail.html +++ b/app_new/ent/templates/ent/staff_detail.html @@ -7,10 +7,7 @@

{{ staff.full_name }}

- - Modifier - - + Retour
@@ -122,4 +119,4 @@
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app_new/ent/templates/ent/staff_form.html b/app_new/ent/templates/ent/staff_form.html index a789ea0..f3cd8c8 100644 --- a/app_new/ent/templates/ent/staff_form.html +++ b/app_new/ent/templates/ent/staff_form.html @@ -58,7 +58,7 @@ - Annuler + Annuler @@ -66,4 +66,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app_new/templates/ent/inbox.html b/app_new/templates/ent/inbox.html index 54839e3..60e7618 100644 --- a/app_new/templates/ent/inbox.html +++ b/app_new/templates/ent/inbox.html @@ -7,17 +7,12 @@

Boîte de réception ENT77

-
- -
-
+
-
+ {{ manual_form.hidden_tag() }} -
- {% if msg.intervention_id %} -
- -
- {% endif %}
@@ -150,4 +131,4 @@
{% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app_new/templates/ent/staff_detail.html b/app_new/templates/ent/staff_detail.html index 462d9a2..eda7831 100644 --- a/app_new/templates/ent/staff_detail.html +++ b/app_new/templates/ent/staff_detail.html @@ -7,10 +7,7 @@

{{ staff.full_name }}

- - Modifier - - + Retour
@@ -122,4 +119,4 @@
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app_new/templates/ent/staff_form.html b/app_new/templates/ent/staff_form.html index a789ea0..f3cd8c8 100644 --- a/app_new/templates/ent/staff_form.html +++ b/app_new/templates/ent/staff_form.html @@ -58,7 +58,7 @@ - Annuler + Annuler @@ -66,4 +66,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %}