effective_orders 3.2.3 → 4.0.0beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/MIT-LICENSE +1 -1
- data/README.md +11 -99
- data/app/assets/stylesheets/effective_orders.scss +1 -0
- data/app/assets/stylesheets/effective_orders/_cart.scss +4 -0
- data/app/assets/stylesheets/effective_orders/_order.scss +6 -2
- data/app/controllers/admin/orders_controller.rb +17 -17
- data/app/controllers/effective/carts_controller.rb +4 -2
- data/app/controllers/effective/orders_controller.rb +50 -105
- data/app/controllers/effective/providers/cheque.rb +1 -1
- data/app/controllers/effective/providers/moneris.rb +17 -23
- data/app/controllers/effective/providers/stripe.rb +2 -37
- data/app/datatables/effective_customers_datatable.rb +1 -5
- data/app/datatables/effective_order_items_datatable.rb +10 -10
- data/app/datatables/effective_orders_datatable.rb +23 -46
- data/app/helpers/effective_carts_helper.rb +5 -25
- data/app/helpers/effective_orders_helper.rb +29 -61
- data/app/helpers/effective_paypal_helper.rb +10 -8
- data/app/helpers/effective_stripe_helper.rb +2 -33
- data/app/models/concerns/acts_as_purchasable.rb +26 -37
- data/app/models/concerns/acts_as_subscribable.rb +1 -1
- data/app/models/effective/cart.rb +4 -5
- data/app/models/effective/customer.rb +1 -4
- data/app/models/effective/order.rb +132 -163
- data/app/models/effective/order_item.rb +2 -21
- data/app/models/{effective → validators/effective}/sold_out_validator.rb +0 -0
- data/app/views/admin/customers/index.html.haml +1 -4
- data/app/views/admin/order_items/index.html.haml +1 -4
- data/app/views/admin/orders/_actions.html.haml +18 -9
- data/app/views/admin/orders/_form.html.haml +12 -14
- data/app/views/admin/orders/_form_note_internal.html.haml +2 -2
- data/app/views/admin/orders/_order_actions.html.haml +8 -5
- data/app/views/admin/orders/_order_item_fields.html.haml +9 -8
- data/app/views/admin/orders/checkout.html.haml +3 -0
- data/app/views/admin/orders/edit.html.haml +3 -1
- data/app/views/admin/orders/new.html.haml +2 -1
- data/app/views/admin/orders/show.html.haml +2 -5
- data/app/views/effective/carts/_cart.html.haml +1 -1
- data/app/views/effective/carts/_cart_actions.html.haml +3 -4
- data/app/views/effective/carts/show.html.haml +4 -4
- data/app/views/effective/orders/_checkout_actions.html.haml +3 -0
- data/app/views/effective/orders/_checkout_step1.html.haml +20 -27
- data/app/views/effective/orders/_checkout_step2.html.haml +26 -30
- data/app/views/effective/orders/_order.html.haml +1 -2
- data/app/views/effective/orders/_order_actions.html.haml +14 -6
- data/app/views/effective/orders/_order_header.html.haml +2 -2
- data/app/views/effective/orders/_order_note_fields.html.haml +6 -4
- data/app/views/effective/orders/_order_notes.html.haml +15 -0
- data/app/views/effective/orders/_order_payment_details.html.haml +1 -1
- data/app/views/effective/orders/_order_shipping.html.haml +6 -6
- data/app/views/effective/orders/_order_terms_and_conditions_fields.html.haml +5 -6
- data/app/views/effective/orders/_order_user_fields.html.haml +5 -11
- data/app/views/effective/orders/_orders_table.html.haml +2 -6
- data/app/views/effective/orders/index.html.haml +2 -1
- data/app/views/effective/orders/mark_as_paid/_form.html.haml +8 -14
- data/app/views/effective/orders/moneris/_form.html.haml +43 -4
- data/app/views/effective/orders/pretend/_form.html.haml +1 -3
- data/app/views/effective/orders/refund/_form.html.haml +8 -12
- data/app/views/effective/orders/show.html.haml +2 -2
- data/app/views/effective/orders/stripe/_form.html.haml +4 -4
- data/app/views/effective/orders_mailer/payment_request_to_buyer.html.haml +1 -1
- data/app/views/effective/orders_mailer/pending_order_invoice_to_buyer.html.haml +1 -1
- data/config/effective_orders.rb +116 -182
- data/config/routes.rb +16 -27
- data/db/migrate/01_create_effective_orders.rb.erb +6 -5
- data/lib/effective_orders.rb +72 -76
- data/lib/effective_orders/engine.rb +8 -80
- data/lib/effective_orders/version.rb +1 -1
- data/lib/generators/templates/effective_orders_mailer_preview.rb +4 -4
- metadata +26 -38
- data/Rakefile +0 -21
- data/app/assets/config/effective_orders_manifest.js +0 -3
- data/app/assets/images/effective_orders/stripe_connect.png +0 -0
- data/app/controllers/effective/providers/app_checkout.rb +0 -38
- data/app/controllers/effective/providers/ccbill.rb +0 -34
- data/app/controllers/effective/providers/stripe_connect.rb +0 -47
- data/app/helpers/effective_ccbill_helper.rb +0 -25
- data/app/models/effective/providers/ccbill_postback.rb +0 -85
- data/app/models/effective/providers/moneris_charge.rb +0 -115
- data/app/views/effective/orders/_order_note.html.haml +0 -5
- data/app/views/effective/orders/_order_note_to_buyer.html.haml +0 -9
- data/app/views/effective/orders/app_checkout/_form.html.haml +0 -2
- data/app/views/effective/orders/ccbill/_form.html.haml +0 -24
- data/app/views/effective/orders/my_purchases.html.haml +0 -3
- data/app/views/effective/orders/my_sales.html.haml +0 -25
- data/app/views/effective/orders_mailer/order_receipt_to_seller.html.haml +0 -25
- data/lib/effective_orders/app_checkout_service.rb +0 -26
@@ -4,7 +4,6 @@ module Effective
|
|
4
4
|
|
5
5
|
belongs_to :order, class_name: 'Effective::Order'
|
6
6
|
belongs_to :purchasable, polymorphic: true
|
7
|
-
belongs_to :seller, class_name: 'User', optional: true
|
8
7
|
|
9
8
|
delegate :purchased_download_url, to: :purchasable
|
10
9
|
delegate :purchased?, :declined?, to: :order
|
@@ -24,9 +23,7 @@ module Effective
|
|
24
23
|
validates :price, presence: true
|
25
24
|
validates :tax_exempt, inclusion: { in: [true, false] }
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
scope :sold, -> { joins(:order).where(orders: { purchase_state: EffectiveOrders::PURCHASED }) }
|
26
|
+
scope :sold, -> { joins(:order).where(orders: { state: EffectiveOrders::PURCHASED }) }
|
30
27
|
scope :sold_by, lambda { |user| sold().where(seller_id: user.id) }
|
31
28
|
|
32
29
|
def to_s
|
@@ -52,26 +49,10 @@ module Effective
|
|
52
49
|
def price=(value)
|
53
50
|
if value.kind_of?(Integer)
|
54
51
|
super
|
55
|
-
|
56
|
-
super
|
57
|
-
else # Could be Float, BigDecimal, or String like 9.99
|
52
|
+
else
|
58
53
|
raise 'expected price to be an Integer representing the number of cents.'
|
59
54
|
end
|
60
55
|
end
|
61
56
|
|
62
|
-
# This is going to return an Effective::Customer object that matches the purchasable.user
|
63
|
-
# And is the Customer representing who is selling the product
|
64
|
-
# This is really only used for StripeConnect
|
65
|
-
def seller
|
66
|
-
@seller ||= Effective::Customer.for_buyer(purchasable.seller)
|
67
|
-
end
|
68
|
-
|
69
|
-
def stripe_connect_application_fee
|
70
|
-
@stripe_connect_application_fee ||= (
|
71
|
-
self.instance_exec(self, &EffectiveOrders.stripe_connect_application_fee_method).to_i.tap do |fee|
|
72
|
-
raise "expected EffectiveOrders.stripe_connect_application_fee_method to return a value between 0 and the order_item total (#{self.total}). Received #{fee}." if (fee > total || fee < 0)
|
73
|
-
end
|
74
|
-
)
|
75
|
-
end
|
76
57
|
end
|
77
58
|
end
|
File without changes
|
@@ -3,7 +3,4 @@
|
|
3
3
|
%p.text-right.effective-admin-actions
|
4
4
|
= link_to 'Stripe Customers', "https://dashboard.stripe.com/#{'test/' if Rails.env.development?}customers", class: 'btn btn-primary'
|
5
5
|
|
6
|
-
|
7
|
-
= render_datatable @datatable
|
8
|
-
- else
|
9
|
-
%p There are no customers present
|
6
|
+
= render_datatable(@datatable)
|
@@ -1,11 +1,20 @@
|
|
1
|
-
|
2
|
-
- if
|
3
|
-
=
|
4
|
-
|
1
|
+
= dropdown(variation: :dropleft) do
|
2
|
+
- if datatable.admin_namespace?
|
3
|
+
= dropdown_link_to 'View', effective_orders.admin_order_path(order)
|
4
|
+
= dropdown_link_to 'Edit', effective_orders.edit_admin_order_path(order)
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
- if order.purchased?
|
7
|
+
= dropdown_link_to 'Email receipt to buyer', effective_orders.send_buyer_receipt_order_path(order),
|
8
|
+
data: { confirm: "Send receipt to #{order.user.email}?" }
|
8
9
|
|
9
|
-
-
|
10
|
-
|
11
|
-
|
10
|
+
- if order.pending? || order.confirmed?
|
11
|
+
= dropdown_link_to 'Email request for payment to buyer', effective_orders.send_payment_request_admin_order_path(order),
|
12
|
+
data: { method: :post, confirm: "Send request for payment to #{order.user.email}?" }
|
13
|
+
|
14
|
+
= dropdown_link_to 'Admin: Checkout', effective_orders.checkout_admin_order_path(order)
|
15
|
+
|
16
|
+
= dropdown_link_to "Delete #{order}", effective_orders.admin_order_path(order),
|
17
|
+
data: { method: :delete, confirm: "Really delete #{order}?" }
|
18
|
+
|
19
|
+
- else
|
20
|
+
= dropdown_link_to 'View', effective_orders.order_path(order)
|
@@ -1,33 +1,31 @@
|
|
1
|
-
=
|
1
|
+
= effective_form_with(model: [:admin, order], url: (order.persisted? ? effective_orders.admin_order_path(order) : effective_orders.admin_orders_path)) do |f|
|
2
2
|
- if f.object.new_record?
|
3
|
-
= f.
|
4
|
-
label: 'Buyer',
|
5
|
-
required: true,
|
6
|
-
as: :effective_select,
|
7
|
-
collection: @users || User.all.to_a.sort { |user1, user2| user1.to_s <=> user2.to_s }
|
3
|
+
= f.select :user_id, @users || User.all.to_a.sort { |user1, user2| user1.to_s <=> user2.to_s }, label: 'Buyer', required: true
|
8
4
|
|
9
5
|
%h2 Order Items
|
10
6
|
.order_items
|
11
7
|
- f.object.order_items.build unless f.object.order_items.present?
|
12
|
-
= f.
|
8
|
+
= f.fields_for :order_items, f.object.order_items do |order_item|
|
13
9
|
= render 'order_item_fields', f: order_item
|
14
10
|
|
15
11
|
.links
|
16
|
-
= link_to_add_association
|
12
|
+
= link_to_add_association "Add line item".html_safe, f, :order_items, class: 'btn btn-success', partial: 'order_item_fields'
|
17
13
|
|
18
|
-
|
19
|
-
|
14
|
+
%hr
|
15
|
+
|
16
|
+
= f.check_box :send_payment_request_to_buyer,
|
20
17
|
label: 'Yes, send a payment request email to the buyer.',
|
21
18
|
value: (f.object.send_payment_request_to_buyer.nil? ? EffectiveOrders.mailer[:send_payment_request_to_buyer] : f.object.send_payment_request_to_buyer?)
|
22
19
|
|
23
20
|
.row
|
24
|
-
.col-
|
21
|
+
.col-md-6.effective-order-note-to-buyer
|
25
22
|
%h2 Note to Buyer
|
26
|
-
= f.
|
23
|
+
= f.text_area :note_to_buyer, disabled: f.object.purchased?, label: false,
|
27
24
|
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.')
|
28
25
|
|
29
|
-
.col-
|
26
|
+
.col-md-6.effective-order-internal-note
|
30
27
|
%h2 Internal Note
|
31
|
-
= f.
|
28
|
+
= f.text_area :note_internal, label: false,
|
29
|
+
hint: 'For internal admin use only. This note will never be displayed to the buyer.'
|
32
30
|
|
33
31
|
= render partial: '/admin/orders/order_actions', locals: { order: @order, form: f, f: f }
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.effective-order-internal-note-form
|
2
2
|
%h2 Internal Note
|
3
3
|
|
4
|
-
=
|
5
|
-
= f.
|
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
6
|
|
7
7
|
= render partial: '/admin/orders/order_actions', locals: { order: @order, form: f, f: f }
|
@@ -1,5 +1,8 @@
|
|
1
|
-
|
2
|
-
= form.
|
3
|
-
= form.
|
4
|
-
|
5
|
-
|
1
|
+
= effective_save(form) do
|
2
|
+
= form.save 'Save', class: 'btn btn-primary'
|
3
|
+
= form.save 'Duplicate', class: 'btn btn-primary'
|
4
|
+
- unless form.object.purchased?
|
5
|
+
= form.save 'Checkout', class: 'btn btn-success'
|
6
|
+
|
7
|
+
= form.save 'Continue', class: 'btn btn-secondary'
|
8
|
+
= form.save 'Add New', class: 'btn btn-secondary'
|
@@ -1,9 +1,10 @@
|
|
1
1
|
.nested-fields.order-item
|
2
|
-
.row
|
3
|
-
|
4
|
-
|
5
|
-
.col-
|
6
|
-
.col-
|
7
|
-
.col-
|
8
|
-
.col-
|
9
|
-
|
2
|
+
.row.align-items-center
|
3
|
+
= f.fields_for :purchasable, (f.object.purchasable || Effective::Product.new) do |pf|
|
4
|
+
.col-md-1= f.number_field :quantity, input_html: { value: f.object.quantity || 1, min: 1 }
|
5
|
+
.col-md-5= pf.text_field :title, maxlength: 255
|
6
|
+
.col-md-2= pf.price_field :price
|
7
|
+
.col-md-2.mt-4= pf.check_box :tax_exempt, label: "Tax Exempt", title: 'When checked, tax will not be applied to this item'
|
8
|
+
.col-md-1.mt-4
|
9
|
+
= link_to_remove_association(f, 'data-confirm': 'Really remove this item?') do
|
10
|
+
= icon('x', class: 'btn-danger')
|
@@ -1,7 +1,4 @@
|
|
1
1
|
%h1.effective-admin-heading= @page_title
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
= render partial: 'admin/orders/form_note_internal', locals: { order: @order }
|
6
|
-
- else
|
7
|
-
= render_checkout_step2(@order, namespace: :admin, purchased_url: effective_orders.admin_order_path(@order), declined_url: effective_orders.admin_order_path(@order))
|
3
|
+
= render partial: 'effective/orders/order', locals: { order: @order }
|
4
|
+
= render partial: 'admin/orders/form_note_internal', locals: { order: @order }
|
@@ -1,4 +1,3 @@
|
|
1
|
-
.effective-
|
2
|
-
|
3
|
-
|
4
|
-
= link_to_empty_cart
|
1
|
+
.effective-cart-actions.form-actions
|
2
|
+
= link_to_checkout
|
3
|
+
= link_to_empty_cart
|
@@ -2,16 +2,16 @@
|
|
2
2
|
|
3
3
|
- if @cart.blank?
|
4
4
|
%p No items in cart.
|
5
|
-
|
5
|
+
|
6
|
+
- if @cart.present?
|
6
7
|
%p Your cart has #{@cart.cart_items.length} items.
|
7
8
|
|
8
9
|
= render_cart(@cart)
|
9
|
-
%hr
|
10
10
|
= render partial: '/effective/carts/cart_actions', locals: { cart: @cart }
|
11
11
|
|
12
12
|
- if @pending_orders.present?
|
13
13
|
%h2 Pending Orders
|
14
14
|
= render_orders(@pending_orders)
|
15
15
|
|
16
|
-
- if
|
17
|
-
=
|
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'
|
@@ -1,35 +1,29 @@
|
|
1
1
|
.effective-order
|
2
|
-
=
|
3
|
-
=
|
4
|
-
=
|
2
|
+
= effective_form_with(model: order, url: checkout_step1_form_url(order, namespace)) do |f|
|
3
|
+
= render partial: 'effective/orders/order_notes', locals: { order: order }
|
4
|
+
= render partial: 'effective/orders/order_items', locals: { order: order }
|
5
5
|
|
6
|
-
|
6
|
+
- if current_cart.present?
|
7
|
+
.effective-order-change-items
|
8
|
+
= link_to 'Change Items', effective_orders.cart_path, rel: :nofollow, class: 'btn btn-secondary'
|
7
9
|
|
8
|
-
-
|
9
|
-
= link_to 'Change Items', effective_orders.cart_path, rel: :nofollow, class: 'btn btn-default'
|
10
|
-
|
11
|
-
- if order.errors[:order_items].present?
|
12
|
-
%p.inline-errors= order.errors[:order_items].first
|
13
|
-
|
14
|
-
- if order.errors[:total].present?
|
15
|
-
%p.inline-errors= order.errors[:total].first
|
16
|
-
|
17
|
-
- if EffectiveOrders.collect_user_fields.present? && (f.object.user rescue nil).present?
|
10
|
+
- if EffectiveOrders.collect_user_fields.present? && f.object.user.present?
|
18
11
|
= render partial: 'effective/orders/order_user_fields', locals: { form: f, user: f.object.user }
|
19
12
|
|
20
|
-
- num_addresses = [EffectiveOrders.
|
13
|
+
- num_addresses = [EffectiveOrders.billing_address, EffectiveOrders.shipping_address].count(true)
|
21
14
|
|
22
15
|
- if num_addresses > 0
|
23
|
-
.
|
24
|
-
|
25
|
-
|
26
|
-
%
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
%
|
32
|
-
|
16
|
+
.effective-order-addresses
|
17
|
+
.row
|
18
|
+
- if EffectiveOrders.billing_address
|
19
|
+
%div{class: "col-md-#{12 / num_addresses}"}
|
20
|
+
%h2 Billing Address
|
21
|
+
= effective_address_fields(f, :billing_address)
|
22
|
+
|
23
|
+
- if EffectiveOrders.shipping_address
|
24
|
+
%div{class: "col-md-#{12 / num_addresses}"}
|
25
|
+
%h2 Shipping Address
|
26
|
+
= effective_address_fields(f, :shipping_address)
|
33
27
|
|
34
28
|
- if EffectiveOrders.collect_note
|
35
29
|
= render partial: 'effective/orders/order_note_fields', locals: { form: f }
|
@@ -37,5 +31,4 @@
|
|
37
31
|
- if EffectiveOrders.terms_and_conditions
|
38
32
|
= render partial: 'effective/orders/order_terms_and_conditions_fields', locals: { form: f }
|
39
33
|
|
40
|
-
|
41
|
-
= f.submit 'Save and Continue', class: 'btn btn-primary', rel: :nofollow, data: { disable_with: 'Saving...' }
|
34
|
+
= effective_save(f, 'Proceed to Checkout')
|
@@ -1,47 +1,43 @@
|
|
1
1
|
= render partial: 'effective/orders/order', locals: { order: order }
|
2
|
-
- form_locals = { order: order, purchased_url: purchased_url, declined_url: declined_url }
|
3
2
|
|
4
|
-
|
5
|
-
-
|
6
|
-
=
|
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'
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
- else
|
12
|
-
- if EffectiveOrders.allow_pretend_purchase_in_development && !Rails.env.production?
|
13
|
-
= render partial: '/effective/orders/pretend/form', locals: form_locals
|
7
|
+
.effective-order.effective-order-purchase-actions.form-actions
|
8
|
+
- provider_locals = { order: order, purchased_url: purchased_url, declined_url: declined_url }
|
14
9
|
|
15
|
-
|
16
|
-
|
10
|
+
- if EffectiveOrders.free? && order.free?
|
11
|
+
= render partial: '/effective/orders/free/form', locals: provider_locals
|
17
12
|
|
18
|
-
|
19
|
-
|
13
|
+
- elsif EffectiveOrders.refunds? && order.refund?
|
14
|
+
-# Nothing
|
20
15
|
|
21
|
-
|
22
|
-
|
16
|
+
- else
|
17
|
+
- if EffectiveOrders.pretend?
|
18
|
+
= render partial: '/effective/orders/pretend/form', locals: provider_locals
|
23
19
|
|
24
|
-
- if EffectiveOrders.
|
25
|
-
= render partial: '/effective/orders/
|
20
|
+
- if EffectiveOrders.moneris?
|
21
|
+
= render partial: '/effective/orders/moneris/form', locals: provider_locals
|
26
22
|
|
27
|
-
- if EffectiveOrders.
|
28
|
-
= render partial: '/effective/orders/
|
23
|
+
- if EffectiveOrders.paypal?
|
24
|
+
= render partial: '/effective/orders/paypal/form', locals: provider_locals
|
29
25
|
|
30
|
-
- if EffectiveOrders.
|
31
|
-
= render partial: '/effective/orders/
|
26
|
+
- if EffectiveOrders.stripe?
|
27
|
+
= render partial: '/effective/orders/stripe/form', locals: provider_locals
|
32
28
|
|
33
|
-
- if EffectiveOrders.
|
34
|
-
= render partial: '/effective/orders/cheque/form', locals:
|
29
|
+
- if EffectiveOrders.cheque? && order.user == current_user
|
30
|
+
= render partial: '/effective/orders/cheque/form', locals: provider_locals
|
35
31
|
|
36
|
-
- if EffectiveOrders.
|
32
|
+
- if EffectiveOrders.pretend? && Rails.env.production? && EffectiveOrders.pretend_purchase_in_production_message.present?
|
37
33
|
%br
|
38
|
-
%p= EffectiveOrders.
|
34
|
+
%p= EffectiveOrders.pretend_purchase_in_production_message
|
39
35
|
|
40
36
|
- if EffectiveOrders.authorized?(controller, :admin, :effective_orders) && order.user != current_user
|
41
|
-
- if EffectiveOrders.
|
37
|
+
- if EffectiveOrders.refunds? && order.refund?
|
42
38
|
.effective-order.effective-order-admin-purchase-actions
|
43
|
-
= render partial: '/effective/orders/refund/form', locals:
|
44
|
-
- elsif EffectiveOrders.
|
39
|
+
= render partial: '/effective/orders/refund/form', locals: provider_locals
|
40
|
+
- elsif EffectiveOrders.mark_as_paid?
|
45
41
|
.effective-order.effective-order-admin-purchase-actions
|
46
|
-
= render partial: '/effective/orders/mark_as_paid/form', locals:
|
42
|
+
= render partial: '/effective/orders/mark_as_paid/form', locals: provider_locals
|
47
43
|
|
@@ -4,8 +4,7 @@
|
|
4
4
|
|
5
5
|
= render partial: 'effective/orders/order_header', locals: { order: order }
|
6
6
|
= render partial: 'effective/orders/order_shipping', locals: { order: order }
|
7
|
-
= render partial: 'effective/orders/
|
8
|
-
= render partial: 'effective/orders/order_note_to_buyer', locals: { order: order }
|
7
|
+
= render partial: 'effective/orders/order_notes', locals: { order: order }
|
9
8
|
= render partial: 'effective/orders/order_items', locals: { order: order }
|
10
9
|
= render partial: 'effective/orders/order_payment_details', locals: { order: order }
|
11
10
|
= render partial: 'effective/orders/order_footer', locals: { order: order }
|
@@ -1,10 +1,18 @@
|
|
1
1
|
.effective-order-actions
|
2
|
-
|
2
|
+
- if order.persisted?
|
3
|
+
= link_to 'Print', '#', class: 'btn btn-primary print-button', data: { role: 'print-button' }, onClick: 'window.print(); false;'
|
3
4
|
|
4
5
|
- if order.purchased?
|
5
|
-
= link_to '
|
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.user.email}?" }
|
6
9
|
|
7
|
-
-
|
8
|
-
- if order.pending?
|
9
|
-
= link_to '
|
10
|
-
|
10
|
+
- if order.persisted? && EffectiveOrders.authorized?(controller, :admin, :effective_orders)
|
11
|
+
- if order.pending? || order.confirmed?
|
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.user.email}?" }
|
15
|
+
|
16
|
+
= link_to 'Delete', effective_orders.admin_order_path(order),
|
17
|
+
class: 'btn btn-danger',
|
18
|
+
data: { method: :delete, confirm: "Really delete #{order}?" }
|
@@ -14,7 +14,7 @@
|
|
14
14
|
.col-sm-6
|
15
15
|
- if order.purchased?
|
16
16
|
%p Receipt: ##{order.to_param}
|
17
|
-
%p Purchased at: #{order.purchased_at.strftime("%
|
17
|
+
%p Purchased at: #{order.purchased_at.strftime("%F %H:%M")}
|
18
18
|
- elsif order.persisted?
|
19
19
|
%p Order: ##{order.to_param}
|
20
|
-
%p Date: #{Time.zone.now.strftime("%
|
20
|
+
%p Date: #{Time.zone.now.strftime("%F %H:%M")}
|