effective_events 0.22.1 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/datatables/admin/effective_event_addons_datatable.rb +5 -4
- data/app/datatables/admin/effective_event_products_datatable.rb +11 -11
- data/app/datatables/admin/effective_event_registrants_datatable.rb +12 -4
- data/app/datatables/admin/effective_event_tickets_datatable.rb +3 -3
- data/app/models/concerns/effective_events_event_registration.rb +12 -0
- data/app/models/effective/event_addon.rb +5 -1
- data/app/models/effective/event_registrant.rb +5 -4
- data/app/models/effective/event_ticket.rb +1 -1
- data/app/views/admin/event_addons/_form.html.haml +3 -0
- data/app/views/admin/event_registrants/_form.html.haml +3 -0
- data/db/migrate/101_create_effective_events.rb +2 -0
- data/lib/effective_events/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b35f3042e9e99875c91066ad1c6cd8c70e601dfc4abc72e0b32632c683523371
|
4
|
+
data.tar.gz: db5f82e191ab087d2b052fb2426c0204a2d8ef0e19b2f4a6f4720aed2d6f1d91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 :
|
5
|
-
scope :
|
4
|
+
scope :registered
|
5
|
+
scope :purchased_or_created_by_admin, label: 'Purchased'
|
6
6
|
scope :deferred
|
7
|
-
scope :
|
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.
|
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
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
col :purchased_event_addons, label: 'Purchased Names', visible: false do |product|
|
40
|
-
|
41
|
-
|
42
|
-
|
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 :
|
5
|
+
scope :purchased_or_created_by_admin, label: 'Purchased'
|
7
6
|
scope :deferred
|
8
|
-
scope :
|
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
|
-
|
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.
|
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.
|
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.
|
48
|
+
event.event_registrants.purchased.count
|
49
49
|
end
|
50
50
|
|
51
51
|
|
@@ -141,6 +141,18 @@ module EffectiveEventsEventRegistration
|
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
144
|
+
# Validate the same registrant user isn't registered on another registration
|
145
|
+
validate(if: -> { current_step == :details }) do
|
146
|
+
present_event_registrants.select { |er| er.user.present? }.each do |er|
|
147
|
+
existing = Effective::EventRegistrant.unarchived.registered.where(event_ticket: er.event_ticket, user: er.user).where.not(id: er)
|
148
|
+
|
149
|
+
if existing.present?
|
150
|
+
errors.add(:base, "Unable to register #{er.user} for #{er.event_ticket}. They've already been registered")
|
151
|
+
er.errors.add(:user_id, "Unable to register #{er.user} for #{er.event_ticket}. They've already been registered")
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
144
156
|
# Validate all products are available for registration
|
145
157
|
validate(if: -> { current_step == :addons }) do
|
146
158
|
unavailable_event_products.each do |event_product|
|
@@ -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
|
@@ -114,9 +118,6 @@ module Effective
|
|
114
118
|
validates :price, presence: true, numericality: { greater_than_or_equal_to: 0 }
|
115
119
|
validates :email, email: true
|
116
120
|
|
117
|
-
# This works for persisted and adding a new one. But not adding two at same time in a registration
|
118
|
-
validates :user_id, uniqueness: { scope: [:event_ticket_id], allow_blank: true, message: 'is already registered for this event ticket' }
|
119
|
-
|
120
121
|
# First name, last name and email are always required fields on details
|
121
122
|
validates :first_name, presence: true, if: -> { registrant_validations_enabled? }
|
122
123
|
validates :last_name, presence: true, if: -> { registrant_validations_enabled? }
|
@@ -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
|
@@ -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
|
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.
|
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-
|
11
|
+
date: 2024-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|