From cc87105938163af40b00384f7bb77539a93bc865 Mon Sep 17 00:00:00 2001 From: Kat Date: Tue, 23 Jan 2024 09:45:41 +0000 Subject: [PATCH] Add prepare your file --- app/models/bulk_upload.rb | 4 +- .../bulk_upload_sales/prepare_your_file.rb | 2 + app/services/bulk_upload/sales/log_creator.rb | 2 + app/services/bulk_upload/sales/validator.rb | 2 + .../forms/prepare_your_file_2024.html.erb | 41 +++++++++++++++++++ 5 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 app/views/bulk_upload_sales_logs/forms/prepare_your_file_2024.html.erb diff --git a/app/models/bulk_upload.rb b/app/models/bulk_upload.rb index 70b591b91..26b988bb2 100644 --- a/app/models/bulk_upload.rb +++ b/app/models/bulk_upload.rb @@ -58,8 +58,8 @@ class BulkUpload < ApplicationRecord end year_class = case year - when 2022 - "Year2022" + when 2024 + "Year2024" when 2023 "Year2023" else diff --git a/app/models/forms/bulk_upload_sales/prepare_your_file.rb b/app/models/forms/bulk_upload_sales/prepare_your_file.rb index 04d52802f..227137d72 100644 --- a/app/models/forms/bulk_upload_sales/prepare_your_file.rb +++ b/app/models/forms/bulk_upload_sales/prepare_your_file.rb @@ -11,6 +11,8 @@ module Forms case year when 2023 "bulk_upload_sales_logs/forms/prepare_your_file_2023" + when 2024 + "bulk_upload_sales_logs/forms/prepare_your_file_2024" end end diff --git a/app/services/bulk_upload/sales/log_creator.rb b/app/services/bulk_upload/sales/log_creator.rb index 1036ac8ff..2d0888e4d 100644 --- a/app/services/bulk_upload/sales/log_creator.rb +++ b/app/services/bulk_upload/sales/log_creator.rb @@ -33,6 +33,8 @@ private @csv_parser ||= case bulk_upload.year when 2023 BulkUpload::Sales::Year2023::CsvParser.new(path:) + when 2024 + BulkUpload::Sales::Year2024::CsvParser.new(path:) else raise "csv parser not found" end diff --git a/app/services/bulk_upload/sales/validator.rb b/app/services/bulk_upload/sales/validator.rb index 1a3234911..978537124 100644 --- a/app/services/bulk_upload/sales/validator.rb +++ b/app/services/bulk_upload/sales/validator.rb @@ -94,6 +94,8 @@ private @csv_parser ||= case bulk_upload.year when 2023 BulkUpload::Sales::Year2023::CsvParser.new(path:) + when 2024 + BulkUpload::Sales::Year2024::CsvParser.new(path:) else raise "csv parser not found" end diff --git a/app/views/bulk_upload_sales_logs/forms/prepare_your_file_2024.html.erb b/app/views/bulk_upload_sales_logs/forms/prepare_your_file_2024.html.erb new file mode 100644 index 000000000..0bbca2317 --- /dev/null +++ b/app/views/bulk_upload_sales_logs/forms/prepare_your_file_2024.html.erb @@ -0,0 +1,41 @@ +<% content_for :before_content do %> + <%= govuk_back_link href: @form.back_path %> +<% end %> + +
+
+ <%= form_with model: @form, scope: :form, url: bulk_upload_sales_log_path(id: "prepare-your-file"), method: :patch do |f| %> + <%= f.hidden_field :year %> + + Upload sales logs in bulk (<%= @form.year_combo %>) +

Prepare your file

+

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

+ +

Download template

+ +

Use one of these templates to upload logs for 2024/25:

+
    +
  • <%= govuk_link_to "Download the new template", @form.template_path %>: In this template, the questions are in the same order as the 2024/25 paper form and web form.
  • +
  • <%= govuk_link_to "Download the legacy template", @form.legacy_template_path %>: In this template, the questions are in the same order as the 2022/23 template, with new questions added on to the end.
  • +
+

There are 7 or 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

+
    +
  • Fill in the template with data from your housing management system. Your data should go below the headers, with one row per log. The bulk upload fields start at column B. Leave column A blank.
  • +
  • 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 "Sales #{@form.year_combo} Bulk Upload Specification", @form.specification_path %> to check your data is in the correct format.
  • +
  • Username field: To assign a log to someone else, enter the email address they use to log into CORE.
  • +
  • If you are using the new template, keep the headers. If you are using the legacy template, you can either keep or remove the headers. If you remove the headers, you should also remove the blank column A.
  • +
+ +

Save your file

+
    +
  • Save your file as a CSV.
  • +
  • Your file should now be ready to upload.
  • +
+ + <%= f.govuk_submit %> + <% end %> +
+