effective_memberships 0.15.3 → 0.16.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/datatables/admin/effective_applicants_datatable.rb +1 -1
- data/app/datatables/admin/effective_representatives_datatable.rb +1 -0
- data/app/datatables/effective_applicants_datatable.rb +1 -0
- data/app/datatables/effective_representatives_datatable.rb +1 -0
- data/app/models/concerns/effective_memberships_applicant.rb +47 -8
- data/app/models/concerns/effective_memberships_category.rb +9 -0
- data/app/models/concerns/effective_memberships_registrar.rb +9 -1
- data/app/models/effective/representative.rb +1 -0
- data/app/views/admin/applicants/_form_approve.html.haml +29 -24
- data/app/views/admin/representatives/_form.html.haml +3 -1
- data/app/views/effective/applicants/_reinstatement.html.haml +1 -1
- data/app/views/effective/applicants/_reinstatement_fields.html.haml +1 -0
- data/app/views/effective/applicants/_resignation.html.haml +6 -0
- data/app/views/effective/applicants/reinstatement.html.haml +1 -3
- data/app/views/effective/applicants/resignation.html.haml +15 -0
- data/app/views/effective/applicants/select/_apply_for_resignation.html.haml +4 -0
- data/app/views/effective/applicants/select.html.haml +12 -5
- data/app/views/effective/representatives/_form.html.haml +3 -1
- data/config/locales/effective_memberships.en.yml +4 -0
- data/db/migrate/01_create_effective_memberships.rb.erb +1 -0
- data/lib/effective_memberships/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f05f20be1f211e1d0a3d17270820752b3015ac6790c635c32973c6c928b2f1b1
|
4
|
+
data.tar.gz: b8273500b7e6af71968a2ed83195a5a380f0563ab2750c1b6a0624e87ec5c9e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c298a6e323ce94af492a00ed1aa8addfd1777a1b2023f7715f66d0231868e813d09f59b13adcb14d80da2519b3bf294b52c4eb68ff08c1c466d07a5b257c1ccd
|
7
|
+
data.tar.gz: c7bcfdb569352928092df90df69ec4fcd735354e71a68676721c139eb1f38b5f7bd0b874bdacadebb641309ff7c1cb425c570a31d806d9ffe227082650c5e7cf
|
@@ -30,7 +30,7 @@ module Admin
|
|
30
30
|
col :user
|
31
31
|
col :organization, visible: false
|
32
32
|
|
33
|
-
col :applicant_type
|
33
|
+
col :applicant_type, search: EffectiveMemberships.Applicant.categories
|
34
34
|
col :category, label: 'Applicant Category', search: { collection: EffectiveMemberships.Category.all, polymorphic: false }
|
35
35
|
col :stream
|
36
36
|
col :from_category, search: { collection: EffectiveMemberships.Category.all, polymorphic: false }
|
@@ -24,7 +24,7 @@ module EffectiveMembershipsApplicant
|
|
24
24
|
# Apply for Reinstatement - Must have a removed membership. Membership history.
|
25
25
|
|
26
26
|
def categories
|
27
|
-
['Apply to Join', 'Apply to Reclassify', 'Apply for Reinstatement']
|
27
|
+
['Apply to Join', 'Apply to Reclassify', 'Apply for Resignation', 'Apply for Reinstatement']
|
28
28
|
end
|
29
29
|
|
30
30
|
def transcripts_statuses
|
@@ -54,6 +54,7 @@ module EffectiveMembershipsApplicant
|
|
54
54
|
demographics: 'Demographics', # Individual only. Users fields.
|
55
55
|
organization: 'Organization', # Organization only. Organization fields.
|
56
56
|
reinstatement: 'Reinstatement', # Apply for Reinstatement only
|
57
|
+
resignation: 'Resignation', # Apply for Resignation only
|
57
58
|
education: 'Education',
|
58
59
|
course_amounts: 'Courses',
|
59
60
|
equivalences: 'Equivalent Memberships',
|
@@ -89,6 +90,9 @@ module EffectiveMembershipsApplicant
|
|
89
90
|
# Reinstatements Step
|
90
91
|
attr_accessor :declare_reinstatement
|
91
92
|
|
93
|
+
# Resignations Step
|
94
|
+
attr_accessor :declare_resignation
|
95
|
+
|
92
96
|
# CPD Step
|
93
97
|
attr_accessor :declare_cpd
|
94
98
|
|
@@ -375,6 +379,11 @@ module EffectiveMembershipsApplicant
|
|
375
379
|
validates :declare_reinstatement, acceptance: true
|
376
380
|
end
|
377
381
|
|
382
|
+
# Resignations step
|
383
|
+
with_options(if: -> { current_step == :resignation }) do
|
384
|
+
validates :declare_resignation, acceptance: true
|
385
|
+
end
|
386
|
+
|
378
387
|
# Admin Approve
|
379
388
|
validate(if: -> { approved_membership_date.present? }) do
|
380
389
|
if approved_membership_date.to_date > Time.zone.now.to_date
|
@@ -405,17 +414,25 @@ module EffectiveMembershipsApplicant
|
|
405
414
|
def default_applicant_required_steps
|
406
415
|
return self.class.test_required_steps if Rails.env.test? && self.class.test_required_steps.present?
|
407
416
|
|
408
|
-
# All required
|
417
|
+
# All required steps
|
409
418
|
required_steps = self.class.required_wizard_steps
|
410
419
|
|
411
|
-
#
|
412
|
-
applicant_steps =
|
413
|
-
|
420
|
+
# The applicant steps
|
421
|
+
applicant_steps = if category.blank?
|
422
|
+
self.class.all_wizard_steps
|
423
|
+
elsif reinstatement?
|
424
|
+
category.applicant_reinstatement_wizard_steps
|
425
|
+
elsif resignation?
|
426
|
+
category.applicant_resignation_wizard_steps
|
427
|
+
else
|
428
|
+
category.applicant_wizard_steps
|
429
|
+
end
|
414
430
|
|
415
431
|
# Sanity check
|
416
432
|
applicant_steps.delete(:stamp) unless apply_to_join?
|
417
433
|
applicant_steps.delete(:organization) unless category&.organization?
|
418
434
|
applicant_steps.delete(:reinstatement) unless reinstatement?
|
435
|
+
applicant_steps.delete(:resignation) unless resignation?
|
419
436
|
|
420
437
|
# change_wizard_steps is defined in effective_resources acts_as_wizard
|
421
438
|
applicant_steps = change_wizard_steps(applicant_steps)
|
@@ -459,6 +476,8 @@ module EffectiveMembershipsApplicant
|
|
459
476
|
|
460
477
|
def applicant_fee_price
|
461
478
|
return category.applicant_reinstatement_fee if reinstatement?
|
479
|
+
return category.applicant_resignation_fee if resignation?
|
480
|
+
|
462
481
|
applicant_fee_category.applicant_fee
|
463
482
|
end
|
464
483
|
|
@@ -541,9 +560,13 @@ module EffectiveMembershipsApplicant
|
|
541
560
|
|
542
561
|
# Instance Methods
|
543
562
|
def to_s
|
544
|
-
|
545
|
-
|
546
|
-
|
563
|
+
if applicant_type.blank? || category.blank? || owner.blank?
|
564
|
+
'New Applicant'
|
565
|
+
elsif resignation?
|
566
|
+
"#{owner} - #{applicant_type}"
|
567
|
+
else
|
568
|
+
"#{owner} - #{applicant_type} to #{category}"
|
569
|
+
end
|
547
570
|
end
|
548
571
|
|
549
572
|
def owner
|
@@ -566,6 +589,10 @@ module EffectiveMembershipsApplicant
|
|
566
589
|
applicant_type == 'Apply to Reclassify'
|
567
590
|
end
|
568
591
|
|
592
|
+
def resignation?
|
593
|
+
applicant_type == 'Apply for Resignation'
|
594
|
+
end
|
595
|
+
|
569
596
|
def reinstatement?
|
570
597
|
applicant_type == 'Apply for Reinstatement'
|
571
598
|
end
|
@@ -632,6 +659,8 @@ module EffectiveMembershipsApplicant
|
|
632
659
|
['Apply for Reinstatement', 'Apply to Join']
|
633
660
|
elsif owner.membership.blank? || owner.membership.categories.blank?
|
634
661
|
['Apply to Join']
|
662
|
+
elsif all_steps.include?(:resignation)
|
663
|
+
['Apply to Reclassify', 'Apply for Resignation']
|
635
664
|
else
|
636
665
|
['Apply to Reclassify']
|
637
666
|
end
|
@@ -706,6 +735,7 @@ module EffectiveMembershipsApplicant
|
|
706
735
|
end
|
707
736
|
|
708
737
|
def applicant_references_required?
|
738
|
+
return false if resignation? || reinstatement?
|
709
739
|
min_applicant_references > 0
|
710
740
|
end
|
711
741
|
|
@@ -715,6 +745,7 @@ module EffectiveMembershipsApplicant
|
|
715
745
|
end
|
716
746
|
|
717
747
|
def applicant_endorsements_required?
|
748
|
+
return false if resignation? || reinstatement?
|
718
749
|
min_applicant_endorsements > 0
|
719
750
|
end
|
720
751
|
|
@@ -729,6 +760,7 @@ module EffectiveMembershipsApplicant
|
|
729
760
|
end
|
730
761
|
|
731
762
|
def transcripts_required?
|
763
|
+
return false if resignation? || reinstatement?
|
732
764
|
required_steps.include?(:transcripts)
|
733
765
|
end
|
734
766
|
|
@@ -886,6 +918,7 @@ module EffectiveMembershipsApplicant
|
|
886
918
|
end
|
887
919
|
|
888
920
|
def to_status
|
921
|
+
return EffectiveMemberships.Registrar.resigned_status! if resignation?
|
889
922
|
nil
|
890
923
|
end
|
891
924
|
|
@@ -919,6 +952,12 @@ module EffectiveMembershipsApplicant
|
|
919
952
|
date: approved_membership_date.presence, # Set by the Admin Process form, or nil
|
920
953
|
number: approved_membership_number.presence # Set by the Admin Process form, or nil
|
921
954
|
)
|
955
|
+
elsif resignation?
|
956
|
+
EffectiveMemberships.Registrar.remove!(
|
957
|
+
owner,
|
958
|
+
statuses: to_status,
|
959
|
+
date: approved_membership_date.presence # Set by the Admin Process form, or nil
|
960
|
+
)
|
922
961
|
elsif reinstatement?
|
923
962
|
# No status
|
924
963
|
EffectiveMemberships.Registrar.reinstate!(
|
@@ -224,6 +224,15 @@ module EffectiveMembershipsCategory
|
|
224
224
|
(Array(self[:applicant_wizard_steps]) - [nil, '']).map(&:to_sym)
|
225
225
|
end
|
226
226
|
|
227
|
+
# Apply for Resignation
|
228
|
+
def applicant_resignation_wizard_steps
|
229
|
+
[:resignation]
|
230
|
+
end
|
231
|
+
|
232
|
+
def applicant_resignation_fee
|
233
|
+
0
|
234
|
+
end
|
235
|
+
|
227
236
|
# Apply for Reinstatement
|
228
237
|
def applicant_reinstatement_wizard_steps
|
229
238
|
[:reinstatement]
|
@@ -51,7 +51,15 @@ module EffectiveMembershipsRegistrar
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def not_in_good_standing_status!
|
54
|
-
|
54
|
+
not_in_good_standing_status.first!
|
55
|
+
end
|
56
|
+
|
57
|
+
def resigned_status
|
58
|
+
EffectiveMemberships.Status.where(title: 'Resigned')
|
59
|
+
end
|
60
|
+
|
61
|
+
def resigned_status!
|
62
|
+
resigned_status.first!
|
55
63
|
end
|
56
64
|
|
57
65
|
# These two could be overridden if we do non 1-year periods
|
@@ -1,38 +1,43 @@
|
|
1
1
|
= effective_form_with(model: [:admin, applicant], engine: true) do |f|
|
2
|
-
|
2
|
+
- owner = f.object.owner
|
3
3
|
|
4
|
-
-
|
5
|
-
|
4
|
+
- if f.object.resignation?
|
5
|
+
%p The #{applicant} will be <strong>approved</strong>
|
6
|
+
%p Their membership will be removed and they will be marked as resigned.
|
6
7
|
|
7
|
-
-
|
8
|
+
- elsif f.object.reinstatement?
|
9
|
+
- reinstatement = applicant.owner.reinstatement_membership_history
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
The member will keep their existing membership number: #{applicant.owner.membership.number_was}.
|
12
|
-
- elsif applicant.reinstatement? && reinstatement&.number.present?
|
13
|
-
The member will keep their previous membership number: #{reinstatement.number}.
|
14
|
-
- else
|
15
|
-
- number = EffectiveMemberships.Registrar.next_membership_number(applicant.owner, to: applicant.category)
|
11
|
+
%p The #{applicant} will be <strong>approved</strong>
|
12
|
+
%p Their membership will be reinstated and they will regain the following category, number and status:
|
16
13
|
|
17
|
-
|
14
|
+
%ul
|
15
|
+
%li Category: #{reinstatement.membership_categories.to_sentence}
|
16
|
+
%li Number: #{reinstatement.number}
|
17
|
+
%li Status: #{badges(reinstatement.membership_statuses).presence || 'None'}
|
18
|
+
|
19
|
+
- else
|
20
|
+
%p The #{applicant} will be <strong>approved</strong> to the following membership category:
|
21
|
+
= f.select :category_id, EffectiveMemberships.Category.all, label: 'Approve to'
|
22
|
+
|
23
|
+
%p
|
24
|
+
- if owner.membership&.number_was.present?
|
25
|
+
They will keep their existing membership number: #{applicant.owner.membership.number_was}.
|
26
|
+
- elsif (number = EffectiveMemberships.Registrar.next_membership_number(applicant.owner, to: applicant.category)).present?
|
18
27
|
= f.text_field :approved_membership_number, hint: "leave blank to assign the next number: #{number || 'none'}."
|
19
28
|
- else
|
20
29
|
No membership number will be assigned.
|
21
30
|
|
22
|
-
-
|
23
|
-
|
24
|
-
|
25
|
-
= render('admin/applicants/fees_approve', f: f, applicant: applicant)
|
26
|
-
|
27
|
-
%p The following unpurchased fees will be deleted:
|
28
|
-
- outstanding_fee_payment_fees = applicant.owner.outstanding_fee_payment_fees
|
31
|
+
- unless f.object.resignation?
|
32
|
+
= render('admin/applicants/fees_approve', f: f, applicant: applicant)
|
29
33
|
|
30
|
-
|
31
|
-
|
32
|
-
|
34
|
+
%p The following unpurchased fees will be deleted:
|
35
|
+
%ul
|
36
|
+
- applicant.owner.outstanding_fee_payment_fees.each do |fee|
|
37
|
+
%li= fee
|
33
38
|
|
34
|
-
|
35
|
-
|
39
|
+
- if applicant.owner.outstanding_fee_payment_fees.blank?
|
40
|
+
%li None
|
36
41
|
|
37
42
|
%h3 Email to send
|
38
43
|
- email_templates = applicant.approve_email_templates
|
@@ -11,6 +11,7 @@
|
|
11
11
|
= f.select :organization, { 'Organizations' => EffectiveMemberships.Organization.sorted }, polymorphic: true
|
12
12
|
|
13
13
|
= f.checks :roles, EffectiveRoles.roles_collection(f.object, skip_disabled: true)
|
14
|
+
= f.check_box :display_on_directory
|
14
15
|
|
15
16
|
- unless inline_datatable? && inline_datatable.attributes[:user_id].present?
|
16
17
|
= f.radios :new_representative_user_action, ['Invite new user', 'Add existing user'], inline: true, label: 'Representative'
|
@@ -30,9 +31,10 @@
|
|
30
31
|
= f.static_field :user
|
31
32
|
|
32
33
|
= f.checks :roles, EffectiveRoles.roles_collection(f.object, skip_disabled: true)
|
34
|
+
= f.check_box :display_on_directory
|
33
35
|
|
34
36
|
- unless inline_datatable? && inline_datatable.attributes[:user_id].present?
|
35
37
|
= f.fields_for :user, f.object.user do |fu|
|
36
38
|
= render 'admin/representatives/user_fields', f: fu
|
37
39
|
|
38
|
-
= f.submit
|
40
|
+
= f.submit "Save " + et(f.object)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
%tbody
|
4
4
|
%tr
|
5
5
|
%td= icon('check')
|
6
|
-
%td Yes, I am applying
|
6
|
+
%td Yes, I am applying for reinstatement to #{applicant.from_status || applicant.from_category}
|
7
7
|
%tr
|
8
8
|
%td= icon('check')
|
9
9
|
%td Yes, I have read, understand and agree to the reinstatement declaration
|
@@ -0,0 +1 @@
|
|
1
|
+
= f.check_box :declare_reinstatement, label: "Yes, I am applying for reinstatement to #{f.object.category}"
|
@@ -8,8 +8,6 @@
|
|
8
8
|
= effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
|
9
9
|
= f.hidden_field :id
|
10
10
|
|
11
|
-
=
|
12
|
-
|
13
|
-
= f.check_box :declare_reinstatement, label: 'Yes, I accept and agree to the above'
|
11
|
+
= render("effective/applicants/reinstatement_fields", f: f)
|
14
12
|
|
15
13
|
= f.save 'Save and Continue'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
= render 'layout' do
|
2
|
+
= render 'effective/applicants/content', resource: resource
|
3
|
+
|
4
|
+
- completed = resource.has_completed_step?(:resignation)
|
5
|
+
- resource.declare_resignation = completed
|
6
|
+
|
7
|
+
= card do
|
8
|
+
= effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
|
9
|
+
= f.hidden_field :id
|
10
|
+
|
11
|
+
= render_if_exists("effective/applicants/resignation_fields", f: f)
|
12
|
+
|
13
|
+
= f.check_box :declare_resignation, label: "Yes, I am applying for resignation from #{f.object.category}"
|
14
|
+
|
15
|
+
= f.save 'Save and Continue'
|
@@ -25,19 +25,26 @@
|
|
25
25
|
= render('effective/applicants/select/apply_to_reclassify', f: f)
|
26
26
|
= render('effective/applicants/select/categories', f: f, categories: categories - [existing_category])
|
27
27
|
|
28
|
+
- elsif applicant_types == ['Apply for Resignation']
|
29
|
+
= render('effective/applicants/select/apply_for_resignation', f: f)
|
30
|
+
|
28
31
|
- else
|
29
32
|
= f.select :applicant_type, applicant_types, label: 'Apply to...'
|
30
33
|
|
31
|
-
- if applicant_types.include?('Apply for Reinstatement')
|
32
|
-
= f.show_if :applicant_type, 'Apply for Reinstatement' do
|
33
|
-
= f.hidden_field :category_id, value: reinstatement_category.id
|
34
|
-
= render('effective/applicants/select/apply_for_reinstatement', f: f)
|
35
|
-
|
36
34
|
- if applicant_types.include?('Apply to Join')
|
37
35
|
= f.show_if :applicant_type, 'Apply to Join' do
|
38
36
|
= render('effective/applicants/select/apply_to_join', f: f)
|
39
37
|
= render('effective/applicants/select/categories', f: f, categories: categories)
|
40
38
|
|
39
|
+
- if applicant_types.include?('Apply for Resignation')
|
40
|
+
= f.show_if :applicant_type, 'Apply for Resignation' do
|
41
|
+
= render('effective/applicants/select/apply_for_resignation', f: f)
|
42
|
+
|
43
|
+
- if applicant_types.include?('Apply for Reinstatement')
|
44
|
+
= f.show_if :applicant_type, 'Apply for Reinstatement' do
|
45
|
+
= f.hidden_field :category_id, value: reinstatement_category.id
|
46
|
+
= render('effective/applicants/select/apply_for_reinstatement', f: f)
|
47
|
+
|
41
48
|
- if applicant_types.include?('Apply to Reclassify')
|
42
49
|
= f.show_if :applicant_type, 'Apply to Reclassify' do
|
43
50
|
= render('effective/applicants/select/apply_to_reclassify', f: f)
|
@@ -11,6 +11,7 @@
|
|
11
11
|
= f.select :organization, { 'Organizations' => EffectiveMemberships.Organization.sorted }, polymorphic: true
|
12
12
|
|
13
13
|
= f.checks :roles, EffectiveRoles.roles_collection(f.object, skip_disabled: true)
|
14
|
+
= f.check_box :display_on_directory
|
14
15
|
|
15
16
|
- unless inline_datatable? && inline_datatable.attributes[:user_id].present?
|
16
17
|
= f.hidden_field :new_representative_user_action, value: 'Invite new user'
|
@@ -26,8 +27,9 @@
|
|
26
27
|
= f.static_field :user
|
27
28
|
|
28
29
|
= f.checks :roles, EffectiveRoles.roles_collection(f.object, skip_disabled: true)
|
30
|
+
= f.check_box :display_on_directory
|
29
31
|
|
30
32
|
= f.fields_for :user, f.object.user do |fu|
|
31
33
|
= render 'effective/representatives/user_fields', f: fu
|
32
34
|
|
33
|
-
= f.submit
|
35
|
+
= f.submit "Save " + et(f.object)
|
@@ -38,3 +38,7 @@ en:
|
|
38
38
|
effective/membership_history: 'Membership History'
|
39
39
|
effective/membership: 'Membership'
|
40
40
|
effective/representative: 'Representative'
|
41
|
+
|
42
|
+
attributes:
|
43
|
+
effective/representative:
|
44
|
+
display_on_directory: 'Display this representative on the member directory'
|
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.
|
4
|
+
version: 0.16.1
|
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: 2023-04-
|
11
|
+
date: 2023-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -456,6 +456,8 @@ files:
|
|
456
456
|
- app/views/effective/applicants/_references.html.haml
|
457
457
|
- app/views/effective/applicants/_references_requirements.html.haml
|
458
458
|
- app/views/effective/applicants/_reinstatement.html.haml
|
459
|
+
- app/views/effective/applicants/_reinstatement_fields.html.haml
|
460
|
+
- app/views/effective/applicants/_resignation.html.haml
|
459
461
|
- app/views/effective/applicants/_select.html.haml
|
460
462
|
- app/views/effective/applicants/_select_organization.html.haml
|
461
463
|
- app/views/effective/applicants/_stamp.html.haml
|
@@ -476,8 +478,10 @@ files:
|
|
476
478
|
- app/views/effective/applicants/organization.html.haml
|
477
479
|
- app/views/effective/applicants/references.html.haml
|
478
480
|
- app/views/effective/applicants/reinstatement.html.haml
|
481
|
+
- app/views/effective/applicants/resignation.html.haml
|
479
482
|
- app/views/effective/applicants/select.html.haml
|
480
483
|
- app/views/effective/applicants/select/_apply_for_reinstatement.html.haml
|
484
|
+
- app/views/effective/applicants/select/_apply_for_resignation.html.haml
|
481
485
|
- app/views/effective/applicants/select/_apply_to_join.html.haml
|
482
486
|
- app/views/effective/applicants/select/_apply_to_reclassify.html.haml
|
483
487
|
- app/views/effective/applicants/select/_categories.html.haml
|