effective_events 0.22.2 → 0.23.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3b9faa624904b433109451d6e7a064141af823256bc6482091e3edfe5cfe877
4
- data.tar.gz: a55f320e5007311f0c53ab662642b5192b6f9310fdb40e8171f6f6119d0546e7
3
+ metadata.gz: b35f3042e9e99875c91066ad1c6cd8c70e601dfc4abc72e0b32632c683523371
4
+ data.tar.gz: db5f82e191ab087d2b052fb2426c0204a2d8ef0e19b2f4a6f4720aed2d6f1d91
5
5
  SHA512:
6
- metadata.gz: e26a9f437b4f21a3a74f6fa666cb602927ecdd22334ea1151761cbc750b6fafa0aefc6f6fc4b616b8b84742aa62359eeb351d79b74656c5bdaea9db4bf423608
7
- data.tar.gz: c7e80b197ccb38b79f9f5f21c5c63247b259a0e728aea20dd148d6b78cee077983f764f9740d8aaf7fa04a4363836009ded9f764a970f64ec53c615640d2f0c2
6
+ metadata.gz: b00e8a6173d55548bbc2b72048b7bab6f724f7655cd6d78dd40eb9bbaa336eba428918b5961882f0d9af1ce688d60aeb2530657bbb1fac24733e43ba0c64552c
7
+ data.tar.gz: 79d0a3ec08ce158f5d65115f4d1f5d516eb2992f384e3b63c25e6026410b8f43134b9605bb811e15c7afae075adf58c73138159754f0e060f012e1a46dff5557
@@ -1,11 +1,12 @@
1
1
  module Admin
2
2
  class EffectiveEventAddonsDatatable < Effective::Datatable
3
3
  filters do
4
- scope :unarchived, label: "All"
5
- scope :purchased
4
+ scope :registered
5
+ scope :purchased_or_created_by_admin, label: 'Purchased'
6
6
  scope :deferred
7
- scope :not_purchased
7
+ scope :not_purchased_not_created_by_admin, label: 'Not Purchased'
8
8
  scope :archived
9
+ scope :all
9
10
  end
10
11
 
11
12
  datatable do
@@ -36,7 +37,7 @@ module Admin
36
37
  end
37
38
 
38
39
  collection do
39
- scope = Effective::EventAddon.deep.registered.includes(:purchased_order, :owner)
40
+ scope = Effective::EventAddon.deep.includes(:purchased_order, :owner)
40
41
 
41
42
  if attributes[:event_id].present?
42
43
  scope = scope.where(event: event)
@@ -30,17 +30,17 @@ module Admin
30
30
  col :capacity, visible: false
31
31
  col :capacity_available, visible: false
32
32
 
33
- col :registered_event_addons, label: 'Registered Names' do |product|
34
- product.registered_event_addons.reject(&:archived?).sort_by(&:to_s).map do |addon|
35
- content_tag(:div, addon.name.to_s, class: 'col-resource_item')
36
- end.join.html_safe
37
- end
38
-
39
- col :purchased_event_addons, label: 'Purchased Names', visible: false do |product|
40
- product.purchased_event_addons.reject(&:archived?).sort_by(&:to_s).map do |addon|
41
- content_tag(:div, addon.name.to_s, class: 'col-resource_item')
42
- end.join.html_safe
43
- end
33
+ # col :registered_event_addons, label: 'Registered Names' do |product|
34
+ # product.registered_event_addons.reject(&:archived?).sort_by(&:to_s).map do |addon|
35
+ # content_tag(:div, addon.name.to_s, class: 'col-resource_item')
36
+ # end.join.html_safe
37
+ # end
38
+
39
+ # col :purchased_event_addons, label: 'Purchased Names', visible: false do |product|
40
+ # product.purchased_event_addons.reject(&:archived?).sort_by(&:to_s).map do |addon|
41
+ # content_tag(:div, addon.name.to_s, class: 'col-resource_item')
42
+ # end.join.html_safe
43
+ # end
44
44
 
45
45
  actions_col
46
46
  end
@@ -1,12 +1,12 @@
1
1
  module Admin
2
2
  class EffectiveEventRegistrantsDatatable < Effective::Datatable
3
3
  filters do
4
- scope :unarchived, label: "All"
5
4
  scope :registered
6
- scope :purchased
5
+ scope :purchased_or_created_by_admin, label: 'Purchased'
7
6
  scope :deferred
8
- scope :not_purchased
7
+ scope :not_purchased_not_created_by_admin, label: 'Not Purchased'
9
8
  scope :archived
9
+ scope :all
10
10
  end
11
11
 
12
12
  datatable do
@@ -60,7 +60,15 @@ module Admin
60
60
  col :organization, visible: false
61
61
 
62
62
  col :orders, visible: false
63
- col :price, as: :price
63
+
64
+ col(:price, as: :price) do |registrant|
65
+ [
66
+ (badge('ADMIN') if registrant.created_by_admin?),
67
+ price_to_currency(registrant.price)
68
+ ].compact.join(' ').html_safe
69
+ end
70
+
71
+ col :created_by_admin, visible: false
64
72
 
65
73
  col :first_name, visible: false
66
74
  col :last_name, visible: false
@@ -37,15 +37,15 @@ module Admin
37
37
  col :category, visible: false
38
38
 
39
39
  col :registered_event_registrants_count, label: 'Registered' do |event|
40
- event.event_registrants.registered.unarchived.count
40
+ event.event_registrants.registered.count
41
41
  end
42
42
 
43
43
  col :purchased_event_registrants_count, label: 'Deferred', visible: false do |event|
44
- event.event_registrants.deferred.unarchived.count
44
+ event.event_registrants.deferred.count
45
45
  end
46
46
 
47
47
  col :purchased_event_registrants_count, label: 'Purchased', visible: false do |event|
48
- event.event_registrants.purchased.unarchived.count
48
+ event.event_registrants.purchased.count
49
49
  end
50
50
 
51
51
 
@@ -32,6 +32,8 @@ module Effective
32
32
 
33
33
  archived :boolean
34
34
 
35
+ created_by_admin :boolean
36
+
35
37
  # Acts as Purchasable
36
38
  price :integer
37
39
  qb_item_name :string
@@ -42,7 +44,9 @@ module Effective
42
44
 
43
45
  scope :sorted, -> { order(:id) }
44
46
  scope :deep, -> { includes(:event, :event_product) }
45
- scope :registered, -> { purchased_or_deferred }
47
+ scope :registered, -> { purchased_or_deferred.or(where(created_by_admin: true)) }
48
+ scope :purchased_or_created_by_admin, -> { purchased.or(unarchived.where(created_by_admin: true)) }
49
+ scope :not_purchased_not_created_by_admin, -> { not_purchased.where(created_by_admin: false) }
46
50
 
47
51
  before_validation(if: -> { event_registration.present? }) do
48
52
  self.event ||= event_registration.event
@@ -55,6 +55,8 @@ module Effective
55
55
 
56
56
  archived :boolean
57
57
 
58
+ created_by_admin :boolean
59
+
58
60
  # Acts as Purchasable
59
61
  price :integer
60
62
  qb_item_name :string
@@ -69,7 +71,9 @@ module Effective
69
71
 
70
72
  scope :sorted, -> { order(:event_ticket_id, :id) }
71
73
  scope :deep, -> { includes(:event, :event_ticket, :owner) }
72
- scope :registered, -> { where.not(registered_at: nil) }
74
+ scope :registered, -> { unarchived.where.not(registered_at: nil) }
75
+ scope :purchased_or_created_by_admin, -> { purchased.or(unarchived.where(created_by_admin: true)) }
76
+ scope :not_purchased_not_created_by_admin, -> { not_purchased.where(created_by_admin: false) }
73
77
 
74
78
  before_validation(if: -> { event_registration.present? }) do
75
79
  self.event ||= event_registration.event
@@ -95,7 +95,7 @@ module Effective
95
95
  raise('expected except to be an EventRegistration') if except && !except.class.try(:effective_events_event_registration?)
96
96
 
97
97
  event_registrants.select do |er|
98
- (er.registered? || er.selected_not_expired?) && (except.blank? || er.event_registration_id != except.id)
98
+ (er.registered? || er.selected_not_expired?) && (except.blank? || er.event_registration_id != except.id) && !er.archived?
99
99
  end
100
100
  end
101
101
 
@@ -23,6 +23,9 @@
23
23
 
24
24
  = f.check_box :archived, label: "Archive this addon. It will be displayed as archived on the owner's event registration"
25
25
 
26
+ - if f.object.new_record?
27
+ = f.hidden_field :created_by_admin, value: true
28
+
26
29
  - if f.object.new_record?
27
30
  = f.submit 'Save and Mark Registered'
28
31
  - else
@@ -37,4 +37,7 @@
37
37
 
38
38
  = f.check_box :archived, label: "Archive this registrant. It will be displayed as archived on the owner's event registration"
39
39
 
40
+ - if f.object.new_record?
41
+ = f.hidden_field :created_by_admin, value: true
42
+
40
43
  = f.submit 'Save'
@@ -105,6 +105,7 @@ class CreateEffectiveEvents < ActiveRecord::Migration[6.0]
105
105
  t.integer :price
106
106
 
107
107
  t.boolean :archived, default: false
108
+ t.boolean :created_by_admin, default: false
108
109
 
109
110
  t.timestamps
110
111
  end
@@ -146,6 +147,7 @@ class CreateEffectiveEvents < ActiveRecord::Migration[6.0]
146
147
  t.integer :price
147
148
 
148
149
  t.boolean :archived, default: false
150
+ t.boolean :created_by_admin, default: false
149
151
 
150
152
  t.timestamps
151
153
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveEvents
2
- VERSION = '0.22.2'.freeze
2
+ VERSION = '0.23.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_events
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.2
4
+ version: 0.23.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: 2024-10-31 00:00:00.000000000 Z
11
+ date: 2024-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails