effective_memberships 0.13.7 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (23) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/effective/applicant_endorsements_controller.rb +1 -1
  3. data/app/controllers/effective/applicant_references_controller.rb +2 -2
  4. data/app/datatables/admin/effective_applicant_endorsements_datatable.rb +5 -1
  5. data/app/datatables/admin/effective_applicant_references_datatable.rb +17 -1
  6. data/app/models/concerns/effective_memberships_applicant.rb +47 -34
  7. data/app/models/concerns/effective_memberships_applicant_review.rb +4 -0
  8. data/app/models/concerns/effective_memberships_owner.rb +1 -1
  9. data/app/models/effective/applicant_reference.rb +17 -13
  10. data/app/views/admin/applicant_references/_form.html.haml +18 -0
  11. data/app/views/admin/applicants/_form_applicant.html.haml +10 -10
  12. data/app/views/admin/applicants/_status.html.haml +79 -39
  13. data/app/views/effective/applicant_references/_applicant_reference.html.haml +19 -49
  14. data/app/views/effective/applicant_references/_declaration_requirements.html.haml +1 -0
  15. data/app/views/effective/applicant_references/_form.html.haml +4 -4
  16. data/app/views/effective/applicant_references/_form_declaration.html.haml +30 -16
  17. data/app/views/effective/applicant_references/edit.html.haml +0 -5
  18. data/app/views/effective/applicants/education.html.haml +2 -2
  19. data/app/views/effective/applicants/submitted.html.haml +1 -1
  20. data/app/views/effective/memberships/_membership.html.haml +5 -1
  21. data/db/migrate/01_create_effective_memberships.rb.erb +7 -4
  22. data/lib/effective_memberships/version.rb +1 -1
  23. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fee4d3bcf27de0af18f92b9e8cfa6c1deb2ab8d5269252bda05aa4b5053a474e
4
- data.tar.gz: 1feb91e4f927b50cedadfba765af24eaee716300c65ea3d7d924226d254361ee
3
+ metadata.gz: bcacbcc7726096bc1fc69dafc09a496b4ba8f785117993b0df13efe44436a84f
4
+ data.tar.gz: 89242751748bdac6d8c84c7eed6c2d507b90c8939b090dd0d9ea44fe4c72368f
5
5
  SHA512:
6
- metadata.gz: d6a4a5e2057af3fc3f60f4e56305359f7ffd73a97cd3d2043a2c5f201039670ebd5a85e5ae3a5e2a2df4d3ede01d758b22be3166656192bfb29f30d8a4cb9be3
7
- data.tar.gz: 9548a342bcf721e7cc9e1bdbe222cfcebfd832d25f9b8b26678e1e5943d513dd0b9f5127c7f32b100491dc904ca2f3a55cf37f85a2958f40a39277b385c83827
6
+ metadata.gz: 595711508e4003185f62c09abe28f31639aeaf02377e088a96edff74dc4f99e6dbe6490aacc2dc279f1a1040f8b321786b9d595e93c129e39bed5f1c3c605cbf
7
+ data.tar.gz: aad625e963199c4a01612e925885fd5ce04acafb0290d113f98357d32ba5b2c84b3963cbc1d7775826b5668c68a1944d2d65bea9c9bfbe09661fe3b75858e6b5
@@ -34,7 +34,7 @@ module Effective
34
34
  protected
35
35
 
36
36
  def permitted_params
37
- permitted = params.require(:effective_applicant_endorsement).permit!.except(:token, :last_notified_at, :status, :status_steps, :applicant_id, :endorser_id)
37
+ permitted = params.require(:effective_applicant_endorsement).permit!.except(:token, :last_notified_at, :status, :status_steps)
38
38
 
39
39
  if current_user && current_user.memberships_owners.include?(resource.applicant&.owner)
40
40
  permitted.except(:notes, :accept_declaration)
@@ -23,10 +23,10 @@ module Effective
23
23
  protected
24
24
 
25
25
  def permitted_params
26
- permitted = params.require(:effective_applicant_reference).permit!.except(:token, :last_notified_at, :status, :status_steps, :applicant_id)
26
+ permitted = params.require(:effective_applicant_reference).permit!.except(:token, :last_notified_at, :status, :status_steps)
27
27
 
28
28
  if current_user && current_user.memberships_owners.include?(resource.applicant&.owner)
29
- permitted.except(:reservations, :reservations_reason, :work_history, :accept_declaration)
29
+ permitted.except(:reservations, :reservations_reason, :recommendation, :recommendation_reason, :title, :regulated_professional, :work_history, :accept_declaration)
30
30
  else
31
31
  permitted
32
32
  end
@@ -2,7 +2,11 @@ module Admin
2
2
  class EffectiveApplicantEndorsementsDatatable < Effective::Datatable
3
3
 
4
4
  datatable do
5
- order :name
5
+ order :updated_at
6
+
7
+ col :updated_at, visible: false
8
+ col :created_at, visible: false
9
+ col :id, visible: false
6
10
 
7
11
  col :applicant
8
12
 
@@ -2,22 +2,38 @@ module Admin
2
2
  class EffectiveApplicantReferencesDatatable < Effective::Datatable
3
3
 
4
4
  datatable do
5
- order :name
5
+ order :updated_at
6
+
7
+ col :updated_at, visible: false
8
+ col :created_at, visible: false
9
+ col :id, visible: false
6
10
 
7
11
  col :applicant
8
12
 
9
13
  col :name
10
14
  col :email
11
15
  col :phone
16
+ col :title
17
+ col :regulated_professional, visible: false
12
18
 
13
19
  col :status do |reference|
14
20
  if reference.submitted?
15
21
  'Waiting on response'
16
22
  elsif reference.completed?
17
23
  'Completed'
24
+ else
25
+ reference.status
18
26
  end
19
27
  end
20
28
 
29
+ col :work_history, visible: false
30
+
31
+ col :reservations
32
+ col :reservations_reason, visible: false
33
+
34
+ col :recommendation
35
+ col :recommendation_reason, visible: false
36
+
21
37
  col :last_notified_at do |reference|
22
38
  reference.last_notified_at&.strftime('%F') unless reference.completed?
23
39
  end
@@ -391,39 +391,41 @@ module EffectiveMembershipsApplicant
391
391
  validates :missing_info_reason, presence: true, if: -> { missing_info? }
392
392
 
393
393
  # These two try completed and try reviewed
394
- # before_save(if: -> { submitted? }) { complete! }
395
- # before_save(if: -> { completed? }) { review! }
394
+ # before_save(if: -> { submitted? }) { try_completed! }
395
+ # before_save(if: -> { completed? }) { try_reviewed! }
396
396
 
397
397
  # Clear required steps memoization
398
398
  after_save { @_required_steps = nil }
399
399
 
400
400
  # This required_steps is defined inside the included do .. end block so it overrides the acts_as_wizard one.
401
401
  def required_steps
402
+ @_required_steps ||= default_applicant_required_steps()
403
+ end
404
+
405
+ def default_applicant_required_steps
402
406
  return self.class.test_required_steps if Rails.env.test? && self.class.test_required_steps.present?
403
407
 
404
- @_required_steps ||= begin
405
- # All required
406
- required_steps = self.class.required_wizard_steps
408
+ # All required
409
+ required_steps = self.class.required_wizard_steps
407
410
 
408
- # Based on current applicant
409
- applicant_steps = self.class.all_wizard_steps if category.blank?
410
- applicant_steps ||= (reinstatement? ? category.applicant_reinstatement_wizard_steps : category.applicant_wizard_steps)
411
+ # Based on current applicant
412
+ applicant_steps = self.class.all_wizard_steps if category.blank?
413
+ applicant_steps ||= (reinstatement? ? category.applicant_reinstatement_wizard_steps : category.applicant_wizard_steps)
411
414
 
412
- # Sanity check
413
- applicant_steps.delete(:stamp) unless apply_to_join?
414
- applicant_steps.delete(:organization) unless category&.organization?
415
- applicant_steps.delete(:reinstatement) unless reinstatement?
415
+ # Sanity check
416
+ applicant_steps.delete(:stamp) unless apply_to_join?
417
+ applicant_steps.delete(:organization) unless category&.organization?
418
+ applicant_steps.delete(:reinstatement) unless reinstatement?
416
419
 
417
- # change_wizard_steps is defined in effective_resources acts_as_wizard
418
- applicant_steps = change_wizard_steps(applicant_steps)
420
+ # change_wizard_steps is defined in effective_resources acts_as_wizard
421
+ applicant_steps = change_wizard_steps(applicant_steps)
419
422
 
420
- unless applicant_steps.kind_of?(Array) && applicant_steps.all? { |step| step.kind_of?(Symbol) }
421
- raise('expected change_wizard_steps to return an Array of steps with no nils')
422
- end
423
+ unless applicant_steps.kind_of?(Array) && applicant_steps.all? { |step| step.kind_of?(Symbol) }
424
+ raise('expected change_wizard_steps to return an Array of steps with no nils')
425
+ end
423
426
 
424
- self.class.all_wizard_steps.select do |step|
425
- required_steps.include?(step) || applicant_steps.include?(step)
426
- end
427
+ self.class.all_wizard_steps.select do |step|
428
+ required_steps.include?(step) || applicant_steps.include?(step)
427
429
  end
428
430
  end
429
431
 
@@ -596,7 +598,12 @@ module EffectiveMembershipsApplicant
596
598
  summary = "Application has been purchased and submitted."
597
599
  tasks = "The following tasks remain before it can be completed:"
598
600
  approval = "Waiting on approval."
599
- items = completed_requirements.map { |item, done| "<li>#{item}: #{done ? 'Complete' : 'Incomplete'}</li>" }.join
601
+
602
+ items = completed_requirements.map do |item, done|
603
+ done = (done ? 'Complete' : 'Incomplete') unless done.is_a?(String) || done.is_a?(Symbol)
604
+ "<li>#{item}: #{done}</li>"
605
+ end.join
606
+
600
607
  completed_requirements.present? ? "<p>#{summary} #{tasks}</p><ul>#{items}</ul>" : "#{summary} #{approval}"
601
608
  when 'completed'
602
609
  if applicant_reviews_required?
@@ -638,7 +645,7 @@ module EffectiveMembershipsApplicant
638
645
  return categories.where(can_apply_new: true)
639
646
  end
640
647
 
641
- category_ids = user.membership.category_ids.map(&:to_s) - [nil, '']
648
+ category_ids = Array(user.membership&.category_ids).map(&:to_s) - [nil, '']
642
649
 
643
650
  categories.select do |category|
644
651
  category.can_apply_new? ||
@@ -699,7 +706,7 @@ module EffectiveMembershipsApplicant
699
706
  end
700
707
 
701
708
  def applicant_references_required?
702
- required_steps.include?(:references) && min_applicant_references > 0
709
+ min_applicant_references > 0
703
710
  end
704
711
 
705
712
  # Endorsements Step
@@ -708,7 +715,7 @@ module EffectiveMembershipsApplicant
708
715
  end
709
716
 
710
717
  def applicant_endorsements_required?
711
- required_steps.include?(:endorsements) && min_applicant_endorsements > 0
718
+ min_applicant_endorsements > 0
712
719
  end
713
720
 
714
721
  # Equivalences Step
@@ -768,16 +775,16 @@ module EffectiveMembershipsApplicant
768
775
  requirements = {}
769
776
  return requirements unless category.present?
770
777
 
771
- if applicant_endorsements_required?
772
- requirements['Applicant Endorsements'] = (applicant_endorsements.count(&:completed?) >= min_applicant_endorsements)
778
+ if all_steps.include?(:transcripts) || transcripts_required?
779
+ requirements['Transcripts'] = ('Not Required' unless transcripts_required?) || transcripts_received?
773
780
  end
774
781
 
775
- if applicant_references_required?
776
- requirements['Applicant References'] = (applicant_references.count(&:completed?) >= min_applicant_references)
782
+ if all_steps.include?(:ensorsements) || applicant_endorsements_required?
783
+ requirements['Endorsements'] = ('Not Required' unless applicant_endorsements_required?) || (applicant_endorsements.count(&:completed?) >= min_applicant_endorsements)
777
784
  end
778
785
 
779
- if transcripts_required?
780
- requirements['Applicant Transcripts'] = transcripts_received?
786
+ if all_steps.include?(:references) || applicant_references_required?
787
+ requirements['References'] = ('Not Required' unless applicant_references_required?) || (applicant_references.count(&:completed?) >= min_applicant_references)
781
788
  end
782
789
 
783
790
  requirements
@@ -820,7 +827,7 @@ module EffectiveMembershipsApplicant
820
827
  end
821
828
 
822
829
  def applicant_reviews_required?
823
- (min_applicant_reviews > 0 || applicant_reviews.present?)
830
+ min_applicant_reviews > 0
824
831
  end
825
832
 
826
833
  def min_applicant_reviews
@@ -843,17 +850,23 @@ module EffectiveMembershipsApplicant
843
850
  requirements = {}
844
851
  return requirements unless category.present?
845
852
 
846
- if applicant_reviews_required?
847
- requirements['Applicant Reviews'] = (applicant_reviews.count(&:done?) >= min_applicant_reviews)
853
+ if EffectiveMemberships.applicant_reviews?
854
+ requirements['Reviews'] = ('Not Required' unless applicant_reviews_required?) || (applicant_reviews.count(&:completed?) >= min_applicant_reviews)
848
855
  end
849
856
 
850
857
  requirements
851
858
  end
852
859
 
860
+ # Called when an applicant is submitted
861
+ def try_completed!
862
+ return false unless submitted? && completed_requirements.values.all?
863
+ complete!
864
+ end
865
+
853
866
  # Called when an applicant_review was submitted
854
867
  def try_reviewed!
855
868
  return false unless completed? && reviewed_requirements.values.all?
856
- reviewed!
869
+ review!
857
870
  end
858
871
 
859
872
  def review!
@@ -86,6 +86,10 @@ module EffectiveMembershipsApplicantReview
86
86
  submitted?
87
87
  end
88
88
 
89
+ def completed?
90
+ submitted?
91
+ end
92
+
89
93
  def can_visit_step?(step)
90
94
  return (step == :submitted) if was_submitted?
91
95
  can_revisit_completed_steps(step)
@@ -160,7 +160,7 @@ module EffectiveMembershipsOwner
160
160
  end
161
161
 
162
162
  def registrar_action_statuses(action)
163
- EffectiveMemberships.Status.sorted.all
163
+ EffectiveMemberships.Status.sorted.all.where.not(id: EffectiveMemberships.Registrar.not_in_good_standing_status)
164
164
  end
165
165
 
166
166
  def after_build_fee(fee)
@@ -12,29 +12,36 @@ module Effective
12
12
 
13
13
  log_changes(to: :applicant) if respond_to?(:log_changes)
14
14
 
15
- belongs_to :applicant, polymorphic: true
15
+ belongs_to :applicant, polymorphic: true, optional: true
16
16
 
17
17
  KNOWNS = ['6 months - 1 year', '1 year - 2 years', '2 - 5 years', '5 - 10 years', 'More than 10 years']
18
18
  RELATIONSHIPS = ['Supervisor', 'Employer', 'Colleague', 'Other']
19
+ RECOMMENDATIONS = ['Recommend for Membership', 'Do not recommend for Membership']
19
20
 
20
21
  effective_resource do
21
- # These two fields are submitted on the Applicant wizard step
22
+ # These fields are submitted on the Applicant wizard references step
22
23
  name :string
23
24
  email :string
24
25
  phone :string
25
26
 
27
+ known :string
28
+ relationship :string
29
+
26
30
  # As per acts_as_statused. For tracking the state machine.
27
31
  status :string
28
32
  status_steps :text
29
33
 
30
34
  # Reference Declaration
31
- known :string
32
- relationship :string
35
+ title :string
36
+ regulated_professional :boolean
37
+
38
+ work_history :text
33
39
 
34
40
  reservations :boolean
35
41
  reservations_reason :text
36
42
 
37
- work_history :text
43
+ recommendation :string
44
+ recommendation_reason :text
38
45
 
39
46
  accept_declaration :boolean
40
47
 
@@ -48,27 +55,24 @@ module Effective
48
55
  scope :deep, -> { all }
49
56
 
50
57
  # All step validations
51
- validates :applicant, presence: true
52
-
53
58
  validates :name, presence: true
54
59
  validates :email, presence: true, email: true
55
- validates :phone, presence: true
56
-
57
- validates :relationship, presence: true
58
- validates :known, presence: true
59
60
 
60
61
  # When being submit by the reference
61
- with_options(if: -> { completed? }) do
62
+ with_options(if: -> { just_completed? }) do
62
63
  validates :reference_address, presence: true
63
64
  validates :reservations_reason, presence: true, if: -> { completed? && reservations? }
64
65
  validates :work_history, presence: true
65
66
  validates :accept_declaration, acceptance: true
67
+
68
+ validates :recommendation, presence: true
69
+ validates :recommendation_reason, presence: true, if: -> { completed? && recommendation.present? }
66
70
  end
67
71
 
68
72
  after_commit(on: :create, if: -> { applicant.was_submitted? && !applicant.done? }, unless: -> { email_form_skip }) { notify! }
69
73
 
70
74
  def to_s
71
- 'reference'
75
+ name.presence || 'reference'
72
76
  end
73
77
 
74
78
  def notify!
@@ -0,0 +1,18 @@
1
+ = effective_form_with(model: [:admin, applicant_reference], engine: true) do |f|
2
+ = f.hidden_field :applicant_type
3
+ = f.hidden_field :applicant_id
4
+
5
+ = f.text_field :name
6
+
7
+ .row
8
+ .col= f.email_field :email
9
+ .col= f.tel_field :phone
10
+
11
+ - applicant = f.object.applicant
12
+ - will_send = applicant.present? && applicant.was_submitted? && !applicant.done?
13
+
14
+ - if f.object.new_record? && will_send
15
+ %p An email will be sent asking them to complete a reference declaration form.
16
+ = f.submit('Create and Notify Reference')
17
+ - else
18
+ = f.submit
@@ -17,28 +17,28 @@
17
17
  = render 'effective/applicants/applicant', applicant: applicant, namespace: :admin
18
18
 
19
19
  - # Just normal tabs now
20
- - if applicant.applicant_reviews.present? || applicant.was_completed?
21
- = tab 'Reviews' do
22
- .mb-4= render_inline_datatable(Admin::EffectiveApplicantReviewsDatatable.new(applicant: applicant))
23
-
24
20
  - if applicant.was_submitted? && !applicant.was_approved?
25
21
  = tab 'Process' do
26
22
  = render 'admin/applicants/form_process', applicant: applicant
27
23
 
28
- - if applicant.applicant_references.present?
24
+ - if applicant.was_submitted? && applicant.required_steps.include?(:transcripts)
25
+ = tab 'Transcripts' do
26
+ = render 'admin/applicants/form_transcripts', applicant: applicant
27
+
28
+ - if applicant.was_submitted? && applicant.required_steps.include?(:references)
29
29
  = tab 'References' do
30
30
  .mb-4= render_inline_datatable(Admin::EffectiveApplicantReferencesDatatable.new(applicant: applicant))
31
31
 
32
- - if applicant.applicant_endorsements.present?
32
+ - if applicant.was_submitted? && applicant.required_steps.include?(:endorsements)
33
33
  = tab 'Endorsements' do
34
34
  .mb-4= render_inline_datatable(Admin::EffectiveApplicantEndorsementsDatatable.new(applicant: applicant))
35
35
 
36
- - if applicant.transcripts_required?
37
- = tab 'Transcripts' do
38
- = render 'admin/applicants/form_transcripts', applicant: applicant
39
-
40
36
  = yield
41
37
 
38
+ - if applicant.applicant_reviews.present? || applicant.was_completed?
39
+ = tab 'Reviews' do
40
+ .mb-4= render_inline_datatable(Admin::EffectiveApplicantReviewsDatatable.new(applicant: applicant))
41
+
42
42
  - if applicant.fees.present? || applicant.orders.present?
43
43
  = tab 'Fees' do
44
44
  .mb-4
@@ -41,32 +41,66 @@
41
41
  %td= applicant.submitted_at&.strftime('%F') || '-'
42
42
  %td
43
43
  - applicant.completed_requirements.each do |requirement, completed|
44
- - next if requirement.to_s == 'Applicant References'
45
44
 
46
- %p
47
- = icon((completed ? 'check' : 'x'), class: 'small-1')
48
- = requirement
45
+ - if requirement == 'References' && applicant.applicant_references_required?
46
+ %p
47
+ = icon((completed ? 'check' : 'x'), class: 'small-1')
49
48
 
50
- - if applicant.applicant_references_required?
51
- %p
52
- - if applicant.completed_requirements['Applicant References']
53
- = icon('check', class: 'small-1')
49
+ = applicant.applicant_references.count(&:completed?)
50
+ = '/'
51
+ = applicant.min_applicant_references
54
52
 
55
- = applicant.applicant_references.count(&:completed?)
56
- = '/'
57
- = applicant.min_applicant_references
58
- Required References Responded
59
- - else
60
- - if applicant.applicant_references.present?
53
+ Required References Responded
54
+
55
+ - elsif requirement == 'References' && (!applicant.applicant_references_required? || applicant.applicant_references.present?)
61
56
  %p
62
- = applicant.applicant_references.count(&:completed?)
57
+ = icon((completed ? 'check' : 'x'), class: 'small-1')
58
+ References Not Required
59
+
60
+ - if applicant.applicant_references.present?
61
+ %p
62
+ = applicant.applicant_references.count(&:completed?)
63
+ = '/'
64
+ = applicant.applicant_references.count
65
+ References Responded
66
+
67
+ - elsif requirement == 'Endorsements' && applicant.applicant_endorsements_required?
68
+ %p
69
+ = icon((completed ? 'check' : 'x'), class: 'small-1')
70
+
71
+ = applicant.applicant_endorsements.count(&:completed?)
63
72
  = '/'
64
- = applicant.applicant_references.count
65
- References Responded
73
+ = applicant.min_applicant_endorsements
74
+
75
+ Required Endorsements Responded
76
+
77
+ - elsif requirement == 'Endorsements' && (!applicant.applicant_endorsements_required? || applicant.applicant_endorsements.present?)
78
+ %p
79
+ = icon((completed ? 'check' : 'x'), class: 'small-1')
80
+ Endorsements Not Required
81
+
82
+ - if applicant.applicant_endorsements.present?
83
+ %p
84
+ = applicant.applicant_endorsements.count(&:completed?)
85
+ = '/'
86
+ = applicant.applicant_endorsements.count
87
+ Endorsements Responded
88
+
89
+ - elsif requirement == 'Transcripts' && applicant.transcripts_required?
90
+ %p
91
+ = icon((completed ? 'check' : 'x'), class: 'small-1')
92
+ Transcripts Received
93
+
94
+ - elsif requirement == 'Transcripts' && !applicant.transcripts_required?
95
+ %p
96
+ = icon((completed ? 'check' : 'x'), class: 'small-1')
97
+ Transcripts Not Required
66
98
 
67
- %p
68
- = icon('check', class: 'small-1')
69
- References Not Required
99
+ - else
100
+ %p
101
+ = icon((completed ? 'check' : 'x'), class: 'small-1')
102
+ = requirement
103
+ = 'Not Required' if completed == 'Not Required'
70
104
 
71
105
  %td
72
106
  - if applicant.submitted?
@@ -96,25 +130,31 @@
96
130
  %td= applicant.reviewed_at&.strftime('%F') || '-'
97
131
  %td
98
132
  - applicant.reviewed_requirements.each do |requirement, completed|
99
- - next if requirement.to_s == 'Applicant Reviews'
100
-
101
- %p
102
- = icon((completed ? 'check' : 'x'), class: 'small-1')
103
- = requirement
104
-
105
- - if applicant.applicant_reviews_required?
106
- %p
107
- - if applicant.reviewed_requirements['Applicant Reviews']
108
- = icon('check', class: 'small-1')
109
-
110
- = applicant.applicant_reviews.count(&:submitted?)
111
- = '/'
112
- = applicant.min_applicant_reviews
113
- Reviews Submitted
114
- - else
115
- %p
116
- = icon('check', class: 'small-1')
117
- Reviews Not Required
133
+ - if requirement == 'Reviews' && applicant.applicant_reviews_required?
134
+ %p
135
+ = icon((completed ? 'check' : 'x'), class: 'small-1')
136
+
137
+ = applicant.applicant_reviews.count(&:completed?)
138
+ = '/'
139
+ = applicant.min_applicant_reviews
140
+
141
+ Reviews Submitted
142
+
143
+ - elsif requirement == 'Reviews' && (!applicant.applicant_reviews_required? || applicant.applicant_reviews.present?)
144
+ %p
145
+ = icon((completed ? 'check' : 'x'), class: 'small-1')
146
+ Reviews Not Required
147
+
148
+ - if applicant.applicant_reviews.present?
149
+ %p
150
+ = applicant.applicant_reviews.count(&:completed?)
151
+ Reviews Submitted
152
+
153
+ - else
154
+ %p
155
+ = icon((completed ? 'check' : 'x'), class: 'small-1')
156
+ = requirement
157
+ = 'Not Required' if completed == 'Not Required'
118
158
 
119
159
  %td
120
160
  - # Button to create reviews here
@@ -1,51 +1,21 @@
1
1
  - reference = applicant_reference
2
2
 
3
- %table.table.table-sm
4
- %tbody
5
- %tr
6
- %th Name
7
- %td= link_to("#{reference.name} <#{reference.email}>", "mailto:#{reference.email}")
8
-
9
- %tr
10
- %th Known
11
- %td= reference.known
12
-
13
- %tr
14
- %th Relationship
15
- %td= reference.relationship
16
-
17
- - if reference.applicant.was_submitted?
18
- %tr
19
- %th Status
20
- %td
21
- - if reference.submitted?
22
- Waiting on response
23
- - elsif reference.completed?
24
- Response completed
25
-
26
- - unless reference.applicant.was_approved?
27
- %tr
28
- %th Last Notified at
29
- %td= reference.last_notified_at&.strftime('%F') || 'Never'
30
-
31
- - if can?(:notify, reference) && !local_assigns[:skip_actions]
32
- %tr
33
- %th Notification
34
- %td= link_to('Resend email notification', effective_memberships.notify_applicant_reference_path(reference), 'data-method': :post, 'data-confirm': "Really resend email notification to #{reference.email}?")
35
-
36
- - if reference.completed? && can?(:review, reference)
37
- %tr
38
- %th Address
39
- %td= reference.reference_address.to_html
40
-
41
- %tr
42
- %th Reservations
43
- %td
44
- - if reference.reservations?
45
- = reference.reservations_reason
46
- - else
47
- None
48
-
49
- %tr
50
- %th Work History
51
- %td= reference.work_history
3
+ = card(et(reference)) do
4
+ = effective_table_with(reference, only: [:applicant, :name, :email, :known, :relationship, :status, :last_notified_at]) do |f|
5
+ = f.content_for :status do
6
+ - if reference.submitted?
7
+ Waiting on response
8
+ - elsif reference.completed?
9
+ Response completed
10
+ - else
11
+ = f.object.status
12
+
13
+ = f.content_for :last_notified_at do
14
+ = reference.last_notified_at&.strftime('%F') || 'Never'
15
+
16
+ - if EffectiveResources.authorized?(self, :notify, reference) && !local_assigns[:skip_actions]
17
+ %p.mt-2= link_to('Resend email notification', effective_memberships.notify_applicant_reference_path(reference), 'data-method': :post, 'data-confirm': "Really resend email notification to #{reference.email}?")
18
+
19
+ - if reference.completed? && can?(:review, reference)
20
+ = card(et(reference) + ' Response') do
21
+ = effective_table_with(reference, only: [:title, :reference_address, :regulated_professional, :work_history, :reservations, :reservations_reason, :recommendation, :recommendation_reason])
@@ -0,0 +1 @@
1
+ %p Please confirm your name, email, phone and address:
@@ -1,16 +1,16 @@
1
1
  = effective_form_with(model: applicant_reference, engine: true) do |f|
2
- = f.hidden_field :applicant_id
3
2
  = f.hidden_field :applicant_type
3
+ = f.hidden_field :applicant_id
4
4
 
5
5
  = f.text_field :name
6
6
 
7
7
  .row
8
8
  .col= f.email_field :email
9
- .col= f.tel_field :phone
9
+ .col= f.tel_field :phone, required: true
10
10
 
11
11
  .row
12
- .col= f.select :relationship, Effective::ApplicantReference::RELATIONSHIPS
13
- .col= f.select :known, Effective::ApplicantReference::KNOWNS, label: 'Known for'
12
+ .col= f.select :relationship, Effective::ApplicantReference::RELATIONSHIPS, required: true
13
+ .col= f.select :known, Effective::ApplicantReference::KNOWNS, label: 'Known for', required: true
14
14
 
15
15
  - if f.object.new_record?
16
16
  %p An email will be sent asking them to complete a reference declaration form.
@@ -1,38 +1,52 @@
1
1
  = effective_form_with(model: applicant_reference, engine: true) do |f|
2
+ - user = f.object.applicant.owner
2
3
 
3
- %h2 My Information
4
- %p Please confirm your name, email, phone and address:
4
+ %p
5
+ Please provide a reference for
6
+ = succeed('.') do
7
+ %strong= user
5
8
 
9
+ = render('effective/applicant_references/declaration_requirements', f: f)
10
+
11
+ %h2 Contact Info
6
12
  .row
7
13
  .col= f.text_field :name
8
14
  .col= f.email_field :email
9
- .col= f.tel_field :phone
15
+ .col= f.tel_field :phone, required: true
16
+
17
+ = f.text_field :title, label: 'Job Position or Professional Title(s)', hint: 'job title and/or professional designations or degrees'
10
18
 
11
19
  = effective_address_fields(f, :reference_address)
12
20
 
13
- %h2 Applicant Reference
21
+ = f.check_box :regulated_professional,
22
+ label: 'Yes, I am a member of a regulated profession',
23
+ hint: 'a regulated profession is a body governed by law and subject to a code of ethics and disciplinary action. By choosing yes, you are confirming that you are in good standing with your regulated professional body.'
24
+
25
+ %h2= et(f.object)
14
26
 
15
- = f.select :known, Effective::ApplicantReference::KNOWNS, label: 'I have known the applicant for', required: true
27
+ = f.select :known, Effective::ApplicantReference::KNOWNS, label: "I have known #{user} for", required: true
16
28
 
17
29
  = f.radios :relationship, Effective::ApplicantReference::RELATIONSHIPS, required: true,
18
- label: 'I have known or been associated with the applicant as their'
30
+ label: "I have known or been associated with #{user} as their"
19
31
 
20
32
  - reservations = [['Yes, I have reservations', true], ['No, I do not have reservations', false]]
21
33
 
34
+ = f.text_area :work_history,
35
+ label: "Work History - Please provide information on the their work history and work ethic",
36
+ hint: "If you are an employer or supervisor please provide information on the term of employment, the responsibilities of the position, and any significant projects undertaken by the individual of which you are aware or with which you have been involved."
37
+
38
+ %hr
39
+
22
40
  = f.radios :reservations, reservations,
23
- label: "Do you have any reservations about the applicant?", inline: true, required: true
41
+ label: "Do you have any reservations about #{user}?", inline: true, required: true
24
42
 
25
43
  = f.show_if :reservations, true do
26
- .mt-2
27
- = f.text_area :reservations_reason,
28
- label: 'Please provide a brief but candid explanation of your reservations'
29
-
30
- .mt-4
44
+ = f.text_area :reservations_reason, label: 'Please provide a brief but candid explanation of your reservations'
31
45
 
32
- = f.text_area :work_history,
33
- label: "Work History - Please provide information on the applicant's work history and work ethic",
34
- hint: "If you are an employer or supervisor please provide information on the term of employment, the responsibilities of the position, and any significant projects undertaken by the individual of which you are aware or with which you have been involved."
46
+ = f.radios :recommendation, Effective::ApplicantReference::RECOMMENDATIONS, label: 'Your recommendation'
47
+ = f.text_area :recommendation_reason, label: 'Please provide an explanation of your recommendation'
35
48
 
49
+ .mt-4
36
50
  = f.check_box :accept_declaration, label: 'Yes, I declare that the above information is true and accurate'
37
51
 
38
- = f.submit 'Complete Reference'
52
+ = f.submit 'Complete ' + et(f.object), 'data-confirm': "Complete #{et(f.object)} for #{user}?", class: 'btn btn-lg btn-primary btn-block'
@@ -1,7 +1,2 @@
1
1
  = card do
2
- %p
3
- Please provide a reference for the applicant
4
- = succeed('.') do
5
- %strong= @applicant_reference.applicant.owner
6
-
7
2
  = render('form_declaration', applicant_reference: @applicant_reference)
@@ -3,7 +3,7 @@
3
3
 
4
4
  = card do
5
5
  - if resource.min_applicant_educations > 0
6
- .alert.alert-danger You must include #{resource.min_applicant_educations} or more post-secondary educations.
6
+ %p You must include #{resource.min_applicant_educations} or more post-secondary educations.
7
7
 
8
8
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
9
9
  = f.hidden_field :id
@@ -19,7 +19,7 @@
19
19
 
20
20
  .row
21
21
  .col= aef.date_field :start_on, label: 'Start Date'
22
- .col= aef.date_field :end_on, label: 'Graduation Date'
22
+ .col= aef.date_field :end_on, label: 'Graduation Date', hint: 'If you are still attending, leave this blank'
23
23
 
24
24
  = render_if_exists("effective/applicants/education_fields", f: f)
25
25
 
@@ -27,7 +27,7 @@
27
27
  %h3 Transcripts
28
28
  = render 'effective/applicants/transcripts_requirements', applicant: resource
29
29
 
30
- - if resource.min_applicant_references.to_i > 0 || resource.applicant_references.present?
30
+ - if resource.required_steps.include?(:references) || resource.applicant_references.present?
31
31
  = card do
32
32
  %h3 Confidential References
33
33
  %p
@@ -26,7 +26,7 @@
26
26
  - if membership.statuses.length == 0
27
27
  %tr
28
28
  %th Status
29
- %td None
29
+ %td= '-'
30
30
  - elsif membership.statuses.length == 1
31
31
  %tr
32
32
  %th Status
@@ -45,3 +45,7 @@
45
45
  %tr
46
46
  %th Fees Paid Through
47
47
  %td= membership.fees_paid_through_period&.strftime('%F') || '-'
48
+
49
+ %tr
50
+ %th Outstanding Fees
51
+ %td= membership.owner.fees.reject(&:purchased?).count
@@ -312,16 +312,19 @@ class CreateEffectiveMemberships < ActiveRecord::Migration[6.0]
312
312
  t.string :name
313
313
  t.string :email
314
314
  t.string :phone
315
+ t.string :known
316
+ t.string :relationship
315
317
 
316
318
  t.string :status
317
319
  t.text :status_steps
318
- t.string :known
319
- t.string :relationship
320
320
 
321
+ t.string :title
322
+ t.boolean :regulated_professional, default: false
323
+ t.text :work_history
321
324
  t.boolean :reservations
322
325
  t.text :reservations_reason
323
-
324
- t.text :work_history
326
+ t.string :recommendation
327
+ t.text :recommendation_reason
325
328
  t.boolean :accept_declaration
326
329
 
327
330
  t.string :token
@@ -1,3 +1,3 @@
1
1
  module EffectiveMemberships
2
- VERSION = '0.13.7'
2
+ VERSION = '0.15.0'
3
3
  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.13.7
4
+ version: 0.15.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: 2023-04-18 00:00:00.000000000 Z
11
+ date: 2023-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -353,6 +353,7 @@ files:
353
353
  - app/views/admin/applicant_course_name/_form.html.haml
354
354
  - app/views/admin/applicant_endorsements/_applicant_endorsement.html.haml
355
355
  - app/views/admin/applicant_references/_applicant_reference.html.haml
356
+ - app/views/admin/applicant_references/_form.html.haml
356
357
  - app/views/admin/applicant_reviews/_applicant_review.html.haml
357
358
  - app/views/admin/applicants/_fees_approve.html.haml
358
359
  - app/views/admin/applicants/_form.html.haml
@@ -417,6 +418,7 @@ files:
417
418
  - app/views/effective/applicant_endorsers/_dashboard.html.haml
418
419
  - app/views/effective/applicant_references/_applicant_reference.html.haml
419
420
  - app/views/effective/applicant_references/_datatable_actions.html.haml
421
+ - app/views/effective/applicant_references/_declaration_requirements.html.haml
420
422
  - app/views/effective/applicant_references/_form.html.haml
421
423
  - app/views/effective/applicant_references/_form_declaration.html.haml
422
424
  - app/views/effective/applicant_references/complete.html.haml