Spaces:
Running
Running
Download script.js from ShoaibAI/mediflow-360: direct link, hf CLI and curl.
- Browser
- Download file 2.2 kB
-
https://huggingface.co/spaces/ShoaibAI/mediflow-360/resolve/main/script.js
- Command line
-
hf download hf://spaces/ShoaibAI/mediflow-360/script.js
-
curl -L -o script.js https://huggingface.co/spaces/ShoaibAI/mediflow-360/resolve/main/script.js
2.2 kB
| // Shared functions across all pages | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Initialize modals | |
| const authModal = document.querySelector('auth-modal'); | |
| // Role selection handling | |
| const roleCards = document.querySelectorAll('.role-card'); | |
| if (roleCards.length > 0) { | |
| roleCards.forEach(card => { | |
| card.addEventListener('click', function(e) { | |
| e.preventDefault(); | |
| authModal.setAttribute('role', this.getAttribute('href').replace('.html', '').replace('/', '')); | |
| authModal.setAttribute('open', 'true'); | |
| }); | |
| }); | |
| } | |
| // Initialize tooltips | |
| const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); | |
| tooltipTriggerList.map(function (tooltipTriggerEl) { | |
| return new bootstrap.Tooltip(tooltipTriggerEl); | |
| }); | |
| }); | |
| // Data storage simulation | |
| const mockDatabase = { | |
| users: [ | |
| { id: 1, name: "Admin User", role: "admin", email: "admin@clinicflow.com" }, | |
| { id: 2, name: "Receptionist", role: "receptionist", email: "reception@clinicflow.com" }, | |
| { id: 3, name: "Dr. Smith", role: "doctor", email: "doctor@clinicflow.com" }, | |
| { id: 4, name: "Pathologist", role: "pathologist", email: "path@clinicflow.com" }, | |
| { id: 5, name: "John Patient", role: "patient", email: "patient@example.com" } | |
| ], | |
| patients: [ | |
| { id: 1, name: "John Doe", age: 35, gender: "male", contact: "1234567890" }, | |
| { id: 2, name: "Jane Smith", age: 28, gender: "female", contact: "9876543210" } | |
| ], | |
| consultations: [ | |
| { id: 1, patientId: 1, doctorId: 3, notes: "Patient complains of headache", date: "2023-05-15" } | |
| ], | |
| tests: [ | |
| { id: 1, patientId: 1, consultationId: 1, type: "Blood Test", status: "pending", result: "" } | |
| ] | |
| }; | |
| // Utility functions | |
| function getCurrentUser() { | |
| return JSON.parse(localStorage.getItem('currentUser')) || null; | |
| } | |
| function setCurrentUser(user) { | |
| localStorage.setItem('currentUser', JSON.stringify(user)); | |
| } | |
| function logout() { | |
| localStorage.removeItem('currentUser'); | |
| window.location.href = 'index.html'; | |
| } |