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. 28
      app/views/bulk_upload_lettings_logs/forms/prepare_your_file.html.erb
  4. 28
      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
class PrepareYourFile
include ActiveModel::Model
include ActiveModel::Attributes
attr_accessor :year
attribute :year, :integer
def view_path
"bulk_upload_lettings_logs/forms/prepare_your_file"
@ -17,6 +18,10 @@ module Forms
end
end
def year_combo
"#{year}/#{year+1-2000}"
end
private
def in_crossover_period?

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

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

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

@ -2,14 +2,30 @@
<%= 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_lettings_log_path(id: "prepare-your-file"), method: :patch do |f| %>
<div>
prepare file goes here
</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>
year selected <%= @form.year %>
</div>
<h2 class="govuk-heading-m">Create your file</h2>
<ul class="govuk-list govuk-list--bullet">
<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>
<h2 class="govuk-heading-m">Check your data</h2>
<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>

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

@ -2,14 +2,30 @@
<%= 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| %>
<div>
prepare file goes here
</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>
year selected <%= @form.year %>
</div>
<h2 class="govuk-heading-m">Create your file</h2>
<ul class="govuk-list govuk-list--bullet">
<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>
<h2 class="govuk-heading-m">Check your data</h2>
<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")
choose("2022/2023")
click_button("Continue")
expect(page).to have_content("prepare file goes here")
click_link("Back")
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

4
spec/features/bulk_upload_sales_logs_spec.rb

@ -21,10 +21,12 @@ RSpec.describe "Bulk upload sales log" do
choose("2022/2023")
click_button("Continue")
expect(page).to have_content("prepare file goes here")
click_link("Back")
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

Loading…
Cancel
Save