effective_events 2.25.1 → 2.27.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: e49dbeed14ddc0a39bfb16c58d43d8a27221be836ccf68b71d1750509d3cc192
4
- data.tar.gz: df551529a5da562d702fdcdef007d5c3f8bd15f80de0bf1642a7db8cb1bb5daa
3
+ metadata.gz: 8ca685f788c0c911540a269b943046c6182232e524f377fedc73d4df69040f32
4
+ data.tar.gz: d959c84ffa9a9a5f6c99107ba30f000795c4aaae1e5fbbe50c80a03642146dd9
5
5
  SHA512:
6
- metadata.gz: b70217d0fd2310908a1c562995360703784b7802ddb55de57ea3112d77e9e5d945ea23086311f2154e76f00f7280eaa078354bc2bd1fc6dec0b58641ec79714c
7
- data.tar.gz: 1c8cdecacf234f76524d580ff360f365a95da3ac872e6d9070e68c85d1c39f355a90a735f43bebe2eb89c32784cd17d73c5603bde2123774850434db85b70127
6
+ metadata.gz: '08cff54abfee17f8058f581832a3bb313011cb6297259dbc856e550c27e6bca2dfd62dea52eaf680e9f80be6fa95f4f236d632793bc465ffd29585dedc597eb8'
7
+ data.tar.gz: 92d401b99b9bc124fe35754837a3c561f9000018f3081501b18ec6b1e81a234c8d9be0d7a1e077b937d9ffc89bbd96d54e9ffd72f9d43ad0f06b669786368a87
@@ -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,23 @@ 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
+ return false unless EffectiveEvents.send_confirmation_email?
492
+
493
+ EffectiveEvents.send_email(:event_registration_confirmation, self)
494
+ end
495
+
468
496
  private
469
497
 
470
498
  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,39 @@
1
+ %h1{style: "text-align: center"} Your tickets have been confirmed!
2
+
3
+ %p{style: "text-align: center"}
4
+ %strong{style: "font-size: 18px"}= @event.title
5
+ %br
6
+ #{effective_events_event_schedule(@event)}
7
+
8
+ - if @event.rich_text_confirmation_email.present?
9
+ %hr
10
+ = @event.rich_text_confirmation_email.to_s.html_safe
11
+
12
+ - if @event.delayed_payment? && @event_registration.present? && @event_registrant.user == @event_registration.owner && @event_registration.submit_order.delayed? && @event_registration.submit_order.deferred?
13
+ %hr
14
+ %p{style: "margin-bottom: 4px; font-weight: bold;"} Please note:
15
+ %ul{style: "margin-top: 0;"}
16
+ %li Your credit card will be charged on <strong>#{@event.delayed_payment_date.strftime("%A, %B %d, %Y")}</strong>.
17
+ %li Changes and cancellations must be made before this date.
18
+ %li A receipt will be sent after the transaction is completed.
19
+
20
+ %hr
21
+
22
+ %table.table
23
+ %thead
24
+ %tr
25
+ %th{style: "text-align: left;"} Qty
26
+ %th{style: "text-align: left;"} Ticket
27
+ %th{style: "text-align: right;"} Price
28
+ %tbody
29
+ %tr
30
+ %td{style: "text-align: left;"} 1
31
+ %td{style: "text-align: left;"}
32
+ = @event_registrant.purchasable_name
33
+ = @event_registrant.responses if @event_registrant.responses.present?
34
+ %td{style: "text-align: right;"}= price_to_currency(@event_registrant.price)
35
+
36
+ - if @event_registration.present? && @event_registrant.user == @event_registration.owner
37
+ %hr
38
+ %p{style: "text-align: center;"}
39
+ = link_to('View your registration', effective_events.event_event_registration_url(@event, @event_registration))
@@ -0,0 +1,53 @@
1
+ %h1{style: "text-align: center"} Your tickets have been confirmed!
2
+
3
+ %p{style: "text-align: center"}
4
+ %strong{style: "font-size: 18px"}= @event.title
5
+ %br
6
+ #{effective_events_event_schedule(@event)}
7
+
8
+ - if @event.rich_text_confirmation_email.present?
9
+ %hr
10
+ = @event.rich_text_confirmation_email.to_s.html_safe
11
+
12
+ - if @event.delayed_payment?
13
+ %hr
14
+ %p{style: "margin-bottom: 4px; font-weight: bold;"} Please note:
15
+ %ul{style: "margin-top: 0;"}
16
+ %li Your credit card will be charged on <strong>#{@event.delayed_payment_date.strftime("%A, %B %d, %Y")}</strong>.
17
+ %li Changes and cancellations must be made before this date.
18
+ %li A receipt will be sent after the transaction is completed.
19
+
20
+ %hr
21
+
22
+ - responses = Array(@event_registrants).any? { |er| er.responses.present? }
23
+
24
+ %table.table
25
+ %thead
26
+ %tr
27
+ %th{style: "text-align: left;"} Qty
28
+ %th{style: "text-align: left;"} Ticket
29
+ %th{style: "text-align: right;"} Price
30
+ %tbody
31
+ - Array(@event_registrants).each do |er|
32
+ %tr
33
+ %td{style: "text-align: left;"} 1
34
+ %td{style: "text-align: left;"}
35
+ = er.purchasable_name
36
+ = er.responses if responses
37
+ %td{style: "text-align: right;"}= price_to_currency(er.price)
38
+
39
+ - Array(@event_addons).each do |ea|
40
+ %tr
41
+ %td{style: "text-align: left;"} 1
42
+ %td{style: "text-align: left;"}
43
+ = ea.purchasable_name
44
+ = ea.notes if responses
45
+ %td{style: "text-align: right;"}= price_to_currency(ea.price)
46
+
47
+ %hr
48
+
49
+ %p{style: "text-align: center;"}
50
+ - if @event.delayed_payment?
51
+ = link_to('View or modify your registration', effective_events.event_event_registration_url(@event, @event_registration))
52
+ - else
53
+ = link_to('View your registration', effective_events.event_event_registration_url(@event, @event_registration))
@@ -29,6 +29,9 @@ EffectiveEvents.setup do |config|
29
29
  # Hint text for event images attachments
30
30
  config.events_hint_text = 'Optional. Shown on the events index and event pages. Dimensions are 220px tall and 350px wide.'
31
31
 
32
+ # Send confirmation emails
33
+ config.send_confirmation_email = false
34
+
32
35
  # Mailer Settings
33
36
  # Please see config/initializers/effective_resources.rb for default effective_* gem mailer settings
34
37
  #
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.27.0'.freeze
3
3
  end
@@ -9,7 +9,7 @@ module EffectiveEvents
9
9
  :events_table_name, :event_registrants_table_name, :event_tickets_table_name, :event_ticket_selections_table_name,
10
10
  :event_registrations_table_name, :event_products_table_name, :event_addons_table_name, :event_notifications_table_name,
11
11
  :mailer, :parent_mailer, :deliver_method, :mailer_layout, :mailer_sender, :mailer_admin, :mailer_subject,
12
- :layout, :per_page, :use_effective_roles, :categories, :events_hint_text,
12
+ :layout, :per_page, :use_effective_roles, :categories, :events_hint_text, :send_confirmation_email,
13
13
  :organization_enabled, :create_users, :company_or_organization_required,
14
14
  :event_registration_class_name
15
15
  ]
@@ -39,4 +39,8 @@ module EffectiveEvents
39
39
  !!EffectiveOrders.try(:delayed?)
40
40
  end
41
41
 
42
+ def self.send_confirmation_email?
43
+ send_confirmation_email == true
44
+ end
45
+
42
46
  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.27.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