Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement order completed form view #602

Merged
merged 2 commits into from
Dec 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class OrderCopyCardsRegistration < TransientRegistration
include CanUseOrderCopyCardsWorkflow

validates :reg_identifier, "waste_carriers_engine/reg_identifier": true
delegate :contact_address, to: :registration
delegate :contact_address, :contact_email, to: :registration

def registration
@_registration ||= Registration.find_by(reg_identifier: reg_identifier)
Expand Down
3 changes: 3 additions & 0 deletions app/views/shared/_message.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="error-summary flash-message" role="alert" aria-labelledby="message-summary-heading-1" tabindex="-1">
<%= message %>
</div>
3 changes: 3 additions & 0 deletions app/views/shared/_success.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="error-summary flash-success" role="alert" aria-labelledby="message-summary-heading-1" tabindex="-1">
<%= message %>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<h1 class="heading-large"><%= t(".heading") %></h1>

<% if @transient_registration.temp_payment_method == "card" %>
<%= render("shared/success", message: t(".payment_success_message_html", email: @transient_registration.contact_email)) %>
<% else %>
<%= render("shared/message", message: t(".awaiting_payment_message_html", email: @transient_registration.contact_email)) %>
<% end %>

<div class="text">
<div class="form-group">
<table>
<tr>
<th><%= t(".details_table.cards_label") %></th>
<td><%= @transient_registration.temp_cards %></td>
</tr>
<tr>
<th><%= t(".details_table.total_cost") %></th>
<td>£ <%= display_pence_as_pounds(@transient_registration.total_registration_card_charge) %></td>
</tr>
<tr>
<th><%= t(".details_table.reference") %></th>
<td><%= @transient_registration.reg_identifier %></td>
</tr>
</table>
</div>
<div class="form-group">
<%= link_to t(".dashboard"), Rails.application.routes.url_helpers.root_path, class: "button" %>
<%= link_to t(".details_page", reg_identifier: @transient_registration.reg_identifier), Rails.application.routes.url_helpers.registration_path(@transient_registration.reg_identifier), class: "button" %>
</div>
</div>
13 changes: 13 additions & 0 deletions config/locales/forms/copy_cards_order_completed_forms/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
en:
waste_carriers_engine:
copy_cards_order_completed_forms:
new:
heading: "Confirmation of order"
awaiting_payment_message_html: "Order is awaiting payment.<br>We've sent an email with payment details to %{email}."
payment_success_message_html: "Order completed.<br>Payment has cleared.<br>We have sent a confirmation email to %{email}."
details_table:
cards_label: "Number of cards ordered"
total_cost: "Total cost"
reference: "Reference"
dashboard: "Go to registration search"
details_page: "Details for %{reg_identifier}"
5 changes: 5 additions & 0 deletions spec/dummy/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@
end

root "waste_carriers_engine/registrations#index"

resources :registrations,
only: :show,
param: :reg_identifier,
path: "/bo/registrations"
end