Files
growstuff/app/views/orders/show.html.haml
2017-02-08 07:25:59 +13:00

85 lines
2.0 KiB
Plaintext

- content_for :title, @order.completed_at ? "Order details (##{@order.id})" : "Current order"
%p
%strong Order number:
= @order.id
%p
%strong Ordered by:
= link_to @order.member, @order.member
%p
%strong Date begun:
= @order.created_at.to_s
- if @order.completed_at
%p
%strong Date completed:
= @order.completed_at.to_s
- if @order.referral_code
%p
%strong Referral code:
= @order.referral_code
- if current_member.role? :admin
%p
%strong Paypal Express token:
= @order.paypal_express_token
%p
%strong Paypal Express payer ID:
= @order.paypal_express_payer_id
%h2 Order items
%table.table.table-striped
%tr
%th Product
%th Price
%th Quantity
%th Subtotal
- @order.order_items.each do |i|
%tr
%td= i.product.name
%td
= price_with_currency(i.price)
%td= i.quantity
%td
- subtotal = i.price * i.quantity
= price_with_currency(subtotal)
%tr
%td
%td
%td
%strong Total:
%td
%strong
= price_with_currency(@order.total)
= forex_link(@order.total)
- if @order.errors.any?
.alert
#error_explanation
%h3
= pluralize(@order.errors.size, "error")
stopped you from checking out:
%ul
- @order.errors.full_messages.each do |msg|
%li= msg
- if can?(:complete, @order) || can?(:destroy, @order)
= form_tag(checkout_order_path(@order), method: :get, class: 'form-inline') do
%p
- if can? :complete, @order
= label_tag :referral_code, "Do you have a referral code?"
= text_field_tag :referral_code, @order.referral_code, class: 'input-medium'
= submit_tag "Checkout with PayPal", class: 'btn btn-primary'
- if can? :destroy, @order
= link_to 'Delete this order', @order, method: :delete,
data: { confirm: 'Are you sure?' },
class: 'btn btn-default'
= link_to "View other orders/order history", orders_path, class: 'btn btn-default'
%p