From 22efb9a6d9dba6f658a1e17e356c9f45b821643f Mon Sep 17 00:00:00 2001 From: kdeterme Date: Mon, 31 Aug 2026 14:05:36 +0200 Subject: [PATCH] style: update intervention badges to use subtle variants for better visual consistency --- loko/interventions/models.py | 15 ++++++++------- .../interventions/services/document_sequencing.py | 6 +++--- .../interventions/detail/intervention_notes.js | 4 ++-- .../interventions/intervention_detail_mobile.html | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/loko/interventions/models.py b/loko/interventions/models.py index c039b67..b388ba6 100644 --- a/loko/interventions/models.py +++ b/loko/interventions/models.py @@ -1229,12 +1229,13 @@ class InterventionNote(models.Model): OTHER = "other", _("Autre") NOTE_TYPE_STYLES = { - NoteType.WORK_DONE: {"badge_class": "bg-success", "icon_class": "bi-clipboard-check"}, - NoteType.EQUIPMENT: {"badge_class": "bg-warning text-dark", "icon_class": "bi-tools"}, - NoteType.IMPORTANT_INFO: {"badge_class": "bg-danger", "icon_class": "bi-exclamation-octagon-fill"}, - NoteType.ORIGIN: {"badge_class": "bg-secondary", "icon_class": "bi-flag-fill"}, - NoteType.COMMENT: {"badge_class": "bg-secondary", "icon_class": "bi-chat-dots"}, - NoteType.OTHER: {"badge_class": "bg-secondary", "icon_class": "bi-sticky"}, + NoteType.WORK_DONE: {"badge_class": "bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle", "icon_class": "bi-clipboard-check"}, + NoteType.MATERIAL: {"badge_class": "bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle", "icon_class": "bi-box-seam"}, + NoteType.EQUIPMENT: {"badge_class": "bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle", "icon_class": "bi-tools"}, + NoteType.IMPORTANT_INFO: {"badge_class": "bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle", "icon_class": "bi-exclamation-octagon-fill"}, + NoteType.ORIGIN: {"badge_class": "bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle", "icon_class": "bi-flag-fill"}, + 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 = { @@ -1271,7 +1272,7 @@ class InterventionNote(models.Model): @property 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 def type_icon_class(self): diff --git a/loko/interventions/services/document_sequencing.py b/loko/interventions/services/document_sequencing.py index 20b1fc4..07ab581 100644 --- a/loko/interventions/services/document_sequencing.py +++ b/loko/interventions/services/document_sequencing.py @@ -214,7 +214,7 @@ def get_sequenced_intervention_documents( 'title': _("Avant réalisation"), 'subtitle': _("Préparation, constat initial et pièces administratives"), '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, 'modal_id': 'interventionDocViewerModal_before', 'documents': before_docs, @@ -229,7 +229,7 @@ def get_sequenced_intervention_documents( 'title': _("Exécution de l'intervention"), 'subtitle': _("Travaux en cours et constat d'achèvement"), '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, 'modal_id': 'interventionDocViewerModal_during', 'documents': during_docs, @@ -244,7 +244,7 @@ def get_sequenced_intervention_documents( 'title': _("Après réalisation"), 'subtitle': _("Contrôle, levée de réserves et clôture"), '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, 'modal_id': 'interventionDocViewerModal_after', 'documents': after_docs, diff --git a/loko/interventions/static/interventions/detail/intervention_notes.js b/loko/interventions/static/interventions/detail/intervention_notes.js index a7123fc..9a43c6a 100644 --- a/loko/interventions/static/interventions/detail/intervention_notes.js +++ b/loko/interventions/static/interventions/detail/intervention_notes.js @@ -209,7 +209,7 @@ metadata.className = 'd-flex flex-wrap align-items-center gap-2 mb-1'; 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; const badgeIcon = document.createElement('i'); badgeIcon.className = `bi ${note.note_type_icon_class || 'bi-card-text'}`; @@ -291,7 +291,7 @@ badge.innerHTML = ''; // 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; const icon = document.createElement('i'); diff --git a/loko/interventions/templates/interventions/intervention_detail_mobile.html b/loko/interventions/templates/interventions/intervention_detail_mobile.html index 8f297d6..d1cf0db 100644 --- a/loko/interventions/templates/interventions/intervention_detail_mobile.html +++ b/loko/interventions/templates/interventions/intervention_detail_mobile.html @@ -3400,7 +3400,7 @@ document.addEventListener('DOMContentLoaded', function() {
- + ${noteData.note_type_display || ''}