diff --git a/src/client/app/css/app.css b/src/client/app/css/app.css index 7638bdf..5fe5ebe 100644 --- a/src/client/app/css/app.css +++ b/src/client/app/css/app.css @@ -1242,18 +1242,33 @@ h6.calendar-week { .radio-icons { border: 1px solid #ced4da; border-radius: .25rem; - padding: .375rem .75rem; + padding: .375rem .32rem .375rem .75rem; } .radio-icons p { margin: 0; font-size: 16px; cursor: pointer; } +.radio-icons p .selected-icon { + padding-left: 6px; +} .radio-icons p i { font-size: 0.65rem; } +.radio-icons p .selected-icon i { + font-size: .9rem; +} .radio-icons label { width: 65px; + display: inline-flex; + align-items: center; + padding-bottom: 8px; +} +.radio-icons label input { + margin-right: 6px; +} +.radio-icons label i { + font-size: 1.2rem; } .radio-icons-inner { display: none; diff --git a/src/client/app/js/app/state/AppointmentCreate.js b/src/client/app/js/app/state/AppointmentCreate.js index 5e7496f..bdcff12 100644 --- a/src/client/app/js/app/state/AppointmentCreate.js +++ b/src/client/app/js/app/state/AppointmentCreate.js @@ -22,17 +22,36 @@ app.state.AppointmentCreate = function() var radioIcons = document.getElementById('radio-icons'); if (radioIcons) { var toggleButton = radioIcons.querySelector('p'); + var toggleLabel = toggleButton.querySelector('span'); var radioIconsInner = radioIcons.querySelector('.radio-icons-inner'); + var iconSpan = toggleButton.querySelector('.selected-icon'); + if (!iconSpan) { + iconSpan = document.createElement('span'); + iconSpan.className = 'selected-icon'; + toggleLabel.insertBefore(iconSpan, toggleLabel.lastElementChild); + } if (toggleButton && radioIconsInner) { toggleButton.addEventListener('click', function(event) { - event.stopPropagation(); // Verhindert Bubble-Up zum parent div + event.stopPropagation(); if (radioIconsInner.style.display === 'none' || radioIconsInner.style.display === '') { radioIconsInner.style.display = 'block'; } else { radioIconsInner.style.display = 'none'; } }); + + radioIconsInner.addEventListener('click', function(event) { + if (event.target.tagName === 'INPUT' && event.target.type === 'radio') { + var selectedIcon = event.target.value; + if (selectedIcon) { + iconSpan.innerHTML = ''; + } else { + iconSpan.innerHTML = ''; + } + radioIconsInner.style.display = 'none'; + } + }); } } } diff --git a/src/client/app/js/app/state/AppointmentEdit.js b/src/client/app/js/app/state/AppointmentEdit.js index 388e44a..8950554 100644 --- a/src/client/app/js/app/state/AppointmentEdit.js +++ b/src/client/app/js/app/state/AppointmentEdit.js @@ -27,17 +27,36 @@ app.state.AppointmentEdit= function() var radioIcons = document.getElementById('radio-icons'); if (radioIcons) { var toggleButton = radioIcons.querySelector('p'); + var toggleLabel = toggleButton.querySelector('span'); var radioIconsInner = radioIcons.querySelector('.radio-icons-inner'); + var iconSpan = toggleButton.querySelector('.selected-icon'); + if (!iconSpan) { + iconSpan = document.createElement('span'); + iconSpan.className = 'selected-icon'; + toggleLabel.insertBefore(iconSpan, toggleLabel.lastElementChild); + } if (toggleButton && radioIconsInner) { toggleButton.addEventListener('click', function(event) { - event.stopPropagation(); // Verhindert Bubble-Up zum parent div + event.stopPropagation(); if (radioIconsInner.style.display === 'none' || radioIconsInner.style.display === '') { radioIconsInner.style.display = 'block'; } else { radioIconsInner.style.display = 'none'; } }); + + radioIconsInner.addEventListener('click', function(event) { + if (event.target.tagName === 'INPUT' && event.target.type === 'radio') { + var selectedIcon = event.target.value; + if (selectedIcon) { + iconSpan.innerHTML = ''; + } else { + iconSpan.innerHTML = ''; + } + radioIconsInner.style.display = 'none'; + } + }); } } } diff --git a/src/client/app/tmpl/appointment-form-edit.html b/src/client/app/tmpl/appointment-form-edit.html index 5598f33..5485723 100644 --- a/src/client/app/tmpl/appointment-form-edit.html +++ b/src/client/app/tmpl/appointment-form-edit.html @@ -27,7 +27,7 @@