From 206c3b87e0b456da139299dfd76716cea759191b Mon Sep 17 00:00:00 2001 From: Deep Koluguri Date: Tue, 26 May 2026 22:58:31 -0400 Subject: [PATCH] fix: Add missing JS handlers for Advanced Profiles in settings.html --- settings.html | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/settings.html b/settings.html index 635725d..3b5c282 100644 --- a/settings.html +++ b/settings.html @@ -345,6 +345,65 @@ document.getElementById('saveSettings').onclick = () => { alert('Settings saved successfully!'); }; + + // UI Stub Functions for Advanced Profiles + function addService() { + const name = document.getElementById('newServiceName').value; + const price = document.getElementById('newServicePrice').value; + if (!name || !price) return alert('Enter service name and price'); + const div = document.createElement('div'); + div.innerHTML = `${name} - ₹${price}`; + document.getElementById('servicesList').appendChild(div); + document.getElementById('newServiceName').value = ''; + document.getElementById('newServicePrice').value = ''; + } + + function addBlockDate() { + const date = document.getElementById('blockDateInput').value; + if (!date) return; + const li = document.createElement('li'); + li.textContent = `🚫 ${date}`; + document.getElementById('blockedDatesList').appendChild(li); + } + + async function uploadMedia() { + const input = document.getElementById('mediaUploadInput'); + if (!input.files || input.files.length === 0) return; + + const file = input.files[0]; + const formData = new FormData(); + formData.append('media', file); + + try { + const res = await fetch('/api/doctor/upload-media', { + method: 'POST', + headers: { 'Authorization': `Bearer ${localStorage.getItem('curio_token')}` }, + body: formData + }); + const data = await res.json(); + if (data.success) { + const div = document.createElement('div'); + div.innerHTML = ``; + document.getElementById('mediaPreview').appendChild(div); + alert('Media uploaded to MinIO!'); + } + } catch (e) { + console.error(e); + alert('Upload failed'); + } + } + + function addQA() { + const q = document.getElementById('qaQuestion').value; + const a = document.getElementById('qaAnswer').value; + if (!q || !a) return; + const div = document.createElement('div'); + div.style.marginBottom = '0.5rem'; + div.innerHTML = `Q: ${q}
A: ${a}`; + document.getElementById('qaList').appendChild(div); + document.getElementById('qaQuestion').value = ''; + document.getElementById('qaAnswer').value = ''; + }