Corriger l'affichage de l'historique des statuts
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
7d64a29601
commit
16c5a5ff88
2 changed files with 17 additions and 4 deletions
|
|
@ -301,6 +301,21 @@ class StatusChange(db.Model):
|
||||||
# Relations
|
# Relations
|
||||||
changed_by = db.relationship("User", backref="status_changes_list")
|
changed_by = db.relationship("User", backref="status_changes_list")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def to_label(self):
|
||||||
|
from app_new.constants import INTERVENTION_STATUSES
|
||||||
|
return INTERVENTION_STATUSES.get(self.to_status, {}).get("label", self.to_status or "Statut inconnu")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def from_label(self):
|
||||||
|
from app_new.constants import INTERVENTION_STATUSES
|
||||||
|
return INTERVENTION_STATUSES.get(self.from_status, {}).get("label", self.from_status or "Création")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def to_color(self):
|
||||||
|
from app_new.constants import INTERVENTION_STATUSES
|
||||||
|
return INTERVENTION_STATUSES.get(self.to_status, {}).get("color", "secondary")
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<StatusChange {self.from_status} → {self.to_status}>"
|
return f"<StatusChange {self.from_status} → {self.to_status}>"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -359,12 +359,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-grow-1">
|
<div class="flex-grow-1">
|
||||||
<strong>{{ change.to_label }}</strong>
|
<strong>{{ change.to_label }}</strong>
|
||||||
{% if change.from_status %}
|
<span class="text-muted small">(de {{ change.from_label }})</span>
|
||||||
<span class="text-muted small">(de {{ change.from_label }})</span>
|
|
||||||
{% endif %}
|
|
||||||
<br>
|
<br>
|
||||||
<span class="text-muted small">
|
<span class="text-muted small">
|
||||||
Par <strong>{{ change.changed_by.full_name }}</strong> — {{ change.created_at|datetime_fmt if change.created_at else '—' }}
|
Par <strong>{{ change.changed_by.full_name if change.changed_by else 'Utilisateur supprimé' }}</strong> — {{ change.created_at|datetime_fmt if change.created_at else '—' }}
|
||||||
</span>
|
</span>
|
||||||
{% if change.comment %}
|
{% if change.comment %}
|
||||||
<br><em class="small">{{ change.comment }}</em>
|
<br><em class="small">{{ change.comment }}</em>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue