effective_events 2.25.1 → 2.26.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: e49dbeed14ddc0a39bfb16c58d43d8a27221be836ccf68b71d1750509d3cc192
4
- data.tar.gz: df551529a5da562d702fdcdef007d5c3f8bd15f80de0bf1642a7db8cb1bb5daa
3
+ metadata.gz: 93702d0f34b53536a8534ad5d983be17e75f66bf133e8cd67c46e3d38f6ec5dc
4
+ data.tar.gz: 243eb4b9796e5b0752ec0bfa4d121508253550e5765a62be4252e2835a6391d8
5
5
  SHA512:
6
- metadata.gz: b70217d0fd2310908a1c562995360703784b7802ddb55de57ea3112d77e9e5d945ea23086311f2154e76f00f7280eaa078354bc2bd1fc6dec0b58641ec79714c
7
- data.tar.gz: 1c8cdecacf234f76524d580ff360f365a95da3ac872e6d9070e68c85d1c39f355a90a735f43bebe2eb89c32784cd17d73c5603bde2123774850434db85b70127
6
+ metadata.gz: 408c0a3b0d923e692e1c853945e0b2899e83d02743049cc7d834ccb1163f00ca6e941b5291e9ece8abe98177f4d475b99eeaa15c9d3f047aa153f0e0f94cfc15
7
+ data.tar.gz: d1d0ddeb5f16cfd4d803e76222b27c5450f584f45adc9f63961fe7f0c033490554f1ab2780d964fcea91113d8553ce1e53d55c4de5afc744e0dddd5075b5f178
@@ -41,6 +41,9 @@ module Admin
41
41
  end
42
42
  end
43
43
 
44
+ col :delayed_payment, visible: false
45
+ col :delayed_payment_date, visible: false
46
+
44
47
  # These show too much information to be useful to admins, rely on the edit screen
45
48
  # col :event_tickets, search: :string
46
49
  # col :event_products, search: :string
@@ -4,20 +4,7 @@ class EffectiveEventRegistrantsDatatable < Effective::Datatable
4
4
  datatable do
5
5
  order :id
6
6
 
7
- col :name do |er|
8
- if er.first_name.present?
9
- [
10
- "#{er.first_name} #{er.last_name}",
11
- ("<small>#{er.organization || er.company}</small>" if er.organization || er.company.present?),
12
- ("<small>#{er.email}</small>" if er.email.present?)
13
- ].compact.join('<br>').html_safe
14
- elsif er.owner.present?
15
- er.owner.to_s + ' - GUEST'
16
- else
17
- 'Unknown'
18
- end
19
- end
20
-
7
+ col :full_name, label: 'Name'
21
8
  col :id, visible: false
22
9
 
23
10
  col :event_ticket, search: :string, label: 'Ticket' do |er|
@@ -36,11 +23,7 @@ class EffectiveEventRegistrantsDatatable < Effective::Datatable
36
23
  col :response2, visible: false
37
24
  col :response3, visible: false
38
25
 
39
- col :responses, label: 'Details' do |registrant|
40
- [registrant.response1.presence, registrant.response2.presence, registrant.response3.presence].compact.map do |response|
41
- content_tag(:div, response)
42
- end.join.html_safe
43
- end
26
+ col :responses, label: 'Details'
44
27
 
45
28
  col :price, as: :price
46
29
  col :archived, visible: false
@@ -4,6 +4,10 @@ module Effective
4
4
  include EffectiveMailer
5
5
  include EffectiveEmailTemplatesMailer
6
6
 
7
+ helper EffectiveEventsHelper
8
+ helper EffectiveOrdersHelper
9
+
10
+ # For the notifications. No longer used.
7
11
  def event_registrant_purchased(resource, opts = {})
8
12
  raise('expected an Effective::EventRegistrant') unless resource.kind_of?(Effective::EventRegistrant)
9
13
 
@@ -11,6 +15,38 @@ module Effective
11
15
  mail(to: resource.email, **headers_for(resource, opts))
12
16
  end
13
17
 
18
+ # Sent on registration purchase
19
+ # Sent on delayed payment date registration submitted
20
+ # Sent on delayed payment date registration update
21
+ # Sent on update blank registrants
22
+ def event_registration_confirmation(resource, opts = {})
23
+ raise('expected an event registration') unless resource.class.try(:effective_events_event_registration?)
24
+
25
+ @event_registration = resource
26
+ @event = resource.event
27
+ @event_registrants = resource.event_registrants
28
+ @event_addons = resource.event_addons
29
+
30
+ subject = subject_for(__method__, "Event Confirmation - #{@event}", resource, opts)
31
+ headers = headers_for(resource, opts)
32
+
33
+ mail(to: resource.owner.email, subject: subject, **headers)
34
+ end
35
+
36
+ # Sent manually by an admin to one registrant
37
+ def event_registrant_confirmation(resource, opts = {})
38
+ raise('expected an event registrant') unless resource.kind_of?(Effective::EventRegistrant)
39
+
40
+ @event_registrant = resource
41
+ @event = resource.event
42
+ @event_registration = resource.event_registration # Optional
43
+
44
+ subject = subject_for(__method__, "Event Registrant Confirmation - #{@event}", resource, opts)
45
+ headers = headers_for(resource, opts)
46
+
47
+ mail(to: resource.email, subject: subject, **headers)
48
+ end
49
+
14
50
  protected
15
51
 
16
52
  def assigns_for(resource)
@@ -220,6 +220,7 @@ module EffectiveEventsEventRegistration
220
220
 
221
221
  def after_submit_deferred!
222
222
  update_deferred_event_registration!
223
+ send_event_registration_confirmation!
223
224
  end
224
225
 
225
226
  def after_submit_purchased!
@@ -227,12 +228,14 @@ module EffectiveEventsEventRegistration
227
228
 
228
229
  notifications = event.event_notifications.select(&:registrant_purchased?)
229
230
  notifications.each { |notification| notification.notify!(event_registrants: event_registrants) }
231
+
232
+ send_event_registration_confirmation! unless submit_order&.delayed?
230
233
  end
231
234
  end
232
235
 
233
236
  # Instance Methods
234
237
  def to_s
235
- 'registration'
238
+ event.present? ? "Event registration - #{event}" : model_name.human
236
239
  end
237
240
 
238
241
  def in_progress?
@@ -358,6 +361,17 @@ module EffectiveEventsEventRegistration
358
361
  save!
359
362
  end
360
363
 
364
+ # Not involved in money processing
365
+ # This will only be called when the order is previously delayed and deferred
366
+ # And we're going through the registration again with a saved card
367
+ def checkout!
368
+ if submit_order.present? && submit_order.delayed? && submit_order.deferred?
369
+ send_event_registration_confirmation!
370
+ end
371
+
372
+ save!
373
+ end
374
+
361
375
  def try_completed!
362
376
  return false unless submitted?
363
377
  return false unless submit_order&.purchased?
@@ -462,9 +476,21 @@ module EffectiveEventsEventRegistration
462
476
 
463
477
  update_submit_fees_and_order! if submit_order.present? && !submit_order.purchased?
464
478
 
479
+ after_commit do
480
+ send_event_registration_confirmation!
481
+ end
482
+
465
483
  true
466
484
  end
467
485
 
486
+ # Sent on registration purchase
487
+ # Sent on delayed payment date registration submitted
488
+ # Sent on delayed payment date registration update
489
+ # Sent on update blank registrants
490
+ def send_event_registration_confirmation!
491
+ EffectiveEvents.send_email(:event_registration_confirmation, self)
492
+ end
493
+
468
494
  private
469
495
 
470
496
  def update_deferred_event_registration!
@@ -33,6 +33,7 @@ module Effective
33
33
 
34
34
  # rich_text_body
35
35
  # rich_text_excerpt
36
+ # rich_text_confirmation_email
36
37
 
37
38
  # rich_text_all_steps_content
38
39
  # rich_text_start_content
@@ -178,6 +178,21 @@ module Effective
178
178
  end
179
179
  end
180
180
 
181
+ # Used in email and tickets datatable
182
+ def full_name
183
+ if first_name.present?
184
+ [
185
+ name,
186
+ ("<small>#{organization || company}</small>" if organization || company.present?),
187
+ ("<small>#{email}</small>" if email.present?)
188
+ ].compact.join('<br>').html_safe
189
+ elsif owner.present?
190
+ owner.to_s + ' - GUEST'
191
+ else
192
+ 'GUEST'
193
+ end
194
+ end
195
+
181
196
  def details
182
197
  [
183
198
  (content_tag(:span, 'Member', class: 'badge badge-warning') if member_ticket?),
@@ -186,6 +201,10 @@ module Effective
186
201
  ].compact.join(' ').html_safe
187
202
  end
188
203
 
204
+ def responses
205
+ [response1.presence, response2.presence, response3.presence].compact.join('<br>').html_safe
206
+ end
207
+
189
208
  def purchasable_name
190
209
  ["#{event_ticket} - #{name}", details.presence].compact.join('<br>').html_safe
191
210
  end
@@ -321,6 +340,11 @@ module Effective
321
340
  (waitlisted? && !promoted?)
322
341
  end
323
342
 
343
+ # Manual admin action only
344
+ def send_confirmation_email!
345
+ EffectiveEvents.send_email(:event_registrant_confirmation, self)
346
+ end
347
+
324
348
  private
325
349
 
326
350
  def build_user
@@ -31,11 +31,11 @@
31
31
  = tab 'Wizard' do
32
32
  = render '/admin/events/form_event_registration_content', event: event
33
33
 
34
- = tab 'Email' do
35
- %p Click New to add one or more emails.
34
+ -# = tab 'Email' do
35
+ -# %p Click New to add one or more emails.
36
36
 
37
- - datatable = Admin::EffectiveEventNotificationsDatatable.new(event_id: event.id)
38
- = render_datatable(datatable, inline: true, simple: true)
37
+ -# - datatable = Admin::EffectiveEventNotificationsDatatable.new(event_id: event.id)
38
+ -# = render_datatable(datatable, inline: true, simple: true)
39
39
 
40
40
  = tab 'Access' do
41
41
  = render '/admin/events/form_access', event: event
@@ -4,8 +4,10 @@
4
4
  - if defined?(EffectiveArticleEditor)
5
5
  = f.article_editor :rich_text_excerpt, label: 'Excerpt', hint: 'Will be used for the events excerpt on index pages.'
6
6
  = f.article_editor :rich_text_body, label: 'Body', hint: 'The main body of your event'
7
+ = f.article_editor :rich_text_confirmation_email, label: 'Confirmation email', hint: 'Include this content in the event registration confirmation email'
7
8
  - else
8
9
  = f.rich_text_area :rich_text_excerpt, label: 'Excerpt', hint: 'Will be used for the events excerpt on index pages.'
9
10
  = f.rich_text_area :rich_text_body, label: 'Body', hint: 'The main body of your event'
11
+ = f.rich_text_area :rich_text_confirmation_email, label: 'Confirmation email', hint: 'Include this content in the event registration confirmation email'
10
12
 
11
13
  = f.submit
@@ -15,5 +15,7 @@
15
15
  = render_checkout_step2(resource.submit_order, purchased_url: wizard_path(:complete), deferred_url: wizard_path(:submitted), declined_url: wizard_path(:checkout))
16
16
 
17
17
  - if resource.submit_order.delayed? && resource.submit_order.deferred?
18
- = link_to 'Save and Continue', wizard_path(:submitted), class: 'btn btn-primary'
18
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
19
+ = f.hidden_field :id
20
+ = f.save 'Save and Continue'
19
21
 
@@ -0,0 +1,22 @@
1
+ %h2 Event Registrant Confirmation
2
+
3
+ %p Event: #{@event.title}
4
+ %p Date: #{effective_events_event_schedule(@event)}
5
+ %p Ticket: #{@event_registrant.purchasable_name.gsub('<br>', ' - ').html_safe} - #{price_to_currency(@event_registrant.price)}
6
+
7
+ - if @event_registrant.responses.present?
8
+ %p= @event_registrant.responses
9
+
10
+ - if @event_registration.present? && @event_registrant.user == @event_registration.owner
11
+ %p= link_to('View your registration', effective_events.event_event_registration_url(@event, @event_registration))
12
+
13
+ - if @event.rich_text_confirmation_email.present?
14
+ %hr
15
+ = @event.rich_text_confirmation_email.to_s.html_safe
16
+
17
+ - if @event.delayed_payment?
18
+ %strong Please note:
19
+ %ul
20
+ %li Credit card payment will be processed on #{@event.delayed_payment_date.strftime("%A, %B %d, %Y")}
21
+ %li Changes and cancellations must be made before this date.
22
+ %li A receipt will be sent to you after the transaction is completed.
@@ -0,0 +1,45 @@
1
+ %h2 Event Registration Confirmation
2
+
3
+ %p Event: #{@event.title}
4
+ %p Date: #{effective_events_event_schedule(@event)}
5
+ %p= link_to('View your registration', effective_events.event_event_registration_url(@event, @event_registration))
6
+
7
+ - if @event.rich_text_confirmation_email.present?
8
+ %hr
9
+ = @event.rich_text_confirmation_email.to_s.html_safe
10
+
11
+ - if @event.delayed_payment?
12
+ %strong Please note:
13
+ %ul
14
+ %li Credit card payment will be processed on #{@event.delayed_payment_date.strftime("%A, %B %d, %Y")}
15
+ %li Changes and cancellations must be made before this date.
16
+ %li A receipt will be sent to you after the transaction is completed.
17
+
18
+ %hr
19
+
20
+ - responses = Array(@event_registrants).any? { |er| er.responses.present? }
21
+
22
+ %table.table
23
+ %thead
24
+ %tr
25
+ %th Qty
26
+ %th Ticket
27
+ - if responses
28
+ %th Details
29
+ %th Price
30
+ %tbody
31
+ - Array(@event_registrants).each do |er|
32
+ %tr
33
+ %td 1
34
+ %td= er.purchasable_name
35
+ - if responses
36
+ %td= er.responses
37
+ %td= price_to_currency(er.price)
38
+
39
+ - Array(@event_addons).each do |ea|
40
+ %tr
41
+ %td 1
42
+ %td= ea.purchasable_name
43
+ - if responses
44
+ %td= ea.notes
45
+ %td= price_to_currency(ea.price)
data/config/routes.rb CHANGED
@@ -49,6 +49,8 @@ EffectiveEvents::Engine.routes.draw do
49
49
 
50
50
  post :archive, on: :member
51
51
  post :unarchive, on: :member
52
+
53
+ post :send_confirmation_email, on: :member
52
54
  end
53
55
 
54
56
  resources :event_addons, except: [:show] do
@@ -1,3 +1,3 @@
1
1
  module EffectiveEvents
2
- VERSION = '2.25.1'.freeze
2
+ VERSION = '2.26.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: 2.25.1
4
+ version: 2.26.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-12-09 00:00:00.000000000 Z
11
+ date: 2024-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -296,7 +296,9 @@ files:
296
296
  - app/views/effective/events/_sidebar.html.haml
297
297
  - app/views/effective/events/index.html.haml
298
298
  - app/views/effective/events/show.html.haml
299
+ - app/views/effective/events_mailer/event_registrant_confirmation.html.haml
299
300
  - app/views/effective/events_mailer/event_registrant_purchased.liquid
301
+ - app/views/effective/events_mailer/event_registration_confirmation.html.haml
300
302
  - app/views/simple_calendar/_month_calendar.html.haml
301
303
  - config/effective_events.rb
302
304
  - config/locales/effective_events.en.yml