1313 {# {% set events = data.events | getClinicEvents(clinicId) %} #}
1414 {% set events = allEvents %}
1515
16- {{ clinic | log }}
16+ {{ clinic | log("Clinic") }}
1717
1818 {% set clinicRiskType %}
1919 {% if clinic.riskLevels | length == 1 %}
@@ -44,13 +44,27 @@ <h1 class="nhsuk-heading-l">
4444
4545 {% set secondaryNavItems = [] %}
4646
47- {# { id: 'scheduled', label: 'Scheduled' }, #}
48- {% for filter in [
47+ {% set tabItems = [
4948 { id: 'remaining', label: 'Remaining' },
5049 { id: 'checked-in', label: 'Checked in' },
5150 { id: 'complete', label: 'Complete' },
5251 { id: 'all', label: 'All' }
5352 ] %}
53+
54+ {% set remainingCount = events | filterEventsByStatus(filter.id) | length %}
55+
56+ {% if clinic.status == 'closed' or remainingCount == 0 %}
57+ {% set tabItems = [
58+ { id: 'complete', label: 'Complete' },
59+ { id: 'all', label: 'All' }
60+ ] %}
61+ {% elseif clinic.status == "scheduled" %}
62+ {% set tabItems = [
63+ { id: 'all', label: 'All' }
64+ ] %}
65+ {% endif %}
66+
67+ {% for filter in tabItems %}
5468 {% set href -%}
5569 /clinics/{{ clinicId }}/{{ filter.id if filter.id !== 'remaining' }}
5670 {% endset %}
@@ -59,13 +73,14 @@ <h1 class="nhsuk-heading-l">
5973 href: href | trim,
6074 current: true if filter.id == status
6175 }) %}
62-
6376 {% endfor %}
6477
65- {{ appSecondaryNavigation({
66- visuallyHiddenTitle: "Secondary menu",
67- items: secondaryNavItems
68- }) }}
78+ {% if clinic.status !== "scheduled" %}
79+ {{ appSecondaryNavigation({
80+ visuallyHiddenTitle: "Secondary menu",
81+ items: secondaryNavItems
82+ }) }}
83+ {% endif %}
6984
7085 {# This probably shouldn't occur #}
7186 {% if filteredEvents.length === 0 %}
0 commit comments