Browse Source

bulk upload journey: add copy for prepare file

pull/1032/head
Phil Lee 4 years ago
parent
commit
907906f62d
  1. 7
      app/models/forms/bulk_upload_lettings/prepare_your_file.rb
  2. 9
      app/models/forms/bulk_upload_sales/prepare_your_file.rb
  3. 34
      app/views/bulk_upload_lettings_logs/forms/prepare_your_file.html.erb
  4. 34
      app/views/bulk_upload_sales_logs/forms/prepare_your_file.html.erb
  5. 5
      spec/features/bulk_upload_lettings_logs_spec.rb
  6. 4
      spec/features/bulk_upload_sales_logs_spec.rb

7
app/models/forms/bulk_upload_lettings/prepare_your_file.rb

@ -2,8 +2,9 @@ module Forms
module BulkUploadLettings module BulkUploadLettings
class PrepareYourFile class PrepareYourFile
include ActiveModel::Model include ActiveModel::Model
include ActiveModel::Attributes
attr_accessor :year attribute :year, :integer
def view_path def view_path
"bulk_upload_lettings_logs/forms/prepare_your_file" "bulk_upload_lettings_logs/forms/prepare_your_file"
@ -17,6 +18,10 @@ module Forms
end end
end end
def year_combo
"#{year}/#{year+1-2000}"
end
private private
def in_crossover_period? def in_crossover_period?

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

@ -2,8 +2,9 @@ module Forms
module BulkUploadSales module BulkUploadSales
class PrepareYourFile class PrepareYourFile
include ActiveModel::Model include ActiveModel::Model
include ActiveModel::Attributes
attr_accessor :year attribute :year, :integer
def view_path def view_path
"bulk_upload_sales_logs/forms/prepare_your_file" "bulk_upload_sales_logs/forms/prepare_your_file"
@ -17,6 +18,12 @@ module Forms
end end
end end
def year_combo
"#{year}/#{year+1-2000}"
end
private
def in_crossover_period? def in_crossover_period?
FormHandler.instance.forms.values.any?(&:in_crossover_period?) FormHandler.instance.forms.values.any?(&:in_crossover_period?)
end end

34
app/views/bulk_upload_lettings_logs/forms/prepare_your_file.html.erb

@ -2,14 +2,30 @@
<%= govuk_back_link href: @form.back_path %> <%= govuk_back_link href: @form.back_path %>
<% end %> <% end %>
<%= form_with model: @form, scope: :form, url: bulk_upload_lettings_log_path(id: "prepare-your-file"), method: :patch do |f| %> <div class="govuk-grid-row">
<div> <div class="govuk-grid-column-two-thirds">
prepare file goes here <%= form_with model: @form, scope: :form, url: bulk_upload_lettings_log_path(id: "prepare-your-file"), method: :patch do |f| %>
</div> <span class="govuk-caption-l">Upload lettings logs in bulk (<%= @form.year_combo %>)</span>
<h1 class="govuk-heading-l">Prepare your file</h1>
<div> <h2 class="govuk-heading-m">Create your file</h2>
year selected <%= @form.year %> <ul class="govuk-list govuk-list--bullet">
</div> <li>Download the bulk lettings template</li>
<li>Export the data from your housing management system, matching the template</li>
<li>If you cannot export it in this format, you may have to input it manually</li>
</ul>
<%= f.govuk_submit %> <h2 class="govuk-heading-m">Check your data</h2>
<% end %> <ul class="govuk-list govuk-list--bullet">
<li>Check data is complete and formatted correctly, using data specifications (opens in a new tab)</li>
</ul>
<h2 class="govuk-heading-m">Save your file</h2>
<ul class="govuk-list govuk-list--bullet">
<li>Save the file (CSV formay <strong>only</strong>)</li>
</ul>
<%= f.govuk_submit %>
<% end %>
</div>
</div>

34
app/views/bulk_upload_sales_logs/forms/prepare_your_file.html.erb

@ -2,14 +2,30 @@
<%= govuk_back_link href: @form.back_path %> <%= govuk_back_link href: @form.back_path %>
<% end %> <% end %>
<%= form_with model: @form, scope: :form, url: bulk_upload_sales_log_path(id: "prepare-your-file"), method: :patch do |f| %> <div class="govuk-grid-row">
<div> <div class="govuk-grid-column-two-thirds">
prepare file goes here <%= form_with model: @form, scope: :form, url: bulk_upload_sales_log_path(id: "prepare-your-file"), method: :patch do |f| %>
</div> <span class="govuk-caption-l">Upload sales logs in bulk (<%= @form.year_combo %>)</span>
<h1 class="govuk-heading-l">Prepare your file</h1>
<div> <h2 class="govuk-heading-m">Create your file</h2>
year selected <%= @form.year %> <ul class="govuk-list govuk-list--bullet">
</div> <li>Download the bulk sales template</li>
<li>Export the data from your housing management system, matching the template</li>
<li>If you cannot export it in this format, you may have to input it manually</li>
</ul>
<%= f.govuk_submit %> <h2 class="govuk-heading-m">Check your data</h2>
<% end %> <ul class="govuk-list govuk-list--bullet">
<li>Check data is complete and formatted correctly, using data specifications (opens in a new tab)</li>
</ul>
<h2 class="govuk-heading-m">Save your file</h2>
<ul class="govuk-list govuk-list--bullet">
<li>Save the file (CSV formay <strong>only</strong>)</li>
</ul>
<%= f.govuk_submit %>
<% end %>
</div>
</div>

5
spec/features/bulk_upload_lettings_logs_spec.rb

@ -19,13 +19,14 @@ RSpec.describe "Bulk upload lettings log" do
expect(page).to have_content("You must select a collection period to upload for") expect(page).to have_content("You must select a collection period to upload for")
choose("2022/2023") choose("2022/2023")
click_button("Continue") click_button("Continue")
expect(page).to have_content("prepare file goes here")
click_link("Back") click_link("Back")
expect(page.find_field("form-year-2022-field")).to be_checked expect(page.find_field("form-year-2022-field")).to be_checked
click_button("Continue")
expect(page).to have_content("Upload lettings logs in bulk (2022/23)")
end end
end end
end end

4
spec/features/bulk_upload_sales_logs_spec.rb

@ -21,10 +21,12 @@ RSpec.describe "Bulk upload sales log" do
choose("2022/2023") choose("2022/2023")
click_button("Continue") click_button("Continue")
expect(page).to have_content("prepare file goes here")
click_link("Back") click_link("Back")
expect(page.find_field("form-year-2022-field")).to be_checked expect(page.find_field("form-year-2022-field")).to be_checked
click_button("Continue")
expect(page).to have_content("Upload sales logs in bulk (2022/23)")
end end
end end
end end

Loading…
Cancel
Save