diff --git a/loko/interventions/static/interventions/detail/desktop_operations_editor.js b/loko/interventions/static/interventions/detail/desktop_operations_editor.js index 9a63b04..b92af7d 100644 --- a/loko/interventions/static/interventions/detail/desktop_operations_editor.js +++ b/loko/interventions/static/interventions/detail/desktop_operations_editor.js @@ -77,9 +77,15 @@ // Trigger the visual update const toggleBtn = operationsCard.querySelector(`.operation-na-toggle[data-operation-id="${input.dataset.operationId}"]`); if (toggleBtn) { - toggleBtn.classList.toggle('text-warning', wasChecked); - toggleBtn.classList.toggle('text-secondary', !wasChecked); - toggleBtn.classList.toggle('opacity-50', !wasChecked); + toggleBtn.classList.toggle('active', wasChecked); + toggleBtn.classList.toggle('bg-secondary', wasChecked); + toggleBtn.classList.toggle('text-white', wasChecked); + const naIcon = toggleBtn.querySelector('i'); + if (naIcon) { + naIcon.classList.toggle('bi-slash-circle-fill', wasChecked); + naIcon.classList.toggle('bi-slash-circle', !wasChecked); + } + toggleBtn.title = wasChecked ? gettext('Marquer comme applicable') : gettext('Marquer comme non applicable'); } // Update card styling const card = input.closest('[data-operation-card]'); @@ -333,9 +339,14 @@ checkbox.checked = isNA; // Update toggle button appearance - toggleBtn.classList.toggle('text-warning', isNA); - toggleBtn.classList.toggle('text-secondary', !isNA); - toggleBtn.classList.toggle('opacity-50', !isNA); + toggleBtn.classList.toggle('active', isNA); + toggleBtn.classList.toggle('bg-secondary', isNA); + toggleBtn.classList.toggle('text-white', isNA); + const naIcon = toggleBtn.querySelector('i'); + if (naIcon) { + naIcon.classList.toggle('bi-slash-circle-fill', isNA); + naIcon.classList.toggle('bi-slash-circle', !isNA); + } toggleBtn.title = isNA ? gettext('Marquer comme applicable') : gettext('Marquer comme non applicable'); if (opType === 'measurement') { diff --git a/loko/interventions/templates/interventions/detail/styles.html b/loko/interventions/templates/interventions/detail/styles.html index e3616d6..b646f41 100644 --- a/loko/interventions/templates/interventions/detail/styles.html +++ b/loko/interventions/templates/interventions/detail/styles.html @@ -200,6 +200,29 @@ opacity: 0.6; background: #f8f9fa; } + /* Operation N/A toggle button */ + .operation-na-toggle { + font-size: 0.75rem; + font-weight: 600; + line-height: 1.4; + padding: 0.1rem 0.5rem !important; + white-space: nowrap; + transition: all 0.15s ease-in-out; + border-color: #ced4da; + color: #6c757d; + background-color: transparent; + text-decoration: none; + } + .operation-na-toggle:hover { + color: #495057; + border-color: #6c757d; + background-color: #f8f9fa; + } + .operation-na-toggle.active { + background-color: #6c757d !important; + border-color: #6c757d !important; + color: #fff !important; + } .desktop-operation-card .card-header { background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%); border-bottom: 1px solid #dee2e6; diff --git a/loko/interventions/templates/interventions/includes/_desktop_operation_card.html b/loko/interventions/templates/interventions/includes/_desktop_operation_card.html index 78d0f83..bdc18b2 100644 --- a/loko/interventions/templates/interventions/includes/_desktop_operation_card.html +++ b/loko/interventions/templates/interventions/includes/_desktop_operation_card.html @@ -14,15 +14,15 @@ {{ op.name_fr }} {% endif %}

-
+
{# N/A toggle button #} {# Hidden checkbox for form submission #} -
+