effective_memberships 0.13.6 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) 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 -36
  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_endorsement.rb +4 -1
  10. data/app/models/effective/applicant_reference.rb +20 -14
  11. data/app/views/admin/applicant_references/_form.html.haml +18 -0
  12. data/app/views/admin/applicants/_form_applicant.html.haml +10 -10
  13. data/app/views/admin/applicants/_status.html.haml +79 -39
  14. data/app/views/effective/applicant_references/_applicant_reference.html.haml +19 -49
  15. data/app/views/effective/applicant_references/_declaration_requirements.html.haml +1 -0
  16. data/app/views/effective/applicant_references/_form.html.haml +4 -4
  17. data/app/views/effective/applicant_references/_form_declaration.html.haml +30 -16
  18. data/app/views/effective/applicant_references/edit.html.haml +0 -5
  19. data/app/views/effective/applicants/education.html.haml +2 -2
  20. data/app/views/effective/applicants/submitted.html.haml +6 -1
  21. data/app/views/effective/memberships/_membership.html.haml +5 -1
  22. data/app/views/effective/wizard_steps/_cpd_statements.html.haml +3 -0
  23. data/db/migrate/01_create_effective_memberships.rb.erb +7 -4
  24. data/lib/effective_memberships/version.rb +1 -1
  25. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77571110c375655e79ac7ef7150003db9d611ea564d7f0f9ebc65ec38be21715
4
- data.tar.gz: a6aa04f69f1cf002779f768f6b2362b819bbfdb8d874ee23bfad8f4ed1c1f65f
3
+ metadata.gz: bcacbcc7726096bc1fc69dafc09a496b4ba8f785117993b0df13efe44436a84f
4
+ data.tar.gz: 89242751748bdac6d8c84c7eed6c2d507b90c8939b090dd0d9ea44fe4c72368f
5
5
  SHA512:
6
- metadata.gz: 96bad4189f675621a5fc51652b23c021fd09e21bb4737a3b97e7ab0f3fa2a770bdc437dac40fc27179b3c91b19d7ce296cb50d14601fc83d8e7be8184df6a382
7
- data.tar.gz: b979ee021ff929ebbab1415f5da5e89134fb2202c4f41bafeeb514c83e10312bf9cc97bf8aa0ad3ea73ef185463eaef574c8d5a94564c589ad16586e18aa4f29
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
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  # EffectiveMembershipsApplicant
4
2
  #
5
3
  # Mark your owner model with effective_memberships_applicant to get all the includes
@@ -393,39 +391,41 @@ module EffectiveMembershipsApplicant
393
391
  validates :missing_info_reason, presence: true, if: -> { missing_info? }
394
392
 
395
393
  # These two try completed and try reviewed
396
- # before_save(if: -> { submitted? }) { complete! }
397
- # before_save(if: -> { completed? }) { review! }
394
+ # before_save(if: -> { submitted? }) { try_completed! }
395
+ # before_save(if: -> { completed? }) { try_reviewed! }
398
396
 
399
397
  # Clear required steps memoization
400
398
  after_save { @_required_steps = nil }
401
399
 
402
400
  # This required_steps is defined inside the included do .. end block so it overrides the acts_as_wizard one.
403
401
  def required_steps
402
+ @_required_steps ||= default_applicant_required_steps()
403
+ end
404
+
405
+ def default_applicant_required_steps
404
406
  return self.class.test_required_steps if Rails.env.test? && self.class.test_required_steps.present?
405
407
 
406
- @_required_steps ||= begin
407
- # All required
408
- required_steps = self.class.required_wizard_steps
408
+ # All required
409
+ required_steps = self.class.required_wizard_steps
409
410
 
410
- # Based on current applicant
411
- applicant_steps = self.class.all_wizard_steps if category.blank?
412
- 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)
413
414
 
414
- # Sanity check
415
- applicant_steps.delete(:stamp) unless apply_to_join?
416
- applicant_steps.delete(:organization) unless category&.organization?
417
- 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?
418
419
 
419
- # change_wizard_steps is defined in effective_resources acts_as_wizard
420
- 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)
421
422
 
422
- unless applicant_steps.kind_of?(Array) && applicant_steps.all? { |step| step.kind_of?(Symbol) }
423
- raise('expected change_wizard_steps to return an Array of steps with no nils')
424
- 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
425
426
 
426
- self.class.all_wizard_steps.select do |step|
427
- required_steps.include?(step) || applicant_steps.include?(step)
428
- end
427
+ self.class.all_wizard_steps.select do |step|
428
+ required_steps.include?(step) || applicant_steps.include?(step)
429
429
  end
430
430
  end
431
431
 
@@ -598,7 +598,12 @@ module EffectiveMembershipsApplicant
598
598
  summary = "Application has been purchased and submitted."
599
599
  tasks = "The following tasks remain before it can be completed:"
600
600
  approval = "Waiting on approval."
601
- 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
+
602
607
  completed_requirements.present? ? "<p>#{summary} #{tasks}</p><ul>#{items}</ul>" : "#{summary} #{approval}"
603
608
  when 'completed'
604
609
  if applicant_reviews_required?
@@ -640,7 +645,7 @@ module EffectiveMembershipsApplicant
640
645
  return categories.where(can_apply_new: true)
641
646
  end
642
647
 
643
- category_ids = user.membership.category_ids.map(&:to_s) - [nil, '']
648
+ category_ids = Array(user.membership&.category_ids).map(&:to_s) - [nil, '']
644
649
 
645
650
  categories.select do |category|
646
651
  category.can_apply_new? ||
@@ -701,7 +706,7 @@ module EffectiveMembershipsApplicant
701
706
  end
702
707
 
703
708
  def applicant_references_required?
704
- required_steps.include?(:references) && min_applicant_references > 0
709
+ min_applicant_references > 0
705
710
  end
706
711
 
707
712
  # Endorsements Step
@@ -710,7 +715,7 @@ module EffectiveMembershipsApplicant
710
715
  end
711
716
 
712
717
  def applicant_endorsements_required?
713
- required_steps.include?(:endorsements) && min_applicant_endorsements > 0
718
+ min_applicant_endorsements > 0
714
719
  end
715
720
 
716
721
  # Equivalences Step
@@ -770,16 +775,16 @@ module EffectiveMembershipsApplicant
770
775
  requirements = {}
771
776
  return requirements unless category.present?
772
777
 
773
- if applicant_endorsements_required?
774
- 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?
775
780
  end
776
781
 
777
- if applicant_references_required?
778
- 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)
779
784
  end
780
785
 
781
- if transcripts_required?
782
- 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)
783
788
  end
784
789
 
785
790
  requirements
@@ -822,7 +827,7 @@ module EffectiveMembershipsApplicant
822
827
  end
823
828
 
824
829
  def applicant_reviews_required?
825
- (min_applicant_reviews > 0 || applicant_reviews.present?)
830
+ min_applicant_reviews > 0
826
831
  end
827
832
 
828
833
  def min_applicant_reviews
@@ -845,17 +850,23 @@ module EffectiveMembershipsApplicant
845
850
  requirements = {}
846
851
  return requirements unless category.present?
847
852
 
848
- if applicant_reviews_required?
849
- 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)
850
855
  end
851
856
 
852
857
  requirements
853
858
  end
854
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
+
855
866
  # Called when an applicant_review was submitted
856
867
  def try_reviewed!
857
868
  return false unless completed? && reviewed_requirements.values.all?
858
- reviewed!
869
+ review!
859
870
  end
860
871
 
861
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)
@@ -4,6 +4,8 @@ module Effective
4
4
  class ApplicantEndorsement < ActiveRecord::Base
5
5
  acts_as_tokened
6
6
 
7
+ attr_accessor :email_form_skip
8
+
7
9
  acts_as_statused(
8
10
  :submitted, # Was submitted by the applicant
9
11
  :completed # Was completed by the endorser.
@@ -14,6 +16,7 @@ module Effective
14
16
  belongs_to :applicant, polymorphic: true
15
17
  belongs_to :endorser, polymorphic: true, optional: true
16
18
 
19
+
17
20
  effective_resource do
18
21
  # These fields are submitted by the applicant
19
22
  # They should try to select an endorser from the dropdown
@@ -58,7 +61,7 @@ module Effective
58
61
  validates :accept_declaration, acceptance: true
59
62
  end
60
63
 
61
- after_commit(on: :create, if: -> { applicant.was_submitted? }) { notify! }
64
+ after_commit(on: :create, if: -> { applicant.was_submitted? && !applicant.done? }, unless: -> { email_form_skip }) { notify! }
62
65
 
63
66
  def self.endorser_collection(applicant)
64
67
  raise('expected an effective memberships applicant') unless applicant.class.try(:effective_memberships_applicant?)
@@ -3,6 +3,8 @@ module Effective
3
3
  acts_as_tokened
4
4
  acts_as_addressable :reference
5
5
 
6
+ attr_accessor :email_form_skip
7
+
6
8
  acts_as_statused(
7
9
  :submitted, # Was submitted by the applicant
8
10
  :completed # Was completed by the reference.
@@ -10,29 +12,36 @@ module Effective
10
12
 
11
13
  log_changes(to: :applicant) if respond_to?(:log_changes)
12
14
 
13
- belongs_to :applicant, polymorphic: true
15
+ belongs_to :applicant, polymorphic: true, optional: true
14
16
 
15
17
  KNOWNS = ['6 months - 1 year', '1 year - 2 years', '2 - 5 years', '5 - 10 years', 'More than 10 years']
16
18
  RELATIONSHIPS = ['Supervisor', 'Employer', 'Colleague', 'Other']
19
+ RECOMMENDATIONS = ['Recommend for Membership', 'Do not recommend for Membership']
17
20
 
18
21
  effective_resource do
19
- # These two fields are submitted on the Applicant wizard step
22
+ # These fields are submitted on the Applicant wizard references step
20
23
  name :string
21
24
  email :string
22
25
  phone :string
23
26
 
27
+ known :string
28
+ relationship :string
29
+
24
30
  # As per acts_as_statused. For tracking the state machine.
25
31
  status :string
26
32
  status_steps :text
27
33
 
28
34
  # Reference Declaration
29
- known :string
30
- relationship :string
35
+ title :string
36
+ regulated_professional :boolean
37
+
38
+ work_history :text
31
39
 
32
40
  reservations :boolean
33
41
  reservations_reason :text
34
42
 
35
- work_history :text
43
+ recommendation :string
44
+ recommendation_reason :text
36
45
 
37
46
  accept_declaration :boolean
38
47
 
@@ -46,27 +55,24 @@ module Effective
46
55
  scope :deep, -> { all }
47
56
 
48
57
  # All step validations
49
- validates :applicant, presence: true
50
-
51
58
  validates :name, presence: true
52
59
  validates :email, presence: true, email: true
53
- validates :phone, presence: true
54
-
55
- validates :relationship, presence: true
56
- validates :known, presence: true
57
60
 
58
61
  # When being submit by the reference
59
- with_options(if: -> { completed? }) do
62
+ with_options(if: -> { just_completed? }) do
60
63
  validates :reference_address, presence: true
61
64
  validates :reservations_reason, presence: true, if: -> { completed? && reservations? }
62
65
  validates :work_history, presence: true
63
66
  validates :accept_declaration, acceptance: true
67
+
68
+ validates :recommendation, presence: true
69
+ validates :recommendation_reason, presence: true, if: -> { completed? && recommendation.present? }
64
70
  end
65
71
 
66
- after_commit(on: :create, if: -> { applicant.was_submitted? }) { notify! }
72
+ after_commit(on: :create, if: -> { applicant.was_submitted? && !applicant.done? }, unless: -> { email_form_skip }) { notify! }
67
73
 
68
74
  def to_s
69
- 'reference'
75
+ name.presence || 'reference'
70
76
  end
71
77
 
72
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?
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
 
@@ -22,7 +22,12 @@
22
22
  = card do
23
23
  = render 'effective/applicants/summary', applicant: resource
24
24
 
25
- - if resource.min_applicant_references.to_i > 0 || resource.applicant_references.present?
25
+ - if resource.transcripts_required? && !resource.transcripts_received?
26
+ = card do
27
+ %h3 Transcripts
28
+ = render 'effective/applicants/transcripts_requirements', applicant: resource
29
+
30
+ - if resource.required_steps.include?(:references) || resource.applicant_references.present?
26
31
  = card do
27
32
  %h3 Confidential References
28
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
@@ -13,3 +13,6 @@
13
13
  - if completed.present?
14
14
  %p The following #{cpd_statements_label} have been completed:
15
15
  = render_datatable(completed, simple: true)
16
+
17
+ - if available.blank? && completed.blank?
18
+ %p No #{cpd_statements_label} are present
@@ -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.6'
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.6
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-14 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