Browse Source

Add sales resume and summary pages

pull/1574/head
Kat 3 years ago
parent
commit
59f71398d9
  1. 16
      app/controllers/bulk_upload_sales_results_controller.rb
  2. 11
      app/views/bulk_upload_sales_results/resume.html.erb
  3. 30
      app/views/bulk_upload_sales_results/summary.html.erb
  4. 7
      config/routes.rb

16
app/controllers/bulk_upload_sales_results_controller.rb

@ -6,4 +6,20 @@ class BulkUploadSalesResultsController < ApplicationController
def show
@bulk_upload = current_user.bulk_uploads.sales.find(params[:id])
end
def resume
@bulk_upload = current_user.bulk_uploads.sales.find(params[:id])
if @bulk_upload.sales_logs.in_progress.count.positive?
set_bulk_upload_logs_filters
redirect_to(sales_logs_path(bulk_upload_id: [@bulk_upload.id]))
else
reset_logs_filters
end
end
def summary
@bulk_upload = current_user.bulk_uploads.sales.find(params[:id])
end
end

11
app/views/bulk_upload_sales_results/resume.html.erb

@ -0,0 +1,11 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-xl">There are no more logs that need updating</h1>
</div>
</div>
<p class="govuk-body-l">
You’ve completed all the logs that had errors from your bulk upload.
</p>
<%= govuk_button_link_to "Back to all logs", sales_logs_path, button: true %>

30
app/views/bulk_upload_sales_results/summary.html.erb

@ -0,0 +1,30 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for sales (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">Fix <%= pluralize(@bulk_upload.bulk_upload_errors.count, "error") %> and upload file again</h1>
<p class="govuk-body-l">
We could not create logs from your bulk upload. Below is a list of everything that you need to fix your spreadsheet. You can download the <%= govuk_link_to "specification", Forms::BulkUploadSales::PrepareYourFile.new(year: @bulk_upload.year).specification_path, target: "_blank" %> to help you fix the cells in your CSV file.
</p>
<p class="govuk-body-l">
Filename: <%= @bulk_upload.filename %>
</p>
</div>
</div>
<div class="govuk-grid-row">
<%= govuk_tabs(title: "Error reports") do |c| %>
<% c.with_tab(label: "Summary") do %>
<%= render BulkUploadErrorSummaryTableComponent.new(bulk_upload: @bulk_upload) %>
<% end %>
<% c.with_tab(label: "Full error report") do %>
<% @bulk_upload.bulk_upload_errors.order_by_cell.group_by(&:row).each do |_row, errors_for_row| %>
<%= render BulkUploadErrorRowComponent.new(bulk_upload_errors: errors_for_row) %>
<% end %>
<% end %>
<% end %>
</div>
<%= govuk_button_link_to "Upload your file again", start_bulk_upload_sales_logs_path %>

7
config/routes.rb

@ -199,7 +199,12 @@ Rails.application.routes.draw do
end
end
resources :bulk_upload_sales_results, path: "bulk-upload-results", only: [:show]
resources :bulk_upload_sales_results, path: "bulk-upload-results", only: [:show] do
member do
get :resume
get :summary
end
end
end
member do

Loading…
Cancel
Save