effective_memberships 0.4.17 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/admin/registrar_actions_controller.rb +8 -0
  3. data/app/controllers/admin/statuses_controller.rb +19 -0
  4. data/app/datatables/admin/effective_membership_histories_datatable.rb +10 -0
  5. data/app/datatables/admin/effective_memberships_datatable.rb +2 -1
  6. data/app/datatables/admin/effective_statuses_datatable.rb +21 -0
  7. data/app/models/concerns/effective_memberships_applicant.rb +84 -41
  8. data/app/models/concerns/effective_memberships_category.rb +10 -3
  9. data/app/models/concerns/effective_memberships_fee_payment.rb +16 -5
  10. data/app/models/concerns/effective_memberships_owner.rb +37 -7
  11. data/app/models/concerns/effective_memberships_registrar.rb +70 -4
  12. data/app/models/concerns/effective_memberships_status.rb +71 -0
  13. data/app/models/effective/fee.rb +11 -3
  14. data/app/models/effective/membership.rb +41 -3
  15. data/app/models/effective/membership_history.rb +17 -4
  16. data/app/models/effective/membership_status.rb +13 -0
  17. data/app/models/effective/registrar_action.rb +38 -4
  18. data/app/models/effective/status.rb +7 -0
  19. data/app/views/admin/membership_histories/_form.html.haml +2 -0
  20. data/app/views/admin/registrar_actions/_form.html.haml +7 -0
  21. data/app/views/admin/registrar_actions/_form_assign.html.haml +29 -9
  22. data/app/views/admin/registrar_actions/_form_register.html.haml +7 -2
  23. data/app/views/admin/registrar_actions/_form_status_change.html.haml +41 -0
  24. data/app/views/admin/statuses/_form.html.haml +8 -0
  25. data/app/views/admin/statuses/_form_status.html.haml +9 -0
  26. data/app/views/effective/applicants/_reinstatement.html.haml +9 -0
  27. data/app/views/effective/applicants/reinstatement.html.haml +15 -0
  28. data/app/views/effective/applicants/select/_apply_for_reinstatement.html.haml +3 -0
  29. data/app/views/effective/applicants/select/_apply_to_join.html.haml +1 -0
  30. data/app/views/effective/applicants/select/_apply_to_reclassify.html.haml +5 -0
  31. data/app/views/effective/applicants/select/_categories.html.haml +25 -0
  32. data/app/views/effective/applicants/select.html.haml +34 -26
  33. data/config/effective_memberships.rb +4 -0
  34. data/config/routes.rb +2 -1
  35. data/db/migrate/01_create_effective_memberships.rb.erb +38 -0
  36. data/db/seeds.rb +6 -0
  37. data/lib/effective_memberships/engine.rb +1 -0
  38. data/lib/effective_memberships/version.rb +1 -1
  39. data/lib/effective_memberships.rb +10 -7
  40. metadata +16 -2
@@ -0,0 +1 @@
1
+ %p Please select a category for your application to join:
@@ -0,0 +1,5 @@
1
+ - membership = f.object.owner.membership
2
+
3
+ %p Apply to reclassify from #{membership.category}.
4
+
5
+ %p Please select a category for your application to reclassify:
@@ -0,0 +1,25 @@
1
+ - organization_categories = categories.select(&:organization?)
2
+
3
+ - if categories.blank?
4
+ %p
5
+ There are no categories available for you to apply for.
6
+ Please contact us if you believe this is in error.
7
+
8
+ - if categories.present?
9
+ = f.select :category_id, categories, required: true
10
+
11
+ - categories.each do |mc|
12
+ = f.show_if(:category_id, mc.id) do
13
+ .mb-4
14
+ %h3= mc.to_s
15
+
16
+ - if organization_categories.present?
17
+ %small.text-muted #{mc.category} #{mc.category_type} Membership
18
+
19
+ = mc.rich_text_body
20
+
21
+ = render_if_exists("effective/applicants/select/#{mc.to_s.parameterize.underscore}", f: f, category: mc)
22
+
23
+ - if organization_categories.present?
24
+ = f.show_if_any(:category_id, organization_categories.map(&:id)) do
25
+ = render('effective/applicants/select_organization', f: f)
@@ -2,41 +2,49 @@
2
2
  = render 'effective/applicants/content', resource: resource
3
3
 
4
4
  - categories = resource.can_apply_categories_collection()
5
- - organization_categories = categories.select(&:organization?)
5
+ - applicant_types = resource.can_apply_applicant_types_collection()
6
+ - existing_category = resource.owner&.membership&.category
6
7
 
7
8
  = card do
8
- - if categories.blank?
9
- %p
10
- There are no categories available for you to apply for.
11
- Please contact us if you believe this is in error.
9
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
10
+ = f.hidden_field :id
12
11
 
13
- - if categories.present?
14
- %p Please select a category to continue.
12
+ = f.hidden_field :stream, value: nil
13
+ = f.hidden_field :organization_id, value: nil
14
+ = f.hidden_field :organization_type, value: nil
15
15
 
16
- = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
17
- = f.hidden_field :id
16
+ = f.hidden_field :applicant_type, value: applicant_types.first
17
+ = f.hidden_field :category_type, value: EffectiveMemberships.Category.name
18
18
 
19
- = f.hidden_field :stream, value: nil
20
- = f.hidden_field :organization_id, value: nil
21
- = f.hidden_field :organization_type, value: nil
22
- = f.hidden_field :category_type, value: EffectiveMemberships.Category.name
19
+ - if applicant_types == ['Apply to Join']
20
+ = render('effective/applicants/select/apply_to_join', f: f)
21
+ = render('effective/applicants/select/categories', f: f, categories: categories)
23
22
 
24
- = f.select :category_id, categories, required: true
23
+ - elsif applicant_types == ['Apply for Reinstatement']
24
+ = f.hidden_field :applicant_type, value: applicant_types.first
25
+ = f.hidden_field :category_id, value: existing_category.id
26
+ = render('effective/applicants/select/apply_for_reinstatement', f: f)
25
27
 
26
- - categories.each do |mc|
27
- = f.show_if(:category_id, mc.id) do
28
- .mb-4
29
- %h3= mc.to_s
28
+ - elsif applicant_types == ['Apply to Reclassify']
29
+ = render('effective/applicants/select/apply_to_reclassify', f: f)
30
+ = render('effective/applicants/select/categories', f: f, categories: categories - [existing_category])
30
31
 
31
- - if organization_categories.present?
32
- %small.text-muted #{mc.category} #{mc.category_type} Membership
32
+ - else
33
+ = f.select :applicant_type, applicant_types, label: 'Apply to...'
33
34
 
34
- = mc.rich_text_body
35
+ - if applicant_types.include?('Apply to Join')
36
+ = f.show_if :applicant_type, 'Apply to Join' do
37
+ = render('effective/applicants/select/apply_to_join', f: f)
38
+ = render('effective/applicants/select/categories', f: f, categories: categories)
35
39
 
36
- = render_if_exists("effective/applicants/select/#{mc.to_s.parameterize.underscore}", f: f, category: mc)
40
+ - if applicant_types.include?('Apply to Reclassify')
41
+ = f.show_if :applicant_type, 'Apply to Reclassify' do
42
+ = render('effective/applicants/select/apply_to_reclassify', f: f)
43
+ = render('effective/applicants/select/categories', f: f, categories: categories - [existing_category])
37
44
 
38
- - if organization_categories.present?
39
- = f.show_if_any(:category_id, organization_categories.map(&:id)) do
40
- = render('effective/applicants/select_organization', f: f)
45
+ - if applicant_types.include?('Apply for Reinstatement')
46
+ = f.show_if :applicant_type, 'Apply for Reinstatement' do
47
+ = f.hidden_field :category_id, value: existing_category.id
48
+ = render('effective/applicants/select/apply_for_reinstatement', f: f)
41
49
 
42
- = f.save 'Save and Continue'
50
+ = f.save 'Save and Continue'
@@ -5,6 +5,7 @@ EffectiveMemberships.setup do |config|
5
5
  config.fee_payments_table_name = :fee_payments
6
6
  config.organizations_table_name = :organizations
7
7
  config.representatives_table_name = :representatives
8
+ config.statuses_table_name = :statuses
8
9
 
9
10
  # Layout Settings
10
11
  # Configure the Layout per controller, or all at once
@@ -17,8 +18,11 @@ EffectiveMemberships.setup do |config|
17
18
  # config.category_class_name = 'Effective::Category'
18
19
  # config.applicant_class_name = 'Effective::Applicant'
19
20
  # config.applicant_review_class_name = 'Effective::ApplicantReview'
21
+ # config.fee_payment_class_name = 'Effective::FeePayment'
22
+ # config.membership_card_class_name = 'Effective::MembershipCard'
20
23
  # config.registrar_class_name = 'Effective::Registrar'
21
24
  # config.organization_class_name = 'Effective::Organization'
25
+ # config.status_class_name = 'Effective::Status'
22
26
 
23
27
  # Fee Categories
24
28
  # The defaults include: Applicant, Prorated, Renewal, Late, Admin
data/config/routes.rb CHANGED
@@ -46,7 +46,7 @@ EffectiveMemberships::Engine.routes.draw do
46
46
  end
47
47
 
48
48
  resources :fees
49
- resources :categories, except: [:show]
49
+ resources :categories, only: [:index, :edit, :update]
50
50
 
51
51
  resources :applicant_course_areas, except: [:show]
52
52
  resources :applicant_course_names, except: [:show]
@@ -62,6 +62,7 @@ EffectiveMemberships::Engine.routes.draw do
62
62
  end
63
63
 
64
64
  resources :representatives, except: [:show]
65
+ resources :statuses, only: [:index, :edit, :update]
65
66
  end
66
67
 
67
68
  end
@@ -18,6 +18,7 @@ class CreateEffectiveMemberships < ActiveRecord::Migration[6.0]
18
18
 
19
19
  t.text :applicant_wizard_steps
20
20
  t.integer :applicant_fee
21
+ t.integer :applicant_reinstatement_fee
21
22
 
22
23
  t.text :applicant_review_wizard_steps
23
24
 
@@ -65,6 +66,22 @@ class CreateEffectiveMemberships < ActiveRecord::Migration[6.0]
65
66
  add_index :categories, :title
66
67
  add_index :categories, :position
67
68
 
69
+ # Statuses
70
+ create_table :statuses do |t|
71
+ t.string :status_type # Individual or Organization
72
+
73
+ t.string :title
74
+ t.string :status # Freeform
75
+
76
+ t.integer :position
77
+
78
+ t.datetime :updated_at
79
+ t.datetime :created_at
80
+ end
81
+
82
+ add_index :statuses, :title
83
+ add_index :statuses, :position
84
+
68
85
  # Memberships
69
86
  create_table :memberships do |t|
70
87
  t.integer :owner_id
@@ -98,6 +115,15 @@ class CreateEffectiveMemberships < ActiveRecord::Migration[6.0]
98
115
  t.string :membership_type
99
116
  end
100
117
 
118
+ # Membership Statuses Join table
119
+ create_table :membership_statuses do |t|
120
+ t.integer :status_id
121
+ t.string :status_type
122
+
123
+ t.integer :membership_id
124
+ t.string :membership_type
125
+ end
126
+
101
127
  # Membership Histories
102
128
  create_table :membership_histories do |t|
103
129
  t.integer :owner_id
@@ -106,6 +132,9 @@ class CreateEffectiveMemberships < ActiveRecord::Migration[6.0]
106
132
  t.text :categories
107
133
  t.text :category_ids
108
134
 
135
+ t.text :statuses
136
+ t.text :status_ids
137
+
109
138
  t.date :start_on
110
139
  t.date :end_on
111
140
 
@@ -182,6 +211,9 @@ class CreateEffectiveMemberships < ActiveRecord::Migration[6.0]
182
211
  t.integer :from_category_id
183
212
  t.string :from_category_type
184
213
 
214
+ t.integer :from_status_id
215
+ t.string :from_status_type
216
+
185
217
  # Acts as Statused
186
218
  t.string :status
187
219
  t.text :status_steps
@@ -427,6 +459,9 @@ class CreateEffectiveMemberships < ActiveRecord::Migration[6.0]
427
459
  t.integer :category_id
428
460
  t.string :category_type
429
461
 
462
+ t.integer :with_status_id
463
+ t.string :with_status_type
464
+
430
465
  t.string :fee_type
431
466
 
432
467
  t.integer :purchased_order_id
@@ -471,6 +506,9 @@ class CreateEffectiveMemberships < ActiveRecord::Migration[6.0]
471
506
  t.integer :category_id
472
507
  t.string :category_type
473
508
 
509
+ t.integer :with_status_id
510
+ t.string :with_status_type
511
+
474
512
  t.date :period
475
513
 
476
514
  # Acts as Statused
data/db/seeds.rb CHANGED
@@ -9,6 +9,8 @@ if Rails.env.test?
9
9
  Effective::ApplicantCourseName.delete_all
10
10
  end
11
11
 
12
+ Effective::Status.where(title: 'Resigned').first_or_create!
13
+
12
14
  member = Effective::Category.create!(
13
15
  title: "Full Member",
14
16
  can_apply_new: true,
@@ -18,6 +20,7 @@ member = Effective::Category.create!(
18
20
  min_applicant_references: 2,
19
21
  min_applicant_reviews: 2,
20
22
  applicant_fee: 100_00,
23
+ applicant_reinstatement_fee: 50_00,
21
24
  renewal_fee: 250_00,
22
25
  late_fee: 50_00,
23
26
  prorated_jan: 120_00, prorated_feb: 110_00, prorated_mar: 100_00, prorated_apr: 90_00, prorated_may: 80_00, prorated_jun: 70_00,
@@ -34,6 +37,7 @@ student = Effective::Category.create!(
34
37
  min_applicant_references: 0,
35
38
  min_applicant_reviews: 0,
36
39
  applicant_fee: 50_00,
40
+ applicant_reinstatement_fee: 25_00,
37
41
  renewal_fee: 125_00,
38
42
  late_fee: 25_00,
39
43
  prorated_jan: 120_00, prorated_feb: 110_00, prorated_mar: 100_00, prorated_apr: 90_00, prorated_may: 80_00, prorated_jun: 70_00,
@@ -49,6 +53,7 @@ retired = Effective::Category.create!(
49
53
  can_apply_restricted: true,
50
54
  can_apply_restricted_ids: [member.id],
51
55
  applicant_fee: 0,
56
+ applicant_reinstatement_fee: 0,
52
57
  renewal_fee: 0,
53
58
  prorated_jan: 120_00, prorated_feb: 110_00, prorated_mar: 100_00, prorated_apr: 90_00, prorated_may: 80_00, prorated_jun: 70_00,
54
59
  prorated_jul: 60_00, prorated_aug: 50_00, prorated_sep: 40_00, prorated_oct: 30_00, prorated_nov: 20_00, prorated_dec: 10_00,
@@ -66,6 +71,7 @@ member = Effective::Category.create!(
66
71
  min_applicant_references: 2,
67
72
  min_applicant_reviews: 2,
68
73
  applicant_fee: 100_00,
74
+ applicant_reinstatement_fee: 50_00,
69
75
  renewal_fee: 250_00,
70
76
  late_fee: 50_00,
71
77
  prorated_jan: 120_00, prorated_feb: 110_00, prorated_mar: 100_00, prorated_apr: 90_00, prorated_may: 80_00, prorated_jun: 70_00,
@@ -12,6 +12,7 @@ module EffectiveMemberships
12
12
  ActiveSupport.on_load :active_record do
13
13
  ActiveRecord::Base.extend(EffectiveMembershipsOwner::Base)
14
14
  ActiveRecord::Base.extend(EffectiveMembershipsCategory::Base)
15
+ ActiveRecord::Base.extend(EffectiveMembershipsStatus::Base)
15
16
 
16
17
  ActiveRecord::Base.extend(EffectiveMembershipsUser::Base)
17
18
  ActiveRecord::Base.extend(EffectiveMembershipsOrganization::Base)
@@ -1,3 +1,3 @@
1
1
  module EffectiveMemberships
2
- VERSION = '0.4.17'
2
+ VERSION = '0.5.1'
3
3
  end
@@ -6,8 +6,8 @@ module EffectiveMemberships
6
6
 
7
7
  def self.config_keys
8
8
  [
9
- :categories_table_name, :applicants_table_name, :applicant_reviews_table_name, :fee_payments_table_name, :organizations_table_name, :representatives_table_name,
10
- :category_class_name, :organization_class_name, :applicant_class_name, :applicant_review_class_name, :fee_payment_class_name, :registrar_class_name, :membership_card_class_name,
9
+ :categories_table_name, :applicants_table_name, :applicant_reviews_table_name, :fee_payments_table_name, :organizations_table_name, :representatives_table_name, :statuses_table_name,
10
+ :category_class_name, :organization_class_name, :applicant_class_name, :applicant_review_class_name, :fee_payment_class_name, :registrar_class_name, :membership_card_class_name, :status_class_name,
11
11
  :additional_fee_types, :applicant_reviews, :applicant_endorsements_endorser_collection,
12
12
  :layout,
13
13
  :mailer, :parent_mailer, :deliver_method, :mailer_layout, :mailer_sender, :mailer_admin, :mailer_subject, :use_effective_email_templates
@@ -40,14 +40,13 @@ module EffectiveMemberships
40
40
  membership_card_class_name&.constantize || Effective::MembershipCard
41
41
  end
42
42
 
43
- def self.applicant_reviews?
44
- applicant_reviews == true
43
+ def self.Status
44
+ status_class_name&.constantize || Effective::Status
45
45
  end
46
46
 
47
47
  # Singleton
48
48
  def self.Registrar
49
- klass = registrar_class_name&.constantize || Effective::Registrar
50
- klass.new
49
+ (registrar_class_name&.constantize || Effective::Registrar).new
51
50
  end
52
51
 
53
52
  def self.mailer_class
@@ -55,7 +54,7 @@ module EffectiveMemberships
55
54
  end
56
55
 
57
56
  def self.fee_types
58
- required = ['Applicant', 'Prorated', 'Discount', 'Renewal', 'Late', 'Admin']
57
+ required = ['Applicant', 'Reinstatement', 'Prorated', 'Discount', 'Renewal', 'Late', 'Admin']
59
58
  additional = Array(additional_fee_types)
60
59
 
61
60
  (required + additional).uniq.sort
@@ -66,4 +65,8 @@ module EffectiveMemberships
66
65
  ['Admin']
67
66
  end
68
67
 
68
+ def self.applicant_reviews?
69
+ applicant_reviews == true
70
+ end
71
+
69
72
  end
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.17
4
+ version: 0.5.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: 2022-07-08 00:00:00.000000000 Z
11
+ date: 2022-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -267,6 +267,7 @@ files:
267
267
  - app/controllers/admin/organizations_controller.rb
268
268
  - app/controllers/admin/registrar_actions_controller.rb
269
269
  - app/controllers/admin/representatives_controller.rb
270
+ - app/controllers/admin/statuses_controller.rb
270
271
  - app/controllers/effective/applicant_endorsements_controller.rb
271
272
  - app/controllers/effective/applicant_references_controller.rb
272
273
  - app/controllers/effective/applicants_controller.rb
@@ -287,6 +288,7 @@ files:
287
288
  - app/datatables/admin/effective_memberships_datatable.rb
288
289
  - app/datatables/admin/effective_organizations_datatable.rb
289
290
  - app/datatables/admin/effective_representatives_datatable.rb
291
+ - app/datatables/admin/effective_statuses_datatable.rb
290
292
  - app/datatables/effective_applicant_courses_datatable.rb
291
293
  - app/datatables/effective_applicant_educations_datatable.rb
292
294
  - app/datatables/effective_applicant_endorsements_datatable.rb
@@ -308,6 +310,7 @@ files:
308
310
  - app/models/concerns/effective_memberships_organization.rb
309
311
  - app/models/concerns/effective_memberships_owner.rb
310
312
  - app/models/concerns/effective_memberships_registrar.rb
313
+ - app/models/concerns/effective_memberships_status.rb
311
314
  - app/models/concerns/effective_memberships_user.rb
312
315
  - app/models/effective/applicant.rb
313
316
  - app/models/effective/applicant_course.rb
@@ -326,10 +329,12 @@ files:
326
329
  - app/models/effective/membership_card.rb
327
330
  - app/models/effective/membership_category.rb
328
331
  - app/models/effective/membership_history.rb
332
+ - app/models/effective/membership_status.rb
329
333
  - app/models/effective/organization.rb
330
334
  - app/models/effective/registrar.rb
331
335
  - app/models/effective/registrar_action.rb
332
336
  - app/models/effective/representative.rb
337
+ - app/models/effective/status.rb
333
338
  - app/views/admin/applicant_course_areas/_form.html.haml
334
339
  - app/views/admin/applicant_course_areas/_form_applicant_course_area.html.haml
335
340
  - app/views/admin/applicant_course_areas/index.html.haml
@@ -374,8 +379,11 @@ files:
374
379
  - app/views/admin/registrar_actions/_form_reclassify.html.haml
375
380
  - app/views/admin/registrar_actions/_form_register.html.haml
376
381
  - app/views/admin/registrar_actions/_form_remove.html.haml
382
+ - app/views/admin/registrar_actions/_form_status_change.html.haml
377
383
  - app/views/admin/representatives/_form.html.haml
378
384
  - app/views/admin/representatives/_user_fields.html.haml
385
+ - app/views/admin/statuses/_form.html.haml
386
+ - app/views/admin/statuses/_form_status.html.haml
379
387
  - app/views/admin/users/_col.html.haml
380
388
  - app/views/effective/applicant_endorsements/_applicant_endorsement.html.haml
381
389
  - app/views/effective/applicant_endorsements/_datatable_actions.html.haml
@@ -405,6 +413,7 @@ files:
405
413
  - app/views/effective/applicants/_orders.html.haml
406
414
  - app/views/effective/applicants/_organization.html.haml
407
415
  - app/views/effective/applicants/_references.html.haml
416
+ - app/views/effective/applicants/_reinstatement.html.haml
408
417
  - app/views/effective/applicants/_select.html.haml
409
418
  - app/views/effective/applicants/_select_organization.html.haml
410
419
  - app/views/effective/applicants/_stamp.html.haml
@@ -423,7 +432,12 @@ files:
423
432
  - app/views/effective/applicants/files.html.haml
424
433
  - app/views/effective/applicants/organization.html.haml
425
434
  - app/views/effective/applicants/references.html.haml
435
+ - app/views/effective/applicants/reinstatement.html.haml
426
436
  - app/views/effective/applicants/select.html.haml
437
+ - app/views/effective/applicants/select/_apply_for_reinstatement.html.haml
438
+ - app/views/effective/applicants/select/_apply_to_join.html.haml
439
+ - app/views/effective/applicants/select/_apply_to_reclassify.html.haml
440
+ - app/views/effective/applicants/select/_categories.html.haml
427
441
  - app/views/effective/applicants/stamp.html.haml
428
442
  - app/views/effective/applicants/start.html.haml
429
443
  - app/views/effective/applicants/submitted.html.haml