Skip to content

Commit

Permalink
Implement order completed form view (#602)
Browse files Browse the repository at this point in the history
* Implement order completed form view

From: https://eaflood.atlassian.net/browse/RUBY-767

This implement the view for the completed form state on order copy cards journey, as per wireframe.
  • Loading branch information
cintamani committed Dec 12, 2019
1 parent 1c270a9 commit 8d2aa13
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 1 deletion.
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

0 comments on commit 8d2aa13

Please sign in to comment.