From d66dc3a13571598aacf22afdcc353e3783b2b763 Mon Sep 17 00:00:00 2001 From: Kat <54268893+kosiakkatrina@users.noreply.github.com> Date: Wed, 12 Feb 2025 08:40:54 +0000 Subject: [PATCH] Add prepare your file and connect the csv parser to log creator and validator --- app/models/bulk_upload.rb | 2 + .../bulk_upload_form/prepare_your_file.rb | 2 + .../bulk_upload/lettings/log_creator.rb | 2 + .../bulk_upload/lettings/validator.rb | 2 + .../forms/prepare_your_file_2025.html.erb | 37 +++++++++++++++++++ 5 files changed, 45 insertions(+) create mode 100644 app/views/bulk_upload_lettings_logs/forms/prepare_your_file_2025.html.erb diff --git a/app/models/bulk_upload.rb b/app/models/bulk_upload.rb index 6616285b0..dd09b365b 100644 --- a/app/models/bulk_upload.rb +++ b/app/models/bulk_upload.rb @@ -104,6 +104,8 @@ class BulkUpload < ApplicationRecord end year_class = case year + when 2025 + "Year2025" when 2024 "Year2024" when 2023 diff --git a/app/models/forms/bulk_upload_form/prepare_your_file.rb b/app/models/forms/bulk_upload_form/prepare_your_file.rb index 911daa4fe..1838e754f 100644 --- a/app/models/forms/bulk_upload_form/prepare_your_file.rb +++ b/app/models/forms/bulk_upload_form/prepare_your_file.rb @@ -13,6 +13,8 @@ module Forms case year when 2024 "bulk_upload_#{log_type}_logs/forms/prepare_your_file_2024" + when 2025 + "bulk_upload_#{log_type}_logs/forms/prepare_your_file_2025" end end diff --git a/app/services/bulk_upload/lettings/log_creator.rb b/app/services/bulk_upload/lettings/log_creator.rb index 0df59b310..ab5405381 100644 --- a/app/services/bulk_upload/lettings/log_creator.rb +++ b/app/services/bulk_upload/lettings/log_creator.rb @@ -34,6 +34,8 @@ private BulkUpload::Lettings::Year2023::CsvParser.new(path:) when 2024 BulkUpload::Lettings::Year2024::CsvParser.new(path:) + when 2025 + BulkUpload::Lettings::Year2025::CsvParser.new(path:) else raise "csv parser not found" end diff --git a/app/services/bulk_upload/lettings/validator.rb b/app/services/bulk_upload/lettings/validator.rb index 291bf45e7..8cb3a1bd9 100644 --- a/app/services/bulk_upload/lettings/validator.rb +++ b/app/services/bulk_upload/lettings/validator.rb @@ -111,6 +111,8 @@ private BulkUpload::Lettings::Year2023::CsvParser.new(path:) when 2024 BulkUpload::Lettings::Year2024::CsvParser.new(path:) + when 2025 + BulkUpload::Lettings::Year2025::CsvParser.new(path:) else raise "csv parser not found" end diff --git a/app/views/bulk_upload_lettings_logs/forms/prepare_your_file_2025.html.erb b/app/views/bulk_upload_lettings_logs/forms/prepare_your_file_2025.html.erb new file mode 100644 index 000000000..abc2ab817 --- /dev/null +++ b/app/views/bulk_upload_lettings_logs/forms/prepare_your_file_2025.html.erb @@ -0,0 +1,37 @@ +<% content_for :before_content do %> + <%= govuk_back_link href: @form.back_path %> +<% end %> + +
+
+ <%= form_with model: @form, scope: :form, url: bulk_upload_lettings_log_path(id: "prepare-your-file"), method: :patch do |f| %> + <%= f.hidden_field :year %> + <%= f.hidden_field :organisation_id %> + + Upload lettings logs in bulk (<%= @form.year_combo %>) +

Prepare your file

+

<%= govuk_link_to "Read the full guidance", bulk_upload_lettings_log_path(id: "guidance", form: { year: @form.year }, referrer: "prepare-your-file") %> before you start if you have not used bulk upload before.

+ +

Download template

+ +

<%= govuk_link_to "Download the lettings bulk upload template (2025 to 2026)", @form.template_path %>

+

There are 8 rows of content in the templates. These rows are called the ‘headers’. They contain the CORE form questions and guidance about which questions are required and how to format your answers.

+ +

Create your file

+ + <%= govuk_list [ + "Fill in the template with data from your housing management system. Your data should go below the headers, with one row per log. Leave column A blank - the bulk upload fields start in column B.", + "Make sure each column of your data aligns with the matching headers above. You may need to reorder your data.", + "Use the #{govuk_link_to 'Lettings bulk upload Specification (2025 to 2026)', @form.specification_path} to check your data is in the correct format.".html_safe, + "Username field: To assign a log to someone else, enter the email address they use to log into CORE.".html_safe, + "If you have reordered the headers, keep the headers in the file.", + ], type: :bullet %> + +

Save your file

+ + <%= govuk_list ["Save your file as a CSV.", "Your file should now be ready to upload."], type: :bullet %> + + <%= f.govuk_submit class: "govuk-!-margin-top-7" %> + <% end %> +
+