{% extends "deliver_grant_funding/grant_base.html" %} {% from "govuk_frontend_jinja/components/back-link/macro.html" import govukBackLink %} {% from "govuk_frontend_jinja/components/error-summary/macro.html" import govukErrorSummary %} {% from 'govuk_frontend_jinja/components/details/macro.html' import govukDetails %} {% set type_constants = collection.type.constants %} {% set active_item_identifier = type_constants.active_nav %} {% set page_title = "Replace " + data_source.name + " data set " %} {% block beforeContent %} {% set back_link = url_for("deliver_grant_funding.list_collection_data_sets", grant_id=grant.id, collection_type=collection.type, collection_id=collection.id) %} {{ govukBackLink({ "text": "Back", "href": back_link }) }} {% endblock beforeContent %} {% block errorSummary %}
{% set error_list = [] %} {% for e in form.name.errors %} {% do error_list.append({"text":e,"href":"#name"}) %} {% endfor %} {% for e in form.file.errors %} {% if e not in form.data_errors %} {% do error_list.append({"text":e,"href":"#file"}) %} {% endif %} {% endfor %} {% if gr_errors %} {% for error in gr_errors %} {% do error_list.append({"text": error, "href": "#file"}) %} {% endfor %} {% endif %} {% if form.data_errors %} {% for error in form.data_errors %} {% do error_list.append({"text": error, "href": "#file"}) %} {% endfor %} {% endif %} {% if removed_column_locked_errors %} {% set error_html %} {% trans count = removed_column_locked_errors| length %}Column{% pluralize %}{{ count }}Columns{% endtrans %} {{ removed_column_locked_errors | comma_join_items("and") }} cannot be removed for grant recipients who’ve submitted or are awaiting sign off: {% endset %} {% do error_list.append({"html": error_html, "href": "#file"}) %} {% endif %} {% if changed_column_locked_errors %} {% set error_html %} Data in {% trans count = changed_column_locked_errors| length %}column{% pluralize %}{{ count }}columns{% endtrans %} {{ changed_column_locked_errors | comma_join_items("and") }} cannot be changed for grant recipients who’ve submitted or are awaiting sign off: {% endset %} {% do error_list.append({"html": error_html, "href": "#file"}) %} {% endif %} {% if error_list %} {{ govukErrorSummary({ "titleText": "There is a problem", "errorList": error_list }) }} {% endif %}
{% endblock %} {% block content %}

{{ collection.name }} {{ page_title }}

Use the latest data set template (CSV) for the latest uploaded data and grant recipients.

Upload a file to replace the existing data set.

{% set change_columns_html %}

If replacing the file will remove an existing column in the data set, first make sure the column is not being referenced in a form. For example, in guidance, questions, conditions and validations.

To change existing column names, data types or formatting, you need to delete the data set instead and upload the file as a new data set.

{% endset %} {{ govukDetails({ "summaryText": "If you are removing or changing columns", "text": change_columns_html, }) }}
{{ form.csrf_token }} {{ form.name }} {{ form.file(params={"javascript": true, "attributes": {"accept": "text/csv"} }) }}

Only CSV (.csv) files can be uploaded for data sets.

{{ form.submit(params={"text": "Check and replace data set" }) }} Cancel
{% endblock content %}