Skip to content

Commit

Permalink
Update filter checkboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
simonwhatley committed Dec 16, 2024
1 parent 3bbad22 commit 3200eeb
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 73 deletions.
11 changes: 6 additions & 5 deletions app/views/_includes/filter-panel/completeStatus.njk
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{% set complete = {
text: "Complete",
checked: checked(query.filterCompleteStatus, "Complete")
checked: true if query.filterCompleteStatus == "Complete"
} %}

{% set hasProblems = {
text: "Has problems",
value: "Has problems",
checked: checked(query.filterCompleteStatus, "Has problems")
checked: true if query.filterCompleteStatus == "Has problems"
} %}

{% set incomplete = {
text: "Incomplete",
checked: checked(query.filterCompleteStatus, "Incomplete")
checked: true if query.filterCompleteStatus == "Incomplete"
} %}

{% set draftItems = [complete, incomplete, hasProblems] %}
Expand All @@ -31,5 +31,6 @@
classes: "govuk-fieldset__legend--s"
}
},
items: draftItems if navActive == "drafts" else recordItems
} | decorateAttributes(data, "data.filterCompleteStatus"))}}
items: draftItems if navActive == "drafts" else recordItems,
values: data.filterCompleteStatus
}) }}
9 changes: 5 additions & 4 deletions app/views/_includes/filter-panel/course-level.njk
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
items: [
{
text: "Undergraduate",
checked: checked(query.filterCourseLevel, "Undergraduate")
value: "Undergraduate"
},
{
text: "Postgraduate",
checked: checked(query.filterCourseLevel, "Postgraduate")
value: "Postgraduate"
}
]
} | decorateAttributes(data, "data.filterCourseLevel"))}}
],
values: data.filterCourseLevel
}) }}
11 changes: 6 additions & 5 deletions app/views/_includes/filter-panel/phase.njk
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@
items: [
{
text: "Early years",
checked: checked(query.filterPhase, "Early years")
value: "Early years"
},
{
text: "Primary",
checked: checked(query.filterPhase, "Primary")
value: "Primary"
},
{
text: "Secondary",
checked: checked(query.filterPhase, "Secondary")
value: "Secondary"
}
]
} | decorateAttributes(data, "data.filterPhase"))}}
],
values: data.filterPhase
}) }}
12 changes: 5 additions & 7 deletions app/views/_includes/filter-panel/signed-in-providers.njk
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
{% set providerItems = [] %}
{% for provider in userProviders %}
{% set providerItems = providerItems | push({
text: provider,
checked: checked(query.filterUserProviders, provider)
text: provider
value: provider
}) %}
{% endfor %}
{{ govukCheckboxes({
Expand All @@ -19,10 +19,8 @@
classes: "govuk-fieldset__legend--s"
}
},
hint: {
text: ""
},
items: providerItems
} | decorateAttributes(data, "data.filterUserProviders")) }}
items: providerItems,
values: data.filterUserProviders
}) }}

{% endif %}
17 changes: 7 additions & 10 deletions app/views/_includes/filter-panel/source.njk
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,20 @@
items: [
{
text: "Added manually",
value: "Manual",
checked: checked(query.filterSource, "Manual")
value: "Manual"
},
{
text: "Imported from Apply",
value: "Apply",
checked: checked(query.filterSource, "Apply")
value: "Apply"
},
{
text: "Imported from DTTP",
value: "DTTP",
checked: checked(query.filterSource, "DTTP")
value: "DTTP"
} if navActive !== "drafts",
{
text: "Imported from HESA",
value: "HESA",
checked: checked(query.filterSource, "HESA")
value: "HESA"
} if navActive !== "drafts"
]
} | decorateAttributes(data, "data.filterSource"))}}
],
values: data.filterSource
}) }}
23 changes: 12 additions & 11 deletions app/views/_includes/filter-panel/statuses.njk
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,40 @@
items: [
{
text: "Draft",
checked: checked(query.filterStatus, "Draft")
value: "Draft"
} if false,
{
text: "Pending TRN",
checked: checked(query.filterStatus, "Pending TRN")
value: "Pending TRN"
},
{
text: "TRN received",
checked: checked(query.filterStatus, "TRN received")
value: "TRN received"
},
{
text: "EYTS recommended",
checked: checked(query.filterStatus, "EYTS recommended")
value: "EYTS recommended"
},
{
text: "EYTS awarded",
checked: checked(query.filterStatus, "EYTS awarded")
value: "EYTS awarded"
},
{
text: "QTS recommended",
checked: checked(query.filterStatus, "QTS recommended")
value: "QTS recommended"
},
{
text: "QTS awarded",
checked: checked(query.filterStatus, "QTS awarded")
value: "QTS awarded"
},
{
text: "Deferred",
checked: checked(query.filterStatus, "Deferred")
value: "Deferred"
},
{
text: "Withdrawn",
checked: checked(query.filterStatus, "Withdrawn")
value: "Withdrawn"
}
]
} | decorateAttributes(data, "data.filterStatus"))}}
],
values: data.filterStatus
}) }}
4 changes: 2 additions & 2 deletions app/views/_includes/filter-panel/studyMode.njk
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
items: [
{
text: "Full time",
checked: checked(query.filterStudyMode, "Full time")
checked: true if query.filterStudyMode == "Full time"
},
{
text: "Part time",
checked: checked(query.filterStudyMode, "Part time")
checked: true if query.filterStudyMode == "Part time"
}
]
} | decorateAttributes(data, "data.filterStudyMode"))}}
10 changes: 4 additions & 6 deletions app/views/_includes/filter-panel/training-routes.njk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% for route in enabledTrainingRoutes %}
{% set routeItems = routeItems | push({
text: route,
checked: checked(query.filterTrainingRoutes, route)
checked: true if query.filterTrainingRoutes == route
}) %}
{% endfor %}
{{ govukCheckboxes({
Expand All @@ -18,10 +18,8 @@
classes: "govuk-fieldset__legend--s"
}
},
hint: {
text: ""
},
items: routeItems
} | decorateAttributes(data, "data.filterTrainingRoutes")) }}
items: routeItems,
values: data.filterTrainingRoutes
}) }}

{% endif %}
20 changes: 9 additions & 11 deletions app/views/_includes/filter-panel/training-status.njk
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@

{% set coursenNotYetStarted = registeredTrainees | filterByFunction('ittInTheFuture') %}


{{ govukCheckboxes({
classes: "govuk-checkboxes--small js-auto-submit",
attributes: {
"id": 'filterTrainingStatusCheckboxes'
}
,
},
fieldset: {
legend: {
text: "Training status",
Expand All @@ -27,24 +25,24 @@
items: [
{
text: "Course not started yet",
checked: checked(query.filterTrainingStatus, "Course not started yet")
value: "Course not started yet"
} if coursenNotYetStarted | length,
{
text: "Actively training",
_checked: checkedStatus,
checked: checked(query.filterTrainingStatus, "Actively training")
value: "Actively training"
},
{
text: "Deferred",
checked: checked(query.filterTrainingStatus, "Deferred")
value: "Deferred"
},
{
text: "Awarded",
checked: checked(query.filterTrainingStatus, "Awarded")
value: "Awarded"
},
{
text: "Withdrawn",
checked: checked(query.filterTrainingStatus, "Withdrawn")
value: "Withdrawn"
}
]
} | decorateAttributes(data, "data.filterTrainingStatus"))}}
],
values: data.filterTrainingStatus
}) }}
18 changes: 6 additions & 12 deletions app/views/_includes/filter-panel/years.njk
Original file line number Diff line number Diff line change
Expand Up @@ -155,25 +155,20 @@
},
items: [
{
text: "2023 to 2024 academic year only",
text: "2023 to 2024",
value: "2023 to 2024",
checked: checked(query.filterAcademicYears, "2023 to 2024")
value: "2023 to 2024"
},
{
text: "2022 to 2023 academic year only",
text: "2022 to 2023",
value: "2022 to 2023",
checked: checked(query.filterAcademicYears, "2022 to 2023")
value: "2022 to 2023"
},
{
text: "2021 to 2022 academic year only",
text: "2021 to 2022",
value: "2021 to 2022",
checked: checked(query.filterAcademicYears, "2021 to 2022")
value: "2021 to 2022"
}
]
} | decorateAttributes(data, "data.filterAcademicYears"))}}
],
values: data.filterAcademicYears
}) }}
{% endset %}


Expand Down Expand Up @@ -210,4 +205,3 @@
}) }}

{% endif %}

0 comments on commit 3200eeb

Please sign in to comment.