diff --git a/app/controllers/bulk_upload_lettings_resume_controller.rb b/app/controllers/bulk_upload_lettings_resume_controller.rb new file mode 100644 index 000000000..9ddffa27f --- /dev/null +++ b/app/controllers/bulk_upload_lettings_resume_controller.rb @@ -0,0 +1,35 @@ +class BulkUploadLettingsResumeController < ApplicationController + before_action :authenticate_user! + + def start + @bulk_upload = current_user.bulk_uploads.find(params[:id]) + + redirect_to fix_choice_bulk_upload_lettings_resume_path(@bulk_upload) + end + + def show + @bulk_upload = current_user.bulk_uploads.find(params[:id]) + + render form.view_path + end + + def update + @bulk_upload = current_user.bulk_uploads.find(params[:id]) + + if form.valid? # && form.save! + redirect_to form.next_path + else + render form.view_path + end + end + +private + + def form + @form ||= Forms::BulkUploadLettingsResume::FixChoice.new(form_params) + end + + def form_params + params.fetch(:form, {}).permit(:choice) + end +end diff --git a/app/models/forms/bulk_upload_lettings_resume/fix_choice.rb b/app/models/forms/bulk_upload_lettings_resume/fix_choice.rb new file mode 100644 index 000000000..4362327d9 --- /dev/null +++ b/app/models/forms/bulk_upload_lettings_resume/fix_choice.rb @@ -0,0 +1,25 @@ +module Forms + module BulkUploadLettingsResume + class FixChoice + include ActiveModel::Model + include ActiveModel::Attributes + include Rails.application.routes.url_helpers + + attribute :choice, :string + + validates :choice, presence: true, + inclusion: { in: %w[create-fix-inline upload-again] } + + def options + [ + OpenStruct.new(id: "create-fix-inline", name: "Upload these logs and fix errors on CORE site"), + OpenStruct.new(id: "upload-again", name: "Fix errors in the CSV and re-upload"), + ] + end + + def view_path + "bulk_upload_lettings_resume/fix_choice" + end + end + end +end diff --git a/app/views/bulk_upload_lettings_resume/fix_choice.html.erb b/app/views/bulk_upload_lettings_resume/fix_choice.html.erb new file mode 100644 index 000000000..70030318c --- /dev/null +++ b/app/views/bulk_upload_lettings_resume/fix_choice.html.erb @@ -0,0 +1,36 @@ +
When it comes to fixing errors, there are pros and cons to doing it on a CSV versus doing it on a website.
+ +Fixing errors on a CSV file can be beneficial because it allows you to easily make changes to multiple records at once, and you can use tools like Excel to quickly identify and correct errors. However, if the CSV file is not properly formatted, it can be difficult to identify which records contain errors.
+ +Fixing errors on a website can be convenient because you can see the data in context and make changes in real-time. However, this approach can be time-consuming if you need to make changes to multiple records, and it may be more difficult to identify errors in a large dataset.
+ +Ultimately, the best approach will depend on the specific situation and the nature of the errors that need to be fixed.
+ <% end %> + + <%= f.govuk_collection_radio_buttons :choice, + @form.options, + :id, + :name, + legend: { hidden: true } %> + + <%= f.govuk_submit %> + <% end %> +