🔔
MS
Matthias⌄
Tag Woche Monat

Physiotherapie Brockenblick – Termin

' + rows.map(([k,v]) => '').join('') + '
'+safe(k)+''+safe(v)+'
'); printable.document.close(); printable.focus(); printable.print(); } function openAppointmentStatusMenu(event, element) { event.preventDefault(); event.stopPropagation(); statusMenuAppointmentId = element.dataset.id; statusMenuAppointmentElement = element; const menu = document.getElementById('appointmentStatusMenu'); if (!menu) return; menu.style.display = 'block'; const menuWidth = 220; const menuHeight = 340; const left = Math.min(event.clientX, window.innerWidth - menuWidth - 10); const top = Math.min(event.clientY, window.innerHeight - menuHeight - 10); menu.style.left = Math.max(10, left) + 'px'; menu.style.top = Math.max(10, top) + 'px'; } function closeAppointmentStatusMenu() { const menu = document.getElementById('appointmentStatusMenu'); if (menu) menu.style.display = 'none'; } function setAppointmentStatus(status) { if (!statusMenuAppointmentId) return; fetch('/appointments/' + statusMenuAppointmentId + '/status', { method: 'PATCH', headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content'), 'Accept': 'application/json' }, body: JSON.stringify({ status: status }) }) .then(async response => { if (!response.ok) { throw new Error(await response.text()); } return response.json(); }) .then(() => window.location.reload()) .catch(error => { console.error(error); alert(status === 'reserved' ? 'Reserviert konnte nicht gespeichert werden. Der Server muss den Status reserved unterstützen.' : 'Der Terminstatus konnte nicht gespeichert werden.'); }); } document.addEventListener('click', closeAppointmentStatusMenu); document.addEventListener('scroll', closeAppointmentStatusMenu, true); window.addEventListener('resize', closeAppointmentStatusMenu);