LOVE CARE GLOBAL
How It Works β€” Updated Oct 28, 2026 β€” ONLINE Nurses Only
🟒 Book ONLINE NurseHome

πŸ“‹ How It Works β€” LOVE CARE GLOBAL HOME NURSING

Simple 4-step system: Client books β†’ ONLINE Nurse selected β†’ Nurse accepts β†’ Nurse navigates to PATIENT (not just client) β†’ Care starts. Works for family bookings across cities (Accra client booking for mother in Kumasi).

🟒 ONLY ONLINE Nurses ShowπŸ’° Full & 50% Payment🎡 Custom Tone + SMS Alerts🧭 Navigate to PATIENT

πŸ‘©β€βš•οΈ FOR NURSES β€” How to Appear & Get Bookings

Step 1: Register & Save Your Details β€” Name Photo Email Phone + Time

Go to nurse-register.html β†’ nurse-login.html β†’ nurses-dashboard.html

  • Enter: Full Name, Phone (+233...), Email, Photo URL, Specialty (Elderly Care, ICU, etc.)
  • Tap πŸ’Ύ Save Name Photo Email Phone + Time β€” Saves to Firestore nurses/{uid} + Realtime nurses/{uid} + nursesByPhone + localStorage with time (e.g. Oct 28, 2026 10:30 AM GMT) + your current lat/lng
  • Your photo shows as avatar with green dot when online

Step 2: Go ONLINE β€” This Makes You Visible in book-nurse.html

CRITICAL β€” Only ONLINE nurses show for clients! Offline nurses are hidden and won't pop up.

  • In nurses-dashboard.html, you see toggle: 🟒 Go Online / Offline β€” Controls Client View
  • Tap 🟒 Go ONLINE Now β€” Appear for Clients
  • What happens behind:
    • Writes nurses/{uid}: isOnline:true, online:true, status:'online', lastSeen:Date.now(), lastActive, lat, lng, fullName, photoURL, email, phone, specialty
    • Writes onlineNurses/{uid}: {isOnline:true, lastSeen, fullName, phone, email, photoURL, lat, lng} β€” book-nurse.html checks this list!
    • Writes nursePresence/{uid}: {status:'online', isOnline:true, lastSeen}
    • Writes nurseLocations/{uid}: {lat, lng, lastUpdate, nurseId, nurseName, isLive:true} β€” For blinking green marker on client map
    • Updates every 2 minutes automatically to stay ONLINE (within 10-min threshold)
  • Badge changes to 🟒 ONLINE β€” Visible to clients + green dot pulsing. Status display: "You now appear in book-nurse.html and book-nurse-50-percent.html!"
  • If you close tab, you stay online for 10 mins (threshold logic). To hide instantly, tap πŸ”΄ Go OFFLINE β€” Hide β€” Removes from onlineNurses, nurseLocations, sets status offline β€” Clients cannot see you.

Step 3: Set Custom Tone + SMS β€” Rings When Client Books You

  • Go to my-job-offer.html or nurse-settings.html β€” Top card: 🎡 NURSE Custom Tone β€” Select Song From Phone
  • Presets: New Booking Beep, Urgent Alarm (loud), Cash Cha-Ching, Gentle Bell, Afrobeat Ghana Vibe β€” Tap ▢️ to preview
  • Or Upload Your Own Song From Phone (MP3, M4A, WAV) β€” File input β†’ Converts to base64 β†’ Saved locally (nurse_tone_base64) + time
  • Checkbox: πŸ’¬ Also send SMS to me (works even if phone silent/data off) β€” FAST! β€” Checked = You get SMS: "πŸ”” NEW BOOKING! Client ASABERE PETER booked you! GHS 150..." + tone rings!
  • Tap πŸ’Ύ Save Nurse Tone + SMS β€” Saves name, type, base64, time, smsEnabled
  • Test: πŸ§ͺ Test Ring + SMS Now β€” Tone rings + SMS sent to your phone
  • Enable Notifications: Tap πŸ”” Enable Notifications + Vibration β€” Allows notification + vibration when booked

Step 4: Receive Booking β€” Tone + Vibration + Notification + SMS

  • Client books you in book-nurse.html (Full Pay) or book-nurse-50-percent.html (Pay 50% now)
  • Your my-job-offer.html detects NEW booking ID (prevIds check) β†’ Rings custom tone + Vibrates [300,100,300,100,500] + Notification "πŸ”” NEW BOOKING! Client Booked You!" + SMS via Hubtel β€” 4 alerts at once!
  • SMS saved in smsLogs with photo name phone email + time for CEO audit
  • You see: Client card (who pays) + Patient card (who needs care) β€” Patient may be different city!
  • Cards show: Client Name Phone Email Photo, Patient Name Phone Address Lat/Lng, Total Amount GHS, Payment method

Step 5: Accept & Navigate to PATIENT β€” Not Just Client

  • Tap βœ… Accept + Navigate β†’ Updates status to ACCEPTED in myJobOffers/{yourId}/{bookingId}, bookings/{bookingId}, ceoBookings
  • Starts GPS Live Tracking: watchPosition highAccuracy β†’ Shares to nurseLocations/{id}, liveNurseLocations/{bookingId}, ceoBookings nurseLat/nurseLng, lastUpdate every few seconds
  • Bottom bar appears: πŸ›°οΈ GPS LIVE β€” lat,lng β€” Getting location... with Stop GPS button
  • Auto opens Google Maps navigation: https://www.google.com/maps/dir/?api=1&origin=yourLat,yourLng&destination=patientLat,patientLng&travelmode=driving β€” Nurse navigates to PATIENT house (critical for family bookings!)
  • If patient phone available, tap πŸ“ž Call Patient or πŸ“ž Call Client (who pays)
  • Buttons: 🧭 Navigate to PATIENT, πŸ—ΊοΈ View Map, πŸ’¬ WhatsApp, πŸ“ž Call
  • Status updates: ACCEPTED β†’ ENROUTE β†’ ARRIVED β†’ INSERVICE β†’ COMPLETED via updateNurseStatus()
  • Client in client-alerts.html sees you accepted with your photo phone β€” His custom tone rings + SMS!

πŸ‘€ FOR CLIENTS β€” How to Book ONLINE Nurse

Step 1: Client Auto-Login β€” Name Photo Email Phone + Location Captured

  • Login via Google or email β†’ Saves to localStorage clientName, clientEmail, clientPhone, clientPhotoUrl, clientUid
  • Open book-nurse.html β†’ Top shows CLIENT β€” Who pays (Auto-filled) card with your photo, name, phone, email
  • Browser asks for location permission β†’ If allowed, captures client lat/lng β†’ Shows βœ… Client: lat,lng + fills clientLatInput, clientLngInput, clientLocationDisplay badge
  • If denied, drag map to set location manually β€” Map center = client location

Step 2: See ONLY ONLINE Nurses β€” Offline Hidden

  • Map shows Leaflet OSM tiles + Blinking green markers for ONLINE nurses only β€” Each marker has pulse animation + dot
  • Top: 🟒 ONLINE NURSES ONLY β€” Select Nurse β€” Drag Map to PATIENT House
  • Buttons: πŸ“ My Location, πŸ” Search ONLINE Only, Radius Select (5/10/20/50 km), Badge: 🟒 X ONLINE nurses within 10km β€” Only online show
  • Search logic (searchNearbyNurses):
    • Fetches nurses + onlineNurses + nursePresence + nurseLocations in parallel
    • Builds onlineIds Set from onlineNurses and nursePresence where status=online
    • For each nurse, checks isNurseOnline(v): isOnline true OR online true OR status online OR lastSeen/lastActive within 10 mins OR in onlineIds OR has recent nurseLocations lastUpdate
    • If OFFLINE β†’ Skip β€” Don't show! β€” Hidden, won't pop up for selection
    • If ONLINE + within radius (Haversine distance) β†’ Push to list with distance, isOnline:true, lastSeen, specialty
    • Clears old markers, adds blinking markers for online nurses only
    • If none: Shows 😴 "No ONLINE nurses within X km β€” All offline β€” Nurses must go online in nurse-dashboard.html"
  • Each card shows: Photo with green dot (online indicator), Name, ⭐ Rating, πŸ“ distance km, 🟒 ONLINE badge, Last seen time, Specialty, Can be booked now β€” Custom tone + SMS will ring for nurse
  • Tap card β†’ Preview modal: Photo, Bio, Rating, distance, Last seen, 🟒 ONLINE β€” Can be booked, Buttons: Close, βœ… Continue β€” ONLINE Nurse
  • Select β†’ Shows βœ… Selected: 🟒 Nurse Name β€” ONLINE β€” Patient lat,lng β€” Nurse is ONLINE and will get tone + SMS!
  • Real-time: Refreshes every 15 seconds + Listens to nursePresence, onlineNurses, nurseLocations onValue β†’ If nurse goes online/offline, list updates instantly!

Step 3: Enter Patient Details β€” Can Be Different Place!

  • CLIENT DETAILS (Payer): Auto-filled from login β€” Name, Phone, Email, PhotoUrl, lat/lng hidden inputs, location badge
  • PATIENT DETAILS (Who needs care):
    • Patient Name (e.g. My Mother, Father), Patient Phone, Patient Address / Location Description (e.g. House No 12, Kumasi near Kejetia), Relationship (Mother, Father, Child, Self, etc.)
    • Checkbox: Patient at same place as me? β€” Checked = Patient lat/lng auto-copied from client β€” Display: "πŸ₯ Patient: Same as client β€” Nurse navigates here"
    • Uncheck if different city: "πŸ₯ Patient: DIFFERENT β€” Drag map to patient house + Click Set Patient Location"
    • Button: πŸ“ Set Patient Location = Map Center β€” Gets map center lat/lng β†’ Sets patientLatInput, patientLngInput, unchecks sameAsClient, updates display "βœ… Patient SET: lat,lng β€” Nurse NAVIGATES HERE!" + fills patientLocationText with lat,lng if empty
    • This is critical: Client in Accra can book for mother in Kumasi β€” Nurse goes to PATIENT location, not client!

Step 4: Calculate β€” Full or 50% Payment β€” Paystack

  • Booking Details: Start Time (08:00), End Time (17:00), Hours/Day Auto (9.0 hrs), Care Mode Daily/Weekly (Γ—7)/Monthly (Γ—30), Quantity, Country Currency GHS (GHS 17/hr) or USD (USD 8/hr) LIVE from config/rates, ceoPricing, pricing β€” Transport GHS 100
  • calcTotal(): Hours = end - start (handles overnight), TotalHours = hrs Γ— qty Γ— modeMult, Base = rate Γ— totalHours, Total = base + transport
  • Full Pay (book-nurse.html): Pay FULL Now β€” GHS 253 β€” Creates booking with status pending_full_payment, amount total, amountSplit nurse 80% CEO 20%
  • 50% Pay (book-nurse-50-percent.html): Total GHS 253 β†’ Pay Now (50%) GHS 126.50, Pay Later (50%) GHS 126.50 β€” Paystack charges only 50% now (payKobo = payNowΓ—100), status pending_50_percent, amount total, amountPaidNow payNow, amountBalance payNow
  • Calculation box shows: Startβ†’End formatted both 12h/24h, Hours per day, QuantityΓ—Mode, Total Hours, CEO Rate LIVE, Base, Transport, TOTAL, PAY NOW, PAY LATER

Step 5: Pay with Paystack β€” Booking Saved Everywhere

  • Validations: Select ONLINE nurse first (checks if selected nurse still isOnline in allNurses β€” If offline, alert "Selected nurse went offline β€” Select another"), Complete client details, Patient name phone address, Patient lat/lng set
  • If valid: Generates bookingId LCG-FULL-YYYYMMDD-RANDOM or LCG-50-YYYYMMDD-RANDOM, payKobo = totalΓ—100 or payNowΓ—100
  • PaystackPop.setup({key: pk_live_f17ae..., email, amount: payKobo, currency: GHS/USD, ref: bookingId+Date.now(), callback, onClose}) β†’ handler.openIframe()
  • On callback success: Creates data object with EVERYTHING: id, bookingId, clientName, clientFullName, phone, clientPhone, clientEmail, email, clientPhotoUrl, clientPhoto, photoUrl, clientUid, clientId, clientLat, clientLng, clientLatLng, clientLatitude, clientLongitude, patientName, patientFullName, patientPhone, patientPhoneNumber, patientContact, patientLocation, patientAddress, patientLocationText, patientLat, patientLng, patientLatLng, patientLatitude, patientLongitude, patientRelationship, patientLocationCapturedAt, patientLocationSource, serviceLocation {lat:pLat,lng:pLng}, destination {lat:pLat,lng:pLng}, mainLat, mainLng, destLat, destLng, lat, lng, nurseId, nurseName, nursePhone, nurseWasOnline:true, nurseOnlineAt, amount, amountPaidNow, amountBalance, payNow, payLater, currency, paymentMethod, paymentType, paystackRef, status, time, createdAt, totalHours, hrsPerDay, startTime, endTime, careMode, quantity, transport, hourlyRateUsed, service, amountSplit
  • Saves to: bookings/{bookingId}, myJobOffers/{nurseId}/{bookingId}, ceoBookings/{bookingId}, allBookings/{bookingId}, bookingsByFull or By50Percent, bookingsByFullPayment or By50Percent, clientBookings/{uid}/{bookingId}, bookingsByFull
  • Shows success modal: βœ… Full Booking Successful! ID, Nurse, Client, Patient, Amount, Location, Calculation breakdown β€” Buttons: Home, πŸ‘‘ CEO Receiver (ceo-booking-receiver.html)
  • Double-check: Before payment, checks selected nurse still ONLINE β€” If offline, refresh list

Step 6: Client Alerts β€” Custom Tone + SMS When Nurse Responds

  • After booking, client goes to client-alerts.html
  • Top: Your booking alerts β€” Shows client card (you) with photo name phone email
  • Custom Tone Picker: Preset tones (Default Beep, Success Melody, Urgent Alarm, Gentle Chime, Afrobeat Ghana) + Upload Your Own Song From Phone MP3/M4A/WAV (max 10MB, base64) β€” Preview ▢️ β€” Selected card shows βœ… Selected + Play button + audio player
  • Checkbox: πŸ’¬ Also send SMS (works even if phone silent/data off) β€” FAST! β€” Checked = When nurse accepts/rejects, you get SMS + tone rings
  • Save Tone + SMS Setting β†’ Saves to localStorage lcg_custom_tone_type, id, name, base64, time, lcg_sms_enabled
  • Buttons: πŸ’Ύ Save Tone + SMS Setting, πŸ§ͺ Test Ring + SMS, πŸ”” Enable Notifications, πŸ—‘οΈ Clear
  • Status: "βœ… Saved! Tone Name + SMS Enabled β€” When nurse responds, tone RINGS + VIBRATES + NOTIFICATION + SMS!"
  • Empty state: "No nurse response yet β€” When nurse taps Accept/Reject, your selected tone will RING + SMS! Tone: Default Beep"
  • Realtime alerts: Listens to bookings node onValue β€” For each booking matching your phone/email, checks status β€” If accepted/rejected and previous status different, creates alert {id, type accepted/rejected, time, read:false, bookingId, nurseId, nurseName, nursePhone, nursePhotoUrl, specialty, rating, amount, currency, clientName, clientPhone, clientEmail, clientPhotoUrl, patientName, patientLocation, patientLat, patientLng, rejectReason}
  • Calls ringCustomTone(type, booking): Gets saved tone (custom base64 or preset), vibrates [200,100,200,100,400...] if accepted, plays tone via audio or Web Audio preset, sends SMS via Cloud Function sendSMS to clientPhone: "βœ… LOVE CARE GLOBAL: Nurse Ama ACCEPTED your booking LCG-...! GHS 150. Call: +233... Tone X rang!" β€” Saves to smsLogs
  • Shows notification if permission granted
  • List renders: ACCEPTED card green border with βœ… NURSE ACCEPTED! Tone + SMS! + Nurse photo big avatar + Name Phone Specialty Rating + Buttons πŸ“ž CALL NURSE, πŸ’¬ WhatsApp, 🧭 Navigation (Google Maps dir to patient lat/lng), 🎡 Play Tone Again β€” REJECTED card red border with reason + Book Another, Increase Rate
  • Count info: "X alerts β€” Y NEW β€” Tone: Name β€” SMS: ON/OFF"
  • Bottom tabs: Dashboard, Book, Alerts + Tone + SMS (active)

πŸ”„ Full Flow Diagram β€” With Patient Location & ONLINE Filter

CLIENT (Accra)                          NURSE (Kumasi)
    |                                        |
    | 1. Auto-capture client lat/lng         | 1. Register + Save Name Photo Email Phone
    |    via geolocation + map drag          |    + Time + Location
    |                                        | 2. Tap 🟒 Go ONLINE β†’ Writes to
    |                                        |    onlineNurses, nursePresence,
    |                                        |    nurseLocations (lat/lng)
    |                                        |
    | 2. Search ONLINE Only (radius 10km)    |
    |    Fetches nurses + onlineNurses +     |
    |    nursePresence + nurseLocations       |
    |    Filters isNurseOnline() true only   |
    |    β†’ Only ONLINE nurses show           |
    |    Offline hidden, won't pop up        |
    |                                        |
    | 3. Select nurse β†’ Preview 🟒 ONLINE     |
    |                                        |
    | 4. Enter PATIENT details               |
    |    Same as client? Checked = same lat  |
    |    Different? Drag map to Kumasi house |
    |    + Set Patient Location = Map Center |
    |    β†’ patientLat, patientLng = Kumasi  |
    |                                        |
    | 5. Calc total: GHS 17/hr Γ— 9hrs + 100  |
    |    Full: Pay GHS 253 now               |
    |    50%: Pay GHS 126.50 now, 126.50 later|
    |                                        |
    | 6. Pay via Paystack β†’ bookingId        |
    |    Saves to bookings, myJobOffers/{nurseId},
    |    ceoBookings, allBookings              |
    |                                        |
    |--------------------------------------->|
    |              Booking created           |  my-job-offer.html detects NEW ID
    |                                        |  β†’ ringNurseTone() β†’ Custom song
    |                                        |  + Vibrate + Notification + SMS:
    |                                        |  "NEW BOOKING! Client booked you!
    |                                        |   GHS 150, Patient Ama at Kumasi"
    |                                        |
    |                                        | 7. Accept β†’ Updates status ACCEPTED
    |                                        |  Starts GPS watchPosition
    |                                        |  Shares to nurseLocations,
    |                                        |  liveNurseLocations, ceoBookings
    |                                        |  Auto opens Google Maps:
    |                                        |  dir/?api=1&origin=nurseLat,lng
    |                                        |  &destination=patientLat,lng
    |                                        |  β†’ Navigates to PATIENT house in
    |                                        |  Kumasi (not client Accra!)
    |                                        |
    |<---------------------------------------|
    |    Nurse accepted + on the way         |  Calls patient + client
    |    client-alerts.html:                 |
    |    ringCustomTone accepted β†’           |
    |    Your custom song rings + Vibrate    |
    |    + Notification + SMS:               |
    |    "Nurse Ama ACCEPTED LCG-FULL-...    |
    |     GHS 150. Call: +233..."            |
    |    Shows nurse photo phone +           |
    |    Buttons: Call, WhatsApp, Navigate   |
    |    to PATIENT, Play Tone Again         |
    |                                        |
    | 8. Nurse arrives β†’ ARRIVED β†’ INSERVICE |
    |    Tracking continues                  |
    |                                        |
    | 9. Job completed β†’ COMPLETED           |
    |    Payout 80% nurse 20% CEO            |
    |    Ratings + Reviews                   |

πŸ› οΈ Firebase Rules Updates Needed

Current rules miss new nodes for ONLINE filter + SMS + Tone. Add:

Without these, clients see "Permission denied" and ONLINE filter fails. Publish updated rules in Firebase Console β†’ Realtime Database β†’ Rules.

πŸ’‘ Tips & Best Practices

Ready to Book?

Only ONLINE nurses can be booked β€” They have green dot + blinking on map + 🟒 ONLINE badge

🟒 Book ONLINE Nurse β€” Full Pay πŸ’° Book ONLINE Nurse β€” 50% Now πŸ‘©β€βš•οΈ Nurses β€” Go ONLINE Now