|
| 1 | +{% set today = "" | today %} |
| 2 | +{% set upcomingAppointments = [] %} |
| 3 | +{% set pastAppointments = [] %} |
| 4 | + |
| 5 | +{% for record in clinicHistory %} |
| 6 | + {% if record.event.timing.startTime | isPast %} |
| 7 | + {% set pastAppointments = (pastAppointments.push(record), pastAppointments) %} |
| 8 | + {% else %} |
| 9 | + {% set upcomingAppointments = (upcomingAppointments.push(record), upcomingAppointments) %} |
| 10 | + {% endif %} |
| 11 | +{% endfor %} |
| 12 | +{% if not hideUpcoming %} |
| 13 | + {% if upcomingAppointments.length > 0 %} |
| 14 | + <h3>Upcoming appointments</h3> |
| 15 | + <table class="nhsuk-table"> |
| 16 | + <thead> |
| 17 | + <tr> |
| 18 | + <th>Date</th> |
| 19 | + <th>Type</th> |
| 20 | + <th>Location</th> |
| 21 | + <th>Status</th> |
| 22 | + <th>Details</th> |
| 23 | + </tr> |
| 24 | + </thead> |
| 25 | + <tbody> |
| 26 | + {% for record in upcomingAppointments | sort(false, false, 'event.slot.dateTime') %} |
| 27 | + {% set event = record.event %} |
| 28 | + {% set clinic = record.clinic %} |
| 29 | + {% set unit = record.unit %} |
| 30 | + <tr> |
| 31 | + <td>{{ event.timing.startTime | formatDate }}</td> |
| 32 | + <td>{{ clinic.clinicType | formatWords | sentenceCase }}</td> |
| 33 | + <td>{{ unit.name }}</td> |
| 34 | + <td> |
| 35 | + {{ tag({ |
| 36 | + text: event.status | formatWords | sentenceCase, |
| 37 | + classes: "nhsuk-tag--" + event.status | getStatusTagColour |
| 38 | + }) }} |
| 39 | + </td> |
| 40 | + <td> |
| 41 | + <a href="/clinics/{{ clinic.id }}/events/{{ event.id }}"> |
| 42 | + View details |
| 43 | + </a> |
| 44 | + </td> |
| 45 | + </tr> |
| 46 | + {% endfor %} |
| 47 | + </tbody> |
| 48 | + </table> |
| 49 | + {% endif %} |
| 50 | +{% endif %} |
| 51 | + |
| 52 | + |
| 53 | +{% if pastAppointments.length > 0 %} |
| 54 | + <h3>Screening history</h3> |
| 55 | + <table class="nhsuk-table"> |
| 56 | + <thead> |
| 57 | + <tr> |
| 58 | + <th>Date</th> |
| 59 | + <th>Type</th> |
| 60 | + <th>Location</th> |
| 61 | + <th>Status</th> |
| 62 | + {# <th>Outcome</th> #} |
| 63 | + <th>Details</th> |
| 64 | + </tr> |
| 65 | + </thead> |
| 66 | + <tbody> |
| 67 | + {% for record in pastAppointments | sort(true, false, 'event.timing.startTime') %} |
| 68 | + {% set event = record.event %} |
| 69 | + {% set clinic = record.clinic %} |
| 70 | + {% set unit = record.unit %} |
| 71 | + <tr> |
| 72 | + <td>{{ event.timing.startTime | formatDate }}</td> |
| 73 | + <td>{{ clinic.clinicType | formatWords | sentenceCase }}</td> |
| 74 | + <td>{{ unit.name }}</td> |
| 75 | + <td> |
| 76 | + {{ tag({ |
| 77 | + text: event.status | formatWords | sentenceCase, |
| 78 | + classes: "nhsuk-tag--" + event.status | getStatusTagColour |
| 79 | + }) }} |
| 80 | + </td> |
| 81 | + {# <td> |
| 82 | + {% if event.outcome %} |
| 83 | + {{ event.outcome.status | formatWords | sentenceCase }} |
| 84 | + {% endif %} |
| 85 | + </td> #} |
| 86 | + <td> |
| 87 | + <a href="/clinics/{{ clinic.id }}/events/{{ event.id }}"> |
| 88 | + View details |
| 89 | + </a> |
| 90 | + </td> |
| 91 | + </tr> |
| 92 | + {% endfor %} |
| 93 | + </tbody> |
| 94 | + </table> |
| 95 | +{% endif %} |
| 96 | + |
| 97 | +{% if upcomingAppointments.length === 0 and pastAppointments.length === 0 %} |
| 98 | + <p>No screening history found</p> |
| 99 | +{% endif %} |
0 commit comments