diff --git a/driverapp/driverapp.ino b/driverapp/driverapp.ino new file mode 100644 index 00000000..9e5e7ab4 --- /dev/null +++ b/driverapp/driverapp.ino @@ -0,0 +1,52 @@ +#include +#include + +// node 2 +#define WIFI_SSID "Manthan's M32" +#define WIFI_PASSWORD "oofv3260" +#define FIREBASE_HOST "https://nodemcudata-6c3df-default-rtdb.firebaseio.com" +#define FIREBASE_AUTH "uWoTgIoe822SwLuAITqXakrsTRNSt4EmXDo66MIN" + + +FirebaseData fbData; +FirebaseAuth auth; +FirebaseConfig config; + +#define GREEN_LED D8 + +void setup() { + Serial.begin(115200); + WiFi.begin(WIFI_SSID, WIFI_PASSWORD); + Serial.print("Connecting to WiFi"); + + while (WiFi.status() != WL_CONNECTED) { + delay(500); + Serial.print("."); + } + + Serial.println("\nConnected to WiFi"); + + // Firebase Setup + config.host = FIREBASE_HOST; + config.signer.tokens.legacy_token = FIREBASE_AUTH; + Firebase.begin(&config, &auth); + + pinMode(GREEN_LED, OUTPUT); + digitalWrite(GREEN_LED, LOW); +} + +void loop() { + if (Firebase.getInt(fbData, "/device1/status")) { + int status = fbData.intData(); + if (status == 1) { + digitalWrite(GREEN_LED, HIGH); + Serial.println("🚦 NodeMCU 1 is near! Turning on LED."); + } else { + digitalWrite(GREEN_LED, LOW); // Turn off Green Light + } + } else { + Serial.println("❌ Error fetching data from Firebase"); + } + + delay(3000); // Check every 3 seconds +} diff --git a/espredlight/espredlight.ino b/espredlight/espredlight.ino new file mode 100644 index 00000000..89171f39 --- /dev/null +++ b/espredlight/espredlight.ino @@ -0,0 +1,9 @@ +void setup() { + Serial.begin(115200); + Serial.println("Hello, NodeMCU!"); +} + +void loop() { + Serial.println("Running..."); + delay(1000); +} diff --git a/node1/node1.ino b/node1/node1.ino new file mode 100644 index 00000000..6cb9daa0 --- /dev/null +++ b/node1/node1.ino @@ -0,0 +1,39 @@ +#include +#include + +// WiFi & Firebase Credentials +#define WIFI_SSID "Manthan's M32" +#define WIFI_PASSWORD "oofv3260" +#define FIREBASE_HOST "https://nodemcudata-6c3df-default-rtdb.firebaseio.com" // 🔸 Replace with Firebase URL +#define FIREBASE_AUTH "uWoTgIoe822SwLuAITqXakrsTRNSt4EmXDo66MIN" // 🔸 Replace with Firebase Secret Key + +FirebaseData fbData; +FirebaseAuth auth; +FirebaseConfig config; + +void setup() { + Serial.begin(115200); + WiFi.begin(WIFI_SSID, WIFI_PASSWORD); + Serial.print("Connecting to WiFi"); + + while (WiFi.status() != WL_CONNECTED) { + delay(500); + Serial.print("."); + } + + Serial.println("\nConnected to WiFi"); + + // Firebase Setup + config.host = FIREBASE_HOST; + config.signer.tokens.legacy_token = FIREBASE_AUTH; + Firebase.begin(&config, &auth); + + // Upload "1" when the device is present + Firebase.setInt(fbData, "/device1/status", 1); +} + +void loop() { + // Keep updating presence + Firebase.setInt(fbData, "/device1/status", 1); + delay(5000); // Update every 5 seconds +} diff --git a/rapidmedx/4amb.css b/rapidmedx/4amb.css new file mode 100644 index 00000000..164ce6c9 --- /dev/null +++ b/rapidmedx/4amb.css @@ -0,0 +1,79 @@ +body { + font-family: sans-serif; + background-color: #f4f4f4; + margin: 0; + padding: 20px; +} + +.container { + max-width: 900px; + margin: 0 auto; + background-color: #fff; + padding: 20px; + border-radius: 8px; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); +} + +h1 { + text-align: center; + margin-bottom: 20px; +} + +.ambulance-list { + display: flex; + flex-wrap: wrap; + justify-content: space-around; +} + +.ambulance { + width: 250px; /* Adjust as needed */ + margin-bottom: 20px; + border: 1px solid #ddd; + border-radius: 8px; + overflow: hidden; /* Make sure image doesn't overflow rounded corners */ +} + +.ambulance img { + width: 100%; + height: auto; /* Maintain aspect ratio */ + display: block; +} + +.ambulance-info { + padding: 10px; + text-align: center; +} + +.badge { + display: inline-block; + padding: 5px 10px; + border-radius: 5px; + font-weight: bold; + text-transform: uppercase; + font-size: 0.8em; +} + +.badge.active { + background-color: #4CAF50; /* Green */ + color: white; +} + +.badge.inactive { + background-color: #f44336; /* Red */ + color: white; +} + +button { + background-color: #007bff; + color: white; + padding: 10px 15px; + border: none; + border-radius: 4px; + cursor: pointer; + display: block; + margin: 10px auto; +} + +button:hover { + background-color: #0056b3; +} \ No newline at end of file diff --git a/rapidmedx/4amb.html b/rapidmedx/4amb.html new file mode 100644 index 00000000..269de6d9 --- /dev/null +++ b/rapidmedx/4amb.html @@ -0,0 +1,72 @@ + + + + + + Ambulance Status + + + + + +
+

Ambulance Fleet Status

+ +
+
+ Ambulance 1 +
+

Ambulance 1

+ Active +
+
+ +
+ Ambulance 2 +
+

Ambulance 2

+ Non-Active +
+
+ +
+ Ambulance 3 +
+

Ambulance 3

+ Active +
+
+ +
+ Ambulance 4 +
+

Ambulance 4

+ Non-Active +
+
+
+ + + + + + +
+ + + + + \ No newline at end of file diff --git a/rapidmedx/index.html b/rapidmedx/index.html new file mode 100644 index 00000000..fad0e119 --- /dev/null +++ b/rapidmedx/index.html @@ -0,0 +1,82 @@ + + + + + + Login Page + + + + + + + + +
+
+ +

RapidMedX

+
+ +

Login

+
+
+ + +
+
+ + +
+ +
+ + +
+ + + + \ No newline at end of file diff --git a/rapidmedx/loginstyle.css b/rapidmedx/loginstyle.css new file mode 100644 index 00000000..1f5a8893 --- /dev/null +++ b/rapidmedx/loginstyle.css @@ -0,0 +1,88 @@ +body { + font-family: sans-serif; + background-color: #f4f4f4; + margin: 0; + display: flex; + justify-content: center; + align-items: center; + min-height: 100vh; +} + +.container { + background-color: #fff; + padding: 20px; + border-radius: 8px; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); + width: 300px; + text-align: center; +} + +.company-info { + margin-bottom: 20px; +} + +.logo { + width: 100px; + height: auto; + margin-bottom: 10px; +} + +.company-info h1 { + font-size: 1.5em; + color: #333; + margin: 0; +} + +.container h2 { + margin-bottom: 20px; + color: #333; +} + +.form-group { + margin-bottom: 15px; + text-align: left; +} + +.form-group label { + display: block; + margin-bottom: 5px; + font-weight: bold; +} + +.form-group input[type="email"], +.form-group input[type="password"] { + width: 100%; + padding: 8px; + border: 1px solid #ccc; + border-radius: 4px; + box-sizing: border-box; /* Important: Include padding and border in element's total width and height */ +} + +button { + background-color: #4CAF50; + color: white; + padding: 10px 15px; + border: none; + border-radius: 4px; + cursor: pointer; + width: 100%; + font-size: 16px; +} + +button:hover { + background-color: #3e8e41; +} + +.options { + margin-top: 15px; +} + +.options a { + margin: 0 10px; + text-decoration: none; + color: #007bff; +} + +.options a:hover { + text-decoration: underline; +} \ No newline at end of file diff --git a/rapidmedx/one_tap_booking.css b/rapidmedx/one_tap_booking.css new file mode 100644 index 00000000..7fe0585a --- /dev/null +++ b/rapidmedx/one_tap_booking.css @@ -0,0 +1,118 @@ +body { + font-family: sans-serif; + background-color: #f4f4f4; + margin: 0; + padding: 20px; +} + +.container { + max-width: 600px; + margin: 0 auto; + background-color: #fff; + padding: 20px; + border-radius: 8px; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); + text-align: center; +} + +h1 { + margin-bottom: 20px; + color: #333; /* Dark gray */ +} + + +#dummyMap { + height: 300px; + width: 100%; + margin-top: 20px; + border: 1px solid #ddd; + border-radius: 5px; +} + +#locationStatus { + margin-top: 20px; + padding: 10px; + border: 1px solid #ddd; + border-radius: 5px; + background-color: #f9f9f9; + color: #555; +} + +button { + background-color: #28a745; + color: white; + padding: 15px 30px; + border: none; + border-radius: 8px; + cursor: pointer; + font-size: 1.2em; + font-weight: bold; + margin-top: 20px; + transition: background-color 0.2s ease; +} + +button:hover { + background-color: #218838; +} + +button:disabled { + background-color: #aaa; + cursor: not-allowed; +} + +#map { + height: 300px; + width: 100%; + margin-top: 20px; + border: 1px solid #ddd; + border-radius: 5px; +} + +#nearestAmbulanceInfo { + margin-top: 20px; + padding: 10px; + border: 1px solid #ddd; + border-radius: 5px; + background-color: #f9f9f9; + color: #555; +} + +#confirmationMessage { + margin-top: 20px; + padding: 15px; + background-color: #d4edda; + color: #155724; + border: 1px solid #c3e6cb; + border-radius: 5px; +} + +.hidden { + display: none; +} + +@media (max-width: 768px) { + .container { + padding: 15px; + } + + button { + padding: 12px 24px; + font-size: 1em; + } +} + +#signOutButton { + background-color: #dc3545; + color: white; + padding: 10px 15px; + border: none; + border-radius: 4px; + cursor: pointer; + margin-top: 20px; + font-size: 1em; + transition: background-color 0.2s ease; +} + +#signOutButton:hover { + background-color: #c82333; +} \ No newline at end of file diff --git a/rapidmedx/one_tap_booking.html b/rapidmedx/one_tap_booking.html new file mode 100644 index 00000000..749c1129 --- /dev/null +++ b/rapidmedx/one_tap_booking.html @@ -0,0 +1,278 @@ + + + + + + One-Tap Ambulance Booking + + + + + + + + + + + + +
+

One-Tap Ambulance Booking

+ +
+

Getting your location...

+
+ + + + + + + + + + + + + + +
+ + + + + + \ No newline at end of file diff --git a/rapidmedx/onetap.css b/rapidmedx/onetap.css new file mode 100644 index 00000000..0c088747 --- /dev/null +++ b/rapidmedx/onetap.css @@ -0,0 +1,62 @@ +body { + font-family: sans-serif; + background-color: #f4f4f4; + margin: 0; + padding: 20px; +} + +.container { + max-width: 600px; + margin: 0 auto; + background-color: #fff; + padding: 20px; + border-radius: 8px; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); + text-align: center; +} + +h1 { + margin-bottom: 20px; +} + +button { + background-color: #dc3545; + color: white; + padding: 15px 30px; + border: none; + border-radius: 8px; + cursor: pointer; + font-size: 1.2em; + font-weight: bold; + margin-top: 20px; +} + +button:hover { + background-color: #c82333; +} + +button:disabled { + background-color: #6c757d; /* Greyed out when disabled */ + cursor: not-allowed; +} + +#nearestAmbulanceInfo { + margin-top: 20px; + padding: 10px; + border: 1px solid #ccc; + border-radius: 5px; + background-color: #f9f9f9; +} + +#confirmationMessage { + margin-top: 20px; + padding: 10px; + background-color: #d4edda; /* Light green for success */ + color: #155724; /* Dark green text */ + border: 1px solid #c3e6cb; + border-radius: 5px; +} + +.hidden { + display: none; +} \ No newline at end of file diff --git a/rapidmedx/onetap.html b/rapidmedx/onetap.html new file mode 100644 index 00000000..ee306a98 --- /dev/null +++ b/rapidmedx/onetap.html @@ -0,0 +1,181 @@ + + + + + + One-Tap Ambulance Booking + + + + + + + + + + + +
+

One-Tap Ambulance Booking

+ +
+

Getting your location...

+
+ + + + + + + + +
+ + + + + \ No newline at end of file diff --git a/rapidmedx/rapidmedxlogo.png b/rapidmedx/rapidmedxlogo.png new file mode 100644 index 00000000..e65dc8aa Binary files /dev/null and b/rapidmedx/rapidmedxlogo.png differ diff --git a/rapidmedx/signup.html b/rapidmedx/signup.html new file mode 100644 index 00000000..32d994a3 --- /dev/null +++ b/rapidmedx/signup.html @@ -0,0 +1,92 @@ + + + + + + Sign Up + + + + + + + + + + + + + + +
+

Sign Up

+
+
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+ + + + \ No newline at end of file diff --git a/rapidmedxdashboard/dashboard.html b/rapidmedxdashboard/dashboard.html new file mode 100644 index 00000000..92099e48 --- /dev/null +++ b/rapidmedxdashboard/dashboard.html @@ -0,0 +1,97 @@ + + + + + + Ambulance Management Dashboard + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rapidmedxdashboard/firebase-config.js b/rapidmedxdashboard/firebase-config.js new file mode 100644 index 00000000..5b12aa50 --- /dev/null +++ b/rapidmedxdashboard/firebase-config.js @@ -0,0 +1,22 @@ +// Import the functions you need from the SDKs you need +import { initializeApp } from "firebase/app"; +import { getAnalytics } from "firebase/analytics"; +// TODO: Add SDKs for Firebase products that you want to use +// https://firebase.google.com/docs/web/setup#available-libraries + +// Your web app's Firebase configuration +// For Firebase JS SDK v7.20.0 and later, measurementId is optional +const firebaseConfig = { + apiKey: "AIzaSyCafSPq3aWUIsbnEpCILfk5yMwq6GssIyg", + authDomain: "rapidmedxdash123.firebaseapp.com", + databaseURL: "https://rapidmedxdash123-default-rtdb.firebaseio.com", + projectId: "rapidmedxdash123", + storageBucket: "rapidmedxdash123.firebasestorage.app", + messagingSenderId: "911953243493", + appId: "1:911953243493:web:f6bdeb2240c5962293058c", + measurementId: "G-045HBMXKTZ" +}; + +// Initialize Firebase +const app = initializeApp(firebaseConfig); +const analytics = getAnalytics(app); \ No newline at end of file diff --git a/rapidmedxdashboard/index.html b/rapidmedxdashboard/index.html new file mode 100644 index 00000000..1ba0d6b2 --- /dev/null +++ b/rapidmedxdashboard/index.html @@ -0,0 +1,90 @@ + + + + + + Ambulance Management Dashboard + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rapidmedxdashboard/script.js b/rapidmedxdashboard/script.js new file mode 100644 index 00000000..a43fe2df --- /dev/null +++ b/rapidmedxdashboard/script.js @@ -0,0 +1,274 @@ +let firebaseApp; +try { + firebaseApp = firebase.initializeApp(firebaseConfig); +} catch (e) { + console.error("Firebase initialization error:", e.message); + alert("Firebase initialization failed. Check your configuration."); +} + +let auth; +let db; +if (firebaseApp) { + auth = firebase.auth(); + db = firebase.firestore(); +} + +let currentUser = null; +let map; +let ambulanceMarkers = {}; + +const loginSignupContainer = document.getElementById('loginSignup'); +const dashboardContainer = document.getElementById('dashboard'); +const loginForm = document.getElementById('loginForm'); +const signupForm = document.getElementById('signupForm'); +const showSignupLink = document.getElementById('showSignup'); +const showLoginLink = document.getElementById('showLogin'); + +const loginError = document.getElementById('loginError'); +const signupError = document.getElementById('signupError'); + +function show(elementId) { + document.getElementById(elementId).style.display = 'block'; +} + +function hide(elementId) { + document.getElementById(elementId).style.display = 'none'; +} + +showSignupLink.addEventListener('click', (e) => { + e.preventDefault(); + hide('loginForm'); + show('signupForm'); + loginError.textContent = ''; +}); + +showLoginLink.addEventListener('click', (e) => { + e.preventDefault(); + hide('signupForm'); + show('loginForm'); + signupError.textContent = ''; +}); + +loginForm.addEventListener('submit', (e) => { + e.preventDefault(); + const email = document.getElementById('loginEmail').value; + const password = document.getElementById('loginPassword').value; + + loginError.textContent = ''; + + if (!auth) { + loginError.textContent = "Firebase not initialized. Check config."; + return; + } + + auth.signInWithEmailAndPassword(email, password) + .then((userCredential) => { + currentUser = userCredential.user; // Store the user + updateUI(currentUser); + }) + .catch((error) => { + console.error("Login error:", error.code, error.message); // Log to console for debugging + loginError.textContent = error.message; // Display to user + }); +}); + +signupForm.addEventListener('submit', (e) => { + e.preventDefault(); + const email = document.getElementById('signupEmail').value; + const password = document.getElementById('signupPassword').value; + + signupError.textContent = ''; + + if (!auth) { + signupError.textContent = "Firebase not initialized. Check config."; + return; + } + + if (!email || !password) { + signupError.textContent = "Email and password are required."; + return; + } + + console.log("Attempting signup with:", email, password); // Debugging + auth.createUserWithEmailAndPassword(email, password) + .then((userCredential) => { + currentUser = userCredential.user; + console.log("Signup successful!", currentUser); + updateUI(currentUser); + }) + .catch((error) => { + console.error("Signup error:", error.code, error.message); + signupError.textContent = error.message; + }); +}); + +const logoutBtn = document.getElementById('logoutBtn'); +logoutBtn.addEventListener('click', () => { + if (!auth) return; + + auth.signOut() + .then(() => { + currentUser = null; + updateUI(null); + }) + .catch(error => { + console.error("Logout error:", error); + }); +}); + +function updateUI(user) { + if (user) { + hide('loginSignup'); + show('dashboard'); + initializeMap(); + + loadAmbulanceData(); + } else { + show('loginSignup'); + hide('dashboard'); + if (map) { + map.remove(); + map = null; + } + } +} + +// --- Ambulance Data (PLACEHOLDER) --- +const totalAmbulancesEl = document.getElementById('totalAmbulances'); +const activeAmbulancesEl = document.getElementById('activeAmbulances'); +const inactiveAmbulancesEl = document.getElementById('inactiveAmbulances'); +const ambulanceDetailsSection = document.getElementById('ambulanceDetailsSection'); +const ambulanceIdEl = document.getElementById('ambulanceId'); +const ambulanceStatusEl = document.getElementById('ambulanceStatus'); +const ambulanceDriverEl = document.getElementById('ambulanceDriver'); +const patientNameEl = document.getElementById('patientName'); +const pickupLocationEl = document.getElementById('pickupLocation'); +const dropoffLocationEl = document.getElementById('dropoffLocation'); +const ambulanceHistoryEl = document.getElementById('ambulanceHistory'); +const stopRouteButton = document.getElementById('stopRouteButton'); + +let ambulanceData = [ + { id: '1', ambulanceId: 'A001', status: 'active', location: { lat: 34.0522, lng: -118.2437 }, driver: 'John Doe', patient: 'Alice Smith', pickup: 'Hospital A', dropoff: 'Home' }, + { id: '2', ambulanceId: 'A002', status: 'inactive', location: { lat: 37.7749, lng: -122.4194 }, driver: 'Jane Smith', patient: null, pickup: null, dropoff: null }, + { id: '3', ambulanceId: 'A003', status: 'active', location: { lat: 40.7128, lng: -74.0060 }, driver: 'Mike Brown', patient: 'Bob Johnson', pickup: 'Accident Site', dropoff: 'Hospital B' }, + { id: '4', ambulanceId: 'A004', status: 'inactive', location: { lat: 41.8781, lng: -87.6298 }, driver: 'Emily Davis', patient: null, pickup: null, dropoff: null }, +]; + +let ambulanceHistoryData = { + 'A001': [ + { timestamp: '2024-01-26 10:00', event: 'Dispatched to Hospital A' }, + { timestamp: '2024-01-26 10:30', event: 'Arrived at Hospital A' }, + { timestamp: '2024-01-26 11:00', event: 'En route to Home' }, + ], + 'A002': [], + 'A003': [ + { timestamp: '2024-01-26 14:00', event: 'Dispatched to Accident Site' }, + { timestamp: '2024-01-26 14:45', event: 'Arrived at Accident Site' }, + { timestamp: '2024-01-26 15:30', event: 'En route to Hospital B' }, + ], + 'A004': [], +}; + +function initializeMap() { + if (!document.getElementById('map')) { + console.error("Map container not found."); + return; + } + + map = L.map('map').setView([0, 0], 2); // Default view + + L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { + maxZoom: 19, + attribution: '© OpenStreetMap' + }).addTo(map); + + updateAmbulanceMarkers(); +} +function updateAmbulanceMarkers() { + if (!map) return; + + ambulanceData.forEach(ambulance => { + if (!ambulance.location) return; + + const ambulanceId = ambulance.ambulanceId; + if (ambulanceMarkers[ambulanceId]) { + ambulanceMarkers[ambulanceId].setLatLng([ambulance.location.lat, ambulance.location.lng]); + } else { + // Create a marker if it doesn't exist + const marker = L.marker([ambulance.location.lat, ambulance.location.lng]).addTo(map); + marker.bindPopup(`${ambulanceId}
Status: ${ambulance.status}
`); + ambulanceMarkers[ambulanceId] = marker; + } + }); + addClickHandlers(); +} + +function loadAmbulanceData() { + if (!db) { + console.warn("Firestore not initialized. Cannot load ambulance data."); + return; + } + + totalAmbulancesEl.textContent = ambulanceData.length; + activeAmbulancesEl.textContent = ambulanceData.filter(a => a.status === 'active').length; + inactiveAmbulancesEl.textContent = ambulanceData.filter(a => a.status === 'inactive').length; +} +// Event listener for the dynamically created button +function addClickHandlers() { + document.querySelectorAll('.show-details-btn').forEach(button => { + button.addEventListener('click', function() { + const ambulanceId = this.dataset.ambulanceId; + showAmbulanceDetails(ambulanceId); + }); + }); +} +function showAmbulanceDetails(ambulanceId) { + console.log('Showing details for ambulance:', ambulanceId); + const ambulance = ambulanceData.find(a => a.ambulanceId === ambulanceId); + + if (ambulance) { + ambulanceIdEl.textContent = ambulance.ambulanceId; + ambulanceStatusEl.textContent = ambulance.status; + ambulanceDriverEl.textContent = ambulance.driver || "N/A"; + patientNameEl.textContent = ambulance.patient || "N/A"; + pickupLocationEl.textContent = ambulance.pickup || "N/A"; + dropoffLocationEl.textContent = ambulance.dropoff || "N/A"; + renderAmbulanceHistory(ambulanceId); + + show('ambulanceDetailsSection'); // Show the ambulance details section + // Center the map on ambulance location + if (ambulance.location && map) { + map.setView([ambulance.location.lat, ambulance.location.lng], 13); + } + } else { + console.warn("Ambulance not found:", ambulanceId); + } +} + +function renderAmbulanceHistory(ambulanceId) { + ambulanceHistoryEl.innerHTML = ''; // Clear previous history + + const history = ambulanceHistoryData[ambulanceId] || []; + + history.forEach(item => { + const li = document.createElement('li'); + li.textContent = `${item.timestamp}: ${item.event}`; + ambulanceHistoryEl.appendChild(li); + }); +} + +stopRouteButton.addEventListener('click', () => { + //Implement logic to stop the route + console.log('Stop route button clicked!'); + alert('Route stopped!'); +}); + +// Initial check for logged-in user on page load +if (auth) { + auth.onAuthStateChanged(user => { + currentUser = user; + updateUI(user); + }); +} else { + console.warn("Authentication is not initialized. The page might not function correctly"); +} \ No newline at end of file diff --git a/rapidmedxdashboard/style.css b/rapidmedxdashboard/style.css new file mode 100644 index 00000000..1eac54fb --- /dev/null +++ b/rapidmedxdashboard/style.css @@ -0,0 +1,137 @@ +body { + font-family: sans-serif; + margin: 0; + padding: 0; + background-color: #f4f4f4; +} + +.login-signup-container { + width: 300px; + margin: 50px auto; + padding: 20px; + background-color: #fff; + border-radius: 5px; + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); +} + +.login-signup-container h2 { + text-align: center; + margin-bottom: 20px; +} + +.login-signup-container form { + display: flex; + flex-direction: column; +} + +.login-signup-container input { + padding: 10px; + margin-bottom: 10px; + border: 1px solid #ccc; + border-radius: 4px; +} + +.login-signup-container button { + padding: 10px; + background-color: #007bff; + color: white; + border: none; + border-radius: 4px; + cursor: pointer; +} + +.login-signup-container button:hover { + background-color: #0056b3; +} + +.login-signup-container a { + text-decoration: none; + color: #007bff; +} + +.dashboard-container { + width: 90%; + max-width: 1200px; + margin: 20px auto; + padding: 20px; + background-color: #fff; + border-radius: 5px; + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); +} + +header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 20px; +} + +header h1 { + margin: 0; +} + +header button { + padding: 10px 15px; + background-color: #dc3545; + color: white; + border: none; + border-radius: 4px; + cursor: pointer; +} + +header button:hover { + background-color: #c82333; +} + +.overview { + display: flex; + justify-content: space-around; + margin-bottom: 20px; +} + +.card { + background-color: #f9f9f9; + padding: 20px; + border-radius: 5px; + text-align: center; +} + +.error-message { + color: red; + margin-top: 5px; +} + +/* Map Styles */ +.map-section { + margin-bottom: 20px; +} + +#map { + height: 400px; /* Adjust as needed */ + border: 1px solid #ccc; +} + +/* Ambulance Details Section */ +.ambulance-details { + padding: 20px; + background-color: #f9f9f9; + border-radius: 5px; + margin-bottom: 20px; +} + +.ambulance-details h3 { + margin-top: 10px; +} + +.ambulance-details ul { + list-style: none; + padding: 0; +} + +.ambulance-details li { + margin-bottom: 5px; +} + +.map-section{ + padding: 20px; +} \ No newline at end of file diff --git a/rapidmedxdriver/rapidmedx/driver.css b/rapidmedxdriver/rapidmedx/driver.css new file mode 100644 index 00000000..672c36f1 --- /dev/null +++ b/rapidmedxdriver/rapidmedx/driver.css @@ -0,0 +1,96 @@ +body { + font-family: sans-serif; + margin: 0; + padding: 0; + background-color: #ba3939; + color: #000000; + } + + header, footer { + background-color: #333; + color: #fff; + text-align: center; + padding: 1em 0; + } + + main { + padding: 20px; + } + + section { + margin-bottom: 20px; + padding: 15px; + background-color: #f6ebeb; + border: 1px solid #e3e3e3; + border-radius: 5px; + } + + .hidden { + display: none; + } + + #booking-list { + list-style: none; + padding: 0; + } + + #booking-list li { + margin-bottom: 10px; + padding: 10px; + border: 1px solid #ccc; + border-radius: 5px; + display: flex; + justify-content: space-between; + align-items: center; + } + + #booking-list li button { + background-color: #4CAF50; + color: white; + padding: 8px 12px; + border: none; + border-radius: 4px; + cursor: pointer; + } + + #map-container { + height: 400px; + width: 100%; + border: 1px solid #ccc; + border-radius: 5px; + } + + #login-section { + max-width: 400px; + margin: 0 auto; + } + + #login-form { + display: flex; + flex-direction: column; + } + + #login-form label { + margin-bottom: 5px; + } + + #login-form input { + padding: 8px; + margin-bottom: 10px; + border: 1px solid #ccc; + border-radius: 4px; + } + + #login-form button { + background-color: #db3434; + color: white; + padding: 10px 15px; + border: none; + border-radius: 4px; + cursor: pointer; + } + + .error-message { + color: red; + margin-top: 5px; + } \ No newline at end of file diff --git a/rapidmedxdriver/rapidmedx/driver.js b/rapidmedxdriver/rapidmedx/driver.js new file mode 100644 index 00000000..706caf61 --- /dev/null +++ b/rapidmedxdriver/rapidmedx/driver.js @@ -0,0 +1,143 @@ +const loginForm = document.getElementById('login-form'); +const bookingSection = document.getElementById('booking-section'); +const mapSection = document.getElementById('map-section'); +const locationSection = document.getElementById('location-section'); +const bookingList = document.getElementById('booking-list'); + +let driverLat = 34.0522; +let driverLng = -118.2437; + +const bookings = [ + { + patientName: "Alice Smith", + pickupLocation: { + latitude: 34.0622, + longitude: -118.2337, + address: "456 Elm St, Los Angeles, CA" + }, + dropoffLocation: { + latitude: 34.1111, + longitude: -118.3000, + address: "789 Oak Ave, Los Angeles, CA" + }, + urgency: "Medium", + bookingId: "BOOK54321" + }, + { + patientName: "Bob Johnson", + pickupLocation: { + latitude: 34.0888, + longitude: -118.2666, + address: "101 Pine Ln, Los Angeles, CA" + }, + dropoffLocation: { + latitude: 34.1333, + longitude: -118.3666, + address: "112 Maple Dr, Los Angeles, CA" + }, + urgency: "High", + bookingId: "BOOK98765" + } +]; + +function populateBookings() { + bookingList.innerHTML = ''; + + bookings.forEach(booking => { + const li = document.createElement('li'); + li.innerHTML = ` + ${booking.patientName} - ${booking.pickupLocation.address} (${booking.urgency}) + + `; + bookingList.appendChild(li); + }); +} + +function acceptBooking(bookingId) { + alert(`Booking ${bookingId} Accepted! Navigation starting...`); + mapSection.classList.remove('hidden'); + locationSection.classList.remove('hidden'); + initializeMap(driverLat, driverLng, + bookings.find(booking => booking.bookingId === bookingId).pickupLocation.latitude, + bookings.find(booking => booking.bookingId === bookingId).pickupLocation.longitude, + bookings.find(booking => booking.bookingId === bookingId).dropoffLocation.latitude, + bookings.find(booking => booking.bookingId === bookingId).dropoffLocation.longitude); +} + +loginForm.addEventListener('submit', function(event) { + event.preventDefault(); + alert("Login Successful!"); + document.getElementById('login-section').classList.add('hidden'); + bookingSection.classList.remove('hidden'); + populateBookings(); + + document.getElementById('latitude').textContent = driverLat.toFixed(4); + document.getElementById('longitude').textContent = driverLng.toFixed(4); + + locationSection.classList.remove('hidden'); +}); + +let map; +let routingControl; + +function initializeMap(driverLat, driverLng, pickupLat, pickupLng, dropoffLat, dropoffLng) { + if (map) { + map.remove(); + } + + map = L.map('map-container').setView([driverLat, driverLng], 13); + + L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { + attribution: '© OpenStreetMap contributors' + }).addTo(map); + + const driverMarker = L.marker([driverLat, driverLng]).addTo(map).bindPopup('Your Location (Ambulance)'); + const pickupMarker = L.marker([pickupLat, pickupLng]).addTo(map).bindPopup('Pickup Location'); + const dropoffMarker = L.marker([dropoffLat, dropoffLng]).addTo(map).bindPopup('Dropoff Location'); + + + routingControl = L.Routing.control({ + waypoints: [ + L.latLng(driverLat, driverLng), + L.latLng(pickupLat, pickupLng), + L.latLng(dropoffLat, dropoffLng) + ], + routeWhileDragging: false, + showAlternatives: false, + createMarker: function(i, waypoint, numberOfWaypoints) { + if (i === 0) { + return driverMarker; + } else if (i === 1) { + return pickupMarker; + } else { + return dropoffMarker; + } + } + + }).addTo(map); + + + routingControl.on('routesfound', function (e) { + const routes = e.routes; + const summary = routes[0].summary; + console.log('Total distance: ' + summary.totalDistance / 1000 + ' km'); + console.log('Total time: ' + Math.round(summary.totalTime / 60) + ' minutes'); + + const instructions = routes[0].instructions; + const instructionsList = document.getElementById('instructions-list'); + instructionsList.innerHTML = ''; + + instructions.forEach(instruction => { + const li = document.createElement('li'); + li.textContent = instruction.text; + instructionsList.appendChild(li); + }); + }); + + + routingControl.on('routingerror', function(e) { + console.error("Routing error:", e); + alert("Could not find a route. Please check the locations."); + }); + +} \ No newline at end of file diff --git a/rapidmedxdriver/rapidmedx/driverindex1.html b/rapidmedxdriver/rapidmedx/driverindex1.html new file mode 100644 index 00000000..0dc9270a --- /dev/null +++ b/rapidmedxdriver/rapidmedx/driverindex1.html @@ -0,0 +1,70 @@ + + + + Ambulance Driver Dashboard (Firebase) + + + + + + + +
+

RapidMedX (Partner)

+
+ +
+
+

Driver Login

+
+ +

+ + +

+ + +

+
+
+ + + + + + +
+ +
+

© 2025 RapidMedX

+
+ + + + + + + + + \ No newline at end of file diff --git a/rapidmedxdriver/rapidmedx/index.html b/rapidmedxdriver/rapidmedx/index.html new file mode 100644 index 00000000..fad0e119 --- /dev/null +++ b/rapidmedxdriver/rapidmedx/index.html @@ -0,0 +1,82 @@ + + + + + + Login Page + + + + + + + + +
+
+ +

RapidMedX

+
+ +

Login

+
+
+ + +
+
+ + +
+ +
+ + +
+ + + + \ No newline at end of file diff --git a/rapidmedxdriver/rapidmedx/loginstyle.css b/rapidmedxdriver/rapidmedx/loginstyle.css new file mode 100644 index 00000000..14418cff --- /dev/null +++ b/rapidmedxdriver/rapidmedx/loginstyle.css @@ -0,0 +1,88 @@ +body { + font-family: sans-serif; + background-color: #f4f4f4; + margin: 0; + display: flex; + justify-content: center; + align-items: center; + min-height: 100vh; +} + +.container { + background-color: #fff; + padding: 20px; + border-radius: 8px; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); + width: 300px; + text-align: center; +} + +.company-info { + margin-bottom: 20px; +} + +.logo { + width: 100px; /* Adjust as needed */ + height: auto; + margin-bottom: 10px; +} + +.company-info h1 { + font-size: 1.5em; + color: #333; /* Dark Gray */ + margin: 0; +} + +.container h2 { + margin-bottom: 20px; + color: #333; +} + +.form-group { + margin-bottom: 15px; + text-align: left; +} + +.form-group label { + display: block; + margin-bottom: 5px; + font-weight: bold; +} + +.form-group input[type="email"], +.form-group input[type="password"] { + width: 100%; + padding: 8px; + border: 1px solid #ccc; + border-radius: 4px; + box-sizing: border-box; /* Important: Include padding and border in element's total width and height */ +} + +button { + background-color: #4CAF50; + color: white; + padding: 10px 15px; + border: none; + border-radius: 4px; + cursor: pointer; + width: 100%; + font-size: 16px; +} + +button:hover { + background-color: #3e8e41; +} + +.options { + margin-top: 15px; +} + +.options a { + margin: 0 10px; + text-decoration: none; + color: #007bff; +} + +.options a:hover { + text-decoration: underline; +} \ No newline at end of file diff --git a/rapidmedxdriver/rapidmedx/rapidmedxlogo.png b/rapidmedxdriver/rapidmedx/rapidmedxlogo.png new file mode 100644 index 00000000..e65dc8aa Binary files /dev/null and b/rapidmedxdriver/rapidmedx/rapidmedxlogo.png differ diff --git a/rapidmedxdriver/rapidmedx/signup.html b/rapidmedxdriver/rapidmedx/signup.html new file mode 100644 index 00000000..0dc0cf2e --- /dev/null +++ b/rapidmedxdriver/rapidmedx/signup.html @@ -0,0 +1,85 @@ + + + + + + Sign Up + + + + + + + + + + + + +
+

Sign Up

+
+
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+ + + + \ No newline at end of file