effective_events 0.18.2 → 0.19.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: ebbe0c4c6c8266a3068883cf636eb167748f5f5be86fd2f25870390579821b85
4
- data.tar.gz: 304f0d1e83f7387f5a8357e01d55353e7f63b3bed9e495a7edee2bf287680b37
3
+ metadata.gz: 6686682576e78118943bd94a91c7d199249ecf048aa5816a8f64cd4bc909bb3b
4
+ data.tar.gz: 8b05cb3220da6ebb866380e4eeb4fad4dcbe0ca7b489c33c80d0bfb21e10847c
5
5
  SHA512:
6
- metadata.gz: 47a29ad6c4a465b750511f03d8bffca8cb50dc77464d7d732fb352b3cc6f250455a3166941b1fff684428a2130bf2e1c2f313add1fd3d34b613da96f7cde6f94
7
- data.tar.gz: 9a3d8e707e1f56f8ec11f9b089dbfb1b9f5d7bfd29b523a48cbd3790e1cbaf65a7b55c104ed5a2bdc055d8965a3a05a3be87799d3f2d437c2509663216a90029
6
+ metadata.gz: 54aaff80f4cccc27e000660b96943a16b7e5cb7fbd88070427e1f462a3bf0554ebafb801023e3e8875f6ea29fce82c9432625f30e5efc0f1cd513bc31059d905
7
+ data.tar.gz: 15d25d2f33735b41143678ecbb9321614ef6cfdbb5914cb8d3bac28e4c7714ed2da1bc60d3e1c287306312249c8efae445db925c9a7e315017cec94e29bc38da
@@ -42,8 +42,12 @@ module Admin
42
42
  col :promoted, visible: false
43
43
 
44
44
  col :name do |er|
45
- if er.first_name.present?
45
+ if er.user.present?
46
+ "#{link_to(er.user, "/admin/users/#{er.user.id}/edit", target: '_blank')}<br><small>#{mail_to(er.user.email)}</small>"
47
+ elsif er.first_name.present? && er.email.present?
46
48
  "#{er.first_name} #{er.last_name}<br><small>#{mail_to(er.email)}</small>"
49
+ elsif er.first_name.present?
50
+ "#{er.first_name} #{er.last_name}"
47
51
  elsif er.owner.present?
48
52
  er.owner.to_s + ' - GUEST'
49
53
  else
@@ -51,7 +55,8 @@ module Admin
51
55
  end
52
56
  end
53
57
 
54
- col :user, label: 'Member'
58
+ col :user, label: 'Member', visible: false
59
+ col :member_or_non_member_choice, visible: false
55
60
 
56
61
  col :orders, visible: false
57
62
  col :price, as: :price
@@ -34,7 +34,7 @@ module EffectiveEventsHelper
34
34
  ].compact.sort.uniq
35
35
 
36
36
  if prices.length > 1
37
- "#{(prices.first == 0 ? '$0' : price_to_currency(prices.first))} to #{(prices.last == 0 ? '$0' : price_to_currency(prices.last))}"
37
+ "#{(prices.first == 0 ? '$0' : price_to_currency(prices.first))} or #{(prices.last == 0 ? '$0' : price_to_currency(prices.last))}"
38
38
  else
39
39
  (prices.first == 0 ? '$0' : price_to_currency(prices.first))
40
40
  end
@@ -97,7 +97,7 @@ module EffectiveEventsHelper
97
97
 
98
98
  return if url.blank?
99
99
 
100
- "Can't find the person you need? <a href='#{url}' target='blank'>Click here</a> to add them to your organization."
100
+ "Can't find the member you need? <a href='#{url}' target='blank'>Click here</a> to add them to your #{EffectiveResources.etd(EffectiveMemberships.Organization)}."
101
101
  end
102
102
 
103
103
  end
@@ -344,6 +344,10 @@ module EffectiveEventsEventRegistration
344
344
  end
345
345
 
346
346
  save!
347
+
348
+ update_submit_fees_and_order! if submit_order.present? && !submit_order.purchased?
349
+
350
+ true
347
351
  end
348
352
 
349
353
  private
@@ -4,7 +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"]
7
+ PERMITTED_BLANK_REGISTRANT_CHANGES = ["first_name", "last_name", "email", "company", "user_id", "user_type", "blank_registrant", "member_or_non_member_choice", "response1", "response2", "response3"]
8
+ MEMBER_OR_NON_MEMBER_CHOICES = ['Add a regular registration', 'Add a member registration']
8
9
 
9
10
  acts_as_purchasable
10
11
  acts_as_archived
@@ -31,7 +32,8 @@ module Effective
31
32
  email :string
32
33
  company :string
33
34
 
34
- blank_registrant :boolean
35
+ blank_registrant :boolean
36
+ member_or_non_member_choice :string # Used by Member or Non-Member tickets to indicate a member or non-member
35
37
 
36
38
  waitlisted :boolean
37
39
  promoted :boolean # An admin marked this registrant as promoted from the waitlist
@@ -98,12 +100,18 @@ module Effective
98
100
  validates :company, presence: true, unless: -> { EffectiveEvents.event_registrant_required_fields.exclude?(:company) }
99
101
  end
100
102
 
101
- with_options(if: -> { event_ticket&.member_or_non_member? && present_registrant? }) do
102
- validates :user_id, presence: { message: 'Please select a member' }, unless: -> { first_name.present? || last_name.present? }
103
- validates :first_name, presence: true, unless: -> { user.present? || EffectiveEvents.event_registrant_required_fields.exclude?(:first_name) }
104
- validates :last_name, presence: true, unless: -> { user.present? || EffectiveEvents.event_registrant_required_fields.exclude?(:last_name) }
105
- validates :email, presence: true, unless: -> { user.present? || EffectiveEvents.event_registrant_required_fields.exclude?(:email) }
106
- validates :company, presence: true, unless: -> { user.present? || EffectiveEvents.event_registrant_required_fields.exclude?(:company) }
103
+ # Member or Non-Member Ticket
104
+ validates :member_or_non_member_choice, presence: true, if: -> { event_ticket&.member_or_non_member? && present_registrant? }
105
+
106
+ with_options(if: -> { event_ticket&.member_or_non_member? && present_registrant? && member_or_non_member_choice == 'Add a regular registration' }) do
107
+ validates :first_name, presence: true, unless: -> { EffectiveEvents.event_registrant_required_fields.exclude?(:first_name) }
108
+ validates :last_name, presence: true, unless: -> { EffectiveEvents.event_registrant_required_fields.exclude?(:last_name) }
109
+ validates :email, presence: true, unless: -> { EffectiveEvents.event_registrant_required_fields.exclude?(:email) }
110
+ validates :company, presence: true, unless: -> { EffectiveEvents.event_registrant_required_fields.exclude?(:company) }
111
+ end
112
+
113
+ with_options(if: -> { event_ticket&.member_or_non_member? && present_registrant? && member_or_non_member_choice == 'Add a member registration' }) do
114
+ validates :user_id, presence: { message: 'Please select a member' }
107
115
  end
108
116
 
109
117
  after_defer do
@@ -140,6 +148,10 @@ module Effective
140
148
  user&.is?(:member)
141
149
  end
142
150
 
151
+ def member_or_non_member_choice
152
+ self[:member_or_non_member_choice] || 'Add a regular registration'
153
+ end
154
+
143
155
  def member_email
144
156
  email.presence || user&.email
145
157
  end
@@ -27,18 +27,26 @@
27
27
  = f.number_field :capacity, hint: "The number of registrations will be limited to capacity. Leave blank for unlimited capacity."
28
28
  = f.check_box :display_capacity, label: "Yes, display the remaining ticket capacity to users during registration", hint: "Leave blank to hide the capacity."
29
29
 
30
- - if f.object.event&.delayed?
30
+ - if EffectiveEvents.delayed?
31
+ - event_delayed = f.object.event&.delayed?
32
+ - f.object.waitlist = false if !event_delayed
33
+
31
34
  = f.check_box :waitlist,
32
35
  label: "Yes, add to waitlist once capacity is reached",
33
- hint: "requires a delayed payment event. Once capacity is reached, new registrations will be added to the waitlist. Payment information is collected but not charged for waitlisted registrants. To waitlist everyone and promote later, set the capacity to zero."
36
+ hint: "requires a event with delayed payment. Once capacity is reached, new registrations will be added to the waitlist. Payment information is collected but not charged for waitlisted registrants. To waitlist everyone and promote later, set the capacity to zero.",
37
+ disabled: !event_delayed
34
38
  .row
35
39
  .col-md-6
36
- - if f.object.event&.early_bird_end_at.present?
37
- = f.price_field :early_bird_price, hint: 'A price of $0 will allow a checkout for free. Leave blank for no early bird price.'
40
+ = f.price_field :early_bird_price,
41
+ hint: 'requires an event with early bird date. A price of $0 will allow a checkout for free. Leave blank for no early bird price.',
42
+ disabled: !f.object.event&.early_bird_end_at.present?
38
43
 
39
44
  = f.show_if_any(:category, ['Regular', 'Member or Non-Member']) do
40
45
  = f.price_field :regular_price, hint: 'A price of $0 will allow a checkout for free.'
41
46
 
47
+ = f.show_if_any(:category, ['Member Only']) do
48
+ = f.static_field :regular_price, value: 'None'
49
+
42
50
  = f.show_if_any(:category, ['Member Only', 'Member or Non-Member']) do
43
51
  = f.price_field :member_price, hint: 'A price of $0 will allow a checkout for free when selecting a member.'
44
52
 
@@ -47,10 +55,11 @@
47
55
  .col-md-6= f.text_field :qb_item_name, label: 'QuickBooks item name'
48
56
 
49
57
  = f.check_box :tax_exempt
50
- = f.check_box :archived, label: 'Archive this ticket. It will be unavailable for purchase.'
58
+ = f.check_box :archived, label: 'Archive this ticket. While archived, it cannot be purchased by users but registrants can only be added by an admin.'
51
59
 
52
60
  = card('Questions') do
53
- %p Add upto 3 questions
61
+ %p
62
+ %small.text-muted Please add up to 3 questions to ask during registration. Each ticket will have their own unique answers. Leave a question blank to skip.
54
63
 
55
64
  = f.text_field :question1, label: 'Question 1'
56
65
  = f.text_field :question2, label: 'Question 2'
@@ -1,19 +1,8 @@
1
1
  = effective_form_with(model: [:admin, event], engine: true) do |f|
2
2
  = f.text_field :title, label: "Title"
3
3
 
4
- -# acts_as_published
5
- = f.hide_if(:save_as_draft, true) do
6
- .row
7
- .col-md-6
8
- = f.datetime_field :published_start_at, hint: 'The event will be available starting on this date and time. Leave blank to publish immediately.'
9
- .col-md-6
10
- = f.datetime_field :published_end_at, label: 'Published start', hint: 'The event will not appear on the website after this date and time. Leave blank for no end date.', date_linked: false
11
-
12
- = f.check_box :save_as_draft, label: "Save as a draft. It will not appear on the website and can only be accessed by admin users."
13
-
14
- - if f.object.persisted? || f.object.errors.include?(:slug)
15
- - current_url = (effective_events.event_url(f.object) rescue nil)
16
- = f.text_field :slug, hint: "The slug controls this event's internet address. Be careful, changing the slug will break links that other websites may have to the old address.<br>#{('This event is currently reachable via ' + link_to(current_url.gsub(f.object.slug, '<strong>' + f.object.slug + '</strong>').html_safe, current_url)) if current_url }".html_safe
4
+ = acts_as_published_fields(f)
5
+ = acts_as_slugged_fields(f, url: (effective_events.event_url(f.object) rescue nil))
17
6
 
18
7
  .row
19
8
  .col
@@ -47,7 +36,7 @@
47
36
  = f.url_field :external_registration_url, hint: "The url for external event registration. Must start with http(s)://"
48
37
 
49
38
  .col-md-6
50
- - if EffectiveOrders.try(:delayed?)
39
+ - if EffectiveEvents.delayed?
51
40
  %h2 Delayed Payments
52
41
  %p The online payment for this event will be charged as follows:
53
42
 
@@ -1,16 +1,28 @@
1
- - # Choose ANY member
2
- - klass = (f.object.user || current_user).class
3
- - ajax_url = (@select2_users_ajax_path || effective_memberships.member_users_membership_select2_ajax_index_path) unless Rails.env.test?
1
+ - if current_user.try(:is_any?, :member, :admin)
2
+ = f.radios :member_or_non_member_choice, Effective::EventRegistrant::MEMBER_OR_NON_MEMBER_CHOICES, label: false, inline: true
3
+ - else
4
+ = f.hidden_field :member_or_non_member_choice, value: 'Add a regular registration'
4
5
 
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_registrant_user_hint()
6
+ = f.show_if(:member_or_non_member_choice, 'Add a member registration', nested: true) do
7
+ = f.hidden_field :first_name, value: nil
8
+ = f.hidden_field :last_name, value: nil
9
+ = f.hidden_field :email, value: nil
10
+ = f.hidden_field :company, value: nil
7
11
 
8
- - # Choose RELATED ORGANIZATION member
9
- -# = f.hidden_field :user_type, value: current_user.class.name
10
- -# = f.select :user_id, effective_events_event_registrant_user_collection(f.object), hint: effective_events_event_registrant_user_hint()
12
+ - # Choose ANY member
13
+ - klass = (f.object.user || current_user).class
14
+ - ajax_url = (@select2_users_ajax_path || effective_memberships.member_users_membership_select2_ajax_index_path) unless Rails.env.test?
11
15
 
12
- = f.show_if(:user_id, '', nested: true) do
13
- %p.text-center - or -
16
+ = f.hidden_field :user_type, value: klass.name
17
+ = f.select :user_id, klass.all, ajax_url: ajax_url, label: 'Member', hint: effective_events_event_registrant_user_hint()
18
+
19
+ - # Choose RELATED ORGANIZATION member
20
+ -# = f.hidden_field :user_type, value: current_user.class.name
21
+ -# = f.select :user_id, effective_events_event_registrant_user_collection(f.object), hint: effective_events_event_registrant_user_hint()
22
+
23
+ = f.show_if(:member_or_non_member_choice, 'Add a regular registration', nested: true) do
24
+ = f.hidden_field :user_type, value: nil
25
+ = f.hidden_field :user_id, value: nil
14
26
 
15
27
  - # Choose non-member
16
28
  .row
@@ -20,5 +32,3 @@
20
32
  .row
21
33
  .col-md= f.email_field :email
22
34
  .col-md= f.text_field :company
23
-
24
- %hr
@@ -1,11 +1,8 @@
1
- - if ticket.questions.present?
2
- %p Please answer the following questions (optional):
1
+ - if ticket.question1.present?
2
+ = f.text_field :response1, label: ticket.question1
3
3
 
4
- - if ticket.question1.present?
5
- = f.text_field :response1, label: ticket.question1
4
+ - if ticket.question2.present?
5
+ = f.text_field :response2, label: ticket.question2
6
6
 
7
- - if ticket.question2.present?
8
- = f.text_field :response2, label: ticket.question2
9
-
10
- - if ticket.question3.present?
11
- = f.text_field :response3, label: ticket.question3
7
+ - if ticket.question3.present?
8
+ = f.text_field :response3, label: ticket.question3
@@ -1,43 +1,50 @@
1
- .card.mb-4
2
- .card-body
3
- - tickets = resource.event.event_tickets.reject(&:archived?)
1
+ - tickets = resource.event.event_tickets.reject(&:archived?)
2
+ - member_column = tickets.any? { |ticket| ticket.member_only? || ticket.member_or_non_member? }
3
+ - waitlist = tickets.any? { |ticket| ticket.waitlist? }
4
4
 
5
- - member_column = tickets.any? { |ticket| ticket.member_only? || ticket.member_or_non_member? }
6
- - waitlist = tickets.any? { |ticket| ticket.waitlist? }
5
+ - all_member_only_tickets = tickets.all? { |ticket| ticket.member_only? }
6
+ - any_member_only_tickets = tickets.any? { |ticket| ticket.member_only? }
7
7
 
8
- %p This event has the following tickets available for purchase:
8
+ = card do
9
+ %p This event has the following tickets available for purchase:
9
10
 
10
- %table.table.table-sm.table-striped
11
- %thead
12
- %tr
13
- %th Ticket
14
- - if member_column
15
- %th Member Price
16
- %th #{'Regular ' if member_column}Price
11
+ %table.table.table-sm.table-striped
12
+ %thead
13
+ %tr
14
+ %th Ticket
15
+ - if member_column
16
+ %th Member Price
17
+ %th #{'Regular ' if member_column}Price
17
18
 
18
- %tbody
19
- - tickets.each do |ticket|
20
- %tr
21
- %td
22
- = ticket.to_s
23
- - if ticket.capacity.present? && ticket.display_capacity?
24
- %br
25
- %small
26
- #{ticket.capacity_available} remaining
27
- - if ticket.waitlist?
28
- before waitlist
19
+ %tbody
20
+ - tickets.each do |ticket|
21
+ %tr
22
+ %td
23
+ = ticket.to_s
24
+ - if ticket.capacity.present? && ticket.display_capacity?
25
+ %br
26
+ %small
27
+ #{ticket.capacity_available} remaining
28
+ - if ticket.waitlist?
29
+ before waitlist
29
30
 
30
- - if member_column
31
- %td
32
- - if ticket.member_price.present?
33
- = price_to_currency(ticket.member_price)
34
- - else
35
- = '-'
31
+ - if member_column
36
32
  %td
37
- - if ticket.regular_price.present?
38
- = price_to_currency(ticket.regular_price)
33
+ - if ticket.member_price.present?
34
+ = price_to_currency(ticket.member_price)
39
35
  - else
40
36
  = '-'
37
+ %td
38
+ - if ticket.regular_price.present?
39
+ = price_to_currency(ticket.regular_price)
40
+ - else
41
+ = '-'
42
+
43
+ - if waitlist
44
+ %p If the ticket capacity has been reached you will be added to the waitlist.
41
45
 
42
- - if waitlist
43
- %p If the ticket capacity has been reached you will be added to the waitlist.
46
+ - unless current_user.try(:is?, :member)
47
+ - if all_member_only_tickets
48
+ .alert.alert-info.mb-4 You must be a member to purchase tickets.
49
+ - elsif any_member_only_tickets
50
+ .alert.alert-info.mb-4 You must be a member to purchase some of these tickets.
@@ -22,10 +22,8 @@
22
22
  = render('effective/event_registrants/fields_regular', f: fr)
23
23
  - elsif ticket.member_only?
24
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)
25
+ - elsif ticket.member_or_non_member?
26
+ = render('effective/event_registrants/fields_member_or_non_member', f: fr)
29
27
  - else
30
28
  - raise("Unexpected ticket category: #{ticket.category || 'nil'}")
31
29
 
@@ -86,6 +86,7 @@ class CreateEffectiveEvents < ActiveRecord::Migration[6.0]
86
86
  t.text :notes
87
87
 
88
88
  t.boolean :blank_registrant, default: false
89
+ t.string :member_or_non_member_choice
89
90
 
90
91
  t.boolean :waitlisted, default: false
91
92
  t.boolean :promoted, default: false
@@ -1,3 +1,3 @@
1
1
  module EffectiveEvents
2
- VERSION = '0.18.2'.freeze
2
+ VERSION = '0.19.0'.freeze
3
3
  end
@@ -24,12 +24,17 @@ module EffectiveEvents
24
24
  mailer&.constantize || Effective::EventsMailer
25
25
  end
26
26
 
27
- def categories
27
+ def self.categories
28
28
  Array(config[:categories]) - [nil, false, '']
29
29
  end
30
30
 
31
- def event_registrant_required_fields
31
+ def self.event_registrant_required_fields
32
32
  (Array(config[:event_registrant_required_fields]) - [nil, false, '']).map(&:to_sym)
33
33
  end
34
34
 
35
+ # If we can create delayed payment events at all
36
+ def self.delayed?
37
+ !!EffectiveOrders.try(:delayed?)
38
+ end
39
+
35
40
  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.18.2
4
+ version: 0.19.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-07-30 00:00:00.000000000 Z
11
+ date: 2024-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails