effective_memberships 0.6.7 → 0.6.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/mailers/effective/memberships_mailer.rb +15 -1
- data/app/models/concerns/effective_memberships_applicant.rb +26 -5
- data/app/models/concerns/effective_memberships_registrar.rb +5 -4
- data/app/views/admin/applicants/_form_approve.html.haml +27 -3
- data/app/views/admin/categories/_form.html.haml +3 -12
- data/app/views/admin/categories/_form_applicant_content.html.haml +3 -2
- data/app/views/admin/categories/_form_category.html.haml +12 -2
- data/app/views/admin/categories/{_form_renewals.html.haml → _form_fees.html.haml} +29 -3
- data/app/views/effective/applicants/_summary.html.haml +5 -1
- data/app/views/effective/applicants/select/_apply_for_reinstatement.html.haml +1 -1
- data/lib/effective_memberships/version.rb +1 -1
- metadata +3 -5
- data/app/views/admin/categories/_form_applicant_eligibility.html.haml +0 -9
- data/app/views/admin/categories/_form_applicant_fees.html.haml +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ba47cb79fdfe1d53bfa440e0c6ecd4b454f7da034a9035d25e0306e0b57a1d9
|
4
|
+
data.tar.gz: 7b342075e2d9aa6e51d7cecd34011e491f1c95ae7123606d26a23b128915e34d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4033eb84334a81fe60aa6b67248f34feec629ca3a83bb6f0725ef2bb013dce6344b629eefd9f940f8a6f2b3a7dbdf35360b4027b925c5785d7e1ab7d359b0dcd
|
7
|
+
data.tar.gz: 59978379131bfb1a4e9988fdeda03e8e792ec37011c1c2a7338072c73c743dd1cd33999be0d1cbb41142e60ca43e1c15e8fe053b56a7ac9ffcc96e9e6ed6aa6d
|
@@ -68,7 +68,7 @@ module Effective
|
|
68
68
|
|
69
69
|
def assigns_for(resource)
|
70
70
|
if resource.class.respond_to?(:effective_memberships_applicant?)
|
71
|
-
return applicant_assigns(resource).merge(owner_assigns(resource.owner))
|
71
|
+
return applicant_assigns(resource).merge(owner_assigns(resource.owner)).merge(membership_assigns(resource.owner.membership))
|
72
72
|
end
|
73
73
|
|
74
74
|
if resource.kind_of?(Effective::ApplicantEndorsement)
|
@@ -87,6 +87,7 @@ module Effective
|
|
87
87
|
|
88
88
|
values = {
|
89
89
|
date: (applicant.submitted_at || Time.zone.now).strftime('%F'),
|
90
|
+
approved_at: (applicant.approved_at&.strftime('%F') || 'not approved'),
|
90
91
|
|
91
92
|
to_category: applicant.category.to_s,
|
92
93
|
from_category: applicant.from_category.to_s,
|
@@ -102,6 +103,19 @@ module Effective
|
|
102
103
|
{ applicant: values }
|
103
104
|
end
|
104
105
|
|
106
|
+
def membership_assigns(membership)
|
107
|
+
return {} if membership.blank?
|
108
|
+
raise('expected a membership') unless membership.kind_of?(Effective::Membership)
|
109
|
+
|
110
|
+
values = {
|
111
|
+
number: (membership.number || 'no membership number'),
|
112
|
+
joined_on: (membership.joined_on&.strftime('%F') || 'unknown'),
|
113
|
+
registration_on: (membership.registration_on.strftime('%F') || 'unknown')
|
114
|
+
}
|
115
|
+
|
116
|
+
{ membership: values }
|
117
|
+
end
|
118
|
+
|
105
119
|
def endorsement_assigns(applicant_endorsement)
|
106
120
|
raise('expected a endorsement') unless applicant_endorsement.kind_of?(Effective::ApplicantEndorsement)
|
107
121
|
|
@@ -87,6 +87,7 @@ module EffectiveMembershipsApplicant
|
|
87
87
|
# Admin Approve Step
|
88
88
|
attr_accessor :approved_membership_number
|
89
89
|
attr_accessor :approved_membership_date
|
90
|
+
attr_accessor :approved_email_action
|
90
91
|
|
91
92
|
# Application Namespace
|
92
93
|
belongs_to :user, polymorphic: true
|
@@ -194,8 +195,14 @@ module EffectiveMembershipsApplicant
|
|
194
195
|
# Set Apply to Join or Reclassification
|
195
196
|
before_validation(if: -> { (new_record? || current_step == :select) && owner.present? }) do
|
196
197
|
self.applicant_type ||= can_apply_applicant_types_collection().first
|
197
|
-
|
198
|
-
|
198
|
+
|
199
|
+
if owner.membership.present?
|
200
|
+
self.from_category = owner.membership.categories.first
|
201
|
+
end
|
202
|
+
|
203
|
+
if owner.membership.present? && reinstatement?
|
204
|
+
self.from_status = owner.membership.statuses.find { |status| status.reinstatable? }
|
205
|
+
end
|
199
206
|
end
|
200
207
|
|
201
208
|
before_validation(if: -> { current_step == :experience }) do
|
@@ -757,6 +764,19 @@ module EffectiveMembershipsApplicant
|
|
757
764
|
reviewed!
|
758
765
|
end
|
759
766
|
|
767
|
+
def approve_email_templates
|
768
|
+
raise('expected EffectiveEmailTemplates') unless defined?(EffectiveEmailTemplates)
|
769
|
+
Effective::EmailTemplate.where('template_name ILIKE ?', 'applicant_approve%').order(:template_name)
|
770
|
+
end
|
771
|
+
|
772
|
+
def to_category
|
773
|
+
category
|
774
|
+
end
|
775
|
+
|
776
|
+
def to_status
|
777
|
+
nil
|
778
|
+
end
|
779
|
+
|
760
780
|
# Admin approves an applicant. Registers the owner. Sends an email.
|
761
781
|
def approve!
|
762
782
|
raise('already approved') if was_approved?
|
@@ -772,14 +792,15 @@ module EffectiveMembershipsApplicant
|
|
772
792
|
if apply_to_join?
|
773
793
|
EffectiveMemberships.Registrar.register!(
|
774
794
|
owner,
|
775
|
-
to:
|
795
|
+
to: to_category,
|
796
|
+
status: to_status,
|
776
797
|
date: approved_membership_date.presence, # Set by the Admin Process form, or nil
|
777
798
|
number: approved_membership_number.presence # Set by the Admin Process form, or nil
|
778
799
|
)
|
779
800
|
elsif reclassification?
|
780
|
-
EffectiveMemberships.Registrar.reclassify!(owner, to:
|
801
|
+
EffectiveMemberships.Registrar.reclassify!(owner, to: to_category, status: to_status)
|
781
802
|
elsif reinstatement?
|
782
|
-
EffectiveMemberships.Registrar.reinstate!(owner)
|
803
|
+
EffectiveMemberships.Registrar.reinstate!(owner, from: from_status)
|
783
804
|
else
|
784
805
|
raise('unsupported approval applicant_type')
|
785
806
|
end
|
@@ -186,17 +186,18 @@ module EffectiveMembershipsRegistrar
|
|
186
186
|
save!(owner, date: date)
|
187
187
|
end
|
188
188
|
|
189
|
-
def reinstate!(owner, date: nil, skip_fees: false)
|
189
|
+
def reinstate!(owner, from:, date: nil, skip_fees: false)
|
190
190
|
raise('expecting a memberships owner') unless owner.class.respond_to?(:effective_memberships_owner?)
|
191
191
|
raise('owner must have an existing membership. use register! instead') if owner.membership.blank?
|
192
192
|
|
193
|
-
from
|
194
|
-
raise('
|
193
|
+
raise('expecting a from') if from.blank?
|
194
|
+
raise('expected a from status or category') unless from.class.respond_to?(:effective_memberships_status?) || from.class.respond_to?(:effective_memberships_category?)
|
195
195
|
|
196
196
|
date ||= Time.zone.now
|
197
197
|
|
198
198
|
membership = owner.membership
|
199
|
-
membership.membership_status(status: from).mark_for_destruction if from.
|
199
|
+
membership.membership_status(status: from).mark_for_destruction if from.class.respond_to?(:effective_memberships_status?)
|
200
|
+
membership.membership_category(category: from).mark_for_destruction if from.class.respond_to?(:effective_memberships_category?)
|
200
201
|
|
201
202
|
unless skip_fees
|
202
203
|
fee = owner.build_prorated_fee(date: date)
|
@@ -9,7 +9,11 @@
|
|
9
9
|
The member will keep their existing membership number: #{applicant.owner.membership.number}.
|
10
10
|
- else
|
11
11
|
- number = EffectiveMemberships.Registrar.next_membership_number(applicant.owner, to: applicant.category)
|
12
|
-
|
12
|
+
|
13
|
+
- if number.present?
|
14
|
+
= f.text_field :approved_membership_number, hint: "leave blank to assign the next number: #{number || 'none'}."
|
15
|
+
- else
|
16
|
+
No membership number will be assigned.
|
13
17
|
|
14
18
|
%h3 Fees
|
15
19
|
%p The following fee(s) will be created:
|
@@ -24,7 +28,27 @@
|
|
24
28
|
%li A #{month} discount fee from their old category
|
25
29
|
|
26
30
|
%h3 Email to send
|
27
|
-
|
28
|
-
|
31
|
+
- email_templates = applicant.approve_email_templates
|
32
|
+
|
33
|
+
- f.object.approved_email_action ||= email_templates.first&.id
|
34
|
+
= f.hidden_field :approved_email_action
|
35
|
+
|
36
|
+
- if email_templates.length == 0
|
37
|
+
%p The following email will be sent:
|
38
|
+
= email_form_fields(f, :applicant_approve)
|
39
|
+
|
40
|
+
- if email_templates.length == 1
|
41
|
+
- template = email_templates.first
|
42
|
+
%p The following #{link_to(template, effective_email_templates.edit_admin_email_template_path(template), target: '_blank')} email will be sent:
|
43
|
+
= email_form_fields(f, template)
|
44
|
+
|
45
|
+
- if email_templates.length > 1
|
46
|
+
- collection = email_templates.map { |et| [et.to_s.titleize.sub('Applicant ', '') + " (#{et})", et.id] }
|
47
|
+
= f.select :approved_email_action, collection
|
48
|
+
|
49
|
+
- email_templates.each do |template|
|
50
|
+
= f.show_if(:approved_email_action, template.id) do
|
51
|
+
%p The following #{link_to(template, effective_email_templates.edit_admin_email_template_path(template), target: '_blank')} email will be sent:
|
52
|
+
= email_form_fields(f, template)
|
29
53
|
|
30
54
|
= f.submit 'Approve Applicant', border: false, center: true, 'data-confirm': "Approve #{f.object.owner}?"
|
@@ -3,11 +3,7 @@
|
|
3
3
|
= render 'admin/categories/form_category', category: category
|
4
4
|
|
5
5
|
- if category.persisted?
|
6
|
-
= render 'admin/categories/
|
7
|
-
|
8
|
-
= render 'admin/categories/form_applicant_fees', category: category
|
9
|
-
= render 'admin/categories/form_renewals', category: category
|
10
|
-
|
6
|
+
= render 'admin/categories/form_fees', category: category
|
11
7
|
|
12
8
|
- if category.persisted?
|
13
9
|
= tab 'Content - Applicants' do
|
@@ -18,14 +14,9 @@
|
|
18
14
|
|
19
15
|
= tab 'Wizards' do
|
20
16
|
.row
|
21
|
-
.col
|
22
|
-
|
23
|
-
|
24
|
-
.col
|
25
|
-
= render 'admin/categories/form_fee_payment_steps', category: category
|
17
|
+
.col= render 'admin/categories/form_applicant_steps', category: category
|
18
|
+
.col= render 'admin/categories/form_fee_payment_steps', category: category
|
26
19
|
|
27
20
|
- if category.respond_to?(:log_changes_datatable)
|
28
21
|
= tab 'Logs' do
|
29
22
|
= render_inline_datatable(category.log_changes_datatable)
|
30
|
-
|
31
|
-
|
@@ -4,10 +4,11 @@
|
|
4
4
|
= f.article_editor "rich_text_applicant_all_steps_content", label: false, hint: "displayed on all steps"
|
5
5
|
- else
|
6
6
|
= f.rich_text_area "rich_text_applicant_all_steps_content", label: false, hint: "displayed on all steps"
|
7
|
-
|
7
|
+
|
8
|
+
- enabled_steps = f.object.applicant_wizard_steps
|
8
9
|
|
9
10
|
- EffectiveMemberships.Applicant::WIZARD_STEPS.each do |step, title|
|
10
|
-
- next unless
|
11
|
+
- next unless enabled_steps.include?(step)
|
11
12
|
|
12
13
|
= card("#{title}") do
|
13
14
|
- if defined?(EffectiveArticleEditor)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
= effective_form_with(model: [:admin, category], engine: true) do |f|
|
2
2
|
.row
|
3
|
-
.col
|
3
|
+
.col
|
4
|
+
= f.text_field :title, label: 'Category title'
|
4
5
|
|
5
6
|
.col
|
6
7
|
= f.select :category_type, f.object.class.category_types,
|
@@ -14,4 +15,13 @@
|
|
14
15
|
- else
|
15
16
|
= f.rich_text_area :rich_text_body, label: 'Description shown in the Application to Join wizard'
|
16
17
|
|
17
|
-
|
18
|
+
%h3 Applicant Eligibility
|
19
|
+
= f.check_box :can_apply_new, label: 'Anyone may apply for this category'
|
20
|
+
= f.check_box :can_apply_existing, label: 'Any current member may apply to join'
|
21
|
+
= f.check_box :can_apply_restricted, label: 'Only some current members may apply to join'
|
22
|
+
|
23
|
+
= f.show_if(:can_apply_restricted, true) do
|
24
|
+
- categories = f.object.class.where.not(id: f.object)
|
25
|
+
= f.select :can_apply_restricted_ids, categories, label: 'Existing member categories'
|
26
|
+
|
27
|
+
= effective_submit(f)
|
@@ -1,4 +1,28 @@
|
|
1
1
|
= effective_form_with(model: [:admin, category], engine: true) do |f|
|
2
|
+
%h3 Applicant Fees
|
3
|
+
.row
|
4
|
+
.col= f.price_field :applicant_fee
|
5
|
+
.col= f.text_field :qb_item_name, label: "Quickbooks Item Name"
|
6
|
+
|
7
|
+
%h3 Pro-rated fees based on date of approval
|
8
|
+
.row
|
9
|
+
.col-lg-3
|
10
|
+
= f.price_field :prorated_jan, label: "January"
|
11
|
+
= f.price_field :prorated_feb, label: "February"
|
12
|
+
= f.price_field :prorated_mar, label: "March"
|
13
|
+
.col-lg-3
|
14
|
+
= f.price_field :prorated_apr, label: "April"
|
15
|
+
= f.price_field :prorated_may, label: "May"
|
16
|
+
= f.price_field :prorated_jun, label: "June"
|
17
|
+
.col-lg-3
|
18
|
+
= f.price_field :prorated_jul, label: "July"
|
19
|
+
= f.price_field :prorated_aug, label: "August"
|
20
|
+
= f.price_field :prorated_sep, label: "September"
|
21
|
+
.col-lg-3
|
22
|
+
= f.price_field :prorated_oct, label: "October"
|
23
|
+
= f.price_field :prorated_nov, label: "November"
|
24
|
+
= f.price_field :prorated_dec, label: "December"
|
25
|
+
|
2
26
|
%h3 Renewal Fees
|
3
27
|
= f.check_box :create_renewal_fees, label: 'Yes, annual renewal fees should be created'
|
4
28
|
|
@@ -6,7 +30,8 @@
|
|
6
30
|
- date = EffectiveMemberships.Registrar.renewal_fee_date(date: Time.zone.now)
|
7
31
|
|
8
32
|
%p Charged to members, every #{date.strftime('%B %e')}, to renew their dues.
|
9
|
-
|
33
|
+
.row
|
34
|
+
.col-3= f.price_field :renewal_fee
|
10
35
|
|
11
36
|
%h3 Late Fees
|
12
37
|
= f.check_box :create_late_fees, label: 'Yes, late fees should be created'
|
@@ -16,7 +41,8 @@
|
|
16
41
|
- date = EffectiveMemberships.Registrar.late_fee_date(period: period)
|
17
42
|
|
18
43
|
%p Charged to members, on #{date.strftime('%B %e')}, with outstanding renewal fees
|
19
|
-
|
44
|
+
.row
|
45
|
+
.col-3= f.price_field :late_fee
|
20
46
|
|
21
47
|
%h3 Bad Standing
|
22
48
|
= f.check_box :create_bad_standing, label: 'Yes, bad standing status should be applied'
|
@@ -27,4 +53,4 @@
|
|
27
53
|
|
28
54
|
%p Members with outstanding fees, on #{date.strftime('%B %e')}, will automatically be marked in bad standing.
|
29
55
|
|
30
|
-
=
|
56
|
+
= f.submit
|
@@ -22,7 +22,11 @@
|
|
22
22
|
- else
|
23
23
|
None
|
24
24
|
|
25
|
-
- if applicant.
|
25
|
+
- if applicant.from_status.present?
|
26
|
+
%tr
|
27
|
+
%th From Status
|
28
|
+
%td= applicant.from_status
|
29
|
+
- elsif applicant.from_category.present?
|
26
30
|
%tr
|
27
31
|
%th From Category
|
28
32
|
%td= applicant.from_category
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_memberships
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.10
|
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-09-
|
11
|
+
date: 2022-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -353,13 +353,11 @@ files:
|
|
353
353
|
- app/views/admin/applicants/_status.html.haml
|
354
354
|
- app/views/admin/categories/_form.html.haml
|
355
355
|
- app/views/admin/categories/_form_applicant_content.html.haml
|
356
|
-
- app/views/admin/categories/_form_applicant_eligibility.html.haml
|
357
|
-
- app/views/admin/categories/_form_applicant_fees.html.haml
|
358
356
|
- app/views/admin/categories/_form_applicant_steps.html.haml
|
359
357
|
- app/views/admin/categories/_form_category.html.haml
|
360
358
|
- app/views/admin/categories/_form_fee_payment_content.html.haml
|
361
359
|
- app/views/admin/categories/_form_fee_payment_steps.html.haml
|
362
|
-
- app/views/admin/categories/
|
360
|
+
- app/views/admin/categories/_form_fees.html.haml
|
363
361
|
- app/views/admin/fee_payments/_fee_payment.html.haml
|
364
362
|
- app/views/admin/fees/_fee.html.haml
|
365
363
|
- app/views/admin/fees/_form.html.haml
|
@@ -1,9 +0,0 @@
|
|
1
|
-
= effective_form_with(model: [:admin, category], engine: true) do |f|
|
2
|
-
%h3 Applicant Eligibility
|
3
|
-
= f.check_box :can_apply_new, label: 'Anyone may apply for this category'
|
4
|
-
= f.check_box :can_apply_existing, label: 'Any current member may apply to join'
|
5
|
-
= f.check_box :can_apply_restricted, label: 'Only some current members may apply to join'
|
6
|
-
|
7
|
-
= f.show_if(:can_apply_restricted, true) do
|
8
|
-
- categories = f.object.class.where.not(id: f.object)
|
9
|
-
= f.select :can_apply_restricted_ids, categories, label: 'Existing member categories'
|
@@ -1,24 +0,0 @@
|
|
1
|
-
= effective_form_with(model: [:admin, category], engine: true) do |f|
|
2
|
-
%h3 Applicant Fees
|
3
|
-
.row
|
4
|
-
.col= f.price_field :applicant_fee
|
5
|
-
.col= f.text_field :qb_item_name, label: "Quickbooks Item Name"
|
6
|
-
|
7
|
-
%h3 Pro-rated fees based on date of approval
|
8
|
-
.row
|
9
|
-
.col-lg-3
|
10
|
-
= f.price_field :prorated_jan, label: "January"
|
11
|
-
= f.price_field :prorated_feb, label: "February"
|
12
|
-
= f.price_field :prorated_mar, label: "March"
|
13
|
-
.col-lg-3
|
14
|
-
= f.price_field :prorated_apr, label: "April"
|
15
|
-
= f.price_field :prorated_may, label: "May"
|
16
|
-
= f.price_field :prorated_jun, label: "June"
|
17
|
-
.col-lg-3
|
18
|
-
= f.price_field :prorated_jul, label: "July"
|
19
|
-
= f.price_field :prorated_aug, label: "August"
|
20
|
-
= f.price_field :prorated_sep, label: "September"
|
21
|
-
.col-lg-3
|
22
|
-
= f.price_field :prorated_oct, label: "October"
|
23
|
-
= f.price_field :prorated_nov, label: "November"
|
24
|
-
= f.price_field :prorated_dec, label: "December"
|