effective_events 0.1.7 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -5
  3. data/app/controllers/admin/{event_purchases_controller.rb → event_addons_controller.rb} +1 -2
  4. data/app/controllers/admin/event_notifications_controller.rb +8 -0
  5. data/app/controllers/effective/event_registrations_controller.rb +0 -1
  6. data/app/controllers/effective/events_controller.rb +1 -1
  7. data/app/datatables/admin/{effective_event_purchases_datatable.rb → effective_event_addons_datatable.rb} +2 -2
  8. data/app/datatables/admin/effective_event_notifications_datatable.rb +52 -0
  9. data/app/datatables/admin/effective_event_products_datatable.rb +3 -3
  10. data/app/datatables/admin/effective_event_registrations_datatable.rb +1 -1
  11. data/app/datatables/admin/effective_events_datatable.rb +3 -1
  12. data/app/datatables/{effective_event_purchases_datatable.rb → effective_event_addons_datatable.rb} +5 -5
  13. data/app/datatables/effective_event_registrants_datatable.rb +1 -1
  14. data/app/datatables/effective_event_registrations_datatable.rb +1 -1
  15. data/app/datatables/effective_events_datatable.rb +2 -2
  16. data/app/mailers/effective/events_mailer.rb +56 -0
  17. data/app/models/concerns/effective_events_event_registration.rb +17 -12
  18. data/app/models/effective/event.rb +9 -6
  19. data/app/models/effective/{event_purchase.rb → event_addon.rb} +2 -2
  20. data/app/models/effective/event_notification.rb +160 -0
  21. data/app/models/effective/event_product.rb +6 -6
  22. data/app/models/effective/event_registrant.rb +4 -0
  23. data/app/views/admin/{event_purchases → event_addons}/_form.html.haml +2 -2
  24. data/app/views/admin/event_notifications/_form.html.haml +44 -0
  25. data/app/views/admin/event_notifications/_form_event_registrant_purchased.html.haml +3 -0
  26. data/app/views/admin/event_products/_form.html.haml +7 -4
  27. data/app/views/admin/event_tickets/_form.html.haml +7 -5
  28. data/app/views/admin/events/_form.html.haml +10 -5
  29. data/app/views/effective/event_addons/_fields.html.haml +8 -0
  30. data/app/views/effective/event_registrants/_fields.html.haml +3 -5
  31. data/app/views/effective/event_registrations/_addons.html.haml +9 -0
  32. data/app/views/effective/event_registrations/_content.html.haml +2 -2
  33. data/app/views/effective/event_registrations/_dashboard.html.haml +1 -1
  34. data/app/views/effective/event_registrations/{_registrants.html.haml → _tickets.haml} +2 -2
  35. data/app/views/effective/event_registrations/addons.html.haml +19 -0
  36. data/app/views/effective/event_registrations/{registrants.html.haml → tickets.haml} +0 -2
  37. data/app/views/effective/events/_dashboard.html.haml +0 -6
  38. data/app/views/effective/events/_event.html.haml +1 -1
  39. data/app/views/effective/events_mailer/event_registrant_purchased.liquid +17 -0
  40. data/config/effective_events.rb +14 -1
  41. data/config/routes.rb +2 -1
  42. data/db/migrate/01_create_effective_events.rb.erb +19 -2
  43. data/lib/effective_events/version.rb +1 -1
  44. data/lib/effective_events.rb +7 -2
  45. data/lib/generators/effective_events/install_generator.rb +1 -1
  46. metadata +33 -12
  47. data/app/views/effective/event_purchases/_fields.html.haml +0 -10
  48. data/app/views/effective/event_registrations/_purchases.html.haml +0 -9
  49. data/app/views/effective/event_registrations/purchases.html.haml +0 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 19f4a303dbab49f23b15a28c71bce29f9d55036371c533a27f36ad3ac70ca1b4
4
- data.tar.gz: ad51623c2087ccf9a1c2a2a97d1623f89224be38cd7aae06b246aedb2108e2e3
3
+ metadata.gz: cd744d00aed47ee8fe88bbfa4f9224f6dea924726a9d7f42be397e88315e5a0f
4
+ data.tar.gz: b24c00d8bc3a54e3ccad2f43db728ede8a53b5aaff618646386c3ad179c827ed
5
5
  SHA512:
6
- metadata.gz: 7d51690029093356830ee881f54881054b4eafa9b0aaf99d2389c9d8966a2d76b2d8456f11e9ef45ef7df92cddce73c89961094802c21a198a766b04373b0eb8
7
- data.tar.gz: 68e1785f75da39ad9916a065c89dc79a3995602c250315276e165b58f4abf43bc4ab116c45698e1ee36cccfa7b7fe2c364efefab73d382deb58bd623e8064325
6
+ metadata.gz: bee221260b8e2aad273c9b79250707bf4c053dc64a937c3eff477eb345e8bc3a10afb4b9504d45f2d2be778a842a62ffc7dc4a9ac76138915575eff8c295524c
7
+ data.tar.gz: 305c28be0450a00d070e15d32d0af3dc2de4c72bdbad1e345948c00851ccb882566b84b9a256d9c62786573902cced56a63a658204fd671614d4e59ebc3a58f2
data/README.md CHANGED
@@ -71,7 +71,7 @@ The permissions you actually want to define are as follows (using CanCan):
71
71
  can([:index, :show], Effective::Event) { |event| !event.draft? }
72
72
  can([:new, :create], EffectiveEvents.EventRegistration)
73
73
  can([:show, :index], Effective::EventRegistrant) { |registrant| registrant.owner == user || registrant.owner.blank? }
74
- can([:show, :index], Effective::EventPurchase) { |purchase| purchase.owner == user || purchase.owner.blank? }
74
+ can([:show, :index], Effective::EventAddon) { |addon| addon.owner == user || addon.owner.blank? }
75
75
  can([:show, :index], EffectiveEvents.EventRegistration) { |registration| registration.owner == user }
76
76
  can([:update, :destroy], EffectiveEvents.EventRegistration) { |registration| registration.owner == user && !registration.was_submitted? }
77
77
 
@@ -85,15 +85,15 @@ if user.admin?
85
85
  can(:mark_paid, Effective::EventRegistrant) { |er| !er.event_registration_id.present? }
86
86
  can(:destroy, Effective::EventRegistrant) { |er| !er.purchased? }
87
87
 
88
- can(crud - [:destroy], Effective::EventPurchase)
89
- can(:mark_paid, Effective::EventPurchase) { |er| !er.event_registration_id.present? }
90
- can(:destroy, Effective::EventPurchase) { |er| !er.purchased? }
88
+ can(crud - [:destroy], Effective::EventAddon)
89
+ can(:mark_paid, Effective::EventAddon) { |er| !er.event_registration_id.present? }
90
+ can(:destroy, Effective::EventAddon) { |er| !er.purchased? }
91
91
 
92
92
  can(crud - [:destroy], Effective::EventTicket)
93
93
  can(:destroy, Effective::EventTicket) { |et| et.purchased_event_registrants_count == 0 }
94
94
 
95
95
  can(crud - [:destroy], Effective::EventProduct)
96
- can(:destroy, Effective::EventProduct) { |et| et.purchased_event_purchases_count == 0 }
96
+ can(:destroy, Effective::EventProduct) { |et| et.purchased_event_addons_count == 0 }
97
97
 
98
98
  can([:index, :show], EffectiveEvents.EventRegistration)
99
99
  end
@@ -1,11 +1,10 @@
1
1
  module Admin
2
- class EventPurchasesController < ApplicationController
2
+ class EventAddonsController < ApplicationController
3
3
  before_action(:authenticate_user!) if defined?(Devise)
4
4
  before_action { EffectiveResources.authorize!(self, :admin, :effective_events) }
5
5
 
6
6
  include Effective::CrudController
7
7
 
8
8
  submit :mark_paid, 'Save and Mark Paid'
9
-
10
9
  end
11
10
  end
@@ -0,0 +1,8 @@
1
+ module Admin
2
+ class EventNotificationsController < ApplicationController
3
+ before_action(:authenticate_user!) if defined?(Devise)
4
+ before_action { EffectiveResources.authorize!(self, :admin, :effective_events) }
5
+
6
+ include Effective::CrudController
7
+ end
8
+ end
@@ -39,7 +39,6 @@ module Effective
39
39
 
40
40
  def permitted_params
41
41
  model = (params.key?(:effective_event_registration) ? :effective_event_registration : :event_registration)
42
-
43
42
  params.require(model).permit!.except(:status, :status_steps, :wizard_steps, :submitted_at)
44
43
  end
45
44
 
@@ -8,7 +8,7 @@ module Effective
8
8
  }
9
9
 
10
10
  def index
11
- @events ||= resource_scope
11
+ @events ||= resource_scope.published
12
12
 
13
13
  @events = @events.paginate(page: params[:page])
14
14
 
@@ -1,5 +1,5 @@
1
1
  module Admin
2
- class EffectiveEventPurchasesDatatable < Effective::Datatable
2
+ class EffectiveEventAddonsDatatable < Effective::Datatable
3
3
  datatable do
4
4
  col :updated_at, visible: false
5
5
  col :created_at, visible: false
@@ -23,7 +23,7 @@ module Admin
23
23
  end
24
24
 
25
25
  collection do
26
- scope = Effective::EventPurchase.deep.purchased
26
+ scope = Effective::EventAddon.deep.purchased
27
27
 
28
28
  if attributes[:event_id].present?
29
29
  scope = scope.where(event: event)
@@ -0,0 +1,52 @@
1
+ class Admin::EffectiveEventNotificationsDatatable < Effective::Datatable
2
+ # filters do
3
+ # scope :all
4
+ # scope :started
5
+ # scope :completed
6
+ # end
7
+
8
+ datatable do
9
+ col :updated_at, visible: false
10
+ col :created_at, visible: false
11
+ col :id, visible: false
12
+
13
+ col :event
14
+ col :category
15
+
16
+ col :from do |event|
17
+ html_escape(event.from)
18
+ end
19
+
20
+ # col :reminder do |poll_notification|
21
+ # case poll_notification.category
22
+ # when 'When poll starts'
23
+ # poll_notification.poll.start_at&.strftime('%F %H:%M')
24
+ # when 'When poll ends'
25
+ # poll_notification.poll.end_at&.strftime('%F %H:%M')
26
+ # when 'Upcoming reminder'
27
+ # Effective::PollNotification::UPCOMING_REMINDERS.invert[poll_notification.reminder]
28
+ # when 'Reminder'
29
+ # Effective::PollNotification::REMINDERS.invert[poll_notification.reminder]
30
+ # when 'Before poll ends'
31
+ # Effective::PollNotification::UPCOMING_REMINDERS.invert[poll_notification.reminder]
32
+ # else
33
+ # raise('unexpected category')
34
+ # end
35
+ # end
36
+
37
+ col :subject
38
+
39
+ col :body do |notification|
40
+ simple_format(notification.body)
41
+ end
42
+
43
+ # col :started_at, visible: false
44
+ # col :completed_at
45
+
46
+ actions_col
47
+ end
48
+
49
+ collection do
50
+ Effective::EventNotification.all.deep
51
+ end
52
+ end
@@ -20,12 +20,12 @@ module Admin
20
20
  end
21
21
  end
22
22
 
23
- col :purchased_event_purchases_count, label: 'Purchased'
23
+ col :purchased_event_addons_count, label: 'Purchased'
24
24
  col :capacity, visible: false
25
25
  col :capacity_available, visible: false
26
26
 
27
- col :purchased_event_purchases, label: 'Purchased by' do |product|
28
- product.purchased_event_purchases.sort_by(&:to_s).map do |purchase|
27
+ col :purchased_event_addons, label: 'Purchased by' do |product|
28
+ product.purchased_event_addons.sort_by(&:to_s).map do |purchase|
29
29
  content_tag(:div, purchase.owner.to_s, class: 'col-resource_item')
30
30
  end.join.html_safe
31
31
  end
@@ -13,7 +13,7 @@ class Admin::EffectiveEventRegistrationsDatatable < Effective::Datatable
13
13
  col :owner
14
14
 
15
15
  col :event_registrants, search: :string
16
- col :event_purchases, search: :string
16
+ col :event_addons, search: :string
17
17
  col :orders, label: 'Order'
18
18
 
19
19
  actions_col
@@ -14,6 +14,8 @@ module Admin
14
14
  col :id, visible: false
15
15
 
16
16
  col :title
17
+ col :slug, visible: false
18
+
17
19
  col :draft
18
20
  col :start_at, label: 'Event Start Date'
19
21
  col :end_at, label: 'Event End Date', visible: false
@@ -34,7 +36,7 @@ module Admin
34
36
  col :event_tickets, search: :string
35
37
  col :event_products, search: :string
36
38
  col :event_registrants, search: :string
37
- col :event_purchases, search: :string
39
+ col :event_addons, search: :string
38
40
 
39
41
  col :roles, visible: false
40
42
  col :authenticate_user, visible: false
@@ -1,16 +1,16 @@
1
- # Used on the Event Registrations purchases step
1
+ # Used on the Event Registrations Addons step
2
2
 
3
- class EffectiveEventPurchasesDatatable < Effective::Datatable
3
+ class EffectiveEventAddonsDatatable < Effective::Datatable
4
4
  datatable do
5
5
 
6
- col :event_product, search: :string
6
+ col :event_product, search: :string, label: 'Product'
7
7
  col :price, as: :price
8
- col :notes
8
+ # col :notes
9
9
  # no actions_col
10
10
  end
11
11
 
12
12
  collection do
13
- scope = Effective::EventPurchase.deep.all
13
+ scope = Effective::EventAddon.deep.all
14
14
 
15
15
  if event.present?
16
16
  scope = scope.where(event: event)
@@ -3,7 +3,7 @@
3
3
  class EffectiveEventRegistrantsDatatable < Effective::Datatable
4
4
  datatable do
5
5
 
6
- col :event_ticket, search: :string
6
+ col :event_ticket, search: :string, label: 'Ticket'
7
7
 
8
8
  col :name do |er|
9
9
  "#{er.first_name} #{er.last_name}<br><small>#{mail_to(er.email)}</small>"
@@ -17,7 +17,7 @@ class EffectiveEventRegistrationsDatatable < Effective::Datatable
17
17
  col :owner, visible: false, search: :string
18
18
  col :status, visible: false
19
19
  col :event_registrants, label: 'Registrants', search: :string
20
- col :event_purchases, label: 'Purchases', search: :string
20
+ col :event_addons, label: 'Add-ons', search: :string
21
21
  col :orders, action: :show, visible: false, search: :string
22
22
 
23
23
  actions_col(actions: []) do |er|
@@ -10,9 +10,9 @@ class EffectiveEventsDatatable < Effective::Datatable
10
10
  order :title
11
11
  col :id, visible: false
12
12
 
13
- col :start_at, label: 'Event Date', as: :date
13
+ col :start_at, label: 'Date', as: :date
14
14
 
15
- col :title, label: 'Event' do |event|
15
+ col :title, label: 'Title' do |event|
16
16
  if event.registerable?
17
17
  link_to(event.to_s, effective_events.new_event_event_registration_path(event))
18
18
  else
@@ -0,0 +1,56 @@
1
+ module Effective
2
+ class EventsMailer < EffectiveResources.parent_mailer_class
3
+ default from: -> { EffectiveResources.mailer_sender }
4
+ layout -> { EffectiveResources.mailer_layout }
5
+
6
+ include EffectiveEmailTemplatesMailer if EffectiveEvents.use_effective_email_templates
7
+
8
+ def event_registrant_purchased(event_registrant, opts = {})
9
+ @assigns = assigns_for(event_registrant)
10
+ @event_registrant = event_registrant
11
+
12
+ mail(to: event_registrant.email, **headers_for(event_registrant, opts))
13
+ end
14
+
15
+ protected
16
+
17
+ def headers_for(resource, opts = {})
18
+ resource.respond_to?(:log_changes_datatable) ? opts.merge(log: resource) : opts
19
+ end
20
+
21
+ def assigns_for(resource)
22
+ if resource.kind_of?(EventRegistrant)
23
+ return event_registrant_assigns(resource).merge(event_assigns(resource.event)).merge(event_ticket_assigns(resource.event_ticket))
24
+ end
25
+
26
+ raise('unexpected resource')
27
+ end
28
+
29
+ def event_assigns(resource)
30
+ raise('expected an event') unless resource.kind_of?(Event)
31
+
32
+ values = {
33
+ name: resource.title,
34
+ date: resource.start_at.strftime('%F %H:%M'),
35
+ url: effective_events.event_url(resource)
36
+ }
37
+
38
+ { event: values }
39
+ end
40
+
41
+ def event_ticket_assigns(resource)
42
+ raise('expected an event ticket') unless resource.kind_of?(EventTicket)
43
+
44
+ values = { name: resource.title }
45
+ { ticket: values }
46
+ end
47
+
48
+ def event_registrant_assigns(resource)
49
+ raise('expected an event registrant') unless resource.kind_of?(EventRegistrant)
50
+
51
+ values = { name: resource.name, email: resource.email }
52
+ { registrant: values }
53
+ end
54
+
55
+ end
56
+ end
@@ -36,8 +36,8 @@ module EffectiveEventsEventRegistration
36
36
 
37
37
  acts_as_wizard(
38
38
  start: 'Start',
39
- registrants: 'Registrants',
40
- purchases: 'Purchases',
39
+ tickets: 'Tickets',
40
+ addons: 'Add-ons',
41
41
  summary: 'Review',
42
42
  billing: 'Billing Address',
43
43
  checkout: 'Checkout',
@@ -58,8 +58,8 @@ module EffectiveEventsEventRegistration
58
58
  has_many :event_registrants, -> { order(:id) }, class_name: 'Effective::EventRegistrant', inverse_of: :event_registration, dependent: :destroy
59
59
  accepts_nested_attributes_for :event_registrants, reject_if: :all_blank, allow_destroy: true
60
60
 
61
- has_many :event_purchases, -> { order(:id) }, class_name: 'Effective::EventPurchase', inverse_of: :event_registration, dependent: :destroy
62
- accepts_nested_attributes_for :event_purchases, reject_if: :all_blank, allow_destroy: true
61
+ has_many :event_addons, -> { order(:id) }, class_name: 'Effective::EventAddon', inverse_of: :event_registration, dependent: :destroy
62
+ accepts_nested_attributes_for :event_addons, reject_if: :all_blank, allow_destroy: true
63
63
 
64
64
  has_many :orders, -> { order(:id) }, as: :parent, class_name: 'Effective::Order', dependent: :nullify
65
65
  accepts_nested_attributes_for :orders
@@ -91,7 +91,7 @@ module EffectiveEventsEventRegistration
91
91
  validates :event, presence: true
92
92
 
93
93
  # Registrants Step
94
- validate(if: -> { current_step == :registrants }) do
94
+ validate(if: -> { current_step == :tickets }) do
95
95
  self.errors.add(:event_registrants, "can't be blank") unless present_event_registrants.present?
96
96
  end
97
97
 
@@ -102,7 +102,7 @@ module EffectiveEventsEventRegistration
102
102
  item.errors.add(:event_ticket_id, "#{item.event_ticket} is unavailable for purchase")
103
103
  end
104
104
 
105
- event_purchases.reject { |ep| ep.purchased? || ep.event_product&.available? }.each do |item|
105
+ event_addons.reject { |ep| ep.purchased? || ep.event_product&.available? }.each do |item|
106
106
  errors.add(:base, "The #{item.event_product} product is sold out and no longer available for purchase")
107
107
  item.errors.add(:event_product_id, "#{item.event_product} is unavailable for purchase")
108
108
  end
@@ -110,19 +110,24 @@ module EffectiveEventsEventRegistration
110
110
 
111
111
  def required_steps
112
112
  return self.class.test_required_steps if Rails.env.test? && self.class.test_required_steps.present?
113
- event&.event_products.present? ? wizard_step_keys : (wizard_step_keys - [:purchases])
113
+ event&.event_products.present? ? wizard_step_keys : (wizard_step_keys - [:addons])
114
114
  end
115
115
 
116
116
  # All Fees and Orders
117
117
  def submit_fees
118
- (event_registrants + event_purchases)
118
+ (event_registrants + event_addons)
119
+ end
120
+
121
+ def after_submit_purchased!
122
+ notifications = event.event_notifications.select(&:registrant_purchased?)
123
+ notifications.each { |notification| notification.notify!(event_registrants: event_registrants) }
119
124
  end
120
125
 
121
126
  end
122
127
 
123
128
  # Instance Methods
124
129
  def to_s
125
- persisted? ? "Registration ##{id}" : 'Event Registration'
130
+ 'registration'
126
131
  end
127
132
 
128
133
  def in_progress?
@@ -140,9 +145,9 @@ module EffectiveEventsEventRegistration
140
145
  end
141
146
 
142
147
  # Find or build. But it's not gonna work with more than 1. This is for testing only really.
143
- def event_purchase(event_product:)
144
- purchase = event_purchases.find { |ep| ep.event_product == event_product }
145
- purchase || event_purchases.build(event_product: event_product, owner: owner)
148
+ def event_addon(event_product:)
149
+ addon = event_addons.find { |ep| ep.event_product == event_product }
150
+ addon || event_addons.build(event_product: event_product, owner: owner)
146
151
  end
147
152
 
148
153
  # This builds the default event registrants used by the wizard form
@@ -2,17 +2,20 @@
2
2
 
3
3
  module Effective
4
4
  class Event < ActiveRecord::Base
5
- has_many :event_tickets, -> { EventTicket.sorted }, inverse_of: :event
5
+ has_many :event_tickets, -> { EventTicket.sorted }, inverse_of: :event, dependent: :destroy
6
6
  accepts_nested_attributes_for :event_tickets, allow_destroy: true
7
7
 
8
- has_many :event_products, -> { EventProduct.sorted }, inverse_of: :event
8
+ has_many :event_products, -> { EventProduct.sorted }, inverse_of: :event, dependent: :destroy
9
9
  accepts_nested_attributes_for :event_products, allow_destroy: true
10
10
 
11
11
  has_many :event_registrants, -> { order(:event_ticket_id, :created_at) }, inverse_of: :event
12
12
  accepts_nested_attributes_for :event_registrants, allow_destroy: true
13
13
 
14
- has_many :event_purchases, -> { order(:event_product_id, :created_at) }, inverse_of: :event
15
- accepts_nested_attributes_for :event_purchases, allow_destroy: true
14
+ has_many :event_addons, -> { order(:event_product_id, :created_at) }, inverse_of: :event
15
+ accepts_nested_attributes_for :event_addons, allow_destroy: true
16
+
17
+ has_many :event_notifications, -> { order(:id) }, inverse_of: :event, dependent: :destroy
18
+ accepts_nested_attributes_for :event_notifications, allow_destroy: true
16
19
 
17
20
  # rich_text_body - Used by the select step
18
21
  has_many_rich_texts
@@ -149,12 +152,12 @@ module Effective
149
152
 
150
153
  def early_bird?
151
154
  return false if early_bird_end_at.blank?
152
- early_bird_end_at < Time.zone.now
155
+ early_bird_end_at > Time.zone.now
153
156
  end
154
157
 
155
158
  def early_bird_past?
156
159
  return false if early_bird_end_at.blank?
157
- early_bird_end_at >= Time.zone.now
160
+ early_bird_end_at <= Time.zone.now
158
161
  end
159
162
 
160
163
  def early_bird_status
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Just like each EventRegistration has EventTickets and EventRegistrants
4
- # An Event Registration has EventProducts and EventPurchases
4
+ # An Event Registration has EventProducts and EventAddons
5
5
 
6
6
  module Effective
7
- class EventPurchase < ActiveRecord::Base
7
+ class EventAddon < ActiveRecord::Base
8
8
  acts_as_purchasable
9
9
 
10
10
  log_changes(to: :event) if respond_to?(:log_changes)
@@ -0,0 +1,160 @@
1
+ module Effective
2
+ class EventNotification < ActiveRecord::Base
3
+ log_changes(to: :event) if respond_to?(:log_changes)
4
+
5
+ belongs_to :event
6
+
7
+ CATEGORIES = ['Registrant purchased']
8
+ EMAIL_TEMPLATE_VARIABLES = ['event.name', 'event.date', 'event.url', 'ticket.name', 'registrant.name', 'registrant.email']
9
+
10
+ #CATEGORIES = ['Upcoming reminder', 'When event starts', 'Reminder', 'Before event ends', 'When event ends']
11
+
12
+ # UPCOMING_REMINDERS = {
13
+ # '1 hour before' => 1.hours.to_i,
14
+ # '3 hours before' => 3.hours.to_i,
15
+ # '6 hours before' => 6.hours.to_i,
16
+ # '12 hours before' => 12.hours.to_i,
17
+ # '1 day before' => 1.days.to_i,
18
+ # '2 days before' => 2.days.to_i,
19
+ # '3 days before' => 3.days.to_i,
20
+ # '4 days before' => 4.days.to_i,
21
+ # '5 days before' => 5.days.to_i,
22
+ # '6 days before' => 6.days.to_i,
23
+ # '1 week before' => 1.weeks.to_i,
24
+ # '2 weeks before' => 2.weeks.to_i,
25
+ # '3 weeks before' => 3.weeks.to_i,
26
+ # '1 month before' => 1.month.to_i
27
+ # }
28
+
29
+ # REMINDERS = {
30
+ # '1 hour after' => 1.hours.to_i,
31
+ # '3 hours after' => 3.hours.to_i,
32
+ # '6 hours after' => 6.hours.to_i,
33
+ # '12 hours after' => 12.hours.to_i,
34
+ # '1 day after' => 1.days.to_i,
35
+ # '2 days after' => 2.days.to_i,
36
+ # '3 days after' => 3.days.to_i,
37
+ # '4 days after' => 4.days.to_i,
38
+ # '5 days after' => 5.days.to_i,
39
+ # '6 days after' => 6.days.to_i,
40
+ # '1 week after' => 1.weeks.to_i,
41
+ # '2 weeks after' => 2.weeks.to_i,
42
+ # '3 weeks after' => 3.weeks.to_i,
43
+ # '1 month after' => 1.month.to_i
44
+ # }
45
+
46
+ effective_resource do
47
+ category :string
48
+ reminder :integer # Number of seconds before event.start_at
49
+
50
+ # Email
51
+ from :string
52
+ subject :string
53
+ body :text
54
+
55
+ # Tracking background jobs email send out
56
+ started_at :datetime
57
+ completed_at :datetime
58
+
59
+ timestamps
60
+ end
61
+
62
+ scope :sorted, -> { order(:id) }
63
+ scope :deep, -> { includes(:event) }
64
+
65
+ scope :started, -> { where.not(started_at: nil) }
66
+ scope :completed, -> { where.not(completed_at: nil) }
67
+
68
+ # Called by a future event_notifier rake task
69
+ scope :notifiable, -> { where(started_at: nil, completed_at: nil) }
70
+
71
+ validates :category, presence: true, inclusion: { in: CATEGORIES }
72
+
73
+ validates :from, presence: true, email: true
74
+ validates :subject, presence: true
75
+ validates :body, presence: true
76
+
77
+ if EffectiveEvents.use_effective_email_templates
78
+ validates :body, liquid: true
79
+ validates :subject, liquid: true
80
+ end
81
+
82
+ # validates :reminder, if: -> { reminder? || upcoming_reminder? || before_event_ends? },
83
+ # presence: true, uniqueness: { scope: [:event_id, :category], message: 'already exists' }
84
+
85
+ def to_s
86
+ 'event notification'
87
+ end
88
+
89
+ def email_template
90
+ 'event_' + category.to_s.parameterize.underscore
91
+ end
92
+
93
+ def registrant_purchased?
94
+ category == 'Registrant purchased'
95
+ end
96
+
97
+ # def upcoming_reminder?
98
+ # category == 'Upcoming reminder'
99
+ # end
100
+
101
+ # def event_start?
102
+ # category == 'When event starts'
103
+ # end
104
+
105
+ # def reminder?
106
+ # category == 'Reminder'
107
+ # end
108
+
109
+ # def before_event_ends?
110
+ # category == 'Before event ends'
111
+ # end
112
+
113
+ # def event_end?
114
+ # category == 'When event ends'
115
+ # end
116
+
117
+ # def notifiable?
118
+ # started_at.blank? && completed_at.blank?
119
+ # end
120
+
121
+ def notify_now?
122
+ true
123
+
124
+ #return false unless notifiable?
125
+
126
+ # case category
127
+ # when 'When event starts'
128
+ # event.available?
129
+ # when 'When event ends'
130
+ # event.ended?
131
+ # when 'Upcoming reminder'
132
+ # !event.started? && event.start_at < (Time.zone.now + reminder)
133
+ # when 'Reminder'
134
+ # !event.ended? && event.start_at < (Time.zone.now - reminder)
135
+ # when 'Before event ends'
136
+ # !event.ended? && event.end_at.present? && event.end_at < (Time.zone.now + reminder)
137
+ # else
138
+ # raise('unexpected category')
139
+ # end
140
+ end
141
+
142
+ def notify!(force: false, event_registrants: nil)
143
+ return false unless (notify_now? || force)
144
+
145
+ # We send one email to each registrant
146
+ event_registrants ||= event.event_registrants.purchased
147
+
148
+ update_column(:started_at, Time.zone.now)
149
+
150
+ opts = { from: from, subject: subject, body: body }
151
+
152
+ event_registrants.each do |event_registrant|
153
+ EffectiveEvents.send_email(email_template, event_registrant, opts)
154
+ end
155
+
156
+ update_column(:completed_at, Time.zone.now)
157
+ end
158
+
159
+ end
160
+ end
@@ -4,8 +4,8 @@ module Effective
4
4
  class EventProduct < ActiveRecord::Base
5
5
  belongs_to :event
6
6
 
7
- has_many :event_purchases
8
- has_many :purchased_event_purchases, -> { EventPurchase.purchased }, class_name: 'Effective::EventPurchase'
7
+ has_many :event_addons
8
+ has_many :purchased_event_addons, -> { EventAddon.purchased }, class_name: 'Effective::EventAddon'
9
9
 
10
10
  log_changes(to: :event) if respond_to?(:log_changes)
11
11
 
@@ -28,7 +28,7 @@ module Effective
28
28
  end
29
29
 
30
30
  scope :sorted, -> { order(:position) }
31
- scope :deep, -> { with_rich_text_body.includes(:purchased_event_purchases) }
31
+ scope :deep, -> { with_rich_text_body.includes(:purchased_event_addons) }
32
32
 
33
33
  scope :archived, -> { where(archived: true) }
34
34
  scope :unarchived, -> { where(archived: false) }
@@ -56,11 +56,11 @@ module Effective
56
56
 
57
57
  def capacity_available
58
58
  return nil if capacity.blank?
59
- [(capacity - purchased_event_purchases_count), 0].max
59
+ [(capacity - purchased_event_addons_count), 0].max
60
60
  end
61
61
 
62
- def purchased_event_purchases_count
63
- purchased_event_purchases.length
62
+ def purchased_event_addons_count
63
+ purchased_event_addons.length
64
64
  end
65
65
 
66
66
  end
@@ -58,6 +58,10 @@ module Effective
58
58
  "#{event_ticket} - #{last_first_name}"
59
59
  end
60
60
 
61
+ def name
62
+ "#{first_name} #{last_name}"
63
+ end
64
+
61
65
  def last_first_name
62
66
  "#{last_name}, #{first_name}"
63
67
  end
@@ -1,4 +1,4 @@
1
- = effective_form_with(model: [:admin, event_purchase], engine: true) do |f|
1
+ = effective_form_with(model: [:admin, event_addon], engine: true) do |f|
2
2
  = f.hidden_field :event_id
3
3
 
4
4
  - if f.object.new_record?
@@ -6,7 +6,7 @@
6
6
  - else
7
7
  = f.static_field :owner
8
8
 
9
- = render 'effective/event_purchases/fields', f: f, event: event_purchase.event
9
+ = render 'effective/event_addons/fields', f: f, event: event_addon.event
10
10
 
11
11
  - if f.object.new_record?
12
12
  = f.submit 'Save and Mark Paid'
@@ -0,0 +1,44 @@
1
+ = effective_form_with(model: [:admin, event_notification], engine: true) do |f|
2
+ - if inline_datatable?
3
+ = f.hidden_field :event_id
4
+ - else
5
+ = f.select :event_id, Effective::Event.sorted.all
6
+
7
+ = f.select :category, Effective::EventNotification::CATEGORIES,
8
+ label: 'Send an email notification'
9
+
10
+ - # Render email templates
11
+ - Effective::EventNotification::CATEGORIES.each do |category|
12
+ - template = 'event_' + category.parameterize.underscore
13
+
14
+ = f.show_if :category, category do
15
+ = render "/admin/event_notifications/form_#{template}", f: f
16
+
17
+ - if f.object.category == category && f.object.persisted?
18
+ = f.text_field :from
19
+ = f.text_field :subject
20
+ = f.text_area :body, rows: 10
21
+
22
+ - elsif EffectiveEvents.use_effective_email_templates == false
23
+ = f.text_field :from, value: EffectiveResources.mailer_sender
24
+ = f.text_field :subject, value: ''
25
+ = f.text_area :body, rows: 10, value: ''
26
+
27
+ - else
28
+ - email_template = Effective::EmailTemplate.where(template_name: template).first!
29
+
30
+ = f.text_field :from, value: email_template.from
31
+ = f.text_field :subject, value: email_template.subject
32
+ = f.text_area :body, rows: 10, value: email_template.body
33
+
34
+ - if EffectiveEvents.use_effective_email_templates
35
+
36
+ %p The available variables are:
37
+
38
+ %ul
39
+ - Effective::EventNotification::EMAIL_TEMPLATE_VARIABLES.each do |variable|
40
+ %li {{ #{variable} }}
41
+
42
+ %small.text-muted Only a developer can add additional variables
43
+
44
+ = effective_submit(f)
@@ -0,0 +1,3 @@
1
+ .alert.alert-warning
2
+ %strong When registrant purchased
3
+ notifications will be sent to each registrant at time of purchase.
@@ -2,11 +2,14 @@
2
2
  = f.hidden_field :event_id
3
3
 
4
4
  = f.text_field :title
5
- = f.number_field :capacity, hint: 'The number of online purchases will be limited to capacity.'
6
- = f.check_box :archived, label: 'Yes, archive this product and make it unavailable for purchase'
5
+ = f.number_field :capacity, hint: 'The number of addons will be limited to this capacity. Leave blank for unlimited capacity.'
7
6
 
8
- = f.price_field :price
9
- = f.text_field :qb_item_name, label: 'Quickbooks item name'
7
+ = f.price_field :price, hint: 'A price of $0 will allow a checkout for free.'
10
8
  = f.check_box :tax_exempt
11
9
 
10
+ - if defined?(EffectiveQbSync)
11
+ = f.text_field :qb_item_name, label: 'QuickBooks item name'
12
+
13
+ = f.check_box :archived, label: 'Archive this product. It will be unavailable for purchase.'
14
+
12
15
  = effective_submit(f)
@@ -2,13 +2,15 @@
2
2
  = f.hidden_field :event_id
3
3
 
4
4
  = f.text_field :title
5
- = f.number_field :capacity, hint: 'The number of online purchases will be limited to capacity.'
6
- = f.check_box :archived, label: 'Yes, archive this ticket and make it unavailable for purchase'
5
+ = f.number_field :capacity, hint: 'The number of registrations will be limited to capacity. Leave blank for unlimited capacity.'
7
6
 
8
- = f.price_field :regular_price
9
- = f.price_field :early_bird_price
10
- = f.text_field :qb_item_name, label: 'Quickbooks item name'
7
+ = f.price_field :regular_price, hint: 'A price of $0 will allow a checkout for free.'
8
+ = f.price_field :early_bird_price, hint: 'A price of $0 will allow a checkout for free.'
11
9
  = f.check_box :tax_exempt
12
10
 
11
+ - if defined?(EffectiveQbSync)
12
+ = f.text_field :qb_item_name, label: 'QuickBooks item name'
13
+
14
+ = f.check_box :archived, label: 'Archive this ticket. It will be unavailable for purchase.'
13
15
 
14
16
  = effective_submit(f)
@@ -7,8 +7,6 @@
7
7
  = render '/admin/events/form_content', event: event
8
8
 
9
9
  = tab 'Tickets' do
10
- %p An event must have tickets before registration can begin
11
-
12
10
  %h2 Tickets
13
11
  - datatable = Admin::EffectiveEventTicketsDatatable.new(event_id: event.id)
14
12
  = render_inline_datatable(datatable)
@@ -18,6 +16,12 @@
18
16
  - datatable = Admin::EffectiveEventProductsDatatable.new(event_id: event.id)
19
17
  = render_inline_datatable(datatable)
20
18
 
19
+ = tab 'Email' do
20
+ %p Click New to add one or more emails.
21
+
22
+ - datatable = Admin::EffectiveEventNotificationsDatatable.new(event_id: event.id)
23
+ = render_datatable(datatable, inline: true, simple: true)
24
+
21
25
  = tab 'Registrations' do
22
26
  %h2 Registrations
23
27
  - datatable = Admin::EffectiveEventRegistrationsDatatable.new(event_id: event.id)
@@ -28,9 +32,10 @@
28
32
  - datatable = Admin::EffectiveEventRegistrantsDatatable.new(event_id: event.id)
29
33
  .mb-4= render_inline_datatable(datatable)
30
34
 
31
- %h2 Purchases
32
- - datatable = Admin::EffectiveEventPurchasesDatatable.new(event_id: event.id)
33
- = render_inline_datatable(datatable)
35
+ = tab 'Add-ons' do
36
+ %h2 Add-ons
37
+ - datatable = Admin::EffectiveEventAddonsDatatable.new(event_id: event.id)
38
+ .mb-4= render_inline_datatable(datatable)
34
39
 
35
40
  = tab 'Wizard' do
36
41
  = render '/admin/events/form_event_registration_content', event: event
@@ -0,0 +1,8 @@
1
+ .card.mb-4
2
+ .card-body
3
+ - if f.object.purchased?
4
+ = f.static_field :event_product, label: 'Purchased event add-ons'
5
+ - else
6
+ = f.select :event_product_id, effective_events_event_products_collection(event), label: false
7
+
8
+ -# = f.text_area :notes, label: 'Notes'
@@ -1,11 +1,9 @@
1
- .card
1
+ .card.mb-4
2
2
  .card-body
3
- %h5.card-title Event Registrant
4
-
5
3
  - if f.object.purchased?
6
- = f.static_field :event_ticket, label: 'Purchased event ticket'
4
+ = f.static_field :event_ticket, label: 'Purchased ticket'
7
5
  - else
8
- = f.select :event_ticket_id, effective_events_event_tickets_collection(event)
6
+ = f.select :event_ticket_id, effective_events_event_tickets_collection(event), label: 'Ticket'
9
7
 
10
8
  .row
11
9
  .col-lg= f.text_field :first_name
@@ -0,0 +1,9 @@
1
+ = card do
2
+ .row
3
+ .col-sm
4
+ %h5.card-title= event_registration.wizard_step_title(:addons)
5
+ .col-sm-auto.text-right
6
+ = link_to('Edit', wizard_path(:addons)) if edit_effective_event_registrations_wizard?
7
+
8
+ - datatable = EffectiveEventAddonsDatatable.new(event_registration: event_registration)
9
+ .mb-4= render_simple_datatable(datatable)
@@ -2,9 +2,9 @@
2
2
  - step_content = resource.event&.send("rich_text_#{step}_content")
3
3
 
4
4
  - if all_steps_content.present?
5
- .card
5
+ .card.mb-4
6
6
  .card-body= all_steps_content
7
7
 
8
8
  - if step_content.present?
9
- .card
9
+ .card.mb-4
10
10
  .card-body= step_content
@@ -17,7 +17,7 @@
17
17
  = link_to('Abandon registration', effective_events.event_event_registration_path(registration.event, registration), 'data-confirm': "Really delete #{registration}?", 'data-method': :delete, class: 'btn btn-danger')
18
18
  to register for another event.
19
19
 
20
- %hr
20
+ %hr
21
21
 
22
22
  %h2 Event Registrations
23
23
 
@@ -1,9 +1,9 @@
1
1
  = card do
2
2
  .row
3
3
  .col-sm
4
- %h5.card-title= event_registration.wizard_step_title(:registrants)
4
+ %h5.card-title= event_registration.wizard_step_title(:tickets)
5
5
  .col-sm-auto.text-right
6
- = link_to('Edit', wizard_path(:registrants)) if edit_effective_event_registrations_wizard?
6
+ = link_to('Edit', wizard_path(:tickets)) if edit_effective_event_registrations_wizard?
7
7
 
8
8
  - datatable = EffectiveEventRegistrantsDatatable.new(event_registration: event_registration)
9
9
  .mb-4= render_simple_datatable(datatable)
@@ -0,0 +1,19 @@
1
+ = render 'layout' do
2
+ .card.mb-4
3
+ .card-body
4
+ %p
5
+ Add-ons are free or paid additional items that can be included in your registration.
6
+ %br
7
+ If you are registering for multiple people, you need to include an add-on for each person.
8
+
9
+ = render 'effective/event_registrations/content', resource: resource
10
+
11
+ .card
12
+ .card-body
13
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
14
+ = f.hidden_field :id
15
+
16
+ = f.has_many :event_addons do |fp|
17
+ = render('effective/event_addons/fields', f: fp, event: f.object.event)
18
+
19
+ = f.save 'Save and Continue'
@@ -3,8 +3,6 @@
3
3
 
4
4
  .card
5
5
  .card-body
6
- %p Please add one or more registrant.
7
-
8
6
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
9
7
  = f.hidden_field :id
10
8
 
@@ -2,12 +2,6 @@
2
2
 
3
3
  - upcoming = Effective::Event.events(user: current_user).upcoming.count
4
4
 
5
- %p
6
- - if upcoming == 1
7
- There is 1 upcoming event.
8
- - else
9
- There are #{upcoming} upcoming events.
10
-
11
5
  - datatable = EffectiveEventsDatatable.new(self, namespace: :effective)
12
6
  = render_datatable(datatable, simple: true)
13
7
 
@@ -1,5 +1,5 @@
1
1
  .effective-event
2
- %table.table.effective-events-table
2
+ %table.table.effective-event-table
3
3
  %tbody
4
4
  %tr
5
5
  %td Starts
@@ -0,0 +1,17 @@
1
+ ---
2
+ subject: 'You have been registered for {{ event.title }}'
3
+ from: 'admin@example.com'
4
+ ---
5
+ Hello {{ registrant.name }},
6
+
7
+ Your ticket {{ ticket.name }} has been purchased.
8
+
9
+ You are registered for {{ event.name }}
10
+
11
+ The event starts on {{ event.date }}
12
+
13
+ {{ event.url }}
14
+
15
+ Thank you.
16
+
17
+ Please contact us for assistance.
@@ -3,7 +3,7 @@ EffectiveEvents.setup do |config|
3
3
  config.event_tickets_table_name = :event_tickets
4
4
  config.event_products_table_name = :event_products
5
5
  config.event_registrants_table_name = :event_registrants
6
- config.event_purchases_table_name = :event_purchases
6
+ config.event_addons_table_name = :event_addons
7
7
  config.event_registrations_table_name = :event_registrations
8
8
 
9
9
  # Layout Settings
@@ -13,7 +13,20 @@ EffectiveEvents.setup do |config|
13
13
  # Event Settings
14
14
  # config.event_registrations_class_name = 'Effective::EventRegistration'
15
15
 
16
+ # Pagination length on the Events#index page
16
17
  config.per_page = 10
17
18
 
19
+ # Events can be restricted by role
18
20
  config.use_effective_roles = true
21
+
22
+ # Mailer Configuration
23
+ #
24
+ # Additional mailer settings for parent_mailer, delivery_method, layout, sender and admin
25
+ # are required fields in config/initializers/effective_resources.rb
26
+
27
+ # Configure the class responsible to send e-mails.
28
+ # config.mailer = 'Effective::EventsMailer'
29
+
30
+ # Use effective email templates for event notifications
31
+ config.use_effective_email_templates = true
19
32
  end
data/config/routes.rb CHANGED
@@ -19,8 +19,9 @@ EffectiveEvents::Engine.routes.draw do
19
19
  resources :event_tickets, except: [:show]
20
20
  resources :event_products, except: [:show]
21
21
  resources :event_registrants, except: [:show]
22
- resources :event_purchases, except: [:show]
22
+ resources :event_addons, except: [:show]
23
23
  resources :event_registrations, only: [:index, :show]
24
+ resources :event_notifications, except: [:show]
24
25
  end
25
26
 
26
27
  end
@@ -14,7 +14,7 @@ class CreateEffectiveEvents < ActiveRecord::Migration[6.0]
14
14
  t.datetime :early_bird_end_at
15
15
 
16
16
  t.integer :event_registrants_count, default: 0
17
- t.integer :event_purchases_count, default: 0
17
+ t.integer :event_addons_count, default: 0
18
18
 
19
19
  t.integer :roles_mask
20
20
  t.boolean :authenticate_user, default: false
@@ -84,7 +84,7 @@ class CreateEffectiveEvents < ActiveRecord::Migration[6.0]
84
84
  t.timestamps
85
85
  end
86
86
 
87
- create_table <%= @event_purchases_table_name %> do |t|
87
+ create_table <%= @event_addons_table_name %> do |t|
88
88
  t.integer :event_id
89
89
  t.integer :event_product_id
90
90
 
@@ -131,5 +131,22 @@ class CreateEffectiveEvents < ActiveRecord::Migration[6.0]
131
131
  add_index <%= @event_registrations_table_name %>, :status
132
132
  add_index <%= @event_registrations_table_name %>, :token
133
133
 
134
+ create_table <%= @event_notifications_table_name %> do |t|
135
+ t.references :event
136
+
137
+ t.string :category
138
+ t.integer :reminder
139
+
140
+ t.string :from
141
+ t.string :subject
142
+ t.text :body
143
+
144
+ t.datetime :started_at
145
+ t.datetime :completed_at
146
+
147
+ t.datetime :updated_at
148
+ t.datetime :created_at
149
+ end
150
+
134
151
  end
135
152
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveEvents
2
- VERSION = '0.1.7'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
@@ -7,9 +7,10 @@ module EffectiveEvents
7
7
  def self.config_keys
8
8
  [
9
9
  :events_table_name, :event_registrants_table_name, :event_tickets_table_name,
10
- :event_registrations_table_name, :event_products_table_name, :event_purchases_table_name,
10
+ :event_registrations_table_name, :event_products_table_name, :event_addons_table_name,
11
11
  :layout, :per_page, :use_effective_roles,
12
- :event_registration_class_name
12
+ :event_registration_class_name,
13
+ :mailer, :use_effective_email_templates
13
14
  ]
14
15
  end
15
16
 
@@ -19,4 +20,8 @@ module EffectiveEvents
19
20
  event_registration_class_name&.constantize || Effective::EventRegistration
20
21
  end
21
22
 
23
+ def self.mailer_class
24
+ mailer&.constantize || Effective::EventsMailer
25
+ end
26
+
22
27
  end
@@ -22,7 +22,7 @@ module EffectiveEvents
22
22
  def create_migration_file
23
23
  @events_table_name = ':' + EffectiveEvents.events_table_name.to_s
24
24
  @event_products_table_name = ':' + EffectiveEvents.event_products_table_name.to_s
25
- @event_purchases_table_name = ':' + EffectiveEvents.event_purchases_table_name.to_s
25
+ @event_addons_table_name = ':' + EffectiveEvents.event_addons_table_name.to_s
26
26
  @event_registrants_table_name = ':' + EffectiveEvents.event_registrants_table_name.to_s
27
27
  @event_registrations_table_name = ':' + EffectiveEvents.event_registrations_table_name.to_s
28
28
  @event_tickets_table_name = ':' + EffectiveEvents.event_tickets_table_name.to_s
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.1.7
4
+ version: 0.2.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: 2022-01-13 00:00:00.000000000 Z
11
+ date: 2022-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: effective_email_templates
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
167
181
  description: Event registrations, tickets and products
168
182
  email:
169
183
  - info@codeandeffect.com
@@ -179,34 +193,40 @@ files:
179
193
  - app/assets/javascripts/effective_events/base.js
180
194
  - app/assets/stylesheets/effective_events.scss
181
195
  - app/assets/stylesheets/effective_events/base.scss
196
+ - app/controllers/admin/event_addons_controller.rb
197
+ - app/controllers/admin/event_notifications_controller.rb
182
198
  - app/controllers/admin/event_products_controller.rb
183
- - app/controllers/admin/event_purchases_controller.rb
184
199
  - app/controllers/admin/event_registrants_controller.rb
185
200
  - app/controllers/admin/event_registrations_controller.rb
186
201
  - app/controllers/admin/event_tickets_controller.rb
187
202
  - app/controllers/admin/events_controller.rb
188
203
  - app/controllers/effective/event_registrations_controller.rb
189
204
  - app/controllers/effective/events_controller.rb
205
+ - app/datatables/admin/effective_event_addons_datatable.rb
206
+ - app/datatables/admin/effective_event_notifications_datatable.rb
190
207
  - app/datatables/admin/effective_event_products_datatable.rb
191
- - app/datatables/admin/effective_event_purchases_datatable.rb
192
208
  - app/datatables/admin/effective_event_registrants_datatable.rb
193
209
  - app/datatables/admin/effective_event_registrations_datatable.rb
194
210
  - app/datatables/admin/effective_event_tickets_datatable.rb
195
211
  - app/datatables/admin/effective_events_datatable.rb
196
- - app/datatables/effective_event_purchases_datatable.rb
212
+ - app/datatables/effective_event_addons_datatable.rb
197
213
  - app/datatables/effective_event_registrants_datatable.rb
198
214
  - app/datatables/effective_event_registrations_datatable.rb
199
215
  - app/datatables/effective_events_datatable.rb
200
216
  - app/helpers/effective_events_helper.rb
217
+ - app/mailers/effective/events_mailer.rb
201
218
  - app/models/concerns/effective_events_event_registration.rb
202
219
  - app/models/effective/event.rb
220
+ - app/models/effective/event_addon.rb
221
+ - app/models/effective/event_notification.rb
203
222
  - app/models/effective/event_product.rb
204
- - app/models/effective/event_purchase.rb
205
223
  - app/models/effective/event_registrant.rb
206
224
  - app/models/effective/event_registration.rb
207
225
  - app/models/effective/event_ticket.rb
226
+ - app/views/admin/event_addons/_form.html.haml
227
+ - app/views/admin/event_notifications/_form.html.haml
228
+ - app/views/admin/event_notifications/_form_event_registrant_purchased.html.haml
208
229
  - app/views/admin/event_products/_form.html.haml
209
- - app/views/admin/event_purchases/_form.html.haml
210
230
  - app/views/admin/event_registrants/_form.html.haml
211
231
  - app/views/admin/event_tickets/_form.html.haml
212
232
  - app/views/admin/events/_form.html.haml
@@ -214,29 +234,30 @@ files:
214
234
  - app/views/admin/events/_form_content.html.haml
215
235
  - app/views/admin/events/_form_event.html.haml
216
236
  - app/views/admin/events/_form_event_registration_content.html.haml
217
- - app/views/effective/event_purchases/_fields.html.haml
237
+ - app/views/effective/event_addons/_fields.html.haml
218
238
  - app/views/effective/event_registrants/_fields.html.haml
239
+ - app/views/effective/event_registrations/_addons.html.haml
219
240
  - app/views/effective/event_registrations/_content.html.haml
220
241
  - app/views/effective/event_registrations/_dashboard.html.haml
221
242
  - app/views/effective/event_registrations/_event_registration.html.haml
222
243
  - app/views/effective/event_registrations/_layout.html.haml
223
244
  - app/views/effective/event_registrations/_orders.html.haml
224
- - app/views/effective/event_registrations/_purchases.html.haml
225
- - app/views/effective/event_registrations/_registrants.html.haml
226
245
  - app/views/effective/event_registrations/_summary.html.haml
246
+ - app/views/effective/event_registrations/_tickets.haml
247
+ - app/views/effective/event_registrations/addons.html.haml
227
248
  - app/views/effective/event_registrations/billing.html.haml
228
249
  - app/views/effective/event_registrations/checkout.html.haml
229
- - app/views/effective/event_registrations/purchases.html.haml
230
- - app/views/effective/event_registrations/registrants.html.haml
231
250
  - app/views/effective/event_registrations/start.html.haml
232
251
  - app/views/effective/event_registrations/submitted.html.haml
233
252
  - app/views/effective/event_registrations/summary.html.haml
253
+ - app/views/effective/event_registrations/tickets.haml
234
254
  - app/views/effective/events/_dashboard.html.haml
235
255
  - app/views/effective/events/_event.html.haml
236
256
  - app/views/effective/events/_layout.html.haml
237
257
  - app/views/effective/events/_spacer.html.haml
238
258
  - app/views/effective/events/index.html.haml
239
259
  - app/views/effective/events/show.html.haml
260
+ - app/views/effective/events_mailer/event_registrant_purchased.liquid
240
261
  - config/effective_events.rb
241
262
  - config/routes.rb
242
263
  - db/migrate/01_create_effective_events.rb.erb
@@ -1,10 +0,0 @@
1
- .card
2
- .card-body
3
- %h5.card-title Event Purchase
4
-
5
- - if f.object.purchased?
6
- = f.static_field :event_product, label: 'Purchased event product'
7
- - else
8
- = f.select :event_product_id, effective_events_event_products_collection(event)
9
-
10
- = f.text_area :notes, label: 'Notes'
@@ -1,9 +0,0 @@
1
- = card do
2
- .row
3
- .col-sm
4
- %h5.card-title= event_registration.wizard_step_title(:purchases)
5
- .col-sm-auto.text-right
6
- = link_to('Edit', wizard_path(:purchases)) if edit_effective_event_registrations_wizard?
7
-
8
- - datatable = EffectiveEventPurchasesDatatable.new(event_registration: event_registration)
9
- .mb-4= render_simple_datatable(datatable)
@@ -1,14 +0,0 @@
1
- = render 'layout' do
2
- = render 'effective/event_registrations/content', resource: resource
3
-
4
- .card
5
- .card-body
6
- %p Please add one or more products.
7
-
8
- = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
9
- = f.hidden_field :id
10
-
11
- = f.has_many :event_purchases do |fp|
12
- = render('effective/event_purchases/fields', f: fp, event: f.object.event)
13
-
14
- = f.save 'Save and Continue'