effective_orders 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/effective_orders/shipping_address_toggle.js.coffee +1 -1
- data/app/controllers/effective/carts_controller.rb +1 -0
- data/app/controllers/effective/orders_controller.rb +9 -8
- data/app/models/concerns/acts_as_active_admin.rb +59 -0
- data/app/models/concerns/acts_as_purchasable.rb +6 -2
- data/app/models/effective/order.rb +64 -41
- data/app/views/admin/order_items/index.html.haml +8 -2
- data/app/views/admin/orders/index.html.haml +8 -2
- data/app/views/admin/orders/show.html.haml +1 -1
- data/config/routes.rb +1 -2
- data/lib/effective_orders.rb +4 -0
- data/lib/effective_orders/engine.rb +1 -0
- data/lib/effective_orders/version.rb +1 -1
- data/lib/generators/templates/effective_orders.rb +3 -0
- metadata +3 -17
- data/app/views/active_admin/effective_orders/orders/_show.html.haml +0 -70
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f869116475dda7d252b6202a1384be1bb181f7bf
|
4
|
+
data.tar.gz: d0288050d30d8915e2a3b255c5405e8ef9ed8567
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81e62b3d4520668550b0d993c4c14f0c0c26d80bd6f8be7c26537e4555af3376d3e1a061948cf1132045a684fd0a81f2cf2a0ca4b935a170176b5a8485cf684c
|
7
|
+
data.tar.gz: b35df012dc37eb2b2391c661947d6238b5333839c7d777ca2cdff0573b0c476b5c248043be21503deb3460d1150259ed7a5db6222fb4aae5d27de5410de3fbf0
|
@@ -1,5 +1,5 @@
|
|
1
1
|
hideShippingAddressFields = (shipping_address) ->
|
2
|
-
shipping_address.hide().find('input,select').
|
2
|
+
shipping_address.hide().find('input,select').removeProp('required')
|
3
3
|
|
4
4
|
showShippingAddressFields = (shipping_address) ->
|
5
5
|
shipping_address.show().find("input:not([name$='[address2]']),select:not([name$='[state_code]'])").prop('required', true)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Effective
|
2
2
|
class CartsController < ApplicationController
|
3
3
|
include EffectiveCartsHelper
|
4
|
+
acts_as_active_admin_controller('carts') if defined?(ActiveAdmin) && EffectiveOrders.use_active_admin == true
|
4
5
|
layout (EffectiveOrders.layout.kind_of?(Hash) ? EffectiveOrders.layout[:carts] : EffectiveOrders.layout)
|
5
6
|
|
6
7
|
def show
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Effective
|
2
2
|
class OrdersController < ApplicationController
|
3
3
|
include EffectiveCartsHelper
|
4
|
+
acts_as_active_admin_controller('orders') if defined?(ActiveAdmin) && EffectiveOrders.use_active_admin == true
|
4
5
|
|
5
6
|
include Providers::Moneris if EffectiveOrders.moneris_enabled
|
6
7
|
include Providers::Paypal if EffectiveOrders.paypal_enabled
|
@@ -34,7 +35,12 @@ module Effective
|
|
34
35
|
def create
|
35
36
|
@order ||= Order.new(current_cart, current_user)
|
36
37
|
@order.attributes = order_params
|
37
|
-
|
38
|
+
|
39
|
+
if EffectiveOrders.require_shipping_address
|
40
|
+
if @order.shipping_address_same_as_billing? && @order.billing_address.present?
|
41
|
+
@order.shipping_address ||= @order.billing_address
|
42
|
+
end
|
43
|
+
end
|
38
44
|
|
39
45
|
EffectiveOrders.authorized?(self, :create, @order)
|
40
46
|
|
@@ -75,7 +81,6 @@ module Effective
|
|
75
81
|
@page_title = 'Checkout'
|
76
82
|
render(:checkout) and return
|
77
83
|
end
|
78
|
-
|
79
84
|
end
|
80
85
|
|
81
86
|
def index
|
@@ -113,17 +118,13 @@ module Effective
|
|
113
118
|
@order = Effective::Order.find(params[:id])
|
114
119
|
EffectiveOrders.authorized?(self, :show, @order)
|
115
120
|
|
116
|
-
if
|
121
|
+
if @order.send_order_receipt_to_buyer!
|
117
122
|
flash[:success] = "Successfully resent order receipt to #{@order.user.email}"
|
118
123
|
else
|
119
124
|
flash[:danger] = "Unable to send order receipt"
|
120
125
|
end
|
121
126
|
|
122
|
-
|
123
|
-
redirect_to :back
|
124
|
-
rescue => e
|
125
|
-
redirect_to effective_orders.admin_orders_path
|
126
|
-
end
|
127
|
+
redirect_to(:back) rescue effective_orders.order_path(@order)
|
127
128
|
end
|
128
129
|
|
129
130
|
def pretend_purchase
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module ActsAsActiveAdmin
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
module ActionController
|
5
|
+
def acts_as_active_admin_controller(key)
|
6
|
+
@active_admin_resource_element_lookup_key = key
|
7
|
+
include ::ActsAsActiveAdmin
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
included do
|
12
|
+
include ::ActiveAdmin::BaseController::Menu
|
13
|
+
include ::ActiveAdmin::BaseController::Authorization
|
14
|
+
|
15
|
+
helper ::ActiveAdmin::ViewHelpers
|
16
|
+
helper_method :active_admin_config, :active_admin_namespace, :current_active_admin_user
|
17
|
+
|
18
|
+
resource_key = @active_admin_resource_element_lookup_key.to_s
|
19
|
+
self.send(:define_method, :active_admin_resource_element_key) { resource_key }
|
20
|
+
|
21
|
+
resource_ivar = '@' + resource_key.singularize
|
22
|
+
self.send(:define_method, :resource) { instance_variable_get(resource_ivar) }
|
23
|
+
|
24
|
+
resource_path = "effective_orders.#{resource_key.singularize}_path"
|
25
|
+
|
26
|
+
if resource_path == 'effective_orders.cart_path'
|
27
|
+
self.send(:define_method, :resource_path) { |resource| effective_orders.cart_path }
|
28
|
+
else
|
29
|
+
self.send(:define_method, :resource_path) { |resource| public_send(resource_path, resource) }
|
30
|
+
end
|
31
|
+
|
32
|
+
helper_method :resource, :resource_path
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
module ClassMethods
|
37
|
+
end
|
38
|
+
|
39
|
+
def active_admin_namespace
|
40
|
+
ActiveAdmin.application.namespaces[EffectiveOrders.active_admin_namespace || :root]
|
41
|
+
end
|
42
|
+
|
43
|
+
def active_admin_config
|
44
|
+
active_admin_namespace.resources[active_admin_resource_key]
|
45
|
+
end
|
46
|
+
|
47
|
+
def active_admin_resource_key
|
48
|
+
@active_admin_resource_key ||= begin
|
49
|
+
namespace = ActiveAdmin.application.namespaces[EffectiveOrders.active_admin_namespace || :root]
|
50
|
+
namespace.resources.keys.find { |resource| resource.element == active_admin_resource_element_key }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def current_active_admin_user
|
55
|
+
send(active_admin_namespace.current_user_method) if active_admin_namespace.current_user_method
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
@@ -91,6 +91,10 @@ module ActsAsPurchasable
|
|
91
91
|
@is_purchased ||= orders.any? { |order| order.purchased? }
|
92
92
|
end
|
93
93
|
|
94
|
+
def purchased_at
|
95
|
+
@purchased_at ||= orders.map { |order| order.purchased_at if order.purchased? }.compact.sort.first
|
96
|
+
end
|
97
|
+
|
94
98
|
def purchased_by?(user)
|
95
99
|
orders.any? { |order| order.purchased? && order.user_id == user.id }
|
96
100
|
end
|
@@ -118,12 +122,12 @@ module ActsAsPurchasable
|
|
118
122
|
# end
|
119
123
|
|
120
124
|
after_purchase(order, order_item) if self.respond_to?(:after_purchase)
|
121
|
-
|
125
|
+
save!
|
122
126
|
end
|
123
127
|
|
124
128
|
def declined!(order = nil, order_item = nil)
|
125
129
|
after_decline(order, order_item) if self.respond_to?(:after_decline)
|
126
|
-
|
130
|
+
save!
|
127
131
|
end
|
128
132
|
|
129
133
|
# Override me if this is a digital purchase.
|
@@ -47,7 +47,8 @@ module Effective
|
|
47
47
|
scope :purchased_by, lambda { |user| purchased.where(:user_id => user.try(:id)) }
|
48
48
|
scope :declined, -> { where(:purchase_state => EffectiveOrders::DECLINED) }
|
49
49
|
|
50
|
-
|
50
|
+
# Can be an Effective::Cart, a single acts_as_purchasable, or an array of acts_as_purchasables
|
51
|
+
def initialize(items = {}, user = nil)
|
51
52
|
super() # Call super with no arguments
|
52
53
|
|
53
54
|
# Set up defaults
|
@@ -55,8 +56,7 @@ module Effective
|
|
55
56
|
self.save_shipping_address = true
|
56
57
|
self.shipping_address_same_as_billing = true
|
57
58
|
|
58
|
-
add_to_order(
|
59
|
-
|
59
|
+
add_to_order(items) if items.present?
|
60
60
|
self.user = user if user.present?
|
61
61
|
end
|
62
62
|
|
@@ -193,62 +193,46 @@ module Effective
|
|
193
193
|
|
194
194
|
# :validate => false, :email => false
|
195
195
|
def purchase!(payment_details = nil, opts = {})
|
196
|
-
opts = {:
|
196
|
+
opts = {validate: true, email: true}.merge(opts)
|
197
197
|
|
198
|
-
|
199
|
-
raise EffectiveOrders::AlreadyDeclinedException.new('order already declined') if (
|
198
|
+
return true if purchased?
|
199
|
+
raise EffectiveOrders::AlreadyDeclinedException.new('order already declined') if (declined? && opts[:validate])
|
200
200
|
|
201
|
-
|
202
|
-
self.purchase_state = EffectiveOrders::PURCHASED
|
203
|
-
self.purchased_at ||= Time.zone.now
|
204
|
-
self.payment = payment_details.kind_of?(Hash) ? payment_details : {:details => (payment_details || 'none').to_s}
|
201
|
+
success = false
|
205
202
|
|
206
|
-
|
207
|
-
|
203
|
+
Order.transaction do
|
204
|
+
begin
|
205
|
+
self.purchase_state = EffectiveOrders::PURCHASED
|
206
|
+
self.purchased_at ||= Time.zone.now
|
207
|
+
self.payment = payment_details.kind_of?(Hash) ? payment_details : {:details => (payment_details || 'none').to_s}
|
208
208
|
|
209
|
-
|
210
|
-
if Rails.env.production?
|
211
|
-
(OrdersMailer.order_receipt_to_admin(self).deliver rescue false)
|
212
|
-
else
|
213
|
-
OrdersMailer.order_receipt_to_admin(self).deliver
|
214
|
-
end
|
215
|
-
end
|
209
|
+
save!(validate: opts[:validate])
|
216
210
|
|
217
|
-
|
218
|
-
if Rails.env.production?
|
219
|
-
(OrdersMailer.order_receipt_to_buyer(self).deliver rescue false)
|
220
|
-
else
|
221
|
-
OrdersMailer.order_receipt_to_buyer(self).deliver
|
222
|
-
end
|
223
|
-
end
|
211
|
+
order_items.each { |item| (item.purchasable.purchased!(self, item) rescue nil) }
|
224
212
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
(OrdersMailer.order_receipt_to_seller(self, seller, order_items).deliver rescue false)
|
229
|
-
else
|
230
|
-
OrdersMailer.order_receipt_to_seller(self, seller, order_items).deliver
|
231
|
-
end
|
232
|
-
end
|
213
|
+
success = true
|
214
|
+
rescue => e
|
215
|
+
raise ActiveRecord::Rollback
|
233
216
|
end
|
234
|
-
|
235
|
-
return true
|
236
217
|
end
|
237
218
|
|
238
|
-
|
219
|
+
send_order_receipts! if success && opts[:email]
|
220
|
+
|
221
|
+
success
|
239
222
|
end
|
240
223
|
|
241
224
|
def decline!(payment_details = nil)
|
242
|
-
|
243
|
-
|
225
|
+
return true if declined?
|
226
|
+
|
227
|
+
raise EffectiveOrders::AlreadyPurchasedException.new('order already purchased') if purchased?
|
244
228
|
|
245
229
|
Order.transaction do
|
246
230
|
self.purchase_state = EffectiveOrders::DECLINED
|
247
231
|
self.payment = payment_details.kind_of?(Hash) ? payment_details : {:details => (payment_details || 'none').to_s}
|
248
232
|
|
249
|
-
order_items.each { |item| item.purchasable.declined!(self, item) }
|
233
|
+
order_items.each { |item| (item.purchasable.declined!(self, item) rescue nil) }
|
250
234
|
|
251
|
-
|
235
|
+
save!
|
252
236
|
end
|
253
237
|
end
|
254
238
|
|
@@ -276,5 +260,44 @@ module Effective
|
|
276
260
|
def declined?
|
277
261
|
purchase_state == EffectiveOrders::DECLINED
|
278
262
|
end
|
263
|
+
|
264
|
+
def send_order_receipts!
|
265
|
+
send_order_receipt_to_admin!
|
266
|
+
send_order_receipt_to_buyer!
|
267
|
+
send_order_receipt_to_seller!
|
268
|
+
end
|
269
|
+
|
270
|
+
def send_order_receipt_to_admin!
|
271
|
+
return false unless purchased? && EffectiveOrders.mailer[:send_order_receipt_to_admin]
|
272
|
+
|
273
|
+
if Rails.env.production?
|
274
|
+
(OrdersMailer.order_receipt_to_admin(self).deliver rescue false)
|
275
|
+
else
|
276
|
+
OrdersMailer.order_receipt_to_admin(self).deliver
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
def send_order_receipt_to_buyer!
|
281
|
+
return false unless purchased? && EffectiveOrders.mailer[:send_order_receipt_to_buyer]
|
282
|
+
|
283
|
+
if Rails.env.production?
|
284
|
+
(OrdersMailer.order_receipt_to_buyer(self).deliver rescue false)
|
285
|
+
else
|
286
|
+
OrdersMailer.order_receipt_to_buyer(self).deliver
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
def send_order_receipt_to_seller!
|
291
|
+
return false unless purchased?(:stripe_connect) && EffectiveOrders.mailer[:send_order_receipt_to_seller]
|
292
|
+
|
293
|
+
order_items.group_by(&:seller).each do |seller, order_items|
|
294
|
+
if Rails.env.production?
|
295
|
+
(OrdersMailer.order_receipt_to_seller(self, seller, order_items).deliver rescue false)
|
296
|
+
else
|
297
|
+
OrdersMailer.order_receipt_to_seller(self, seller, order_items).deliver
|
298
|
+
end
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
279
302
|
end
|
280
303
|
end
|
@@ -1,4 +1,10 @@
|
|
1
1
|
%h2 Order Items
|
2
2
|
|
3
|
-
|
4
|
-
%p
|
3
|
+
- if @datatable.nil?
|
4
|
+
%p
|
5
|
+
Please install
|
6
|
+
= link_to 'effective_datatables', 'https://github.com/code-and-effect/effective_datatables'
|
7
|
+
to see this page.
|
8
|
+
- else
|
9
|
+
= render_datatable @datatable do
|
10
|
+
%p There are no order items
|
@@ -1,4 +1,10 @@
|
|
1
1
|
%h2 Orders
|
2
2
|
|
3
|
-
|
4
|
-
%p
|
3
|
+
- if @datatable.nil?
|
4
|
+
%p
|
5
|
+
Please install
|
6
|
+
= link_to 'effective_datatables', 'https://github.com/code-and-effect/effective_datatables'
|
7
|
+
to see this page.
|
8
|
+
- else
|
9
|
+
= render_datatable @datatable do
|
10
|
+
%p There are no orders
|
@@ -3,7 +3,7 @@
|
|
3
3
|
= render :partial => 'effective/orders/order_payment_details', :locals => {:order => @order}
|
4
4
|
|
5
5
|
%hr
|
6
|
-
= link_to 'Back',
|
6
|
+
= link_to 'Back', :back, :class => 'btn btn-primary'
|
7
7
|
- if @order.purchased?
|
8
8
|
= '-'
|
9
9
|
= link_to 'Resend Receipt', effective_orders.resend_buyer_receipt_path(@order), 'data-confirm' => 'This action will email the buyer a copy of the original email receipt. Send receipt now?', :class => 'btn btn-default'
|
data/config/routes.rb
CHANGED
@@ -35,7 +35,6 @@ EffectiveOrders::Engine.routes.draw do
|
|
35
35
|
match 'orders/:id/pretend_purchase', :to => 'orders#pretend_purchase', :as => 'pretend_purchase', :via => [:get, :post]
|
36
36
|
end
|
37
37
|
|
38
|
-
# This must be below the other routes defined above.
|
39
38
|
resources :orders, :only => [:new, :create, :show, :index]
|
40
39
|
|
41
40
|
match 'cart', :to => 'carts#show', :as => 'cart', :via => :get
|
@@ -48,7 +47,7 @@ EffectiveOrders::Engine.routes.draw do
|
|
48
47
|
match 'webhooks/stripe', :to => 'webhooks#stripe', :via => [:post, :put]
|
49
48
|
end
|
50
49
|
|
51
|
-
if defined?(EffectiveDatatables)
|
50
|
+
if defined?(EffectiveDatatables) && !EffectiveOrders.use_active_admin == true
|
52
51
|
namespace :admin do
|
53
52
|
resources :customers, :only => [:index]
|
54
53
|
resources :orders, :only => [:index, :show]
|
data/lib/effective_orders.rb
CHANGED
@@ -2,6 +2,7 @@ require 'effective_addresses'
|
|
2
2
|
require 'effective_obfuscation'
|
3
3
|
require "effective_orders/engine"
|
4
4
|
require 'migrant' # Required for rspec to run properly
|
5
|
+
require 'simple_form'
|
5
6
|
|
6
7
|
module EffectiveOrders
|
7
8
|
PURCHASED = 'purchased'
|
@@ -20,7 +21,10 @@ module EffectiveOrders
|
|
20
21
|
|
21
22
|
mattr_accessor :layout
|
22
23
|
mattr_accessor :simple_form_options
|
24
|
+
|
23
25
|
mattr_accessor :use_active_admin
|
26
|
+
mattr_accessor :active_admin_namespace
|
27
|
+
|
24
28
|
mattr_accessor :obfuscate_order_ids
|
25
29
|
mattr_accessor :silence_deprecation_warnings
|
26
30
|
|
@@ -45,6 +45,7 @@ module EffectiveOrders
|
|
45
45
|
initializer 'effective_orders.active_admin' do
|
46
46
|
if defined?(ActiveAdmin) && EffectiveOrders.use_active_admin == true
|
47
47
|
ActiveAdmin.application.load_paths.unshift Dir["#{config.root}/active_admin"]
|
48
|
+
ActionController::Base.extend(ActsAsActiveAdmin::ActionController)
|
48
49
|
end
|
49
50
|
end
|
50
51
|
|
@@ -31,7 +31,10 @@ EffectiveOrders.setup do |config|
|
|
31
31
|
config.authorization_method = Proc.new { |controller, action, resource| true }
|
32
32
|
|
33
33
|
# Register Effective::Order with ActiveAdmin if ActiveAdmin is present
|
34
|
+
# You must have authorization to authorized?(:manage, Effective::Order)
|
35
|
+
# For the activeadmin menu to item to show up
|
34
36
|
config.use_active_admin = true
|
37
|
+
config.active_admin_namespace = :admin # Passed internally to ActiveAdmin.register
|
35
38
|
|
36
39
|
# Use effective_obfuscation gem to change order.id into a seemingly random 10-digit number
|
37
40
|
config.obfuscate_order_ids = true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_orders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -122,20 +122,6 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 1.1.0
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: effective_datatables
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: 2.0.0
|
132
|
-
type: :runtime
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: 2.0.0
|
139
125
|
- !ruby/object:Gem::Dependency
|
140
126
|
name: effective_obfuscation
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -352,6 +338,7 @@ files:
|
|
352
338
|
- app/helpers/effective_paypal_helper.rb
|
353
339
|
- app/helpers/effective_stripe_helper.rb
|
354
340
|
- app/mailers/effective/orders_mailer.rb
|
341
|
+
- app/models/concerns/acts_as_active_admin.rb
|
355
342
|
- app/models/concerns/acts_as_purchasable.rb
|
356
343
|
- app/models/effective/access_denied.rb
|
357
344
|
- app/models/effective/cart.rb
|
@@ -370,7 +357,6 @@ files:
|
|
370
357
|
- app/models/inputs/price_input.rb
|
371
358
|
- app/models/inputs/price_simple_form_input.rb
|
372
359
|
- app/models/validators/effective/sold_out_validator.rb
|
373
|
-
- app/views/active_admin/effective_orders/orders/_show.html.haml
|
374
360
|
- app/views/admin/customers/_actions.html.haml
|
375
361
|
- app/views/admin/customers/index.html.haml
|
376
362
|
- app/views/admin/order_items/index.html.haml
|
@@ -1,70 +0,0 @@
|
|
1
|
-
.panel
|
2
|
-
%h3= "Order ##{order.to_param} Details"
|
3
|
-
.panel_contents
|
4
|
-
.attributes_table
|
5
|
-
%table
|
6
|
-
%tbody
|
7
|
-
%tr
|
8
|
-
%th order
|
9
|
-
%td= "##{order.to_param}"
|
10
|
-
%tr
|
11
|
-
%th buyer
|
12
|
-
%td= link_to order.user, admin_user_path(order.user)
|
13
|
-
%tr
|
14
|
-
%th purchase state
|
15
|
-
%td= order.purchase_state
|
16
|
-
- if order.purchased?
|
17
|
-
%tr
|
18
|
-
%th purchased
|
19
|
-
%td= order.purchased_at.strftime("%Y-%m-%d %H:%M")
|
20
|
-
- if order.billing_address.present?
|
21
|
-
%tr
|
22
|
-
%th billing address
|
23
|
-
%td= order.billing_address.to_html
|
24
|
-
- if order.shipping_address.present?
|
25
|
-
%tr
|
26
|
-
%th shipping address
|
27
|
-
%td= order.shipping_address.to_html
|
28
|
-
|
29
|
-
.panel
|
30
|
-
%h3 Order Items
|
31
|
-
.panel_contents
|
32
|
-
.attributes_table
|
33
|
-
- has_seller = order.purchased?(:stripe_connect)
|
34
|
-
%table.table
|
35
|
-
%thead
|
36
|
-
%tr
|
37
|
-
%th Items
|
38
|
-
%th Price
|
39
|
-
- if has_seller
|
40
|
-
%th Seller
|
41
|
-
%tbody
|
42
|
-
- order.order_items.each do |item|
|
43
|
-
%tr
|
44
|
-
%td
|
45
|
-
- if item.quantity > 1
|
46
|
-
= "#{item.quantity}x "
|
47
|
-
= item.title
|
48
|
-
%td= price_to_currency(item.subtotal)
|
49
|
-
- if has_seller
|
50
|
-
%td= link_to item.seller.user, admin_user_path(item.seller.user)
|
51
|
-
%tfoot
|
52
|
-
%tr
|
53
|
-
%th Subtotal
|
54
|
-
%td= price_to_currency(order.subtotal)
|
55
|
-
%tr
|
56
|
-
%th Tax
|
57
|
-
%td= price_to_currency(order.tax)
|
58
|
-
%tr
|
59
|
-
%th Total
|
60
|
-
%td= price_to_currency(order.total)
|
61
|
-
|
62
|
-
- if order.payment.present?
|
63
|
-
.panel
|
64
|
-
%h3 Payment
|
65
|
-
.panel_contents
|
66
|
-
.attributes_table
|
67
|
-
= order_payment_to_html(order) rescue order.payment
|
68
|
-
|
69
|
-
|
70
|
-
|