style: update intervention badges to use subtle variants for better visual consistency

This commit is contained in:
kdeterme 2026-08-31 14:05:36 +02:00
parent fd2c696780
commit 22efb9a6d9
4 changed files with 14 additions and 13 deletions

View file

@ -1229,12 +1229,13 @@ class InterventionNote(models.Model):
OTHER = "other", _("Autre") OTHER = "other", _("Autre")
NOTE_TYPE_STYLES = { NOTE_TYPE_STYLES = {
NoteType.WORK_DONE: {"badge_class": "bg-success", "icon_class": "bi-clipboard-check"}, NoteType.WORK_DONE: {"badge_class": "bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle", "icon_class": "bi-clipboard-check"},
NoteType.EQUIPMENT: {"badge_class": "bg-warning text-dark", "icon_class": "bi-tools"}, NoteType.MATERIAL: {"badge_class": "bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle", "icon_class": "bi-box-seam"},
NoteType.IMPORTANT_INFO: {"badge_class": "bg-danger", "icon_class": "bi-exclamation-octagon-fill"}, NoteType.EQUIPMENT: {"badge_class": "bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle", "icon_class": "bi-tools"},
NoteType.ORIGIN: {"badge_class": "bg-secondary", "icon_class": "bi-flag-fill"}, NoteType.IMPORTANT_INFO: {"badge_class": "bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle", "icon_class": "bi-exclamation-octagon-fill"},
NoteType.COMMENT: {"badge_class": "bg-secondary", "icon_class": "bi-chat-dots"}, NoteType.ORIGIN: {"badge_class": "bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle", "icon_class": "bi-flag-fill"},
NoteType.OTHER: {"badge_class": "bg-secondary", "icon_class": "bi-sticky"}, NoteType.COMMENT: {"badge_class": "bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle", "icon_class": "bi-chat-dots"},
NoteType.OTHER: {"badge_class": "bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle", "icon_class": "bi-sticky"},
} }
NOTE_TYPE_PRIORITIES = { NOTE_TYPE_PRIORITIES = {
@ -1271,7 +1272,7 @@ class InterventionNote(models.Model):
@property @property
def type_badge_class(self): def type_badge_class(self):
return self.NOTE_TYPE_STYLES.get(self.note_type, {"badge_class": "bg-secondary"}).get("badge_class", "bg-secondary") return self.NOTE_TYPE_STYLES.get(self.note_type, {"badge_class": "bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle"}).get("badge_class", "bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle")
@property @property
def type_icon_class(self): def type_icon_class(self):

View file

@ -214,7 +214,7 @@ def get_sequenced_intervention_documents(
'title': _("Avant réalisation"), 'title': _("Avant réalisation"),
'subtitle': _("Préparation, constat initial et pièces administratives"), 'subtitle': _("Préparation, constat initial et pièces administratives"),
'icon': 'bi-clipboard-check', 'icon': 'bi-clipboard-check',
'badge_class': 'bg-secondary text-white', 'badge_class': 'bg-info-subtle text-info-emphasis border border-info-subtle',
'period_display': period_before, 'period_display': period_before,
'modal_id': 'interventionDocViewerModal_before', 'modal_id': 'interventionDocViewerModal_before',
'documents': before_docs, 'documents': before_docs,
@ -229,7 +229,7 @@ def get_sequenced_intervention_documents(
'title': _("Exécution de l'intervention"), 'title': _("Exécution de l'intervention"),
'subtitle': _("Travaux en cours et constat d'achèvement"), 'subtitle': _("Travaux en cours et constat d'achèvement"),
'icon': 'bi-tools', 'icon': 'bi-tools',
'badge_class': 'bg-primary text-white', 'badge_class': 'bg-primary-subtle text-primary-emphasis border border-primary-subtle',
'period_display': period_during, 'period_display': period_during,
'modal_id': 'interventionDocViewerModal_during', 'modal_id': 'interventionDocViewerModal_during',
'documents': during_docs, 'documents': during_docs,
@ -244,7 +244,7 @@ def get_sequenced_intervention_documents(
'title': _("Après réalisation"), 'title': _("Après réalisation"),
'subtitle': _("Contrôle, levée de réserves et clôture"), 'subtitle': _("Contrôle, levée de réserves et clôture"),
'icon': 'bi-shield-check', 'icon': 'bi-shield-check',
'badge_class': 'bg-success text-white', 'badge_class': 'bg-success-subtle text-success-emphasis border border-success-subtle',
'period_display': period_after, 'period_display': period_after,
'modal_id': 'interventionDocViewerModal_after', 'modal_id': 'interventionDocViewerModal_after',
'documents': after_docs, 'documents': after_docs,

View file

@ -209,7 +209,7 @@
metadata.className = 'd-flex flex-wrap align-items-center gap-2 mb-1'; metadata.className = 'd-flex flex-wrap align-items-center gap-2 mb-1';
const badge = document.createElement('span'); const badge = document.createElement('span');
const badgeClass = `badge note-type-badge d-inline-flex align-items-center gap-1 ${note.note_type_badge_class || 'bg-secondary'}`.trim(); const badgeClass = `badge note-type-badge d-inline-flex align-items-center gap-1 ${note.note_type_badge_class || 'bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle'}`.trim();
badge.className = badgeClass; badge.className = badgeClass;
const badgeIcon = document.createElement('i'); const badgeIcon = document.createElement('i');
badgeIcon.className = `bi ${note.note_type_icon_class || 'bi-card-text'}`; badgeIcon.className = `bi ${note.note_type_icon_class || 'bi-card-text'}`;
@ -291,7 +291,7 @@
badge.innerHTML = ''; badge.innerHTML = '';
// Recréer le contenu du badge // Recréer le contenu du badge
const badgeClass = `badge note-type-badge d-inline-flex align-items-center gap-1 ${note.note_type_badge_class || 'bg-secondary'}`.trim(); const badgeClass = `badge note-type-badge d-inline-flex align-items-center gap-1 ${note.note_type_badge_class || 'bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle'}`.trim();
badge.className = badgeClass; badge.className = badgeClass;
const icon = document.createElement('i'); const icon = document.createElement('i');

View file

@ -3400,7 +3400,7 @@ document.addEventListener('DOMContentLoaded', function() {
<div class="d-flex justify-content-between align-items-start gap-2"> <div class="d-flex justify-content-between align-items-start gap-2">
<div class="note-content flex-grow-1"> <div class="note-content flex-grow-1">
<div class="d-flex flex-wrap align-items-center gap-2 mb-1"> <div class="d-flex flex-wrap align-items-center gap-2 mb-1">
<span class="badge note-type-badge d-inline-flex align-items-center gap-1 ${noteData.badge_class || 'bg-secondary'}"> <span class="badge note-type-badge d-inline-flex align-items-center gap-1 ${noteData.badge_class || 'bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle'}">
<i class="bi ${noteData.icon_class || 'bi-chat-left-text'}"></i> <i class="bi ${noteData.icon_class || 'bi-chat-left-text'}"></i>
${noteData.note_type_display || ''} ${noteData.note_type_display || ''}
</span> </span>