effective_events 0.12.2 → 0.12.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/datatables/effective_event_registrations_datatable.rb +6 -1
- data/app/helpers/effective_events_helper.rb +9 -1
- data/app/models/concerns/effective_events_event_registration.rb +36 -1
- data/app/models/effective/event_registrant.rb +2 -0
- data/app/views/admin/event_tickets/_form.html.haml +4 -4
- data/app/views/effective/event_registrants/_fields_member_only.html.haml +2 -5
- data/app/views/effective/event_registrants/_fields_member_or_non_member.html.haml +2 -5
- data/app/views/effective/event_registrations/_form_blank_registrants.html.haml +34 -0
- data/app/views/effective/event_registrations/complete.html.haml +6 -0
- data/app/views/effective/event_registrations/submitted.html.haml +6 -0
- data/config/routes.rb +2 -0
- data/lib/effective_events/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0db42bb64a1639b358488381a0e7e4ca73814f98c41153cdb929063661b0e947
|
4
|
+
data.tar.gz: ad79f29da0313754aafc31e90a432eefbda54d631062ab9e593448540c6c4a08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ce3f1278268630aab2aec2547f6b9d3ad100b303a42e403b0b1dd93e7be6a21f1f09385f8835147cc768a77d2a8278cf1ca48dab8afbed97df986716a6478e1
|
7
|
+
data.tar.gz: 15459694c87b8208ba7f6bd7feb53dc66030e5f7c0ccc858e2a90d3dbb7ebe5761ede77ba6900e86ebcc28f1e225b1b3b5f65113860e268eedcd50f2f96a2f76
|
@@ -27,7 +27,12 @@ class EffectiveEventRegistrationsDatatable < Effective::Datatable
|
|
27
27
|
elsif er.submitted?
|
28
28
|
dropdown_link_to('Continue', effective_events.event_event_registration_build_path(er.event, er, er.next_step), 'data-turbolinks' => false)
|
29
29
|
elsif er.completed?
|
30
|
-
|
30
|
+
|
31
|
+
if EffectiveResources.authorized?(self, :update_blank_registrants, er)
|
32
|
+
dropdown_link_to('Continue', effective_events.event_event_registration_path(er.event, er))
|
33
|
+
else
|
34
|
+
dropdown_link_to('Show', effective_events.event_event_registration_path(er.event, er))
|
35
|
+
end
|
31
36
|
|
32
37
|
# Register Again
|
33
38
|
if er.event.registerable?
|
@@ -66,7 +66,15 @@ module EffectiveEventsHelper
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
def
|
69
|
+
def effective_events_event_registrant_user_collection(event_registrant)
|
70
|
+
raise("expected an Effective::EventRegistrant") unless event_registrant.kind_of?(Effective::EventRegistrant)
|
71
|
+
|
72
|
+
Array(event_registrant.event_registration&.event_ticket_member_users).map do |user|
|
73
|
+
["<span>#{user}</span> <small>#{user.email}</small>", user.to_param]
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def effective_events_event_registrant_user_hint
|
70
78
|
url = if current_user.class.try(:effective_memberships_organization_user?)
|
71
79
|
organization = current_user.membership_organizations.first || current_user.organizations.first
|
72
80
|
effective_memberships.edit_organization_path(organization, anchor: 'tab-representatives') if organization
|
@@ -125,7 +125,7 @@ module EffectiveEventsEventRegistration
|
|
125
125
|
# If we're submitted. Try to move to completed.
|
126
126
|
before_save(if: -> { submitted? }) { try_completed! }
|
127
127
|
|
128
|
-
def
|
128
|
+
def future_payment_date?
|
129
129
|
false
|
130
130
|
end
|
131
131
|
|
@@ -133,6 +133,11 @@ module EffectiveEventsEventRegistration
|
|
133
133
|
return false if step == :complete && !completed?
|
134
134
|
return true if step == :complete && completed?
|
135
135
|
|
136
|
+
# If they submitted payment with a deferred processor then lock down the steps.
|
137
|
+
if submitted? && !future_payment_date?
|
138
|
+
return (step == :submitted)
|
139
|
+
end
|
140
|
+
|
136
141
|
can_revisit_completed_steps(step)
|
137
142
|
end
|
138
143
|
|
@@ -262,6 +267,36 @@ module EffectiveEventsEventRegistration
|
|
262
267
|
unavailable
|
263
268
|
end
|
264
269
|
|
270
|
+
def event_ticket_member_users
|
271
|
+
raise("expected owner to be a user") if owner.class.try(:effective_memberships_organization?)
|
272
|
+
users = [owner] + (owner.try(:organizations).try(:flat_map, &:users) || [])
|
273
|
+
|
274
|
+
users.select { |user| user.is_any?(:member) }.uniq
|
275
|
+
end
|
276
|
+
|
277
|
+
def update_blank_registrants!
|
278
|
+
# This method is called by the user on a submitted or completed event registration.
|
279
|
+
# Allow them to update blank registrants
|
280
|
+
# Don't let them hack the form and change any information.
|
281
|
+
if changes.present? || previous_changes.present?
|
282
|
+
raise('unable to make changes to event while updating blank registrants')
|
283
|
+
end
|
284
|
+
|
285
|
+
if event_registrants.any? { |er| (er.changes.keys - Effective::EventRegistrant::PERMITTED_BLANK_REGISTRANT_CHANGES).present? }
|
286
|
+
raise('unable to make changes to event registrants while updating blank registrants')
|
287
|
+
end
|
288
|
+
|
289
|
+
if event_registrants.any? { |er| er.blank_registrant_was == false && er.changes.present? }
|
290
|
+
raise('unable to make changes to non-blank registrant while updating blank registrants')
|
291
|
+
end
|
292
|
+
|
293
|
+
if event_addons.any? { |ea| ea.changes.present? }
|
294
|
+
raise('unable to make changes to event addons while updating blank registrants')
|
295
|
+
end
|
296
|
+
|
297
|
+
save!
|
298
|
+
end
|
299
|
+
|
265
300
|
private
|
266
301
|
|
267
302
|
def present_event_registrants
|
@@ -4,6 +4,8 @@ module Effective
|
|
4
4
|
class EventRegistrant < ActiveRecord::Base
|
5
5
|
self.table_name = (EffectiveEvents.event_registrants_table_name || :event_registrants).to_s
|
6
6
|
|
7
|
+
PERMITTED_BLANK_REGISTRANT_CHANGES = ["first_name", "last_name", "email", "company", "user_id", "user_type", "blank_registrant", "response1", "response2", "response3"]
|
8
|
+
|
7
9
|
acts_as_purchasable
|
8
10
|
acts_as_archived
|
9
11
|
|
@@ -5,23 +5,23 @@
|
|
5
5
|
= f.text_field :title
|
6
6
|
|
7
7
|
.row
|
8
|
-
.col= f.select :category, Effective::EventTicket::CATEGORIES, hint: "Determines who can purchase this ticket at which price. Also determines if the dropdown of
|
8
|
+
.col= f.select :category, Effective::EventTicket::CATEGORIES, hint: "Determines who can purchase this ticket at which price. Also determines if the dropdown of related members is displayed to the purchaser."
|
9
9
|
.col= f.number_field :capacity, hint: "The number of registrations will be limited to capacity.<br>Leave blank for unlimited capacity."
|
10
10
|
|
11
11
|
= f.show_if(:category, 'Regular') do
|
12
12
|
.alert.alert-info.mb-4
|
13
13
|
%strong Regular Ticket:
|
14
|
-
Anyone will be able to purchase this ticket. They will be asked for a first name, last name and email. Will not display the dropdown list of
|
14
|
+
Anyone will be able to purchase this ticket. They will be asked for a first name, last name and email. Will not display the dropdown list of related members. Only the regular price applies.
|
15
15
|
|
16
16
|
= f.show_if(:category, 'Member Only') do
|
17
17
|
.alert.alert-info.mb-4
|
18
18
|
%strong Member Only Ticket:
|
19
|
-
Only members will be able to purchase this ticket. They must select a member from the dropdown list of
|
19
|
+
Only members will be able to purchase this ticket. They must select a member from the dropdown list of related members. Only the member price applies.
|
20
20
|
|
21
21
|
= f.show_if(:category, 'Member or Non-Member') do
|
22
22
|
.alert.alert-info.mb-4
|
23
23
|
%strong Member or Non-Member Ticket:
|
24
|
-
Anyone will be able to purchase this ticket. They can select a member from the dropdown list of
|
24
|
+
Anyone will be able to purchase this ticket. They can select a member from the dropdown list of related members to receive the member pricing.
|
25
25
|
Or, they can enter a first name, last name and email to receive the regular pricing.
|
26
26
|
|
27
27
|
.row
|
@@ -1,6 +1,3 @@
|
|
1
1
|
- # Choose member
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
= f.hidden_field :user_type, value: klass.name
|
6
|
-
= f.select :user_id, klass.all, ajax_url: ajax_url, label: 'Member', required: true, hint: effective_events_event_tickets_user_hint()
|
2
|
+
= f.hidden_field :user_type, value: current_user.class.name
|
3
|
+
= f.select :user_id, effective_events_event_registrant_user_collection(f.object), required: true, hint: effective_events_event_registrant_user_hint()
|
@@ -1,9 +1,6 @@
|
|
1
1
|
- # Choose member
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
= f.hidden_field :user_type, value: klass.name
|
6
|
-
= f.select :user_id, klass.all, ajax_url: ajax_url, label: 'Member', hint: effective_events_event_tickets_user_hint()
|
2
|
+
= f.hidden_field :user_type, value: current_user.class.name
|
3
|
+
= f.select :user_id, effective_events_event_registrant_user_collection(f.object), required: true, hint: effective_events_event_registrant_user_hint()
|
7
4
|
|
8
5
|
= f.show_if(:user_id, '', nested: true) do
|
9
6
|
%p.text-center - or -
|
@@ -0,0 +1,34 @@
|
|
1
|
+
= effective_form_with(model: resource, url: effective_events.update_blank_registrants_event_event_registration_path(event_registration.event, event_registration), method: :put) do |f|
|
2
|
+
= f.hidden_field :id
|
3
|
+
|
4
|
+
- event_registrants = f.object.event_registrants.select(&:blank_registrant?)
|
5
|
+
|
6
|
+
%p Please update the information for the following #{pluralize(event_registrants.count, 'incomplete ticket')}:
|
7
|
+
|
8
|
+
= f.fields_for :event_registrants, event_registrants do |fr|
|
9
|
+
- registrant = fr.object
|
10
|
+
- ticket = registrant.event_ticket
|
11
|
+
|
12
|
+
= card do
|
13
|
+
%p
|
14
|
+
= ticket
|
15
|
+
= ' - '
|
16
|
+
= price_to_currency(registrant.price)
|
17
|
+
|
18
|
+
= fr.check_box :blank_registrant, label: "I will return and add this ticket's information later"
|
19
|
+
|
20
|
+
= fr.show_if(:blank_registrant, false) do
|
21
|
+
- if ticket.regular?
|
22
|
+
= render('effective/event_registrants/fields_regular', f: fr)
|
23
|
+
- elsif ticket.member_only?
|
24
|
+
= render('effective/event_registrants/fields_member_only', f: fr)
|
25
|
+
- elsif ticket.member_or_non_member? && registrant.member_registrant?
|
26
|
+
= render('effective/event_registrants/fields_member_only', f: fr)
|
27
|
+
- elsif ticket.member_or_non_member? && !registrant.member_registrant?
|
28
|
+
= render('effective/event_registrants/fields_regular', f: fr)
|
29
|
+
- else
|
30
|
+
- raise("Unexpected ticket category: #{ticket.category || 'nil'}")
|
31
|
+
|
32
|
+
= render('effective/event_registrants/fields_questions', f: fr, ticket: ticket)
|
33
|
+
|
34
|
+
= f.submit 'Save Ticket Information', center: true
|
@@ -11,6 +11,12 @@
|
|
11
11
|
= link_to "Return to Dashboard", return_to_dashboard_path, class: 'btn btn-lg btn-primary btn-block'
|
12
12
|
|
13
13
|
= render 'effective/event_registrations/summary', event_registration: resource
|
14
|
+
|
15
|
+
- if resource.event.allow_blank_registrants? && EffectiveResources.authorized?(self, :update_blank_registrants, resource)
|
16
|
+
= card do
|
17
|
+
%h3 Incomplete Ticket Information
|
18
|
+
= render 'effective/event_registrations/form_blank_registrants', event_registration: resource
|
19
|
+
|
14
20
|
= render 'effective/event_registrations/event_registration', event_registration: resource
|
15
21
|
= render 'effective/event_registrations/orders', event_registration: resource
|
16
22
|
|
@@ -8,6 +8,12 @@
|
|
8
8
|
= link_to "Return to Dashboard", return_to_dashboard_path, class: 'btn btn-lg btn-primary btn-block'
|
9
9
|
|
10
10
|
= render 'effective/event_registrations/summary', event_registration: resource
|
11
|
+
|
12
|
+
- if resource.event.allow_blank_registrants? && EffectiveResources.authorized?(self, :update_blank_registrants, resource)
|
13
|
+
= card do
|
14
|
+
%h3 Incomplete Ticket Information
|
15
|
+
= render 'effective/event_registrations/form_blank_registrants', event_registration: resource
|
16
|
+
|
11
17
|
= render 'effective/event_registrations/event_registration', event_registration: resource
|
12
18
|
= render 'effective/event_registrations/orders', event_registration: resource
|
13
19
|
|
data/config/routes.rb
CHANGED
@@ -20,6 +20,8 @@ EffectiveEvents::Engine.routes.draw do
|
|
20
20
|
resources :events, only: [:index, :show] do
|
21
21
|
resources :event_registrations, only: [:new, :show, :destroy] do
|
22
22
|
resources :build, controller: :event_registrations, only: [:show, :update]
|
23
|
+
|
24
|
+
put :update_blank_registrants, on: :member
|
23
25
|
end
|
24
26
|
end
|
25
27
|
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.12.
|
4
|
+
version: 0.12.5
|
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-05-
|
11
|
+
date: 2024-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -275,6 +275,7 @@ files:
|
|
275
275
|
- app/views/effective/event_registrations/_content.html.haml
|
276
276
|
- app/views/effective/event_registrations/_dashboard.html.haml
|
277
277
|
- app/views/effective/event_registrations/_event_registration.html.haml
|
278
|
+
- app/views/effective/event_registrations/_form_blank_registrants.html.haml
|
278
279
|
- app/views/effective/event_registrations/_layout.html.haml
|
279
280
|
- app/views/effective/event_registrations/_orders.html.haml
|
280
281
|
- app/views/effective/event_registrations/_summary.html.haml
|