Corriger les aperçus des templates obsolètes
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run
This commit is contained in:
parent
dc242c2e57
commit
799b1ee8ca
8 changed files with 55 additions and 69 deletions
|
|
@ -488,20 +488,44 @@ def template_debug_preview():
|
||||||
class DemoValue(str):
|
class DemoValue(str):
|
||||||
"""Valeur vide pouvant aussi être appelée par un template."""
|
"""Valeur vide pouvant aussi être appelée par un template."""
|
||||||
def __call__(self, *args, **kwargs):
|
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):
|
class DemoObject(SimpleNamespace):
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
return DemoValue('')
|
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_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(
|
demo_equipment = DemoObject(
|
||||||
id=42, name='Luminaire LED central', code='ECL-0042',
|
id=42, name='Luminaire LED central', code='ECL-0042',
|
||||||
full_path='Bâtiment principal / Zone Anglais / B102 / Éclairage',
|
full_path='Bâtiment principal / Zone Anglais / B102 / Éclairage',
|
||||||
room=demo_room, status='en_service', status_label='En service',
|
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({
|
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),
|
'stats': DemoObject(alerts_unread=3, interventions_pending=4, equipments=128),
|
||||||
'unread': 3,
|
'unread': 3,
|
||||||
'alerts': [DemoObject(id=1, title='Luminaire défaillant', message='Une intervention est à traiter.', level='warning')],
|
'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)],
|
'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'))],
|
'lots': [DemoObject(id=3, name='Éclairage intérieur', category=DemoObject(name='Éclairage'))],
|
||||||
'companies': [DemoObject(id=2, name='Entreprise Démo Maintenance')],
|
'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)
|
rendered = template.render(**preview_context)
|
||||||
except (TemplateNotFound, Exception) as exc:
|
except (TemplateNotFound, Exception) as exc:
|
||||||
|
|
|
||||||
|
|
@ -7,17 +7,12 @@
|
||||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||||
<h4><i class="bi bi-envelope me-2"></i>Boîte de réception ENT77</h4>
|
<h4><i class="bi bi-envelope me-2"></i>Boîte de réception ENT77</h4>
|
||||||
<div class="d-flex gap-2">
|
<div class="d-flex gap-2">
|
||||||
<form method="POST" action="{{ url_for('ent.reset_last_msg') }}" class="show-progress-form" data-progress-text="Réinitialisation…" data-confirm="Supprimer le dernier message traité ? Le prochain scan re-scannera toute la boîte.">
|
<form method="POST" action="{{ url_for('ent.check') }}" class="show-progress-form" data-progress-text="Synchronisation ENT…">
|
||||||
<button type="submit" class="btn btn-outline-warning btn-sm">
|
|
||||||
<i class="bi bi-skip-backward me-1"></i>Reset dernier msg
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
<form method="POST" action="{{ url_for('ent.import_first_messages') }}" class="show-progress-form" data-progress-text="Import des messages ENT…" data-confirm="Importer les 5 premiers messages de la boîte ENT ?">
|
|
||||||
<button type="submit" class="btn btn-outline-success btn-sm">
|
<button type="submit" class="btn btn-outline-success btn-sm">
|
||||||
<i class="bi bi-download me-1"></i>Importer 5 messages
|
<i class="bi bi-download me-1"></i>Synchroniser les messages
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<form method="POST" action="{{ url_for('ent.check_all_messages') }}" class="show-progress-form" data-progress-text="Import de TOUS les messages ENT (lus et non lus)…">
|
<form method="POST" action="{{ url_for('ent.check_all') }}" class="show-progress-form" data-progress-text="Import de TOUS les messages ENT (lus et non lus)…">
|
||||||
{{ manual_form.hidden_tag() }}
|
{{ manual_form.hidden_tag() }}
|
||||||
<button type="submit" class="btn btn-primary">
|
<button type="submit" class="btn btn-primary">
|
||||||
<i class="bi bi-arrow-repeat me-1"></i>Vérifier maintenant (tous)
|
<i class="bi bi-arrow-repeat me-1"></i>Vérifier maintenant (tous)
|
||||||
|
|
@ -121,20 +116,6 @@
|
||||||
class="btn btn-sm btn-outline-primary" title="Voir">
|
class="btn btn-sm btn-outline-primary" title="Voir">
|
||||||
<i class="bi bi-eye"></i>
|
<i class="bi bi-eye"></i>
|
||||||
</a>
|
</a>
|
||||||
<form method="POST" action="{{ url_for('ent.delete_message', msg_id=msg.id) }}"
|
|
||||||
onsubmit="return confirm('Supprimer ce message du cache ?')">
|
|
||||||
<button type="submit" class="btn btn-sm btn-outline-danger" title="Supprimer du cache">
|
|
||||||
<i class="bi bi-trash"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
{% if msg.intervention_id %}
|
|
||||||
<form method="POST" action="{{ url_for('ent.delete_ent_intervention', id=msg.intervention_id) }}"
|
|
||||||
onsubmit="return confirm('Supprimer l\'intervention #{{ msg.intervention_id }} créée via ENT ?')">
|
|
||||||
<button type="submit" class="btn btn-sm btn-outline-warning" title="Supprimer l'intervention ENT">
|
|
||||||
<i class="bi bi-x-circle"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
@ -150,4 +131,4 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -56,9 +56,7 @@
|
||||||
{% if not s.email and not s.phone %}<span class="text-muted">—</span>{% endif %}
|
{% if not s.email and not s.phone %}<span class="text-muted">—</span>{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ url_for('ent.edit_staff', id=s.id) }}" class="btn btn-sm btn-outline-primary">
|
<span class="text-muted" title="Modification depuis l’ENT non disponible">—</span>
|
||||||
<i class="bi bi-pencil"></i>
|
|
||||||
</a>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
@ -96,9 +94,7 @@
|
||||||
<td>{{ s.function or '—' }}</td>
|
<td>{{ s.function or '—' }}</td>
|
||||||
<td class="text-center">{{ s.intervention_count }}</td>
|
<td class="text-center">{{ s.intervention_count }}</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ url_for('ent.edit_staff', id=s.id) }}" class="btn btn-sm btn-outline-secondary">
|
<span class="text-muted" title="Modification depuis l’ENT non disponible">—</span>
|
||||||
<i class="bi bi-pencil"></i>
|
|
||||||
</a>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
@ -108,4 +104,4 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,7 @@
|
||||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||||
<h4><i class="bi bi-person me-2"></i>{{ staff.full_name }}</h4>
|
<h4><i class="bi bi-person me-2"></i>{{ staff.full_name }}</h4>
|
||||||
<div>
|
<div>
|
||||||
<a href="{{ url_for('ent.edit_staff', id=staff.id) }}" class="btn btn-outline-primary btn-sm">
|
<a href="{{ url_for('ent.staff') }}" class="btn btn-outline-secondary btn-sm">
|
||||||
<i class="bi bi-pencil me-1"></i>Modifier
|
|
||||||
</a>
|
|
||||||
<a href="{{ url_for('ent.list_staff') }}" class="btn btn-outline-secondary btn-sm">
|
|
||||||
<i class="bi bi-arrow-left me-1"></i>Retour
|
<i class="bi bi-arrow-left me-1"></i>Retour
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -122,4 +119,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@
|
||||||
<button type="submit" class="btn btn-primary">
|
<button type="submit" class="btn btn-primary">
|
||||||
<i class="bi bi-check-lg me-1"></i>Enregistrer
|
<i class="bi bi-check-lg me-1"></i>Enregistrer
|
||||||
</button>
|
</button>
|
||||||
<a href="{{ url_for('ent.list_staff') }}" class="btn btn-outline-secondary">Annuler</a>
|
<a href="{{ url_for('ent.staff') }}" class="btn btn-outline-secondary">Annuler</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -66,4 +66,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -7,17 +7,12 @@
|
||||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||||
<h4><i class="bi bi-envelope me-2"></i>Boîte de réception ENT77</h4>
|
<h4><i class="bi bi-envelope me-2"></i>Boîte de réception ENT77</h4>
|
||||||
<div class="d-flex gap-2">
|
<div class="d-flex gap-2">
|
||||||
<form method="POST" action="{{ url_for('ent.reset_last_msg') }}" class="show-progress-form" data-progress-text="Réinitialisation…" data-confirm="Supprimer le dernier message traité ? Le prochain scan re-scannera toute la boîte.">
|
<form method="POST" action="{{ url_for('ent.check') }}" class="show-progress-form" data-progress-text="Synchronisation ENT…">
|
||||||
<button type="submit" class="btn btn-outline-warning btn-sm">
|
|
||||||
<i class="bi bi-skip-backward me-1"></i>Reset dernier msg
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
<form method="POST" action="{{ url_for('ent.import_first_messages') }}" class="show-progress-form" data-progress-text="Import des messages ENT…" data-confirm="Importer les 5 premiers messages de la boîte ENT ?">
|
|
||||||
<button type="submit" class="btn btn-outline-success btn-sm">
|
<button type="submit" class="btn btn-outline-success btn-sm">
|
||||||
<i class="bi bi-download me-1"></i>Importer 5 messages
|
<i class="bi bi-download me-1"></i>Synchroniser les messages
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<form method="POST" action="{{ url_for('ent.check_all_messages') }}" class="show-progress-form" data-progress-text="Import de TOUS les messages ENT (lus et non lus)…">
|
<form method="POST" action="{{ url_for('ent.check_all') }}" class="show-progress-form" data-progress-text="Import de TOUS les messages ENT (lus et non lus)…">
|
||||||
{{ manual_form.hidden_tag() }}
|
{{ manual_form.hidden_tag() }}
|
||||||
<button type="submit" class="btn btn-primary">
|
<button type="submit" class="btn btn-primary">
|
||||||
<i class="bi bi-arrow-repeat me-1"></i>Vérifier maintenant (tous)
|
<i class="bi bi-arrow-repeat me-1"></i>Vérifier maintenant (tous)
|
||||||
|
|
@ -121,20 +116,6 @@
|
||||||
class="btn btn-sm btn-outline-primary" title="Voir">
|
class="btn btn-sm btn-outline-primary" title="Voir">
|
||||||
<i class="bi bi-eye"></i>
|
<i class="bi bi-eye"></i>
|
||||||
</a>
|
</a>
|
||||||
<form method="POST" action="{{ url_for('ent.delete_message', msg_id=msg.id) }}"
|
|
||||||
onsubmit="return confirm('Supprimer ce message du cache ?')">
|
|
||||||
<button type="submit" class="btn btn-sm btn-outline-danger" title="Supprimer du cache">
|
|
||||||
<i class="bi bi-trash"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
{% if msg.intervention_id %}
|
|
||||||
<form method="POST" action="{{ url_for('ent.delete_ent_intervention', id=msg.intervention_id) }}"
|
|
||||||
onsubmit="return confirm('Supprimer l\'intervention #{{ msg.intervention_id }} créée via ENT ?')">
|
|
||||||
<button type="submit" class="btn btn-sm btn-outline-warning" title="Supprimer l'intervention ENT">
|
|
||||||
<i class="bi bi-x-circle"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
@ -150,4 +131,4 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,7 @@
|
||||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||||
<h4><i class="bi bi-person me-2"></i>{{ staff.full_name }}</h4>
|
<h4><i class="bi bi-person me-2"></i>{{ staff.full_name }}</h4>
|
||||||
<div>
|
<div>
|
||||||
<a href="{{ url_for('ent.edit_staff', id=staff.id) }}" class="btn btn-outline-primary btn-sm">
|
<a href="{{ url_for('ent.staff') }}" class="btn btn-outline-secondary btn-sm">
|
||||||
<i class="bi bi-pencil me-1"></i>Modifier
|
|
||||||
</a>
|
|
||||||
<a href="{{ url_for('ent.list_staff') }}" class="btn btn-outline-secondary btn-sm">
|
|
||||||
<i class="bi bi-arrow-left me-1"></i>Retour
|
<i class="bi bi-arrow-left me-1"></i>Retour
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -122,4 +119,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@
|
||||||
<button type="submit" class="btn btn-primary">
|
<button type="submit" class="btn btn-primary">
|
||||||
<i class="bi bi-check-lg me-1"></i>Enregistrer
|
<i class="bi bi-check-lg me-1"></i>Enregistrer
|
||||||
</button>
|
</button>
|
||||||
<a href="{{ url_for('ent.list_staff') }}" class="btn btn-outline-secondary">Annuler</a>
|
<a href="{{ url_for('ent.staff') }}" class="btn btn-outline-secondary">Annuler</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -66,4 +66,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue