effective_orders 4.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +1004 -0
- data/app/assets/images/effective_orders/stripe.png +0 -0
- data/app/assets/javascripts/effective_orders.js +6 -0
- data/app/assets/javascripts/effective_orders/customers.js.coffee +32 -0
- data/app/assets/javascripts/effective_orders/providers/stripe.js.coffee +77 -0
- data/app/assets/javascripts/effective_orders/subscriptions.js.coffee +81 -0
- data/app/assets/stylesheets/effective_orders.scss +2 -0
- data/app/assets/stylesheets/effective_orders/_cart.scss +4 -0
- data/app/assets/stylesheets/effective_orders/_order.scss +58 -0
- data/app/controllers/admin/customers_controller.rb +24 -0
- data/app/controllers/admin/order_items_controller.rb +16 -0
- data/app/controllers/admin/orders_controller.rb +223 -0
- data/app/controllers/effective/carts_controller.rb +85 -0
- data/app/controllers/effective/concerns/purchase.rb +62 -0
- data/app/controllers/effective/customers_controller.rb +20 -0
- data/app/controllers/effective/orders_controller.rb +162 -0
- data/app/controllers/effective/providers/cheque.rb +22 -0
- data/app/controllers/effective/providers/free.rb +33 -0
- data/app/controllers/effective/providers/mark_as_paid.rb +33 -0
- data/app/controllers/effective/providers/moneris.rb +60 -0
- data/app/controllers/effective/providers/paypal.rb +33 -0
- data/app/controllers/effective/providers/phone.rb +22 -0
- data/app/controllers/effective/providers/pretend.rb +26 -0
- data/app/controllers/effective/providers/refund.rb +33 -0
- data/app/controllers/effective/providers/stripe.rb +72 -0
- data/app/controllers/effective/subscripter_controller.rb +18 -0
- data/app/controllers/effective/webhooks_controller.rb +109 -0
- data/app/datatables/admin/effective_customers_datatable.rb +22 -0
- data/app/datatables/admin/effective_orders_datatable.rb +100 -0
- data/app/datatables/effective_orders_datatable.rb +79 -0
- data/app/helpers/effective_carts_helper.rb +113 -0
- data/app/helpers/effective_orders_helper.rb +143 -0
- data/app/helpers/effective_paypal_helper.rb +49 -0
- data/app/helpers/effective_stripe_helper.rb +85 -0
- data/app/helpers/effective_subscriptions_helper.rb +34 -0
- data/app/mailers/effective/orders_mailer.rb +196 -0
- data/app/models/concerns/acts_as_purchasable.rb +118 -0
- data/app/models/concerns/acts_as_subscribable.rb +90 -0
- data/app/models/concerns/acts_as_subscribable_buyer.rb +49 -0
- data/app/models/effective/access_denied.rb +17 -0
- data/app/models/effective/cart.rb +88 -0
- data/app/models/effective/cart_item.rb +40 -0
- data/app/models/effective/customer.rb +92 -0
- data/app/models/effective/order.rb +541 -0
- data/app/models/effective/order_item.rb +63 -0
- data/app/models/effective/product.rb +23 -0
- data/app/models/effective/sold_out_validator.rb +7 -0
- data/app/models/effective/subscripter.rb +185 -0
- data/app/models/effective/subscription.rb +95 -0
- data/app/models/effective/tax_rate_calculator.rb +48 -0
- data/app/views/admin/customers/_actions.html.haml +2 -0
- data/app/views/admin/customers/index.html.haml +6 -0
- data/app/views/admin/customers/show.html.haml +6 -0
- data/app/views/admin/order_items/index.html.haml +3 -0
- data/app/views/admin/orders/_datatable_actions.html.haml +18 -0
- data/app/views/admin/orders/_form.html.haml +35 -0
- data/app/views/admin/orders/_form_note_internal.html.haml +7 -0
- data/app/views/admin/orders/_order_actions.html.haml +9 -0
- data/app/views/admin/orders/_order_item_fields.html.haml +14 -0
- data/app/views/admin/orders/checkout.html.haml +3 -0
- data/app/views/admin/orders/edit.html.haml +6 -0
- data/app/views/admin/orders/index.html.haml +6 -0
- data/app/views/admin/orders/new.html.haml +4 -0
- data/app/views/admin/orders/show.html.haml +4 -0
- data/app/views/effective/carts/_cart.html.haml +28 -0
- data/app/views/effective/carts/_cart_actions.html.haml +3 -0
- data/app/views/effective/carts/show.html.haml +17 -0
- data/app/views/effective/customers/_customer.html.haml +72 -0
- data/app/views/effective/customers/_form.html.haml +21 -0
- data/app/views/effective/customers/edit.html.haml +4 -0
- data/app/views/effective/customers/update.js.erb +5 -0
- data/app/views/effective/orders/_checkout_actions.html.haml +3 -0
- data/app/views/effective/orders/_checkout_step1.html.haml +4 -0
- data/app/views/effective/orders/_checkout_step2.html.haml +37 -0
- data/app/views/effective/orders/_datatable_actions.html.haml +2 -0
- data/app/views/effective/orders/_fields.html.haml +31 -0
- data/app/views/effective/orders/_fields_note.html.haml +7 -0
- data/app/views/effective/orders/_fields_terms.html.haml +8 -0
- data/app/views/effective/orders/_order.html.haml +11 -0
- data/app/views/effective/orders/_order_actions.html.haml +18 -0
- data/app/views/effective/orders/_order_deferred.html.haml +9 -0
- data/app/views/effective/orders/_order_footer.html.haml +1 -0
- data/app/views/effective/orders/_order_header.html.haml +23 -0
- data/app/views/effective/orders/_order_items.html.haml +72 -0
- data/app/views/effective/orders/_order_notes.html.haml +17 -0
- data/app/views/effective/orders/_order_payment.html.haml +24 -0
- data/app/views/effective/orders/_order_shipping.html.haml +30 -0
- data/app/views/effective/orders/_orders_table.html.haml +23 -0
- data/app/views/effective/orders/cheque/_form.html.haml +4 -0
- data/app/views/effective/orders/declined.html.haml +12 -0
- data/app/views/effective/orders/deferred.html.haml +13 -0
- data/app/views/effective/orders/deferred/_form.html.haml +16 -0
- data/app/views/effective/orders/edit.html.haml +3 -0
- data/app/views/effective/orders/free/_form.html.haml +5 -0
- data/app/views/effective/orders/index.html.haml +3 -0
- data/app/views/effective/orders/mark_as_paid/_form.html.haml +23 -0
- data/app/views/effective/orders/moneris/_form.html.haml +47 -0
- data/app/views/effective/orders/new.html.haml +3 -0
- data/app/views/effective/orders/paypal/_form.html.haml +5 -0
- data/app/views/effective/orders/phone/_form.html.haml +4 -0
- data/app/views/effective/orders/pretend/_form.html.haml +8 -0
- data/app/views/effective/orders/purchased.html.haml +11 -0
- data/app/views/effective/orders/refund/_form.html.haml +5 -0
- data/app/views/effective/orders/show.html.haml +6 -0
- data/app/views/effective/orders/stripe/_element.html.haml +8 -0
- data/app/views/effective/orders/stripe/_form.html.haml +31 -0
- data/app/views/effective/orders_mailer/order_error.html.haml +11 -0
- data/app/views/effective/orders_mailer/order_receipt_to_admin.html.haml +2 -0
- data/app/views/effective/orders_mailer/order_receipt_to_buyer.html.haml +2 -0
- data/app/views/effective/orders_mailer/payment_request_to_buyer.html.haml +13 -0
- data/app/views/effective/orders_mailer/pending_order_invoice_to_buyer.html.haml +13 -0
- data/app/views/effective/orders_mailer/refund_notification_to_admin.html.haml +15 -0
- data/app/views/effective/orders_mailer/subscription_canceled.html.haml +9 -0
- data/app/views/effective/orders_mailer/subscription_created.html.haml +13 -0
- data/app/views/effective/orders_mailer/subscription_event_to_admin.html.haml +13 -0
- data/app/views/effective/orders_mailer/subscription_payment_failed.html.haml +9 -0
- data/app/views/effective/orders_mailer/subscription_payment_succeeded.html.haml +9 -0
- data/app/views/effective/orders_mailer/subscription_trial_expired.html.haml +5 -0
- data/app/views/effective/orders_mailer/subscription_trialing.html.haml +7 -0
- data/app/views/effective/orders_mailer/subscription_updated.html.haml +13 -0
- data/app/views/effective/subscripter/_form.html.haml +60 -0
- data/app/views/effective/subscripter/_plan.html.haml +23 -0
- data/app/views/layouts/effective_orders_mailer_layout.html.haml +25 -0
- data/config/effective_orders.rb +279 -0
- data/config/routes.rb +70 -0
- data/db/migrate/01_create_effective_orders.rb.erb +137 -0
- data/lib/effective_orders.rb +243 -0
- data/lib/effective_orders/engine.rb +60 -0
- data/lib/effective_orders/version.rb +3 -0
- data/lib/generators/effective_orders/install_generator.rb +63 -0
- data/lib/generators/templates/effective_orders_mailer_preview.rb +120 -0
- data/lib/tasks/effective_orders_tasks.rake +69 -0
- 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 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,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,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,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,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,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,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 @@
|
|
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")}
|