effective_cpd 0.6.8 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/admin/cpd_audit_levels_controller.rb +7 -1
  3. data/app/controllers/admin/cpd_audit_reviews_controller.rb +7 -1
  4. data/app/controllers/admin/cpd_audits_controller.rb +21 -1
  5. data/app/controllers/admin/cpd_statements_controller.rb +1 -1
  6. data/app/controllers/effective/cpd_audit_reviews_controller.rb +3 -39
  7. data/app/controllers/effective/cpd_audits_controller.rb +3 -41
  8. data/app/datatables/admin/effective_cpd_audit_levels_datatable.rb +1 -1
  9. data/app/datatables/admin/effective_cpd_audit_reviews_datatable.rb +4 -2
  10. data/app/datatables/admin/effective_cpd_audits_datatable.rb +12 -10
  11. data/app/datatables/effective_cpd_available_audit_reviews_datatable.rb +4 -4
  12. data/app/datatables/effective_cpd_available_audits_datatable.rb +1 -1
  13. data/app/datatables/effective_cpd_completed_audit_reviews_datatable.rb +3 -3
  14. data/app/datatables/effective_cpd_completed_audits_datatable.rb +2 -2
  15. data/app/helpers/effective_cpd_audits_helper.rb +0 -32
  16. data/app/mailers/effective/cpd_mailer.rb +37 -24
  17. data/app/models/concerns/effective_cpd_audit.rb +594 -0
  18. data/app/models/concerns/effective_cpd_audit_level.rb +111 -0
  19. data/app/models/concerns/effective_cpd_audit_review.rb +297 -0
  20. data/app/models/concerns/effective_cpd_user.rb +16 -11
  21. data/app/models/effective/cpd_audit.rb +1 -397
  22. data/app/models/effective/cpd_audit_level.rb +1 -83
  23. data/app/models/effective/cpd_audit_level_question.rb +1 -1
  24. data/app/models/effective/cpd_audit_level_section.rb +4 -3
  25. data/app/models/effective/cpd_audit_response.rb +4 -2
  26. data/app/models/effective/cpd_audit_review.rb +1 -224
  27. data/app/models/effective/cpd_audit_review_item.rb +1 -1
  28. data/app/views/admin/cpd_audit_levels/_form_content_audit.html.haml +1 -1
  29. data/app/views/admin/cpd_audit_levels/_form_content_audit_review.html.haml +1 -1
  30. data/app/views/admin/cpd_audit_levels/_form_cpd_audit_level.html.haml +7 -1
  31. data/app/views/admin/cpd_audit_levels/_form_cpd_audit_level_section.html.haml +2 -0
  32. data/app/views/admin/cpd_audit_reviews/_form.html.haml +4 -1
  33. data/app/views/admin/cpd_audits/_form.html.haml +1 -49
  34. data/app/views/admin/cpd_audits/{_form_determination.html.haml → _form_close.html.haml} +1 -1
  35. data/app/views/admin/cpd_audits/_form_complete.html.haml +17 -0
  36. data/app/views/admin/cpd_audits/_form_cpd_audit.html.haml +56 -0
  37. data/app/views/admin/cpd_audits/_form_deadlines.html.haml +8 -9
  38. data/app/views/admin/cpd_audits/_form_exemption.html.haml +1 -1
  39. data/app/views/admin/cpd_audits/_form_extension.html.haml +1 -1
  40. data/app/views/admin/cpd_audits/_form_files.html.haml +6 -0
  41. data/app/views/admin/cpd_audits/_form_missing_info.html.haml +11 -0
  42. data/app/views/admin/cpd_audits/_form_new.html.haml +3 -1
  43. data/app/views/admin/cpd_audits/_form_process.html.haml +18 -0
  44. data/app/views/admin/cpd_audits/_status.html.haml +48 -6
  45. data/app/views/effective/cpd/_dashboard.html.haml +15 -12
  46. data/app/views/effective/cpd_audit_level_questions/_cpd_audit_level_question.html.haml +2 -1
  47. data/app/views/effective/cpd_audit_reviews/_conflict.html.haml +1 -1
  48. data/app/views/effective/cpd_audit_reviews/_cpd_audit_level_section.html.haml +3 -3
  49. data/app/views/effective/cpd_audit_reviews/_cpd_audit_review.html.haml +3 -1
  50. data/app/views/effective/cpd_audit_reviews/_cpd_statement.html.haml +3 -3
  51. data/app/views/effective/cpd_audit_reviews/_feedback.html.haml +9 -0
  52. data/app/views/effective/cpd_audit_reviews/_files.html.haml +12 -0
  53. data/app/views/effective/cpd_audit_reviews/_layout.html.haml +3 -0
  54. data/app/views/effective/cpd_audit_reviews/_recommendation.html.haml +6 -2
  55. data/app/views/effective/cpd_audit_reviews/_summary.html.haml +41 -14
  56. data/app/views/effective/cpd_audit_reviews/conflict.html.haml +5 -1
  57. data/app/views/effective/cpd_audit_reviews/cpd_audit_level_section.html.haml +2 -2
  58. data/app/views/effective/cpd_audit_reviews/feedback.html.haml +16 -0
  59. data/app/views/effective/cpd_audit_reviews/files.html.haml +17 -0
  60. data/app/views/effective/cpd_audit_reviews/recommendation.html.haml +5 -3
  61. data/app/views/effective/cpd_audit_reviews/start.html.haml +10 -3
  62. data/app/views/effective/cpd_audit_reviews/statements.html.haml +4 -5
  63. data/app/views/effective/cpd_audit_reviews/submit.html.haml +1 -1
  64. data/app/views/effective/cpd_audit_reviews/submitted.html.haml +20 -0
  65. data/app/views/effective/cpd_audit_reviews/waiting.html.haml +1 -1
  66. data/app/views/effective/cpd_audits/_conflict.html.haml +1 -1
  67. data/app/views/effective/cpd_audits/_cpd.html.haml +1 -1
  68. data/app/views/effective/cpd_audits/_cpd_audit.html.haml +3 -1
  69. data/app/views/effective/cpd_audits/_cpd_audit_level_section.html.haml +1 -1
  70. data/app/views/effective/cpd_audits/_exemption.html.haml +1 -1
  71. data/app/views/effective/cpd_audits/_extension.html.haml +1 -1
  72. data/app/views/effective/cpd_audits/_files.html.haml +1 -1
  73. data/app/views/effective/cpd_audits/_missing_info.html.haml +19 -0
  74. data/app/views/effective/cpd_audits/_summary.html.haml +30 -12
  75. data/app/views/effective/cpd_audits/_waiting.html.haml +1 -1
  76. data/app/views/effective/cpd_audits/conflict.html.haml +5 -1
  77. data/app/views/effective/cpd_audits/cpd_audit_level_section.html.haml +1 -0
  78. data/app/views/effective/cpd_audits/start.html.haml +10 -4
  79. data/app/views/effective/cpd_audits/submit.html.haml +5 -2
  80. data/app/views/effective/cpd_audits/{complete.html.haml → submitted.haml} +13 -8
  81. data/app/views/effective/cpd_audits/waiting.html.haml +1 -1
  82. data/app/views/effective/cpd_mailer/cpd_audit_missing_info.liquid +15 -0
  83. data/app/views/effective/cpd_mailer/cpd_audit_review_ready.liquid +1 -1
  84. data/app/views/effective/cpd_mailer/cpd_audit_submitted.liquid +3 -1
  85. data/config/effective_cpd.rb +5 -2
  86. data/db/migrate/01_create_effective_cpd.rb.erb +36 -7
  87. data/lib/effective_cpd/engine.rb +4 -0
  88. data/lib/effective_cpd/version.rb +1 -1
  89. data/lib/effective_cpd.rb +13 -1
  90. metadata +19 -5
  91. data/app/views/effective/cpd_audit_reviews/complete.html.haml +0 -20
@@ -1,8 +1,8 @@
1
- = card(cpd_audit_review.wizard_step_title(step)) do
1
+ = wizard_card(cpd_audit_review) do
2
2
  %table.table.table-hover
3
3
  %thead
4
- %th Question and #{cpd_audit_review.cpd_audit.user}'s Response
5
- %th #{cpd_audit_review.user}'s Review
4
+ %th Responses submitted by #{cpd_audit_review.cpd_audit.name}
5
+ %th Review by #{cpd_audit_review.name}
6
6
  %tbody
7
7
  - cpd_audit_level_section.cpd_audit_level_questions.each_with_index do |cpd_audit_level_question, index|
8
8
  - cpd_audit_response = cpd_audit_review.cpd_audit.cpd_audit_response(cpd_audit_level_question)
@@ -2,9 +2,11 @@
2
2
  = render('effective/cpd_audit_reviews/summary', cpd_audit_review: cpd_audit_review)
3
3
 
4
4
  - steps = cpd_audit_review.required_steps.select { |step| cpd_audit_review.has_completed_step?(step) }
5
- - blacklist = [:start, :information, :instructions, :waiting, :statements, :questionnaire, :submit, :complete]
5
+ - blacklist = [:start, :information, :instructions, :waiting, :statements, :questionnaire, :submit, :submitted]
6
6
 
7
7
  - (steps - blacklist).each do |step|
8
+ - cpd_audit_review.render_step = step
9
+
8
10
  - if cpd_audit_review.dynamic_wizard_questionnaire_steps.keys.include?(step)
9
11
  - cpd_audit_level_section = cpd_audit_review.cpd_audit_level_section(step) || raise("no cpd audit section for #{step}")
10
12
  = render("effective/cpd_audit_reviews/cpd_audit_level_section", cpd_audit_review: cpd_audit_review, step: step, cpd_audit_level_section: cpd_audit_level_section)
@@ -1,8 +1,8 @@
1
- = card(cpd_audit_review.wizard_step_title(step)) do
1
+ = wizard_card(cpd_audit_review) do
2
2
  %table.table.table-hover
3
3
  %thead
4
- %th #{cpd_audit_review.cpd_audit.user}'s #{cpd_statement}
5
- %th #{cpd_audit_review.user}'s Review
4
+ %th #{cpd_audit_review.cpd_audit.name}'s #{cpd_statement}
5
+ %th #{cpd_audit_review.name}'s Review
6
6
 
7
7
  %tbody
8
8
  - cpd_statement.cpd_statement_activities.each do |cpd_statement_activity|
@@ -0,0 +1,9 @@
1
+ = wizard_card(cpd_audit_review) do
2
+ %table.table
3
+ %tbody
4
+ %tr
5
+ %td{colspan: 2}
6
+ - if cpd_audit_review.feedback.present?
7
+ = simple_format(cpd_audit_review.feedback)
8
+ - else
9
+ No feedback
@@ -0,0 +1,12 @@
1
+ = wizard_card(cpd_audit_review) do
2
+ %table.table
3
+ %tbody
4
+ %tr
5
+ %th Files
6
+ %td
7
+ - if cpd_audit_review.cpd_audit.files.blank?
8
+ None
9
+ - else
10
+ %ul
11
+ - cpd_audit_review.cpd_audit.files.each do |file|
12
+ %li= link_to(file.filename, url_for(file), target: '_blank')
@@ -11,6 +11,9 @@
11
11
 
12
12
  %td
13
13
  = (Time.zone.now > resource.due_date) ? 'days overdue' : 'days left to review'
14
+ %tr
15
+ %td
16
+ %td
14
17
 
15
18
  .col-9
16
19
  %h1= @page_title
@@ -1,4 +1,4 @@
1
- = card(cpd_audit_review.wizard_step_title(step)) do
1
+ = wizard_card(cpd_audit_review) do
2
2
  %table.table
3
3
  %tbody
4
4
  %tr
@@ -6,4 +6,8 @@
6
6
  %td= cpd_audit_review.recommendation
7
7
 
8
8
  %tr
9
- %td{colspan: 2}= cpd_audit_review.comments.presence || 'No comments'
9
+ %td{colspan: 2}
10
+ - if cpd_audit_review.comments.present?
11
+ = simple_format(cpd_audit_review.comments)
12
+ - else
13
+ No comments
@@ -1,28 +1,55 @@
1
1
  = card(cpd_audit_review) do
2
+ - cpd_audit = cpd_audit_review.cpd_audit
3
+
2
4
  %table.table
3
5
  %tbody
6
+ - if request.path.start_with?('/admin')
7
+ %tr
8
+ %th Audit
9
+ %td
10
+ = link_to(cpd_audit, effective_cpd.edit_admin_cpd_audit_path(cpd_audit), target: '_blank')
11
+
4
12
  %tr
5
13
  %th Audit Reviewer
6
14
  %td
7
- = cpd_audit_review.user
8
- %br
9
- %small= mail_to cpd_audit_review.user.email
15
+ - if cpd_audit_review.anonymous?
16
+ %p= cpd_audit_review.anonymous_name
10
17
 
11
- - if request.path.start_with?('/admin') && respond_to?(:edit_admin_user_path)
12
- %tr
13
- %th User
14
- %td= link_to(cpd_audit_review.user, edit_admin_user_path(cpd_audit_review.user))
18
+ - if request.path.start_with?('/admin')
19
+ - url = (polymorphic_admin_path(cpd_audit_review.user) rescue "/admin/users/#{cpd_audit_review.user.to_param}/edit")
20
+ %p
21
+ = link_to(cpd_audit_review.user, url)
22
+ %br
23
+ %small= mail_to cpd_audit_review.user.email
24
+
25
+ - if cpd_audit_review.anonymous? == false
26
+ %p
27
+ = cpd_audit_review.user
28
+ %br
29
+ %small= mail_to cpd_audit_review.user.email
15
30
 
16
31
  %tr
17
32
  %th Auditee
18
33
  %td
19
- = cpd_audit_review.cpd_audit.user
20
- %br
21
- %small= mail_to cpd_audit_review.cpd_audit.user.email
34
+ - if cpd_audit.anonymous?
35
+ %p= cpd_audit.anonymous_name
36
+
37
+ - if request.path.start_with?('/admin')
38
+ - url = (polymorphic_admin_path(cpd_audit.user) rescue "/admin/users/#{cpd_audit.user.to_param}/edit")
39
+ %p
40
+ = link_to(cpd_audit.user, url)
41
+ %br
42
+ %small= mail_to cpd_audit.user.email
43
+
44
+ - if cpd_audit.anonymous? == false
45
+ %p
46
+ = cpd_audit.user
47
+ %br
48
+ %small= mail_to cpd_audit.user.email
22
49
 
23
50
  %tr
24
51
  %th Date of notification
25
- %td= cpd_audit_review.cpd_audit.notification_date.strftime('%F')
52
+ %td= cpd_audit.notification_date.strftime('%F')
26
53
 
27
54
  %tr
28
55
  %th Due date
@@ -42,6 +69,6 @@
42
69
  %th Recommendation
43
70
  %td= cpd_audit_review.recommendation.presence || '-'
44
71
 
45
- %tr
46
- %th Summary
47
- %td= cpd_audit_summary_text(cpd_audit_review.cpd_audit)
72
+ %tr
73
+ %th Reviewer Comments
74
+ %td= cpd_audit_review.comments.presence || 'No comments'
@@ -2,7 +2,11 @@
2
2
  %p You have been selected to conduct a #{resource.cpd_audit.cpd_audit_level} audit with the following auditee:
3
3
 
4
4
  %ul
5
- %li #{resource.cpd_audit.user} <#{mail_to(resource.cpd_audit.user.email)}>
5
+ %li
6
+ - if resource.anonymous?
7
+ = resource.cpd_audit.name
8
+ - else
9
+ #{resource.cpd_audit.user} <#{mail_to(resource.cpd_audit.user.email)}>
6
10
 
7
11
  %p The deadline to declare a conflict of interest is: #{resource.deadline_to_conflict_of_interest.strftime('%F')}.
8
12
 
@@ -13,8 +13,8 @@
13
13
 
14
14
  %table.table.table-hover
15
15
  %thead
16
- %th Question and #{resource.cpd_audit.user}'s Response
17
- %th #{resource.user}'s Review
16
+ %th Responses submitted by #{resource.cpd_audit.name}
17
+ %th Review by #{resource.name}
18
18
  %tbody
19
19
  - cpd_audit_level_section.cpd_audit_level_questions.each_with_index do |cpd_audit_level_question, index|
20
20
  - cpd_audit_response = resource.cpd_audit.cpd_audit_response(cpd_audit_level_question)
@@ -0,0 +1,16 @@
1
+ = render('layout') do
2
+ .mb-3
3
+ = collapse('Show audit...', card_class: '') do
4
+ .mt-4= render('effective/cpd_audits/cpd_audit', cpd_audit: resource.cpd_audit)
5
+
6
+ %p Please provide any feedback for #{resource.cpd_audit.name}:
7
+
8
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
9
+ = f.hidden_field :current_step
10
+
11
+ = f.text_area :feedback, label: 'Feedback for the auditee'
12
+
13
+ %hr
14
+ = f.text_area :comments, label: 'Reviewer comments'
15
+
16
+ = f.submit 'Save and Continue', center: true
@@ -0,0 +1,17 @@
1
+ = render('layout') do
2
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
3
+ = f.hidden_field :current_step
4
+
5
+ %p
6
+ The auditee attached the following files:
7
+ - if resource.cpd_audit.files.blank?
8
+ None
9
+
10
+ %ul
11
+ - resource.cpd_audit.files.each do |file|
12
+ %li= link_to(file.filename, url_for(file), target: '_blank')
13
+
14
+ %hr
15
+ = f.text_area :comments, label: 'Reviewer comments'
16
+
17
+ = f.submit 'Save and Continue', center: true
@@ -1,13 +1,15 @@
1
1
  = render('layout') do
2
2
  .mb-3
3
- = collapse('Show / hide audit review...', card_class: '') do
4
- = render(resource)
3
+ = collapse('Show audit...', card_class: '') do
4
+ .mt-4= render('effective/cpd_audits/cpd_audit', cpd_audit: resource.cpd_audit)
5
5
 
6
- %p Please provide your final recommendation on #{resource.cpd_audit.user}:
6
+ %p Please provide your final recommendation on #{resource.cpd_audit.name}:
7
7
 
8
8
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
9
9
  = f.hidden_field :current_step
10
10
 
11
+ = f.text_area :feedback, label: 'Feedback for the auditee'
12
+
11
13
  - recommendations = resource.cpd_audit_level.recommendations
12
14
 
13
15
  - if recommendations.length > 3
@@ -1,8 +1,15 @@
1
1
  = render('layout') do
2
- %p You have been selected to conduct a #{resource.cpd_audit.cpd_audit_level} audit with the following auditee:
2
+ %p You have been selected to conduct a #{resource.cpd_audit.cpd_audit_level} audit.
3
3
 
4
- %ul
5
- %li #{resource.cpd_audit.user} <#{mail_to(resource.cpd_audit.user.email)}>
4
+ - if resource.cpd_audit_level.anonymous?
5
+ %p This is an anonymous audit, and you have been assigned the name #{resource.name}.
6
+ %p You have been matched with the auditee, #{resource.cpd_audit.name}.
7
+
8
+ - else
9
+ %p You have been matched with the auditee:
10
+
11
+ %ul
12
+ %li #{resource.cpd_audit.user} <#{mail_to(resource.cpd_audit.user.email)}>
6
13
 
7
14
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
8
15
  = f.hidden_field :current_step
@@ -1,14 +1,13 @@
1
1
  = render('layout') do
2
- - auditee = resource.cpd_audit.user
2
+ - cpd_audit = resource.cpd_audit
3
3
 
4
- %h2 Review Statements
5
- %p #{auditee} has submitted the following statements:
4
+ %p #{cpd_audit.name} has submitted the following statements:
6
5
 
7
- - datatable = EffectiveCpdCompletedStatementsDatatable.new(user_id: auditee.id, actions: false)
6
+ - datatable = EffectiveCpdCompletedStatementsDatatable.new(user: cpd_audit.user, actions: false)
8
7
 
9
8
  - if datatable.blank?(self)
10
9
  %p
11
- %strong There are no completed CPD statements from #{auditee}.
10
+ %strong There are no completed CPD statements from #{cpd_audit.name}.
12
11
  - else
13
12
  = render_datatable(datatable, simple: true)
14
13
 
@@ -6,7 +6,7 @@
6
6
  %strong will not
7
7
  be able to change your recommendation.
8
8
 
9
- .mb-4= render(resource)
9
+ .mb-4= render('effective/cpd_audit_reviews/cpd_audit_review', cpd_audit_review: resource)
10
10
 
11
11
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
12
12
  = f.hidden_field :current_step
@@ -0,0 +1,20 @@
1
+ = render('layout') do
2
+ - raise('expected a completed cpd_audit_review') unless resource.completed?
3
+
4
+ - if resource.completed?
5
+ .alert.alert-success.mb-4
6
+ This audit review was submitted on #{resource.submitted_at.strftime('%F')}
7
+
8
+ %p Thank you for your review.
9
+
10
+ = render 'effective/cpd_audit_reviews/summary', cpd_audit_review: resource
11
+
12
+ .mb-4
13
+ = collapse('Show audit review...', card_class: 'my-2') do
14
+ = render('effective/cpd_audit_reviews/cpd_audit_review', cpd_audit_review: resource)
15
+
16
+ .mb-4
17
+ = collapse('Show audit...', card_class: 'my-2') do
18
+ = render 'effective/cpd_audits/cpd_audit', cpd_audit: resource.cpd_audit
19
+
20
+ = link_to "Return to Dashboard", return_to_dashboard_path, class: 'btn btn-lg btn-primary btn-block'
@@ -1,6 +1,6 @@
1
1
  = render('layout') do
2
2
  %h2 Next Step
3
- %p= cpd_audit_summary_text(resource.cpd_audit)
3
+ %p= resource.cpd_audit.summary
4
4
 
5
5
  %p
6
6
  You may not continue at this time.
@@ -1,4 +1,4 @@
1
- = card(cpd_audit.wizard_step_title(step)) do
1
+ = wizard_card(cpd_audit) do
2
2
  %table.table
3
3
  %tbody
4
4
  %tr
@@ -1,4 +1,4 @@
1
- = card(cpd_audit.wizard_step_title(step)) do
1
+ = wizard_card(cpd_audit) do
2
2
  - cpd_cycle = cpd_audit.required_cpd_cycle
3
3
 
4
4
  %table.table
@@ -2,9 +2,11 @@
2
2
  = render('effective/cpd_audits/summary', cpd_audit: cpd_audit)
3
3
 
4
4
  - steps = cpd_audit.required_steps.select { |step| cpd_audit.has_completed_step?(step) }
5
- - blacklist = [:start, :information, :instructions, :waiting, :questionnaire, :submit, :complete]
5
+ - blacklist = [:start, :information, :instructions, :waiting, :questionnaire, :submit, :submitted]
6
6
 
7
7
  - (steps - blacklist).each do |step|
8
+ - cpd_audit.render_step = step
9
+
8
10
  - if cpd_audit.dynamic_wizard_steps.keys.include?(step)
9
11
  - cpd_audit_level_section = cpd_audit.cpd_audit_level_section(step) || raise("no cpd audit section for #{step}")
10
12
  = render("effective/cpd_audits/cpd_audit_level_section", cpd_audit: cpd_audit, step: step, cpd_audit_level_section: cpd_audit_level_section)
@@ -1,4 +1,4 @@
1
- = card(cpd_audit.wizard_step_title(step)) do
1
+ = wizard_card(cpd_audit) do
2
2
  %table.table.table-hover
3
3
  %thead
4
4
  %tr
@@ -1,4 +1,4 @@
1
- = card(cpd_audit.wizard_step_title(step)) do
1
+ = wizard_card(cpd_audit) do
2
2
  %table.table
3
3
  %tbody
4
4
  %tr
@@ -1,4 +1,4 @@
1
- = card(cpd_audit.wizard_step_title(step)) do
1
+ = wizard_card(cpd_audit) do
2
2
  %table.table
3
3
  %tbody
4
4
  %tr
@@ -1,4 +1,4 @@
1
- = card(cpd_audit.wizard_step_title(step)) do
1
+ = wizard_card(cpd_audit) do
2
2
  %table.table
3
3
  %tbody
4
4
  %tr
@@ -0,0 +1,19 @@
1
+ %h3 Missing Information
2
+ %p The following information is missing:
3
+ %ul
4
+ %li= resource.missing_info_reason
5
+
6
+ %p
7
+ Please revisit each wizard step and
8
+ = link_to 'Complete all missing information', wizard_path(:information), class: 'btn btn-primary'
9
+ for this audit.
10
+
11
+ %p
12
+ Once you're ready, click below to re-submit your audit with the updated information.
13
+
14
+ %p
15
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
16
+ = f.hidden_field :id
17
+
18
+ - # If you change this label, update EffectiveMemberships ApplicantsController
19
+ = f.save 'Resubmit Audit', 'data-confirm': "Really re-submit?", class: 'btn-sm'
@@ -4,23 +4,41 @@
4
4
  %tr
5
5
  %th Auditee
6
6
  %td
7
- = cpd_audit.user
8
- %br
9
- %small= mail_to cpd_audit.user.email
7
+ - if cpd_audit.anonymous?
8
+ %p= cpd_audit.anonymous_name
10
9
 
11
- - if request.path.start_with?('/admin') && respond_to?(:edit_admin_user_path)
12
- %tr
13
- %th User
14
- %td= link_to(cpd_audit.user, edit_admin_user_path(cpd_audit.user))
10
+ - if request.path.start_with?('/admin')
11
+ - url = (polymorphic_admin_path(cpd_audit.user) rescue "/admin/users/#{cpd_audit.user.to_param}/edit")
12
+ %p
13
+ = link_to(cpd_audit.user, url)
14
+ %br
15
+ %small= mail_to cpd_audit.user.email
16
+
17
+ - if cpd_audit.anonymous? == false
18
+ %p
19
+ = cpd_audit.user
20
+ %br
21
+ %small= mail_to cpd_audit.user.email
15
22
 
16
23
  %tr
17
24
  %th Audit Reviewer
18
25
  %td
19
26
  - cpd_audit.cpd_audit_reviews.each do |cpd_audit_review|
20
- %p
21
- = cpd_audit_review.user
22
- %br
23
- %small= mail_to cpd_audit_review.user.email
27
+ - if cpd_audit_review.anonymous?
28
+ %p= cpd_audit_review.anonymous_name
29
+
30
+ - if request.path.start_with?('/admin')
31
+ - url = (polymorphic_admin_path(cpd_audit_review.user) rescue "/admin/users/#{cpd_audit_review.user.to_param}/edit")
32
+ %p
33
+ = link_to(cpd_audit_review.user, url)
34
+ %br
35
+ %small= mail_to cpd_audit_review.user.email
36
+
37
+ - if cpd_audit_review.anonymous? == false
38
+ %p
39
+ = cpd_audit_review.user
40
+ %br
41
+ %small= mail_to cpd_audit_review.user.email
24
42
 
25
43
  %tr
26
44
  %th Date of notification
@@ -51,4 +69,4 @@
51
69
 
52
70
  %tr
53
71
  %th Summary
54
- %td= cpd_audit_summary_text(cpd_audit)
72
+ %td= cpd_audit.summary
@@ -1,4 +1,4 @@
1
- = card(cpd_audit.wizard_step_title(step)) do
1
+ = wizard_card(cpd_audit) do
2
2
  %table.table
3
3
  %tbody
4
4
  %tr
@@ -3,7 +3,11 @@
3
3
 
4
4
  %ul
5
5
  - resource.cpd_audit_reviews.each do |cpd_audit_review|
6
- %li #{cpd_audit_review.user} <#{mail_to(cpd_audit_review.user.email)}>
6
+ %li
7
+ - if cpd_audit_review.anonymous?
8
+ = cpd_audit_review.name
9
+ - else
10
+ #{cpd_audit_review.user} <#{mail_to(cpd_audit_review.user.email)}>
7
11
 
8
12
  - if resource.deadline_to_conflict_of_interest.present? && !resource.ignore_deadlines?
9
13
  %p The deadline to declare a conflict of interest is: #{resource.deadline_to_conflict_of_interest.strftime('%F')}.
@@ -12,6 +12,7 @@
12
12
  - cpd_audit_response = resource.cpd_audit_response(cpd_audit_level_question)
13
13
 
14
14
  = f.fields_for :cpd_audit_responses, cpd_audit_response do |fcar|
15
+ %hr
15
16
  .mt-2= render('/effective/cpd_audit_responses/fields', f: fcar, cpd_audit_level_question: cpd_audit_level_question)
16
17
 
17
18
  - if cpd_audit_level_section.bottom_content.present?
@@ -1,9 +1,15 @@
1
1
  = render('layout') do
2
- %p You have been selected for #{resource.cpd_audit_level} audit and matched with:
2
+ %p You have been selected for #{resource.cpd_audit_level} audit.
3
3
 
4
- %ul
5
- - resource.cpd_audit_reviews.each do |cpd_audit_review|
6
- %li #{cpd_audit_review.user} <#{mail_to(cpd_audit_review.user.email)}>
4
+ - if resource.cpd_audit_level.anonymous?
5
+ %p This is an anonymous audit, and you have been assigned the name #{resource.name}
6
+
7
+ - if resource.cpd_audit_level.anonymous? == false
8
+ %p You have been matched with:
9
+
10
+ %ul
11
+ - resource.cpd_audit_reviews.each do |cpd_audit_review|
12
+ %li #{cpd_audit_review.user} <#{mail_to(cpd_audit_review.user.email)}>
7
13
 
8
14
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
9
15
  = f.hidden_field :current_step
@@ -7,9 +7,12 @@
7
7
  %strong will not
8
8
  be able to change your submission
9
9
 
10
- .mb-4= render(resource)
10
+ .mb-4= render('effective/cpd_audits/cpd_audit', cpd_audit: resource)
11
11
 
12
12
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
13
13
  = f.hidden_field :current_step
14
14
 
15
- = f.submit 'Submit Audit', center: true
15
+ - if EffectiveResources.authorized?(self, :resubmit, resource)
16
+ = f.submit 'Resubmit Audit', center: true
17
+ - else
18
+ = f.submit 'Submit Audit', center: true
@@ -2,12 +2,14 @@
2
2
  - raise('expected a submitted or conflicted cpd_audit') unless (resource.was_submitted? || resource.was_conflicted? || resource.closed?)
3
3
 
4
4
  - if resource.was_submitted?
5
- .text-center
6
- .row
7
- .col-2
8
- .col-8
9
- .alert.alert-success Audit Submitted!
5
+ .alert.alert-success.mb-4
6
+ This audit was submitted on #{resource.submitted_at.strftime('%F')}
10
7
 
8
+ - if resource.missing_info?
9
+ = card do
10
+ = render 'effective/cpd_audits/missing_info', cpd_audit: resource
11
+
12
+ - if resource.was_submitted?
11
13
  %p
12
14
  The following audit was successfully submitted at
13
15
  = succeed('.') do
@@ -19,7 +21,10 @@
19
21
  %strong= resource.user.email
20
22
  an email notifying you of the determination.
21
23
 
22
- .mb-4= render(resource)
24
+ = render 'effective/cpd_audits/summary', cpd_audit: resource
25
+
26
+ .mb-4
27
+ = collapse('Show audit...', card_class: 'my-2') do
28
+ = render 'effective/cpd_audits/cpd_audit', cpd_audit: resource
23
29
 
24
- %br
25
- .text-center= link_to 'Home', root_path, class: 'btn btn-primary'
30
+ = link_to "Return to Dashboard", return_to_dashboard_path, class: 'btn btn-lg btn-primary btn-block'
@@ -20,5 +20,5 @@
20
20
  = render("effective/cpd_audits/extension", cpd_audit: resource, step: :extension)
21
21
 
22
22
  %h2 Next Step
23
- %p= cpd_audit_summary_text(resource)
23
+ %p= resource.summary
24
24
  %p You may not continue at this time. Please wait for an email with further instructions. Thank you.
@@ -0,0 +1,15 @@
1
+ ---
2
+ subject: 'Your audit is missing information'
3
+ from: 'admin@example.com'
4
+ ---
5
+ Hello {{ auditee.name }},
6
+
7
+ Your audit is missing information:
8
+
9
+ {{ audit.missing_info_reason }}
10
+
11
+ Please update your audit with this info.
12
+
13
+ {{ url }}
14
+
15
+ Thank you
@@ -4,7 +4,7 @@ from: 'admin@example.com'
4
4
  ---
5
5
  Hello {{ reviewer.name }},
6
6
 
7
- The auditee {{ auditee.name }} has submitted their audit questionnaire.
7
+ The auditee {{ auditee.name }} has completed their audit questionnaire.
8
8
 
9
9
  It is now ready for you to review.
10
10
 
@@ -6,7 +6,9 @@ Hello Admin,
6
6
 
7
7
  The auditee {{ auditee.name }} has submitted their audit statement.
8
8
 
9
- The audit reviewers have been notified and may now begin their reviews.
9
+ Please review the audit and mark it complete or missing information.
10
+
11
+ Once marked complete, the audit reviewers will be notified and their review may begin.
10
12
 
11
13
  {{ url }}
12
14
 
@@ -32,6 +32,9 @@ EffectiveCpd.setup do |config|
32
32
  # CPD Class Settings
33
33
  # Configure the class responsible for the cpd statements.
34
34
  # config.cpd_statement_class_name = 'Effective::CpdStatement'
35
+ # config.cpd_audit_class_name = 'Effective::CpdAudit'
36
+ # config.cpd_audit_level_class_name = 'Effective::CpdAuditLevel'
37
+ # config.cpd_audit_review_class_name = 'Effective::CpdAuditReview'
35
38
 
36
39
  # Program label settings
37
40
  config.program_label = 'CPD' # CPD or MCE
@@ -42,10 +45,10 @@ EffectiveCpd.setup do |config|
42
45
  #
43
46
  # When creating a new audit, these are used to select the auditee
44
47
  # The User model must respond to these
45
- config.auditee_user_scope = :all
48
+ config.auditee_user_scope = :cpd_audit_auditees
46
49
 
47
50
  # Audit Reviewer Scope Collection
48
- config.audit_reviewer_user_scope = :all
51
+ config.audit_reviewer_user_scope = :cpd_audit_reviewers
49
52
 
50
53
  # Mailer Settings
51
54
  # Please see config/initializers/effective_resources.rb for default effective_* gem mailer settings