{% extends "website/base.html" %}
{% block content %}
<section class="section">
  <div class="card">
    <h1 class="h1">Caregiver Portal</h1>
    <p class="p">Update your availability and view your assigned clients.</p>
    <div class="sep"></div>

    <div class="grid grid-2">
      <div class="card soft card-tight">
        <div style="font-weight:900">My Availability</div>
        <div class="sep"></div>
        <form method="post">
          {% csrf_token %}
          {% for field in form %}
            <label class="label">{{ field.label }}</label>
            {{ field }}
          {% endfor %}
          <div class="sep"></div>
          <button class="btn btn-accent" type="submit">Save</button>
        </form>
      </div>

      <div class="card soft card-tight">
        <div style="font-weight:900">My Assignments</div>
        <div class="sep"></div>
        {% for a in assignments %}
          <div class="card soft card-tight" style="margin-bottom:10px">
            <div style="font-weight:900">{{ a.care_request.full_name }}</div>
            <div class="small">{{ a.care_request.get_request_type_display }} • {{ a.get_status_display }}</div>
            <div class="small">Location: {{ a.care_request.location }}</div>
            <div class="small">Start: {{ a.start_date }}{% if a.end_date %} • End: {{ a.end_date }}{% endif %}</div>
          </div>
        {% empty %}
          <div class="small">No assignments yet.</div>
        {% endfor %}
      </div>
    </div>
  </div>
</section>
{% endblock %}
