From d355319b87c42b1f3b81e9e6afd51e3bb841b653 Mon Sep 17 00:00:00 2001 From: RamuniN Date: Thu, 12 Oct 2023 12:24:18 +0100 Subject: [PATCH] add dashboard for cyp --- app/blueprints/assessments/routes.py | 9 +- .../templates/assessor_dashboard.html | 20 ++- .../application_overviews_table_cyp.html | 124 ++++++++++++++++++ .../templates/macros/filter_options.html | 2 +- app/blueprints/shared/filters.py | 6 + config/display_value_mappings.py | 17 +++ create_app.py | 2 + 7 files changed, 177 insertions(+), 3 deletions(-) create mode 100644 app/blueprints/assessments/templates/macros/application_overviews_table_cyp.html diff --git a/app/blueprints/assessments/routes.py b/app/blueprints/assessments/routes.py index 99d334eb..b06ccdc7 100644 --- a/app/blueprints/assessments/routes.py +++ b/app/blueprints/assessments/routes.py @@ -98,9 +98,11 @@ from config import Config from config.display_value_mappings import assessment_statuses from config.display_value_mappings import asset_types +from config.display_value_mappings import cohort from config.display_value_mappings import funding_types from config.display_value_mappings import landing_filters from config.display_value_mappings import search_params_cof +from config.display_value_mappings import search_params_cyp from config.display_value_mappings import search_params_nstf from flask import abort from flask import Blueprint @@ -195,8 +197,12 @@ def landing(): def fund_dashboard(fund_short_name: str, round_short_name: str): if fund_short_name.upper() == "NSTF": search_params = {**search_params_nstf} - else: + elif fund_short_name.upper() == "COF": search_params = {**search_params_cof} + elif fund_short_name.upper() == "CYP": + search_params = {**search_params_cyp} + else: + search_params = {} fund = get_fund( fund_short_name, @@ -317,6 +323,7 @@ def get_sorted_application_overviews( query_params=search_params, asset_types=asset_types, funding_types=funding_types, + cohort=cohort, assessment_statuses=assessment_statuses, show_clear_filters=show_clear_filters, stats=stats, diff --git a/app/blueprints/assessments/templates/assessor_dashboard.html b/app/blueprints/assessments/templates/assessor_dashboard.html index 86391387..dca6df29 100644 --- a/app/blueprints/assessments/templates/assessor_dashboard.html +++ b/app/blueprints/assessments/templates/assessor_dashboard.html @@ -2,6 +2,7 @@ {%- from 'govuk_frontend_jinja/components/inset-text/macro.html' import govukInsetText -%} {%- from "govuk_frontend_jinja/components/button/macro.html" import govukButton -%} {%- from 'govuk_frontend_jinja/components/back-link/macro.html' import govukBackLink -%} +{% import "macros/application_overviews_table_cyp.html" as application_overviews_table_cyp -%} {% import "macros/application_overviews_table_nstf.html" as application_overviews_table_nstf -%} {% import "macros/application_overviews_table_cof.html" as application_overviews_table_cof -%} {% from "macros/banner_summary.html" import banner_summary %} @@ -61,7 +62,24 @@

{% if is_active_status %}All act
- {% if round_details.fund_short_name.upper() == 'NSTF' %} + {% if round_details.fund_short_name.upper() == 'CYP' %} + {{ application_overviews_table_cyp.render( + application_overviews, + round_details, + query_params, + cohort, + assessment_statuses, + countries, + regions, + local_authorities, + show_clear_filters, + sort_column, + sort_order, + tag_option_groups, + tags, + tagging_purpose_config + ) }} + {% elif round_details.fund_short_name.upper() == 'NSTF' %} {{ application_overviews_table_nstf.render( application_overviews, round_details, diff --git a/app/blueprints/assessments/templates/macros/application_overviews_table_cyp.html b/app/blueprints/assessments/templates/macros/application_overviews_table_cyp.html new file mode 100644 index 00000000..3f98ad71 --- /dev/null +++ b/app/blueprints/assessments/templates/macros/application_overviews_table_cyp.html @@ -0,0 +1,124 @@ +{% from "govuk_frontend_jinja/components/input/macro.html" import govukInput %} +{% from "macros/sortable_table_header.html" import sortable_table_header %} +{% from "macros/filter_options.html" import filter_options %} +{% from "macros/tags_table.html" import tags_table %} + + +{% macro render(application_overviews, round_details, query_params, cohort, + assessment_statuses, countries, regions, local_authorities, show_clear_filters, + sort_column, sort_order, tag_option_groups, tags, tagging_purpose_config) -%} + + +{% if not application_overviews %} +
+

+ No matching results. +

+

Improve your results by:

+
    +
  • removing filters
  • +
  • double-checking your spelling
  • +
+
+{% else %} + + + + + + {{ sortable_table_header('organisation_name', 'Organisation name', sort_order, sort_column, round_details, query_params) }} + + {{ sortable_table_header('cohort', 'Cohort', sort_order, sort_column, round_details, query_params) }} + + {{ sortable_table_header('funding_requested', 'Funding requested', sort_order, sort_column, round_details, query_params) }} + + {{ sortable_table_header('national_or_regional', 'National or regional', sort_order, sort_column, round_details, query_params) }} + + {{ sortable_table_header('tags', 'Tags', sort_order, sort_column, round_details, query_params) }} + + {% if g.access_controller.has_any_assessor_role %} + {{ sortable_table_header('status', 'Status', sort_order, sort_column, round_details, query_params) }} + {% endif %} + + + + + {% for overview in application_overviews %} + + + + + + {% set cohort_display_list = [] %} + {% set cohort_list = overview.cohort | ast_literal_eval %} + {% for cohrt in cohort_list %} + {% set _ = cohort_display_list.append(cohort.get(cohrt)) %} + {% endfor %} + + + + + + + {{ tags_table(tags[overview.application_id], tagging_purpose_config, query_params.show_tags == "ON") }} + + {% if g.access_controller.has_any_assessor_role %} + + {% endif %} + + {% endfor %} + +
+ Reference +
{{ overview.short_id[-6:] }}{{ overview.organisation_name }}{{ cohort_display_list | join(' ') }}£{{ "{:,.2f}".format(overview.funding_amount_requested|int|round) }}{{ "Regional" if overview.is_project_regional else "National"}} + {% if overview.application_status == "QA_COMPLETED" %} + {{ assessment_statuses[overview.application_status] }} + {% elif overview.application_status == "STOPPED" %} + + {{ assessment_statuses[overview.application_status] }} + + {% elif overview.application_status == "FLAGGED" %} + + {{ assessment_statuses[overview.application_status] }} + + {% elif "Flagged" in overview.application_status %} + + {{ overview.application_status }} + + {% elif overview.application_status == "NOT_STARTED" %} + + {{ assessment_statuses[overview.application_status] }} + + {% elif overview.application_status == "COMPLETED" %} + + {{ assessment_statuses[overview.application_status] }} + + {% elif overview.application_status == "MULTIPLE_FLAGS" %} + + {{ assessment_statuses[overview.application_status] }} + + {% else %} + + {{ assessment_statuses[overview.application_status] }} + {{ '(' + overview.progress|string + '%)' if 'progress' in overview else '(0%)' }} + + {% endif %} +
+{% endif %} +{%- endmacro %} diff --git a/app/blueprints/assessments/templates/macros/filter_options.html b/app/blueprints/assessments/templates/macros/filter_options.html index 2d8f4a62..2df4b3c3 100644 --- a/app/blueprints/assessments/templates/macros/filter_options.html +++ b/app/blueprints/assessments/templates/macros/filter_options.html @@ -20,7 +20,7 @@