From 3200eebbf93b1e1af6dae244472901a26a7a2ff0 Mon Sep 17 00:00:00 2001 From: Simon Whatley Date: Mon, 16 Dec 2024 11:25:38 +0000 Subject: [PATCH] Update filter checkboxes --- .../_includes/filter-panel/completeStatus.njk | 11 +++++---- .../_includes/filter-panel/course-level.njk | 9 ++++---- app/views/_includes/filter-panel/phase.njk | 11 +++++---- .../filter-panel/signed-in-providers.njk | 12 ++++------ app/views/_includes/filter-panel/source.njk | 17 ++++++-------- app/views/_includes/filter-panel/statuses.njk | 23 ++++++++++--------- .../_includes/filter-panel/studyMode.njk | 4 ++-- .../filter-panel/training-routes.njk | 10 ++++---- .../filter-panel/training-status.njk | 20 ++++++++-------- app/views/_includes/filter-panel/years.njk | 18 +++++---------- 10 files changed, 62 insertions(+), 73 deletions(-) diff --git a/app/views/_includes/filter-panel/completeStatus.njk b/app/views/_includes/filter-panel/completeStatus.njk index edb487681..c21f62001 100644 --- a/app/views/_includes/filter-panel/completeStatus.njk +++ b/app/views/_includes/filter-panel/completeStatus.njk @@ -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] %} @@ -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 +}) }} diff --git a/app/views/_includes/filter-panel/course-level.njk b/app/views/_includes/filter-panel/course-level.njk index 019ae1013..9952c9a9a 100644 --- a/app/views/_includes/filter-panel/course-level.njk +++ b/app/views/_includes/filter-panel/course-level.njk @@ -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 +}) }} diff --git a/app/views/_includes/filter-panel/phase.njk b/app/views/_includes/filter-panel/phase.njk index 3fc883ed3..fc427b963 100644 --- a/app/views/_includes/filter-panel/phase.njk +++ b/app/views/_includes/filter-panel/phase.njk @@ -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 +}) }} diff --git a/app/views/_includes/filter-panel/signed-in-providers.njk b/app/views/_includes/filter-panel/signed-in-providers.njk index db452d169..4e1f8f091 100644 --- a/app/views/_includes/filter-panel/signed-in-providers.njk +++ b/app/views/_includes/filter-panel/signed-in-providers.njk @@ -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({ @@ -19,10 +19,8 @@ classes: "govuk-fieldset__legend--s" } }, - hint: { - text: "" - }, - items: providerItems - } | decorateAttributes(data, "data.filterUserProviders")) }} + items: providerItems, + values: data.filterUserProviders + }) }} {% endif %} diff --git a/app/views/_includes/filter-panel/source.njk b/app/views/_includes/filter-panel/source.njk index a2537082b..dea5a3b9c 100644 --- a/app/views/_includes/filter-panel/source.njk +++ b/app/views/_includes/filter-panel/source.njk @@ -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 +}) }} diff --git a/app/views/_includes/filter-panel/statuses.njk b/app/views/_includes/filter-panel/statuses.njk index 9383038d3..29b0f6eb9 100644 --- a/app/views/_includes/filter-panel/statuses.njk +++ b/app/views/_includes/filter-panel/statuses.njk @@ -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 +}) }} diff --git a/app/views/_includes/filter-panel/studyMode.njk b/app/views/_includes/filter-panel/studyMode.njk index 95264193d..729b1e044 100644 --- a/app/views/_includes/filter-panel/studyMode.njk +++ b/app/views/_includes/filter-panel/studyMode.njk @@ -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"))}} diff --git a/app/views/_includes/filter-panel/training-routes.njk b/app/views/_includes/filter-panel/training-routes.njk index cbc22ce89..1efe5b011 100644 --- a/app/views/_includes/filter-panel/training-routes.njk +++ b/app/views/_includes/filter-panel/training-routes.njk @@ -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({ @@ -18,10 +18,8 @@ classes: "govuk-fieldset__legend--s" } }, - hint: { - text: "" - }, - items: routeItems - } | decorateAttributes(data, "data.filterTrainingRoutes")) }} + items: routeItems, + values: data.filterTrainingRoutes + }) }} {% endif %} diff --git a/app/views/_includes/filter-panel/training-status.njk b/app/views/_includes/filter-panel/training-status.njk index bcfe79a65..a3a237371 100644 --- a/app/views/_includes/filter-panel/training-status.njk +++ b/app/views/_includes/filter-panel/training-status.njk @@ -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", @@ -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 +}) }} diff --git a/app/views/_includes/filter-panel/years.njk b/app/views/_includes/filter-panel/years.njk index c8905053b..bf117470a 100644 --- a/app/views/_includes/filter-panel/years.njk +++ b/app/views/_includes/filter-panel/years.njk @@ -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 %} @@ -210,4 +205,3 @@ }) }} {% endif %} -