{% extends 'familytouch/base.html' %} {% block title %}Dashboard - FamilyTouch{% endblock %} {% block extra_css %} {% endblock %} {% block content %}

👋 Welcome, {{ display_name }}!

{{ user_type|title }}
{% if pending_invitations %}
📬
✉️ New Connection Request{{ pending_invitations|length|pluralize }}
You have {{ pending_invitations|length }} pending invitation{{ pending_invitations|length|pluralize }} from healthcare providers and family members
{% if pending_invitations|length <= 2 %}
{% for invitation in pending_invitations %}
{% if invitation.role == 'provider' %}👨‍⚕️{% else %}👪{% endif %} {{ invitation.sender.get_full_name|default:invitation.sender.username }} wants to connect as {{ invitation.get_role_display }}
{% endfor %}
{% endif %}
Review Invitations →
{% endif %} {% if user_type == 'doctor' and upcoming_appointments %}
📅
📋 Upcoming Appointments
You have {{ upcoming_appointments|length }} appointment{{ upcoming_appointments|pluralize }} in the next 7 days
{% if upcoming_appointments|length <= 3 %}
{% for appt in upcoming_appointments %}
👤 {{ appt.patient.get_full_name|default:appt.patient.username }} • 🕐 {{ appt.start|date:"M d g:i A" }}
{% endfor %}
{% endif %}
View All →
{% endif %} {% if user_type == 'patient' and upcoming_appointments %}
📅
📋 Your Upcoming Appointments
You have {{ upcoming_appointments|length }} appointment{{ upcoming_appointments|pluralize }} scheduled
{% if upcoming_appointments|length <= 3 %}
{% for appt in upcoming_appointments %}
👨‍⚕️ Dr. {{ appt.provider.get_full_name|default:appt.provider.username }} • 🕐 {{ appt.start|date:"M d g:i A" }} • 📝 {{ appt.reason }}
{% endfor %}
{% endif %}
📅 Book Appointment View Details →
{% endif %} {% if user_type == 'patient' %}
📅
{{ appointments|length }}
Upcoming Appointments
💬
{{ unread_message_count }}
Unread Messages
👥
{{ care_connections|length }}
Care Team Members
❤️
{{ recent_vitals|length }}
Health Tracking Records
🍽️
{{ meal_choices|length }}
Meal Selections
{% if pending_invitations %}

📬 Pending Connection Invitations ({{ pending_invitations|length }})

{% for invitation in pending_invitations %}
{% if invitation.role == 'provider' %}👨‍⚕️{% else %}👪{% endif %}
{{ invitation.sender.get_full_name|default:invitation.sender.username }}
@{{ invitation.sender.username }}
Wants to connect as: {{ invitation.get_role_display }}
Sent {{ invitation.created_at|timesince }} ago
{% csrf_token %}
{% csrf_token %}
{% endfor %}
View All Invitations →
{% endif %}

📅 Your Appointments

{% if upcoming_appointments %}
{% for appt in upcoming_appointments %}
👨‍⚕️
Dr. {{ appt.provider.get_full_name|default:appt.provider.username }}
{{ appt.provider.username }}
🕐 {{ appt.start|date:"l, F d, Y" }} at {{ appt.start|date:"g:i A" }}
📝 Reason: {{ appt.reason }}
⏱️ Duration: {{ appt.start|date:"g:i A" }} - {{ appt.end|date:"g:i A" }}
✓ {{ appt.get_status_display }}
{% endfor %}
{% else %}
📅
No upcoming appointments scheduled
Book an appointment with your healthcare provider
📅 Book Appointment
{% endif %}

🔗 Your Connected Care Team

{% if care_connections %}
{% for c in care_connections %}
{% if c.role == 'provider' %}👨‍⚕️{% else %}👪{% endif %}
{{ c.contact.get_full_name|default:c.contact.username }}
@{{ c.contact.username }}
{% if c.role == 'provider' %}🏥 Healthcare Provider{% else %}👪 Family Member{% endif %}
{% if c.family_role %}
Role: {{ c.get_family_role_display }}
{% endif %}
Connected {{ c.created_at|date:"M d, Y" }}
{% endfor %}
{% else %}
🔗

No care team members connected yet.

Connect Now →
{% endif %}

❤️ Health Tracking & Vitals

{% if recent_vitals %}
{% for vital in recent_vitals %}
{% if vital.vital_type == 'bp' %}🩸{% elif vital.vital_type == 'hr' %}💓{% elif vital.vital_type == 'temp' %}🌡️{% elif vital.vital_type == 'weight' %}⚖️{% else %}📊{% endif %}
{{ vital.get_vital_type_display }}
{{ vital.value }}
{% if vital.units %}
{{ vital.units }}
{% endif %}
{{ vital.created_at|date:"M d, g:i A" }}
{% endfor %}
{% else %}

No health tracking records yet.

Add Health Record →
{% endif %}

🍽️ Recent Meal Selections

{% if meal_choices %}
{% for meal in meal_choices %}
👤 {{ meal.chooser.get_full_name|default:meal.chooser.username }}
{{ meal.created_at|date:"M d, g:i A" }}
{% if meal.lunch %}
🌞 Lunch
{{ meal.lunch }}
{% endif %} {% if meal.dinner %}
🌙 Dinner
{{ meal.dinner }}
{% endif %}
{% endfor %}
{% else %}

No meal selections yet.

Your family members can choose meals for you.

{% endif %}

📅 Upcoming Appointments

{% if appointments %}
{% for a in appointments %}
📅 {{ a.start|date:"l, M d, Y" }} at {{ a.start|date:"g:i A" }}
Provider: 👨‍⚕️ {{ a.provider.get_full_name|default:a.provider.username }}
{% if a.reason %}
Reason: {{ a.reason }}
{% endif %}
Status: {{ a.get_status_display }}
{% endfor %}
{% else %}

No upcoming appointments scheduled.

{% endif %}

📋 Recent Care Updates

{% if recent_updates %}
{% for u in recent_updates %}
{{ u.sender.get_full_name|default:u.sender.username }}
{{ u.content }}
{{ u.created_at|date:"M d, Y H:i" }}
{% endfor %}
{% else %}

No recent care updates.

{% endif %}

💬 Direct Messages

{% if recent_conversations %}
{% for conv in recent_conversations %}
{% if conv.role == 'provider' %}👨‍⚕️{% else %}👪{% endif %} {{ conv.user.get_full_name|default:conv.user.username }}
{% if conv.unread_count > 0 %} {{ conv.unread_count }} new {% endif %}
{% if conv.latest_message %}
{{ conv.latest_message.content|truncatechars:80 }}
{{ conv.latest_message.created_at|date:"M d, H:i" }}
{% else %}
No messages yet
{% endif %}
{% endfor %} View All Messages →
{% else %}

No messages yet. Connect with family or care providers to start messaging.

{% endif %}
{% if pending_invitations %}

📬 Pending Connection Invitations

{% for inv in pending_invitations %}
{{ inv.sender.get_full_name|default:inv.sender.username }}
Wants to connect as {% if inv.role == 'provider' %}Healthcare Provider{% else %}Family Member{% endif %}
{% csrf_token %}
{% csrf_token %}
{% endfor %}
{% endif %} {% if meal_choices %}

🍽️ Recent Meal Preferences

{% for meal in meal_choices %}
{{ meal.created_at|date:"M d, Y" }}
Lunch: {{ meal.lunch }}
Dinner: {{ meal.dinner }}
by {{ meal.chooser.get_full_name|default:meal.chooser.username }}
{% endfor %}
{% endif %} {% if latest_dietitian_review %}

👨‍⚕️ Latest Dietitian Review

{{ latest_dietitian_review.summary }}
Reviewed by {{ latest_dietitian_review.reviewer.get_full_name|default:latest_dietitian_review.reviewer.username }} on {{ latest_dietitian_review.created_at|date:"M d, Y" }}
{% endif %} {% elif user_type == 'doctor' %}
📅
{{ appointments|length }}
Upcoming Appointments
👥
{{ care_connections|length }}
Connected Patients
{% if pending_invitations %}
📬
{{ pending_invitations|length }}
Pending Invitations
{% endif %}
{% if pending_invitations %}

📬 Pending Connection Invitations ({{ pending_invitations|length }})

{% for invitation in pending_invitations %}
{% if invitation.sender.profile.user_type == 'patient' %}🧑‍⚕️{% else %}👪{% endif %}
{{ invitation.sender.get_full_name|default:invitation.sender.username }}
@{{ invitation.sender.username }}
Wants to connect as: {{ invitation.get_role_display }}
Sent {{ invitation.created_at|timesince }} ago
{% csrf_token %}
{% csrf_token %}
{% endfor %}
View All Connections →
{% endif %}

📅 Your Appointments

{% if appointments %} {% for a in appointments %}
👤 {{ a.patient.get_full_name|default:a.patient.username }}
🕐 {{ a.start|date:"l, M d, Y @ g:i A" }} {% if a.reason %} • Reason: {{ a.reason }}{% endif %}
{% if a.get_status_display %}
Status: {{ a.get_status_display }}
{% endif %}
{% endfor %} {% else %}
📅

No appointments scheduled

Schedule Appointment
{% endif %}

👥 Your Patients

{% if care_connections %} {% for conn in care_connections %}
🧑‍⚕️

{{ conn.patient.get_full_name|default:conn.patient.username }}

Connected since {{ conn.created_at|date:"M d, Y" }}
📊 Total appointments: {{ conn.patient.appointments.count }}
{% endfor %} {% else %}
👥

No connected patients yet

View All Patients
{% endif %}
{% elif user_type == 'family' %}
👥
{{ care_connections|length }}
Connected Patients
{% if pending_invitations %}
📬
{{ pending_invitations|length }}
Pending Invitations
{% endif %}
{% if pending_invitations %}

📬 Pending Connection Invitations ({{ pending_invitations|length }})

{% for invitation in pending_invitations %}
{% if invitation.sender.profile.user_type == 'patient' %}🧑‍⚕️{% elif invitation.sender.profile.user_type == 'doctor' %}👨‍⚕️{% else %}👪{% endif %}
{{ invitation.sender.get_full_name|default:invitation.sender.username }}
@{{ invitation.sender.username }}
Wants to connect as: {{ invitation.get_role_display }}
Sent {{ invitation.created_at|timesince }} ago
{% csrf_token %}
{% csrf_token %}
{% endfor %}
View All Connections →
{% endif %}

👪 Your Connected Patients

{% if care_connections %} {% for c in care_connections %} {% if c.role == 'family' %}
🧑‍⚕️

{{ c.patient.get_full_name|default:c.patient.username }}

Connected since {{ c.created_at|date:"M d, Y" }} {% if c.family_role %} • Role: {{ c.get_family_role_display }}{% endif %}
📅 Doctor Appointments {% with appointments=c.patient.appointments.all %} {% if appointments %}
{% for appt in appointments|slice:":3" %}
Dr. {{ appt.provider.get_full_name|default:appt.provider.username }}
🕐 {{ appt.start|date:"M d, Y @ g:i A" }} {% if appt.reason %} • {{ appt.reason }}{% endif %}
{% endfor %} {% if appointments|length > 3 %}
+{{ appointments|length|add:"-3" }} more appointments
{% endif %}
{% else %}
No appointments scheduled
{% endif %} {% endwith %}
👨‍⚕️ Connected Doctors
{% for doc in c.patient.care_connections.all %} {% if doc.role == 'provider' %}
• {{ doc.contact.get_full_name|default:doc.contact.username }}
{% endif %} {% empty %}
No doctors connected yet
{% endfor %}
🍽️ Set Meal Preferences
{% csrf_token %}
Latest preferences: {% with mc=c.patient.meal_choices.first %} {% if mc %}
🥗 Lunch: {{ mc.lunch }} | 🍲 Dinner: {{ mc.dinner }}
Set by {{ mc.chooser.get_full_name|default:mc.chooser.username }} {% else %}
No preferences set yet {% endif %} {% endwith %}
{% endif %} {% endfor %} {% else %}
👥

No connected patients found

Connect with a Patient
{% endif %}
{% else %}

This is your dashboard. More features coming soon!

{% endif %}

Quick Actions

🔗
Connected Care
Coordinate care with family & providers
📱
Mobile First
Access on any device
🔒
Secure & Private
HIPAA-grade security
⚡
Real-Time Updates
Instant notifications
📊
Health Tracking
Vitals & medications
💬
Direct Communication
Secure messaging with providers
Back to Home
{% endblock %}