diff --git a/app/assets/javascripts/organizationDashboard.js b/app/assets/javascripts/organizationDashboard.js index 07cd7e255..f340a7bfb 100644 --- a/app/assets/javascripts/organizationDashboard.js +++ b/app/assets/javascripts/organizationDashboard.js @@ -57,9 +57,41 @@ } } + function initDeleteServiceConfirmation() { + var deleteButtons = document.querySelectorAll('[data-open-modal="confirmDeleteModal"]'); + var confirmDeleteButton = document.getElementById('delete-service-confirm-btn'); + var deleteServiceNameDisplay = document.getElementById('delete-service-name-display'); + var deleteForm = document.getElementById('delete-service-form'); + + if (deleteButtons.length > 0 && confirmDeleteButton && deleteForm) { + var currentServiceId = null; + + deleteButtons.forEach(function(button) { + button.addEventListener('click', function() { + currentServiceId = button.getAttribute('data-service-id'); + var serviceName = button.getAttribute('data-service-name'); + + if (deleteServiceNameDisplay && serviceName) { + deleteServiceNameDisplay.textContent = serviceName; + } + }); + }); + + confirmDeleteButton.addEventListener('click', function() { + if (currentServiceId) { + var orgId = window.location.pathname.split('/')[2]; + deleteForm.action = '/organizations/' + encodeURIComponent(orgId) + '?action=delete-service&service_id=' + encodeURIComponent(currentServiceId); + + deleteForm.submit(); + } + }); + } + } + document.addEventListener('DOMContentLoaded', function() { initForms(); initEditServiceConfirmation(); + initDeleteServiceConfirmation(); }); window.OrganizationDashboard = { diff --git a/app/assets/sass/uswds/components/_forms.scss b/app/assets/sass/uswds/components/_forms.scss index 8f38a4eb3..cf2d41898 100644 --- a/app/assets/sass/uswds/components/_forms.scss +++ b/app/assets/sass/uswds/components/_forms.scss @@ -48,3 +48,8 @@ display: inline-flex; justify-content: center; } + +.button-not-clickable { + cursor: default; + pointer-events: none; +} diff --git a/app/assets/sass/uswds/components/_tables.scss b/app/assets/sass/uswds/components/_tables.scss index ecb75300e..8c5cb555c 100644 --- a/app/assets/sass/uswds/components/_tables.scss +++ b/app/assets/sass/uswds/components/_tables.scss @@ -47,3 +47,22 @@ td.table-empty-message { box-shadow: none; } } + +.is-highlighted { + td { + background-color: color('blue-cool-5v'); + animation: fadeHighlight 3s ease-out forwards; + } +} + +@keyframes fadeHighlight { + 0% { + background-color: color('blue-cool-10v'); + } + 50% { + background-color: color('blue-cool-5v'); + } + 100% { + background-color: transparent; + } +} diff --git a/app/templates/views/organizations/organization/index.html b/app/templates/views/organizations/organization/index.html index 5ae9c5aee..879e9c994 100644 --- a/app/templates/views/organizations/organization/index.html +++ b/app/templates/views/organizations/organization/index.html @@ -70,7 +70,7 @@ {% if create_service_form %} -