-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve validation for clawback payer response upload
- Loading branch information
Jamie
committed
Jan 30, 2025
1 parent
f86f3c1
commit b39d4da
Showing
28 changed files
with
467 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 36 additions & 4 deletions
40
app/views/wizards/claims/upload_esfa_clawback_response_wizard/_confirmation_step.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,50 @@ | ||
<% content_for(:page_title) { sanitize t(".page_title") } %> | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<div class="govuk-grid-column-full"> | ||
<span class="govuk-caption-l"><%= t(".caption") %></span> | ||
<h1 class="govuk-heading-l"><%= t(".title") %></h1> | ||
|
||
<%= form_for(current_step, url: current_step_path, method: :put) do |f| %> | ||
<%= f.govuk_error_summary %> | ||
|
||
<p class="govuk-body"> | ||
<%= t(".claims_count", count: current_step.claims_count) %> | ||
<h2 class="govuk-heading-m"><%= current_step.file_name %></h2> | ||
|
||
<div class="horizontal-scrollable"> | ||
<%= govuk_table do |table| %> | ||
<% table.with_head do |head| %> | ||
<% head.with_row do |row| %> | ||
<% row.with_cell text: 1 %> | ||
<% current_step.csv_headers.each do |header| %> | ||
<% row.with_cell text: header %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
|
||
<% table.with_body do |body| %> | ||
<% current_step.csv.each_with_index do |csv_row, index| %> | ||
<% if csv_row["claim_reference"].present? %> | ||
<% body.with_row do |row| %> | ||
<% row.with_cell text: index + 2 %> | ||
<% current_step.csv_headers.each do |header| %> | ||
<%= row.with_cell text: csv_row[header] %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
|
||
<p class="govuk_body govuk-!-text-align-centre"> | ||
<% if current_step.csv.count > 5 %> | ||
<%= t(".only_showing_first_five_rows") %> | ||
<% else %> | ||
<%= t(".showing_all_rows") %> | ||
<% end %> | ||
</p> | ||
|
||
<%= f.govuk_submit(t(".upload_data")) %> | ||
<%= f.govuk_submit(t(".confirm_upload")) %> | ||
<% end %> | ||
</div> | ||
</div> |
110 changes: 52 additions & 58 deletions
110
app/views/wizards/claims/upload_esfa_clawback_response_wizard/_upload_errors_step.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,69 @@ | ||
<% content_for(:page_title) { sanitize t(".page_title") } %> | ||
<% content_for(:page_title) { sanitize title_with_error_prefix(t(".page_title"), error: true) } %> | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<div class="govuk-grid-column-full"> | ||
<span class="govuk-caption-l"><%= t(".caption") %></span> | ||
<h1 class="govuk-heading-l"><%= t(".title") %></h1> | ||
<% if current_step.invalid_claim_references.present? %> | ||
<h2 class="govuk-heading-m govuk-!-margin-top-0"> | ||
<%= t(".incorrect_claim_reference") %> | ||
</h2> | ||
|
||
<%= govuk_summary_list(actions: false) do |summary_list| %> | ||
<% current_step.invalid_claim_references.each do |invalid_claim_references| %> | ||
<% summary_list.with_row do |row| %> | ||
<% row.with_key( | ||
text: invalid_claim_references, | ||
) %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<div class="govuk-error-summary" data-module="govuk-error-summary"> | ||
<div role="alert"> | ||
<h2 class="govuk-error-summary__title"> | ||
<%= t(".error_summary.title") %> | ||
</h2> | ||
<div class="govuk-error-summary__body"> | ||
<div class="govuk-list govuk-error-summary__list"> | ||
<% if current_step.error_count > 0 %> | ||
<p class="govuk-heading-s"> | ||
<%= t(".error_summary.errors_to_fix", count: current_step.error_count) %> | ||
</p> | ||
<% end %> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<% if current_step.invalid_status_claims.present? %> | ||
<h2 class="govuk-heading-m govuk-!-margin-top-0"> | ||
<%= t(".incorrect_status") %> | ||
</h2> | ||
<h2 class="govuk-heading-m"><%= current_step.file_name %></h2> | ||
|
||
<%= govuk_table do |table| %> | ||
<% table.with_head do |head| %> | ||
<% head.with_row do |row| %> | ||
<% row.with_cell text: 1 %> | ||
<% row.with_cell text: t(".csv_table.headers.claim_reference") %> | ||
<% row.with_cell text: t(".csv_table.headers.claim_status") %> | ||
|
||
<%= govuk_summary_list do |summary_list| %> | ||
<% current_step.invalid_status_claims.each do |invalid_claim| %> | ||
<% summary_list.with_row do |row| %> | ||
<% row.with_key( | ||
text: invalid_claim.reference, | ||
) %> | ||
<% row.with_action( | ||
text: t(".view"), | ||
href: claims_support_claim_path(invalid_claim), | ||
visually_hidden_text: invalid_claim.reference, | ||
html_attributes: { | ||
class: "govuk-link--no-visited-state", | ||
target: "_blank", | ||
new_tab: true, | ||
}, | ||
) %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
|
||
<% if current_step.invalid_updated_status_claims.present? %> | ||
<h2 class="govuk-heading-m govuk-!-margin-top-0"> | ||
<%= t(".invalid_updated_status") %> | ||
</h2> | ||
|
||
<%= govuk_summary_list do |summary_list| %> | ||
<% current_step.invalid_updated_status_claims.each do |invalid_claim| %> | ||
<% summary_list.with_row do |row| %> | ||
<% row.with_key( | ||
text: invalid_claim.reference, | ||
) %> | ||
<% row.with_action( | ||
text: t(".view"), | ||
href: claims_support_claim_path(invalid_claim), | ||
visually_hidden_text: invalid_claim.reference, | ||
html_attributes: { class: "govuk-link--no-visited-state" }, | ||
) %> | ||
<% table.with_body do |body| %> | ||
<% current_step.row_indexes_with_errors.each do |csv_row_index| %> | ||
<% csv_row = current_step.csv[csv_row_index] %> | ||
<% body.with_row do |row| %> | ||
<% row.with_cell(text: csv_row_index + 2) %> | ||
<% row.with_cell do %> | ||
<p> | ||
<% if current_step.invalid_claim_rows.include?(csv_row_index) %> | ||
<strong class="error-text"><%= t(".csv_table.errors.invalid_claim_reference") %></strong><br> | ||
<% end %> | ||
<%= csv_row["claim_reference"] %> | ||
</p> | ||
<% end %> | ||
<% row.with_cell do %> | ||
<p> | ||
<% if current_step.invalid_claim_status_rows.include?(csv_row_index) %> | ||
<strong class="error-text"><%= t(".csv_table.errors.invalid_claim_status") %></strong><br> | ||
<% end %> | ||
<%= csv_row["claim_status"] %> | ||
</p> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
|
||
<%= govuk_warning_text do %> | ||
<%= t(".upload_warning_html") %> | ||
<% end %> | ||
<p class="govuk_body govuk-!-text-align-centre"> | ||
<%= t(".only_showing_rows_with_errors") %> | ||
</p> | ||
|
||
<%= govuk_button_link_to t(".upload_your_file_again"), step_path(:upload) %> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 11 additions & 1 deletion
12
app/wizards/claims/upload_esfa_clawback_response_wizard/confirmation_step.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
class Claims::UploadESFAClawbackResponseWizard::ConfirmationStep < BaseStep | ||
delegate :claims_count, to: :wizard | ||
delegate :file_name, :csv, to: :upload_step | ||
|
||
def csv_headers | ||
@csv_headers ||= csv.headers | ||
end | ||
|
||
private | ||
|
||
def upload_step | ||
@upload_step ||= wizard.steps.fetch(:upload) | ||
end | ||
end |
24 changes: 13 additions & 11 deletions
24
app/wizards/claims/upload_esfa_clawback_response_wizard/upload_errors_step.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.