You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.5 KiB
57 lines
1.5 KiB
2 years ago
|
module Forms
|
||
4 weeks ago
|
module BulkUploadResume
|
||
2 years ago
|
class Confirm
|
||
|
include ActiveModel::Model
|
||
|
include ActiveModel::Attributes
|
||
|
include Rails.application.routes.url_helpers
|
||
|
|
||
4 weeks ago
|
attribute :log_type
|
||
2 years ago
|
attribute :bulk_upload
|
||
|
|
||
|
def view_path
|
||
4 weeks ago
|
"bulk_upload_#{log_type}_resume/confirm"
|
||
2 years ago
|
end
|
||
|
|
||
|
def back_path
|
||
4 weeks ago
|
send("page_bulk_upload_#{log_type}_resume_path", bulk_upload, page: "fix-choice")
|
||
2 years ago
|
end
|
||
|
|
||
|
def next_path
|
||
4 weeks ago
|
send("resume_bulk_upload_#{log_type}_result_path", bulk_upload)
|
||
2 years ago
|
end
|
||
|
|
||
12 months ago
|
def error_report_path
|
||
|
if BulkUploadErrorSummaryTableComponent.new(bulk_upload:).errors?
|
||
4 weeks ago
|
send("summary_bulk_upload_#{log_type}_result_path", bulk_upload)
|
||
12 months ago
|
else
|
||
4 weeks ago
|
send("bulk_upload_#{log_type}_result_path", bulk_upload)
|
||
12 months ago
|
end
|
||
|
end
|
||
|
|
||
2 years ago
|
def save!
|
||
2 years ago
|
ApplicationRecord.transaction do
|
||
|
processor = BulkUpload::Processor.new(bulk_upload:)
|
||
|
processor.approve
|
||
|
|
||
|
bulk_upload.update!(choice: "create-fix-inline")
|
||
|
end
|
||
2 years ago
|
|
||
|
true
|
||
|
end
|
||
2 years ago
|
|
||
|
def preflight_valid?
|
||
|
bulk_upload.choice != "create-fix-inline" && bulk_upload.choice != "bulk-confirm-soft-validations"
|
||
|
end
|
||
|
|
||
|
def preflight_redirect
|
||
|
case bulk_upload.choice
|
||
|
when "create-fix-inline"
|
||
4 weeks ago
|
send("page_bulk_upload_#{log_type}_resume_path", bulk_upload, :chosen)
|
||
2 years ago
|
when "bulk-confirm-soft-validations"
|
||
4 weeks ago
|
send("page_bulk_upload_#{log_type}_soft_validations_check_path", bulk_upload, :chosen)
|
||
2 years ago
|
end
|
||
|
end
|
||
2 years ago
|
end
|
||
|
end
|
||
|
end
|