fix: Add missing JS handlers for Advanced Profiles in settings.html
Build Curio HMS / build-and-deploy (push) Successful in 1m6s
Details
Build Curio HMS / build-and-deploy (push) Successful in 1m6s
Details
This commit is contained in:
parent
7f27c206b5
commit
206c3b87e0
|
|
@ -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 = `<strong>${name}</strong> - ₹${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 = `<img src="${data.url}" style="max-width: 150px; border-radius: var(--radius-md);">`;
|
||||
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 = `<strong>Q: ${q}</strong><br><span class="text-muted">A: ${a}</span>`;
|
||||
document.getElementById('qaList').appendChild(div);
|
||||
document.getElementById('qaQuestion').value = '';
|
||||
document.getElementById('qaAnswer').value = '';
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Reference in New Issue