(title: string, message: string, type: string = 'info')
| 91 | } |
| 92 | |
| 93 | function showToast(title: string, message: string, type: string = 'info') { |
| 94 | const toast = document.getElementById('toast'); |
| 95 | const toastBody = document.getElementById('toast-body'); |
| 96 | |
| 97 | if (toastBody && toast) { |
| 98 | toastBody.textContent = message; |
| 99 | |
| 100 | // Remove existing classes and add new type class |
| 101 | toast.className = 'toast'; |
| 102 | if (type === 'success') { |
| 103 | toast.classList.add('text-bg-success'); |
| 104 | } else if (type === 'error') { |
| 105 | toast.classList.add('text-bg-danger'); |
| 106 | } else if (type === 'warning') { |
| 107 | toast.classList.add('text-bg-orange'); |
| 108 | } else { |
| 109 | toast.classList.add('text-bg-info'); |
| 110 | } |
| 111 | |
| 112 | const bsToast = new bootstrap.Toast(toast, { |
| 113 | autohide: true, |
| 114 | delay: 3000 |
| 115 | }); |
| 116 | bsToast.show(); |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | function changeButtonAction(element, buttonID, attribute) { |
| 121 | var value = element.options[element.selectedIndex].value; |
no test coverage detected