Browse Source
# Conflicts: # db/schema.rb # spec/factories/sales_log.rb # spec/models/form_handler_spec.rbpull/1165/head
447 changed files with 4789 additions and 963 deletions
@ -0,0 +1,33 @@
|
||||
<div class="x-govuk-summary-card govuk-!-margin-bottom-6"> |
||||
<div class="x-govuk-summary-card__header"> |
||||
<% if lettings? %> |
||||
<h3 class="x-govuk-summary-card__title"><strong>Row <%= row %></strong> <span class="govuk-!-margin-left-3">Tenant code: <%= tenant_code %></span> <span class="govuk-!-margin-left-3">Property reference: <%= property_ref %></span></h3> |
||||
<% else %> |
||||
<h3 class="x-govuk-summary-card__title"><strong>Row <%= row %></strong> <span class="govuk-!-margin-left-3">Purchaser code: <%= purchaser_code %></span></h3> |
||||
<% end %> |
||||
</div> |
||||
|
||||
<div class="x-govuk-summary-card__body"> |
||||
<%= govuk_table do |table| %> |
||||
<% table.head do |head| %> |
||||
<% head.row do |row| %> |
||||
<% row.cell(header: true, text: "Cell") %> |
||||
<% row.cell(header: true, text: "Question") %> |
||||
<% row.cell(header: true, text: "Error") %> |
||||
<% row.cell(header: true, text: "Specification") %> |
||||
<% end %> |
||||
|
||||
<% table.body do |body| %> |
||||
<% bulk_upload_errors.each do |error| %> |
||||
<% body.row do |row| %> |
||||
<% row.cell(header: true, text: error.cell) %> |
||||
<% row.cell(text: question_for_field(error.field)) %> |
||||
<% row.cell(text: error.error) %> |
||||
<% row.cell(text: error.field.humanize) %> |
||||
<% end %> |
||||
<% end %> |
||||
<% end %> |
||||
<% end %> |
||||
<% end %> |
||||
</div> |
||||
</div> |
||||
@ -0,0 +1,48 @@
|
||||
class BulkUploadErrorRowComponent < ViewComponent::Base |
||||
attr_reader :bulk_upload_errors |
||||
|
||||
def initialize(bulk_upload_errors:) |
||||
@bulk_upload_errors = bulk_upload_errors |
||||
|
||||
super |
||||
end |
||||
|
||||
def row |
||||
bulk_upload_errors.first.row |
||||
end |
||||
|
||||
def tenant_code |
||||
bulk_upload_errors.first.tenant_code |
||||
end |
||||
|
||||
def purchaser_code |
||||
bulk_upload_errors.first.purchaser_code |
||||
end |
||||
|
||||
def property_ref |
||||
bulk_upload_errors.first.property_ref |
||||
end |
||||
|
||||
def question_for_field(field) |
||||
case bulk_upload.log_type |
||||
when "lettings" |
||||
BulkUpload::Lettings::Validator.question_for_field(field.to_sym) |
||||
when "sales" |
||||
BulkUpload::Sales::Validator.question_for_field(field.to_sym) |
||||
else |
||||
"Unknown question" |
||||
end |
||||
end |
||||
|
||||
def bulk_upload |
||||
bulk_upload_errors.first.bulk_upload |
||||
end |
||||
|
||||
def lettings? |
||||
bulk_upload.log_type == "lettings" |
||||
end |
||||
|
||||
def sales? |
||||
bulk_upload.log_type == "sales" |
||||
end |
||||
end |
||||
@ -0,0 +1,9 @@
|
||||
class BulkUploadLettingsResultsController < ApplicationController |
||||
before_action :authenticate_user! |
||||
|
||||
rescue_from ActiveRecord::RecordNotFound, with: :render_not_found |
||||
|
||||
def show |
||||
@bulk_upload = current_user.bulk_uploads.lettings.find(params[:id]) |
||||
end |
||||
end |
||||
@ -0,0 +1,9 @@
|
||||
class BulkUploadSalesResultsController < ApplicationController |
||||
before_action :authenticate_user! |
||||
|
||||
rescue_from ActiveRecord::RecordNotFound, with: :render_not_found |
||||
|
||||
def show |
||||
@bulk_upload = current_user.bulk_uploads.sales.find(params[:id]) |
||||
end |
||||
end |
||||
@ -0,0 +1,7 @@
|
||||
class ProcessBulkUploadJob < ApplicationJob |
||||
queue_as :default |
||||
|
||||
def perform(bulk_upload:) |
||||
BulkUpload::Processor.new(bulk_upload:).call |
||||
end |
||||
end |
||||
@ -0,0 +1,3 @@
|
||||
class BulkUploadError < ApplicationRecord |
||||
belongs_to :bulk_upload |
||||
end |
||||
@ -0,0 +1,14 @@
|
||||
class Form::Sales::Pages::MortgageLender < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@header = "" |
||||
@description = "" |
||||
@subsection = subsection |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::MortgageLender.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
||||
@ -0,0 +1,17 @@
|
||||
class Form::Sales::Pages::MortgageLenderOther < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@header = "" |
||||
@description = "" |
||||
@subsection = subsection |
||||
@depends_on = [{ |
||||
"mortgagelender" => 40, |
||||
}] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::MortgageLenderOther.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue