effective_orders 6.23.1 → 6.24.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aacbf648e88be000dccd67b2eaf3b5f659f58ce5d04238cc2ce06cf38abb496f
4
- data.tar.gz: 88fe0446cc0a7788a199e63020db3605cd165b407836e51e963fafcb8ea4ab64
3
+ metadata.gz: 9da5a3039ab999f6469ee93178d23257c81724a4532548e536af212e082ea782
4
+ data.tar.gz: 94e9f7086405b091105bb47ffd9d7fc4181c04f9eba5cdfd1f176285959d2c91
5
5
  SHA512:
6
- metadata.gz: 18343e5fbc7c8d6462f40800078f02228afa29a983f1bab6ed5e6ce4c1b7ac7c824a60e30fdd93a9c0767dc1e9960b049fdfa3e9b22dc37925f7d6d7c20b14ba
7
- data.tar.gz: 461cb7c6788cff12420017d6d1f4c0358f41131bc76500f92408b75e309a671c8e5baa0e221708a21a1843c4b4df859cc33a213316b5bcf2fbb5c29b7512387f
6
+ metadata.gz: ebb63ef8c77027aef6a2fa831a14c96e22044746f208054c364d556b458f137adf16fb357ae60b00b09c1eb45a11208b9f2ac879548be8ccad1e9c87a0dbd6da
7
+ data.tar.gz: 83182d0a3220cdf5cf6ea93c7828fc90d8d3c124b4e48a9f3e54a50693de6b77bb087cf64a6da5ebfe30204a0d20d1ee6bc3d5909139cb2890f64cb82fc0e36d
@@ -32,6 +32,14 @@ module Admin
32
32
  render 'index'
33
33
  end
34
34
 
35
+ # This is used by the transactions_grouped_by_name and transactions_grouped_by_qb_name datatables
36
+ # To display a nested datatable of the orders
37
+ def nested_orders
38
+ ids = params[:ids].to_s.split("|")
39
+ @datatable = Admin::EffectiveOrdersDatatable.new(ids: ids, skip_filters: true, skip_bulk_actions: true)
40
+ nested_datatable_action
41
+ end
42
+
35
43
  def payment_providers
36
44
  @datatable = Admin::ReportPaymentProvidersDatatable.new
37
45
  @page_title = @datatable.datatable_name
@@ -1,17 +1,19 @@
1
1
  module Admin
2
2
  class EffectiveOrdersDatatable < Effective::Datatable
3
3
  bulk_actions do
4
- bulk_action(
5
- 'Send payment request email to selected orders',
6
- effective_orders.bulk_send_payment_request_admin_orders_path,
7
- data: { confirm: 'Send payment request emails?' }
8
- )
9
-
10
- bulk_action(
11
- 'Send invoice email to selected purchased orders',
12
- effective_orders.bulk_send_order_email_to_buyer_orders_path,
13
- data: { confirm: 'Send invoice emails?' }
14
- )
4
+ unless attributes[:skip_bulk_actions]
5
+ bulk_action(
6
+ 'Send payment request email to selected orders',
7
+ effective_orders.bulk_send_payment_request_admin_orders_path,
8
+ data: { confirm: 'Send payment request emails?' }
9
+ )
10
+
11
+ bulk_action(
12
+ 'Send invoice email to selected purchased orders',
13
+ effective_orders.bulk_send_order_email_to_buyer_orders_path,
14
+ data: { confirm: 'Send invoice emails?' }
15
+ )
16
+ end
15
17
  end
16
18
 
17
19
  filters do
@@ -32,7 +34,9 @@ module Admin
32
34
  datatable do
33
35
  order :updated_at
34
36
 
35
- bulk_actions_col
37
+ unless attributes[:skip_bulk_actions]
38
+ bulk_actions_col
39
+ end
36
40
 
37
41
  col :created_at, visible: false
38
42
  col :updated_at, visible: false
@@ -116,7 +120,9 @@ module Admin
116
120
  col :note_to_buyer, visible: false
117
121
  col :note_internal, visible: false
118
122
 
119
- actions_col
123
+ unless attributes[:skip_actions]
124
+ actions_col
125
+ end
120
126
 
121
127
  unless attributes[:total] == false
122
128
  aggregate :total
@@ -147,6 +153,10 @@ module Admin
147
153
  scope = scope.where(parent_id: attributes[:parent_id], parent_type: attributes[:parent_type])
148
154
  end
149
155
 
156
+ if attributes[:ids].present?
157
+ scope = scope.where(id: attributes[:ids])
158
+ end
159
+
150
160
  scope
151
161
  end
152
162
 
@@ -18,9 +18,18 @@ module Admin
18
18
  col("p - #{provider}", as: :price, visible: false)
19
19
  end
20
20
 
21
- col :orders_count
21
+ col :orders_count, visible: false
22
+
23
+ col(:orders, col_class: 'col-actions') do |orders|
24
+ if orders.present?
25
+ title = pluralize(orders.length, 'orders')
26
+ order_ids = orders.map(&:id).join("|")
27
+
28
+ path = effective_orders.nested_orders_admin_order_reports_path(ids: order_ids)
29
+ nested_datatable_link_to(title, path)
30
+ end
31
+ end
22
32
 
23
- col :orders, visible: false
24
33
  col :users, visible: false
25
34
 
26
35
  col :filtered_start_date, as: :date, search: false, sort: false, visible: false do
@@ -53,10 +62,12 @@ module Admin
53
62
  items.sum { |item| (item.order.payment_provider == payment_provider) ? item.total : 0 }.to_i
54
63
  end
55
64
 
65
+ orders = items.map { |item| item.order }.uniq.sort
66
+
56
67
  row += [
57
- items.map(&:order_id).uniq.length,
58
- items.map { |item| item.order },
59
- items.map { |item| item.order.user },
68
+ orders.length,
69
+ orders,
70
+ orders.map(&:user),
60
71
  start_date,
61
72
  end_date
62
73
  ]
@@ -18,9 +18,18 @@ module Admin
18
18
  col("p - #{provider}", as: :price, visible: false)
19
19
  end
20
20
 
21
- col :orders_count
21
+ col :orders_count, visible: false
22
+
23
+ col(:orders, col_class: 'col-actions') do |orders|
24
+ if orders.present?
25
+ title = pluralize(orders.length, 'orders')
26
+ order_ids = orders.map(&:id).join("|")
27
+
28
+ path = effective_orders.nested_orders_admin_order_reports_path(ids: order_ids)
29
+ nested_datatable_link_to(title, path)
30
+ end
31
+ end
22
32
 
23
- col :orders, visible: false
24
33
  col :users, visible: false
25
34
 
26
35
  col :start_date, as: :date, search: false, sort: false, visible: false do
@@ -53,10 +62,12 @@ module Admin
53
62
  items.sum { |item| (item.order.payment_provider == payment_provider) ? item.total : 0 }.to_i
54
63
  end
55
64
 
65
+ orders = items.map { |item| item.order }.uniq.sort
66
+
56
67
  row += [
57
- items.map(&:order_id).uniq.length,
58
- items.map { |item| item.order },
59
- items.map { |item| item.order.user },
68
+ orders.length,
69
+ orders,
70
+ orders.map(&:user),
60
71
  start_date,
61
72
  end_date
62
73
  ]
@@ -416,6 +416,10 @@ module Effective
416
416
  [label, ' #', to_param].join
417
417
  end
418
418
 
419
+ def full_to_s
420
+ [to_s, billing_name.presence, email.presence, total_to_s].compact.join(' - ')
421
+ end
422
+
419
423
  def label
420
424
  if refund? && purchased?
421
425
  'Refund'
@@ -434,6 +438,10 @@ module Effective
434
438
  purchased? ? 'Total paid' : 'Total due'
435
439
  end
436
440
 
441
+ def total_to_s
442
+ "$#{'%0.2f' % total_to_f}"
443
+ end
444
+
437
445
  def payment_method
438
446
  payment_method_value if purchased?
439
447
  end
@@ -582,7 +590,7 @@ module Effective
582
590
  return unless delayed? && deferred? && delayed_payment_provider?
583
591
  return unless delayed_payment_date_upcoming?
584
592
 
585
- "Your #{delayed_payment_method} will be charged $#{'%0.2f' % total_to_f} on #{delayed_payment_date.strftime('%A, %B %e, %Y')}."
593
+ "Your #{delayed_payment_method} will be charged #{total_to_s} on #{delayed_payment_date.strftime('%A, %B %e, %Y')}."
586
594
  end
587
595
 
588
596
  def delayed_payment_date_past?
data/config/routes.rb CHANGED
@@ -78,6 +78,7 @@ EffectiveOrders::Engine.routes.draw do
78
78
 
79
79
  resources :order_reports, only: [] do
80
80
  collection do
81
+ get :nested_orders
81
82
  get :transactions
82
83
  get :transactions_grouped_by_name
83
84
  get :transactions_grouped_by_qb_name
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '6.23.1'.freeze
2
+ VERSION = '6.24.0'.freeze
3
3
  end
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: 6.23.1
4
+ version: 6.24.0
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: 2025-04-24 00:00:00.000000000 Z
11
+ date: 2025-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails