effective_orders 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +1004 -0
  4. data/app/assets/images/effective_orders/stripe.png +0 -0
  5. data/app/assets/javascripts/effective_orders.js +6 -0
  6. data/app/assets/javascripts/effective_orders/customers.js.coffee +32 -0
  7. data/app/assets/javascripts/effective_orders/providers/stripe.js.coffee +77 -0
  8. data/app/assets/javascripts/effective_orders/subscriptions.js.coffee +81 -0
  9. data/app/assets/stylesheets/effective_orders.scss +2 -0
  10. data/app/assets/stylesheets/effective_orders/_cart.scss +4 -0
  11. data/app/assets/stylesheets/effective_orders/_order.scss +58 -0
  12. data/app/controllers/admin/customers_controller.rb +24 -0
  13. data/app/controllers/admin/order_items_controller.rb +16 -0
  14. data/app/controllers/admin/orders_controller.rb +223 -0
  15. data/app/controllers/effective/carts_controller.rb +85 -0
  16. data/app/controllers/effective/concerns/purchase.rb +62 -0
  17. data/app/controllers/effective/customers_controller.rb +20 -0
  18. data/app/controllers/effective/orders_controller.rb +162 -0
  19. data/app/controllers/effective/providers/cheque.rb +22 -0
  20. data/app/controllers/effective/providers/free.rb +33 -0
  21. data/app/controllers/effective/providers/mark_as_paid.rb +33 -0
  22. data/app/controllers/effective/providers/moneris.rb +60 -0
  23. data/app/controllers/effective/providers/paypal.rb +33 -0
  24. data/app/controllers/effective/providers/phone.rb +22 -0
  25. data/app/controllers/effective/providers/pretend.rb +26 -0
  26. data/app/controllers/effective/providers/refund.rb +33 -0
  27. data/app/controllers/effective/providers/stripe.rb +72 -0
  28. data/app/controllers/effective/subscripter_controller.rb +18 -0
  29. data/app/controllers/effective/webhooks_controller.rb +109 -0
  30. data/app/datatables/admin/effective_customers_datatable.rb +22 -0
  31. data/app/datatables/admin/effective_orders_datatable.rb +100 -0
  32. data/app/datatables/effective_orders_datatable.rb +79 -0
  33. data/app/helpers/effective_carts_helper.rb +113 -0
  34. data/app/helpers/effective_orders_helper.rb +143 -0
  35. data/app/helpers/effective_paypal_helper.rb +49 -0
  36. data/app/helpers/effective_stripe_helper.rb +85 -0
  37. data/app/helpers/effective_subscriptions_helper.rb +34 -0
  38. data/app/mailers/effective/orders_mailer.rb +196 -0
  39. data/app/models/concerns/acts_as_purchasable.rb +118 -0
  40. data/app/models/concerns/acts_as_subscribable.rb +90 -0
  41. data/app/models/concerns/acts_as_subscribable_buyer.rb +49 -0
  42. data/app/models/effective/access_denied.rb +17 -0
  43. data/app/models/effective/cart.rb +88 -0
  44. data/app/models/effective/cart_item.rb +40 -0
  45. data/app/models/effective/customer.rb +92 -0
  46. data/app/models/effective/order.rb +541 -0
  47. data/app/models/effective/order_item.rb +63 -0
  48. data/app/models/effective/product.rb +23 -0
  49. data/app/models/effective/sold_out_validator.rb +7 -0
  50. data/app/models/effective/subscripter.rb +185 -0
  51. data/app/models/effective/subscription.rb +95 -0
  52. data/app/models/effective/tax_rate_calculator.rb +48 -0
  53. data/app/views/admin/customers/_actions.html.haml +2 -0
  54. data/app/views/admin/customers/index.html.haml +6 -0
  55. data/app/views/admin/customers/show.html.haml +6 -0
  56. data/app/views/admin/order_items/index.html.haml +3 -0
  57. data/app/views/admin/orders/_datatable_actions.html.haml +18 -0
  58. data/app/views/admin/orders/_form.html.haml +35 -0
  59. data/app/views/admin/orders/_form_note_internal.html.haml +7 -0
  60. data/app/views/admin/orders/_order_actions.html.haml +9 -0
  61. data/app/views/admin/orders/_order_item_fields.html.haml +14 -0
  62. data/app/views/admin/orders/checkout.html.haml +3 -0
  63. data/app/views/admin/orders/edit.html.haml +6 -0
  64. data/app/views/admin/orders/index.html.haml +6 -0
  65. data/app/views/admin/orders/new.html.haml +4 -0
  66. data/app/views/admin/orders/show.html.haml +4 -0
  67. data/app/views/effective/carts/_cart.html.haml +28 -0
  68. data/app/views/effective/carts/_cart_actions.html.haml +3 -0
  69. data/app/views/effective/carts/show.html.haml +17 -0
  70. data/app/views/effective/customers/_customer.html.haml +72 -0
  71. data/app/views/effective/customers/_form.html.haml +21 -0
  72. data/app/views/effective/customers/edit.html.haml +4 -0
  73. data/app/views/effective/customers/update.js.erb +5 -0
  74. data/app/views/effective/orders/_checkout_actions.html.haml +3 -0
  75. data/app/views/effective/orders/_checkout_step1.html.haml +4 -0
  76. data/app/views/effective/orders/_checkout_step2.html.haml +37 -0
  77. data/app/views/effective/orders/_datatable_actions.html.haml +2 -0
  78. data/app/views/effective/orders/_fields.html.haml +31 -0
  79. data/app/views/effective/orders/_fields_note.html.haml +7 -0
  80. data/app/views/effective/orders/_fields_terms.html.haml +8 -0
  81. data/app/views/effective/orders/_order.html.haml +11 -0
  82. data/app/views/effective/orders/_order_actions.html.haml +18 -0
  83. data/app/views/effective/orders/_order_deferred.html.haml +9 -0
  84. data/app/views/effective/orders/_order_footer.html.haml +1 -0
  85. data/app/views/effective/orders/_order_header.html.haml +23 -0
  86. data/app/views/effective/orders/_order_items.html.haml +72 -0
  87. data/app/views/effective/orders/_order_notes.html.haml +17 -0
  88. data/app/views/effective/orders/_order_payment.html.haml +24 -0
  89. data/app/views/effective/orders/_order_shipping.html.haml +30 -0
  90. data/app/views/effective/orders/_orders_table.html.haml +23 -0
  91. data/app/views/effective/orders/cheque/_form.html.haml +4 -0
  92. data/app/views/effective/orders/declined.html.haml +12 -0
  93. data/app/views/effective/orders/deferred.html.haml +13 -0
  94. data/app/views/effective/orders/deferred/_form.html.haml +16 -0
  95. data/app/views/effective/orders/edit.html.haml +3 -0
  96. data/app/views/effective/orders/free/_form.html.haml +5 -0
  97. data/app/views/effective/orders/index.html.haml +3 -0
  98. data/app/views/effective/orders/mark_as_paid/_form.html.haml +23 -0
  99. data/app/views/effective/orders/moneris/_form.html.haml +47 -0
  100. data/app/views/effective/orders/new.html.haml +3 -0
  101. data/app/views/effective/orders/paypal/_form.html.haml +5 -0
  102. data/app/views/effective/orders/phone/_form.html.haml +4 -0
  103. data/app/views/effective/orders/pretend/_form.html.haml +8 -0
  104. data/app/views/effective/orders/purchased.html.haml +11 -0
  105. data/app/views/effective/orders/refund/_form.html.haml +5 -0
  106. data/app/views/effective/orders/show.html.haml +6 -0
  107. data/app/views/effective/orders/stripe/_element.html.haml +8 -0
  108. data/app/views/effective/orders/stripe/_form.html.haml +31 -0
  109. data/app/views/effective/orders_mailer/order_error.html.haml +11 -0
  110. data/app/views/effective/orders_mailer/order_receipt_to_admin.html.haml +2 -0
  111. data/app/views/effective/orders_mailer/order_receipt_to_buyer.html.haml +2 -0
  112. data/app/views/effective/orders_mailer/payment_request_to_buyer.html.haml +13 -0
  113. data/app/views/effective/orders_mailer/pending_order_invoice_to_buyer.html.haml +13 -0
  114. data/app/views/effective/orders_mailer/refund_notification_to_admin.html.haml +15 -0
  115. data/app/views/effective/orders_mailer/subscription_canceled.html.haml +9 -0
  116. data/app/views/effective/orders_mailer/subscription_created.html.haml +13 -0
  117. data/app/views/effective/orders_mailer/subscription_event_to_admin.html.haml +13 -0
  118. data/app/views/effective/orders_mailer/subscription_payment_failed.html.haml +9 -0
  119. data/app/views/effective/orders_mailer/subscription_payment_succeeded.html.haml +9 -0
  120. data/app/views/effective/orders_mailer/subscription_trial_expired.html.haml +5 -0
  121. data/app/views/effective/orders_mailer/subscription_trialing.html.haml +7 -0
  122. data/app/views/effective/orders_mailer/subscription_updated.html.haml +13 -0
  123. data/app/views/effective/subscripter/_form.html.haml +60 -0
  124. data/app/views/effective/subscripter/_plan.html.haml +23 -0
  125. data/app/views/layouts/effective_orders_mailer_layout.html.haml +25 -0
  126. data/config/effective_orders.rb +279 -0
  127. data/config/routes.rb +70 -0
  128. data/db/migrate/01_create_effective_orders.rb.erb +137 -0
  129. data/lib/effective_orders.rb +243 -0
  130. data/lib/effective_orders/engine.rb +60 -0
  131. data/lib/effective_orders/version.rb +3 -0
  132. data/lib/generators/effective_orders/install_generator.rb +63 -0
  133. data/lib/generators/templates/effective_orders_mailer_preview.rb +120 -0
  134. data/lib/tasks/effective_orders_tasks.rake +69 -0
  135. metadata +276 -0
@@ -0,0 +1,18 @@
1
+ = dropdown(variation: :dropleft) do
2
+ = dropdown_link_to 'View', effective_orders.admin_order_path(order)
3
+
4
+ - if order.purchased? == false
5
+ = dropdown_link_to 'Edit', effective_orders.edit_admin_order_path(order)
6
+
7
+ - if order.purchased?
8
+ = dropdown_link_to 'Email receipt to buyer', effective_orders.send_buyer_receipt_order_path(order),
9
+ data: { confirm: "Send receipt to #{order.emails_send_to}?" }
10
+
11
+ - if order.pending? || order.confirmed? || order.deferred?
12
+ = dropdown_link_to 'Email request for payment to buyer', effective_orders.send_payment_request_admin_order_path(order),
13
+ data: { method: :post, confirm: "Send request for payment to #{order.emails_send_to}?" }
14
+
15
+ = dropdown_link_to 'Admin: Checkout', effective_orders.checkout_admin_order_path(order)
16
+
17
+ = dropdown_link_to "Delete #{order}", effective_orders.admin_order_path(order),
18
+ data: { method: :delete, confirm: "Really delete #{order}?" }
@@ -0,0 +1,35 @@
1
+ = effective_form_with(model: [:admin, order], url: (order.persisted? ? effective_orders.admin_order_path(order) : effective_orders.admin_orders_path)) do |f|
2
+ - if f.object.new_record?
3
+ = f.select :user_id, @users || User.all.to_a.sort { |user1, user2| user1.to_s <=> user2.to_s },
4
+ label: 'Buyer', required: true, hint: 'The user that should purchase this order.'
5
+
6
+ = f.email_cc_field :cc, hint: "Cc the above on any emailed receipts or payment requests."
7
+
8
+ %h2 Order Items
9
+ .order_items
10
+ - f.object.order_items.build unless f.object.order_items.present?
11
+
12
+ = f.fields_for :order_items, f.object.order_items do |order_item|
13
+ = render 'order_item_fields', f: order_item
14
+
15
+ .links
16
+ = link_to_add_association (icon('plus') + 'Add item'), f, :order_items, class: 'btn btn-secondary', partial: 'order_item_fields'
17
+
18
+ %hr
19
+
20
+ = f.check_box :send_payment_request_to_buyer,
21
+ label: 'Yes, send a payment request email to the buyer and any cc.',
22
+ value: (f.object.send_payment_request_to_buyer.nil? ? EffectiveOrders.mailer[:send_payment_request_to_buyer] : f.object.send_payment_request_to_buyer?)
23
+
24
+ .row
25
+ .col-md-6.effective-order-note-to-buyer
26
+ %h2 Note to Buyer
27
+ = f.text_area :note_to_buyer, disabled: f.object.purchased?, label: false,
28
+ hint: (f.object.purchased? ? 'This message was displayed to the buyer during checkout and appears on the receipt.' : 'This message will be displayed to the buyer during checkout and will appear on the receipt.')
29
+
30
+ .col-md-6.effective-order-internal-note
31
+ %h2 Internal Note
32
+ = f.text_area :note_internal, label: false,
33
+ hint: 'For internal admin use only. This note will never be displayed to the buyer.'
34
+
35
+ = render partial: '/admin/orders/order_actions', locals: { order: @order, form: f, f: f }
@@ -0,0 +1,7 @@
1
+ .effective-order-internal-note-form
2
+ %h2 Internal Note
3
+
4
+ = effective_form_with(model: [:admin, order] ,url: effective_orders.admin_order_path(order)) do |f|
5
+ = f.text_area :note_internal, label: false, hint: 'For internal admin use only. This note will never be displayed to the buyer.'
6
+
7
+ = render partial: '/admin/orders/order_actions', locals: { order: @order, form: f, f: f }
@@ -0,0 +1,9 @@
1
+ = form.submit do
2
+ = form.save 'Save', class: 'btn btn-primary'
3
+ = form.save 'Duplicate', class: 'btn btn-primary'
4
+
5
+ - unless form.object.purchased?
6
+ = form.save 'Checkout', class: 'btn btn-success'
7
+
8
+ = form.save 'Continue', class: 'btn btn-secondary'
9
+ = form.save 'Add New', class: 'btn btn-secondary'
@@ -0,0 +1,14 @@
1
+ .nested-fields.order-item
2
+ .row.align-items-center
3
+ = f.fields_for :purchasable, (f.object.purchasable || Effective::Product.new) do |pf|
4
+ .col-md-2= f.number_field :quantity, input_html: { value: f.object.quantity || 1, min: 1 }
5
+ .col-md-4= pf.text_field :name, maxlength: 255
6
+ .col-md-2= pf.price_field :price
7
+
8
+ - if defined?(EffectiveQbSync)
9
+ .col-md-2= pf.text_field :qb_item_name, maxlength: 255, label: 'Quickbooks Item'
10
+
11
+ .col-md-2.mt-4= pf.check_box :tax_exempt, label: "Tax&nbsp;Exempt", title: 'When checked, tax will not be applied to this item'
12
+ .col-md-1
13
+ = link_to_remove_association(f, 'data-confirm': 'Remove?') do
14
+ = icon('trash-2', class: 'text-danger')
@@ -0,0 +1,3 @@
1
+ %h1.effective-admin-heading= @page_title
2
+
3
+ = render_checkout(@order, namespace: :admin, purchased_url: effective_orders.admin_order_path(@order), declined_url: effective_orders.admin_order_path(@order))
@@ -0,0 +1,6 @@
1
+ %h1.effective-admin-heading= @page_title
2
+
3
+ = render partial: 'effective/orders/order', locals: { order: @order }
4
+
5
+ .effective-order
6
+ = render partial: 'form', locals: { order: @order }
@@ -0,0 +1,6 @@
1
+ %h1.effective-admin-heading= @page_title
2
+
3
+ %p.text-right.effective-admin-actions
4
+ = link_to 'New Order', effective_orders.new_admin_order_path, class: 'btn btn-primary'
5
+
6
+ = render_datatable @datatable
@@ -0,0 +1,4 @@
1
+ %h1.effective-admin-heading= @page_title
2
+
3
+ .effective-order
4
+ = render partial: 'form', locals: { order: @order }
@@ -0,0 +1,4 @@
1
+ %h1.effective-admin-heading= @page_title
2
+
3
+ = render partial: 'effective/orders/order', locals: { order: @order }
4
+ = render partial: 'admin/orders/form_note_internal', locals: { order: @order }
@@ -0,0 +1,28 @@
1
+ .effective-cart
2
+ %table.table
3
+ %thead
4
+ %tr
5
+ %th.quantity Qty
6
+ %th.item Item
7
+ %th.price Price
8
+ %tbody
9
+ - cart.cart_items.each do |item|
10
+ %tr
11
+ %td.quantity
12
+ = item.quantity
13
+ %td.item
14
+ = item.name.html_safe
15
+ = ' - '
16
+ = link_to_remove_from_cart(item)
17
+ %td.price
18
+ = price_to_currency(item.price)
19
+ - if cart.blank?
20
+ %tr
21
+ %td.quantity
22
+ %td.item No items in cart.
23
+ %td.price
24
+ %tfoot
25
+ %tr
26
+ %th.quantity
27
+ %th.subtotal Subtotal
28
+ %td.price.subtotal-price= price_to_currency(cart.subtotal)
@@ -0,0 +1,3 @@
1
+ .effective-cart-actions.form-actions
2
+ = link_to_checkout
3
+ = link_to_empty_cart
@@ -0,0 +1,17 @@
1
+ %h1.effective-heading= @page_title
2
+
3
+ - if @cart.blank?
4
+ %p No items in cart.
5
+
6
+ - if @cart.present?
7
+ %p Your cart has #{@cart.cart_items.length} items.
8
+
9
+ = render_cart(@cart)
10
+ = render partial: '/effective/carts/cart_actions', locals: { cart: @cart }
11
+
12
+ - if @pending_orders.present?
13
+ %h2 Pending Orders
14
+ = render_orders(@pending_orders)
15
+
16
+ - if @cart.user && Effective::Order.purchased.where(user: @cart.user).exists?
17
+ = link_to 'Order History', effective_orders.orders_path, rel: :nofollow, class: 'btn btn-secondary'
@@ -0,0 +1,72 @@
1
+ - if customer.subscriptions.present?
2
+ .card.my-4
3
+ .card-header Subscriptions
4
+ .card-body
5
+ %table.table
6
+ %thead
7
+ %tr
8
+ %th Subscribed
9
+ %th Quantity
10
+ %th Interval
11
+ %tbody
12
+ - customer.subscriptions.each do |sub|
13
+ %tr
14
+ %td= sub.subscribable
15
+ %td= sub.quantity
16
+ %td= sub.interval
17
+
18
+ - if customer.invoices.present?
19
+ .card.my-4
20
+ .card-header Invoices
21
+ .card-body
22
+ %table.table
23
+ %thead
24
+ %tr
25
+ %th Date
26
+ %th Invoice
27
+ %th Total
28
+ %tbody
29
+ - customer.invoices.each do |invoice|
30
+ - date_method = [(:date if invoice.respond_to?(:date)), (:period_start if invoice.respond_to?(:period_start)), :created].compact.first
31
+ %tr
32
+ %td= link_to Time.zone.at(invoice.public_send(date_method)).strftime('%F'), invoice.invoice_pdf
33
+ %td
34
+ %p
35
+ = invoice.number
36
+ %br
37
+ = Time.zone.at(invoice.lines.first.period.start).strftime('%F')
38
+ to
39
+ = Time.zone.at(invoice.lines.first.period.end).strftime('%F')
40
+
41
+ %p
42
+ - invoice.lines.each do |line|
43
+ = line.description
44
+ %br
45
+
46
+ %td= price_to_currency(invoice.total)
47
+
48
+ - if customer.upcoming_invoice.present?
49
+ - invoice = customer.upcoming_invoice
50
+ - date_method = [(:date if invoice.respond_to?(:date)), (:period_start if invoice.respond_to?(:period_start)), :created].compact.first
51
+
52
+ .card.my-4
53
+ .card-header Upcoming Invoice
54
+ .card-body
55
+ %table.table
56
+ %tbody
57
+ %tr
58
+ %th Date
59
+ %td= Time.zone.at(invoice.public_send(date_method)).strftime('%F')
60
+ %tr
61
+ %th Items
62
+ %td
63
+ %table.table
64
+ %tbody
65
+ - invoice.lines.each do |line|
66
+ %tr
67
+ %td #{Time.zone.at(line.period.start).strftime('%F')} to #{Time.zone.at(line.period.end).strftime('%F')}
68
+ %td= line.description
69
+ %td= price_to_currency(line.amount)
70
+ %tr
71
+ %th Total
72
+ %td= price_to_currency(customer.upcoming_invoice.total)
@@ -0,0 +1,21 @@
1
+ = javascript_include_tag 'https://checkout.stripe.com/checkout.js'
2
+
3
+ .card
4
+ .card-header Customer Summary
5
+ .card-body
6
+ = effective_form_with(model: subscripter, url: effective_orders.customer_settings_path, remote: true, data: { stripe: subscripter_stripe_data(subscripter) }) do |f|
7
+ = f.hidden_field :stripe_token, value: nil
8
+ = f.error :stripe_token
9
+
10
+ %p
11
+ All subscription and billing notifications are sent to:
12
+ %strong= f.object.user.email
13
+
14
+ - if f.object.customer.active_card.present?
15
+ %p
16
+ All charges are made to
17
+ %strong= f.object.customer.active_card
18
+
19
+ %p= f.object.customer.payment_status
20
+
21
+ = f.submit 'Update Card', border: false, left: true, class: 'effective-orders-stripe-update-card'
@@ -0,0 +1,4 @@
1
+ %h1.effective-heading= @page_title
2
+
3
+ = render 'effective/customers/form', subscripter: @subscripter
4
+ = render 'effective/customers/customer', customer: @customer
@@ -0,0 +1,5 @@
1
+ <% resource = (@_effective_resource || Effective::Resource.new(controller_path)) %>
2
+ <% @resource = instance_variable_get('@' + resource.name) if resource.name %>
3
+
4
+ EffectiveForm.remote_form_payload = "<%= j render('effective/customers/form', subscripter: @subscripter) %>";
5
+ EffectiveForm.remote_form_flash = <%= raw flash.to_json %>;
@@ -0,0 +1,3 @@
1
+ - if (order.pending? || order.confirmed?) && current_cart.present? && order.user == current_user
2
+ .effective-order-change-items
3
+ = link_to 'Change Items', effective_orders.cart_path, rel: :nofollow, class: 'btn btn-secondary'
@@ -0,0 +1,4 @@
1
+ .effective-order
2
+ = effective_form_with(model: order, url: checkout_step1_form_url(order, namespace)) do |f|
3
+ = render('effective/orders/fields', order: order, form: f)
4
+ = f.submit 'Proceed to Checkout'
@@ -0,0 +1,37 @@
1
+ = render partial: 'effective/orders/order', locals: { order: order }
2
+
3
+ - if order.persisted? && order.user == current_user
4
+ .effective-order-change-items
5
+ = link_to 'Change Addresses', effective_orders.edit_order_path(order), rel: :nofollow, class: 'btn btn-secondary'
6
+
7
+ .effective-order-purchase-actions
8
+ - provider_locals = { order: order, purchased_url: purchased_url, declined_url: declined_url, deferred_url: deferred_url }
9
+
10
+ - if EffectiveOrders.free? && order.free?
11
+ = render partial: '/effective/orders/free/form', locals: provider_locals
12
+
13
+ - elsif EffectiveOrders.refund? && order.refund?
14
+ = render partial: '/effective/orders/refund/form', locals: provider_locals
15
+
16
+ - else
17
+ - if EffectiveOrders.pretend?
18
+ = render partial: '/effective/orders/pretend/form', locals: provider_locals
19
+
20
+ - if EffectiveOrders.moneris?
21
+ = render partial: '/effective/orders/moneris/form', locals: provider_locals
22
+
23
+ - if EffectiveOrders.paypal?
24
+ = render partial: '/effective/orders/paypal/form', locals: provider_locals
25
+
26
+ - if EffectiveOrders.stripe?
27
+ = render partial: '/effective/orders/stripe/form', locals: provider_locals
28
+
29
+ - if EffectiveOrders.deferred? && order.user == current_user
30
+ %p.my-4.text-center - or -
31
+ = render partial: '/effective/orders/deferred/form', locals: provider_locals
32
+
33
+ - if EffectiveOrders.authorized?(controller, :admin, :effective_orders) && order.user != current_user
34
+ - if EffectiveOrders.mark_as_paid?
35
+ .effective-order-admin-purchase-actions
36
+ = render partial: '/effective/orders/mark_as_paid/form', locals: provider_locals
37
+
@@ -0,0 +1,2 @@
1
+ = dropdown(variation: :dropleft) do
2
+ = dropdown_link_to (order.purchased? ? 'View' : 'Checkout'), effective_orders.order_path(order)
@@ -0,0 +1,31 @@
1
+ - form ||= local_assigns[:form] || local_assigns[:f]
2
+
3
+ = render 'effective/orders/order_notes', order: form.object
4
+ = render 'effective/orders/order_items', order: form.object
5
+
6
+ = form.hidden_field :confirmed_checkout, value: true
7
+
8
+ - if current_cart.present?
9
+ .effective-order-change-items
10
+ = link_to 'Change Items', effective_orders.cart_path, rel: :nofollow, class: 'btn btn-secondary'
11
+
12
+ - num_addresses = [EffectiveOrders.billing_address, EffectiveOrders.shipping_address].count(true)
13
+
14
+ - if num_addresses > 0
15
+ .effective-order-addresses
16
+ .row
17
+ - if EffectiveOrders.billing_address
18
+ %div{class: "col-md-#{12 / num_addresses}"}
19
+ %h2 Billing Address
20
+ = effective_address_fields(form, :billing_address)
21
+
22
+ - if EffectiveOrders.shipping_address
23
+ %div{class: "col-md-#{12 / num_addresses}"}
24
+ %h2 Shipping Address
25
+ = effective_address_fields(form, :shipping_address)
26
+
27
+ - if EffectiveOrders.collect_note
28
+ = render 'effective/orders/fields_note', form: form
29
+
30
+ - if EffectiveOrders.terms_and_conditions
31
+ = render 'effective/orders/fields_terms', form: form
@@ -0,0 +1,7 @@
1
+ .effective-order-note-fields
2
+ %h2 Note
3
+
4
+ - if EffectiveOrders.collect_note_message.present?
5
+ %p= EffectiveOrders.collect_note_message.html_safe
6
+
7
+ = form.text_area :note, required: (EffectiveOrders.collect_note_required == true)
@@ -0,0 +1,8 @@
1
+ .effective-order-terms-and-conditions
2
+ %h2 Terms and Conditions
3
+
4
+ - terms = EffectiveOrders.terms_and_conditions_label
5
+ - label = terms.respond_to?(:call) ? instance_exec(form.object, &terms) : terms
6
+
7
+ = form.check_box :terms_and_conditions, required: true,
8
+ label: (label.presence || 'I accept the terms and conditions.').html_safe
@@ -0,0 +1,11 @@
1
+ .effective-order
2
+ - unless defined?(no_order_actions)
3
+ = render partial: 'effective/orders/order_actions', locals: { order: order }
4
+
5
+ = render partial: 'effective/orders/order_header', locals: { order: order }
6
+ = render partial: 'effective/orders/order_shipping', locals: { order: order }
7
+ = render partial: 'effective/orders/order_deferred', locals: { order: order }
8
+ = render partial: 'effective/orders/order_notes', locals: { order: order }
9
+ = render partial: 'effective/orders/order_items', locals: { order: order }
10
+ = render partial: 'effective/orders/order_payment', locals: { order: order }
11
+ = render partial: 'effective/orders/order_footer', locals: { order: order }
@@ -0,0 +1,18 @@
1
+ .effective-order-actions
2
+ - if order.persisted?
3
+ = link_to 'Print', '#', class: 'btn btn-primary print-button', data: { role: 'print-button' }, onClick: 'window.print(); false;'
4
+
5
+ - if order.purchased?
6
+ = link_to 'Email receipt to buyer', effective_orders.send_buyer_receipt_order_path(order),
7
+ class: 'btn btn-secondary',
8
+ data: { confirm: "Send receipt to #{order.emails_send_to}?" }
9
+
10
+ - if order.persisted? && EffectiveOrders.authorized?(controller, :admin, :effective_orders)
11
+ - if order.pending? || order.confirmed? || order.deferred?
12
+ = link_to 'Email request for payment to buyer', effective_orders.send_payment_request_admin_order_path(order),
13
+ class: 'btn btn-secondary',
14
+ data: { method: :post, confirm: "Send request for payment to #{order.emails_send_to}?" }
15
+
16
+ = link_to 'Delete', effective_orders.admin_order_path(order),
17
+ class: 'btn btn-danger',
18
+ data: { method: :delete, confirm: "Really delete #{order}?" }
@@ -0,0 +1,9 @@
1
+ - if order.deferred?
2
+ .effective-order-deferred
3
+ %table.table
4
+ %thead
5
+ %tr
6
+ %th Payment
7
+ %tbody
8
+ %tr
9
+ %td Waiting for payment by #{order.payment_provider}
@@ -0,0 +1 @@
1
+ - # intentionally left blank
@@ -0,0 +1,23 @@
1
+ .effective-order-header
2
+ %h2 Acme Industries Inc.
3
+ .row
4
+ .col-sm-6
5
+ - email_address = EffectiveOrders.mailer[:admin_email] || 'info@acmeindustries.com'
6
+ %p= mail_to u(email_address), email_address
7
+ %p
8
+ 1234 Fake Street
9
+ %br
10
+ Edmonton, AB, T5H 4A5
11
+ %br
12
+ %small Customize me by overriding '/app/views/effective/orders/_order_header.html.haml'
13
+
14
+ .col-sm-6
15
+ - if order.purchased?
16
+ %p Receipt: ##{order.to_param}
17
+ - elsif order.persisted?
18
+ %p Order: ##{order.to_param}
19
+
20
+ - if order.purchased?
21
+ %p Purchased at: #{order.purchased_at.strftime("%F %H:%M")}
22
+ - else
23
+ %p Date: #{Time.zone.now.strftime("%F %H:%M")}