Browse Source

Add prepare your file

pull/2154/head
Kat 2 years ago
parent
commit
cc87105938
  1. 4
      app/models/bulk_upload.rb
  2. 2
      app/models/forms/bulk_upload_sales/prepare_your_file.rb
  3. 2
      app/services/bulk_upload/sales/log_creator.rb
  4. 2
      app/services/bulk_upload/sales/validator.rb
  5. 41
      app/views/bulk_upload_sales_logs/forms/prepare_your_file_2024.html.erb

4
app/models/bulk_upload.rb

@ -58,8 +58,8 @@ class BulkUpload < ApplicationRecord
end end
year_class = case year year_class = case year
when 2022 when 2024
"Year2022" "Year2024"
when 2023 when 2023
"Year2023" "Year2023"
else else

2
app/models/forms/bulk_upload_sales/prepare_your_file.rb

@ -11,6 +11,8 @@ module Forms
case year case year
when 2023 when 2023
"bulk_upload_sales_logs/forms/prepare_your_file_2023" "bulk_upload_sales_logs/forms/prepare_your_file_2023"
when 2024
"bulk_upload_sales_logs/forms/prepare_your_file_2024"
end end
end end

2
app/services/bulk_upload/sales/log_creator.rb

@ -33,6 +33,8 @@ private
@csv_parser ||= case bulk_upload.year @csv_parser ||= case bulk_upload.year
when 2023 when 2023
BulkUpload::Sales::Year2023::CsvParser.new(path:) BulkUpload::Sales::Year2023::CsvParser.new(path:)
when 2024
BulkUpload::Sales::Year2024::CsvParser.new(path:)
else else
raise "csv parser not found" raise "csv parser not found"
end end

2
app/services/bulk_upload/sales/validator.rb

@ -94,6 +94,8 @@ private
@csv_parser ||= case bulk_upload.year @csv_parser ||= case bulk_upload.year
when 2023 when 2023
BulkUpload::Sales::Year2023::CsvParser.new(path:) BulkUpload::Sales::Year2023::CsvParser.new(path:)
when 2024
BulkUpload::Sales::Year2024::CsvParser.new(path:)
else else
raise "csv parser not found" raise "csv parser not found"
end end

41
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 %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= form_with model: @form, scope: :form, url: bulk_upload_sales_log_path(id: "prepare-your-file"), method: :patch do |f| %>
<%= f.hidden_field :year %>
<span class="govuk-caption-l">Upload sales logs in bulk (<%= @form.year_combo %>)</span>
<h1 class="govuk-heading-l">Prepare your file</h1>
<p class="govuk-body govuk-!-margin-bottom-2"><%= 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.</p>
<h2 class="govuk-heading-s">Download template</h2>
<p class="govuk-body govuk-!-margin-bottom-2">Use one of these templates to upload logs for 2024/25:</p>
<ul class="govuk-list govuk-list--bullet">
<li><%= 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.</li>
<li><%= 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.</li>
</ul>
<p class="govuk-body govuk-!-margin-bottom-2">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.</p>
<h2 class="govuk-heading-s">Create your file</h2>
<ul class="govuk-list govuk-list--bullet">
<li>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.</li>
<li>Make sure each column of your data aligns with the matching headers above. You may need to reorder your data.</li>
<li>Use the <%= govuk_link_to "Sales #{@form.year_combo} Bulk Upload Specification", @form.specification_path %> to check your data is in the correct format.</li>
<li><strong>Username field:</strong> To assign a log to someone else, enter the email address they use to log into CORE.</li>
<li>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.</li>
</ul>
<h2 class="govuk-heading-s">Save your file</h2>
<ul class="govuk-list govuk-list--bullet">
<li>Save your file as a CSV.</li>
<li>Your file should now be ready to upload.</li>
</ul>
<%= f.govuk_submit %>
<% end %>
</div>
</div>
Loading…
Cancel
Save