effective_cpd 1.0.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -6
  3. data/app/controllers/admin/cpd_audit_levels_controller.rb +2 -2
  4. data/app/controllers/admin/cpd_audit_reviews_controller.rb +2 -2
  5. data/app/controllers/admin/cpd_audits_controller.rb +15 -1
  6. data/app/controllers/admin/cpd_statements_controller.rb +1 -1
  7. data/app/controllers/effective/cpd_audit_reviews_controller.rb +5 -39
  8. data/app/controllers/effective/cpd_audits_controller.rb +5 -41
  9. data/app/datatables/admin/effective_cpd_audit_reviews_datatable.rb +3 -1
  10. data/app/datatables/admin/effective_cpd_audits_datatable.rb +11 -9
  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 +257 -66
  18. data/app/models/concerns/effective_cpd_audit_level.rb +7 -4
  19. data/app/models/concerns/effective_cpd_audit_review.rb +121 -65
  20. data/app/models/concerns/effective_cpd_statement.rb +1 -0
  21. data/app/models/concerns/effective_cpd_user.rb +10 -5
  22. data/app/models/effective/cpd_audit_level_question.rb +1 -1
  23. data/app/models/effective/cpd_audit_level_section.rb +4 -3
  24. data/app/models/effective/cpd_audit_response.rb +3 -2
  25. data/app/models/effective/cpd_audit_review_item.rb +1 -1
  26. data/app/views/admin/cpd_audit_levels/_form_content_audit.html.haml +1 -1
  27. data/app/views/admin/cpd_audit_levels/_form_content_audit_review.html.haml +1 -1
  28. data/app/views/admin/cpd_audit_levels/_form_cpd_audit_level.html.haml +7 -1
  29. data/app/views/admin/cpd_audit_levels/_form_cpd_audit_level_section.html.haml +2 -0
  30. data/app/views/admin/cpd_audit_reviews/_form.html.haml +4 -1
  31. data/app/views/admin/cpd_audits/_form.html.haml +1 -49
  32. data/app/views/admin/cpd_audits/_form_chat.html.haml +4 -0
  33. data/app/views/admin/cpd_audits/{_form_determination.html.haml → _form_close.html.haml} +1 -1
  34. data/app/views/admin/cpd_audits/_form_complete.html.haml +17 -0
  35. data/app/views/admin/cpd_audits/_form_cpd_audit.html.haml +60 -0
  36. data/app/views/admin/cpd_audits/_form_deadlines.html.haml +8 -9
  37. data/app/views/admin/cpd_audits/_form_exemption.html.haml +1 -1
  38. data/app/views/admin/cpd_audits/_form_extension.html.haml +1 -1
  39. data/app/views/admin/cpd_audits/_form_files.html.haml +6 -0
  40. data/app/views/admin/cpd_audits/_form_missing_info.html.haml +11 -0
  41. data/app/views/admin/cpd_audits/_form_new.html.haml +3 -1
  42. data/app/views/admin/cpd_audits/_form_process.html.haml +18 -0
  43. data/app/views/admin/cpd_audits/_status.html.haml +48 -6
  44. data/app/views/admin/users/_form_cpd.html.haml +7 -0
  45. data/app/views/admin/users/_form_cpd_audits.html.haml +8 -0
  46. data/app/views/effective/cpd/_dashboard.html.haml +15 -12
  47. data/app/views/effective/cpd_audit_level_questions/_cpd_audit_level_question.html.haml +2 -1
  48. data/app/views/effective/cpd_audit_reviews/_conflict.html.haml +1 -1
  49. data/app/views/effective/cpd_audit_reviews/_cpd_audit_level_section.html.haml +3 -3
  50. data/app/views/effective/cpd_audit_reviews/_cpd_audit_review.html.haml +3 -1
  51. data/app/views/effective/cpd_audit_reviews/_cpd_statement.html.haml +3 -3
  52. data/app/views/effective/cpd_audit_reviews/_feedback.html.haml +9 -0
  53. data/app/views/effective/cpd_audit_reviews/_files.html.haml +12 -0
  54. data/app/views/effective/cpd_audit_reviews/_layout.html.haml +11 -1
  55. data/app/views/effective/cpd_audit_reviews/_recommendation.html.haml +6 -2
  56. data/app/views/effective/cpd_audit_reviews/_summary.html.haml +41 -14
  57. data/app/views/effective/cpd_audit_reviews/chat.html.haml +4 -0
  58. data/app/views/effective/cpd_audit_reviews/conflict.html.haml +5 -1
  59. data/app/views/effective/cpd_audit_reviews/cpd_audit_level_section.html.haml +2 -2
  60. data/app/views/effective/cpd_audit_reviews/feedback.html.haml +16 -0
  61. data/app/views/effective/cpd_audit_reviews/files.html.haml +17 -0
  62. data/app/views/effective/cpd_audit_reviews/recommendation.html.haml +5 -3
  63. data/app/views/effective/cpd_audit_reviews/start.html.haml +10 -3
  64. data/app/views/effective/cpd_audit_reviews/statements.html.haml +4 -5
  65. data/app/views/effective/cpd_audit_reviews/submit.html.haml +1 -1
  66. data/app/views/effective/cpd_audit_reviews/submitted.html.haml +20 -0
  67. data/app/views/effective/cpd_audit_reviews/waiting.html.haml +1 -1
  68. data/app/views/effective/cpd_audits/_conflict.html.haml +1 -1
  69. data/app/views/effective/cpd_audits/_cpd.html.haml +1 -1
  70. data/app/views/effective/cpd_audits/_cpd_audit.html.haml +3 -1
  71. data/app/views/effective/cpd_audits/_cpd_audit_level_section.html.haml +1 -1
  72. data/app/views/effective/cpd_audits/_exemption.html.haml +1 -1
  73. data/app/views/effective/cpd_audits/_extension.html.haml +2 -2
  74. data/app/views/effective/cpd_audits/_files.html.haml +1 -1
  75. data/app/views/effective/cpd_audits/_layout.html.haml +18 -6
  76. data/app/views/effective/cpd_audits/_missing_info.html.haml +19 -0
  77. data/app/views/effective/cpd_audits/_summary.html.haml +30 -12
  78. data/app/views/effective/cpd_audits/_waiting.html.haml +1 -1
  79. data/app/views/effective/cpd_audits/chat.html.haml +4 -0
  80. data/app/views/effective/cpd_audits/conflict.html.haml +5 -1
  81. data/app/views/effective/cpd_audits/cpd_audit_level_section.html.haml +1 -0
  82. data/app/views/effective/cpd_audits/start.html.haml +10 -4
  83. data/app/views/effective/cpd_audits/submit.html.haml +5 -2
  84. data/app/views/effective/cpd_audits/{complete.html.haml → submitted.haml} +13 -8
  85. data/app/views/effective/cpd_audits/waiting.html.haml +1 -1
  86. data/app/views/effective/cpd_mailer/cpd_audit_missing_info.liquid +15 -0
  87. data/app/views/effective/cpd_mailer/cpd_audit_review_ready.liquid +1 -1
  88. data/app/views/effective/cpd_mailer/cpd_audit_submitted.liquid +3 -1
  89. data/config/effective_cpd.rb +6 -2
  90. data/config/routes.rb +2 -0
  91. data/db/migrate/01_create_effective_cpd.rb.erb +25 -7
  92. data/lib/effective_cpd/version.rb +1 -1
  93. data/lib/effective_cpd.rb +5 -0
  94. metadata +34 -5
  95. data/app/views/effective/cpd_audit_reviews/complete.html.haml +0 -20
@@ -0,0 +1,11 @@
1
+ = effective_form_with(model: [:admin, cpd_audit], engine: true) do |f|
2
+ %p This audit will be marked as <strong>missing information</strong> with the following:
3
+
4
+ = f.text_field :missing_info_reason, required: true, label: 'Explanation of missing info'
5
+
6
+ %h3 Email to send
7
+
8
+ %p The following email will be sent:
9
+ = email_form_fields(f, :cpd_audit_missing_info)
10
+
11
+ = f.submit 'Missing Info', border: false, center: true, 'data-confirm': "Missing Info #{f.object}?"
@@ -1,7 +1,9 @@
1
1
  = effective_form_with(model: [:admin, cpd_audit], engine: true) do |f|
2
2
 
3
3
  %h2 Audit
4
- = f.select :cpd_audit_level_id, Effective::CpdAuditLevel.all.sorted, label: 'Audit level'
4
+ = f.hidden_field :cpd_audit_level_type, value: EffectiveCpd.CpdAuditLevel.name
5
+
6
+ = f.select :cpd_audit_level_id, EffectiveCpd.CpdAuditLevel.all.sorted, label: 'Audit level'
5
7
 
6
8
  = f.date_field :notification_date, label: 'Date of notification', required: false,
7
9
  hint: "the starting date for any deadline calculations. leave blank for today's date"
@@ -0,0 +1,18 @@
1
+ %p
2
+ %span.badge.badge-secondary= cpd_audit.status_label
3
+ = cpd_audit.summary
4
+
5
+ %p Process audit:
6
+
7
+ = accordion do
8
+ - if EffectiveResources.authorized?(self, :complete, cpd_audit)
9
+ = collapse 'Complete this Audit' do
10
+ = render('admin/cpd_audits/form_complete', cpd_audit: cpd_audit)
11
+
12
+ - if EffectiveResources.authorized?(self, :missing, cpd_audit)
13
+ = collapse 'Missing Information' do
14
+ = render('admin/cpd_audits/form_missing_info', cpd_audit: cpd_audit)
15
+
16
+ - if EffectiveResources.authorized?(self, :close, cpd_audit)
17
+ = collapse 'Close Audit with Determination' do
18
+ = render('admin/cpd_audits/form_close', cpd_audit: cpd_audit)
@@ -1,4 +1,4 @@
1
- %p= cpd_audit_summary_text(cpd_audit)
1
+ %p= cpd_audit.summary
2
2
 
3
3
  %table.table.table-striped
4
4
  %thead
@@ -95,6 +95,42 @@
95
95
  Done
96
96
  %td
97
97
 
98
+ - # Waiting to Complete
99
+ - unless cpd_audit.was_completed?
100
+ %tr
101
+ %td Waiting to Complete
102
+ %td= cpd_audit.submitted_at&.strftime('%F') || '-'
103
+ %td
104
+ - cpd_audit.completed_requirements.each do |requirement, completed|
105
+ %p
106
+ = icon((completed ? 'check' : 'x'), class: 'small-1')
107
+ = requirement
108
+
109
+ %td
110
+ - if cpd_audit.submitted?
111
+ = link_to 'Complete Audit', '#process', 'data-click-tab': true, class: 'btn btn-sm btn-primary'
112
+
113
+ - # Missing Information
114
+ %tr
115
+ %td Missing Information
116
+ %td= cpd_audit.missing_info_at&.strftime('%F') || '-'
117
+ %td
118
+ = cpd_audit.missing_info_reason
119
+
120
+ - if cpd_audit.was_missing_info? && cpd_audit.missing_info_reason.blank?
121
+ = icon('check', class: 'small-1')
122
+ Done
123
+ %td
124
+
125
+ %tr
126
+ %td Complete
127
+ %td= cpd_audit.completed_at&.strftime('%F') || '-'
128
+ %td
129
+ - if cpd_audit.was_completed?
130
+ = icon('check', class: 'small-1')
131
+ Done
132
+ %td
133
+
98
134
  %tr
99
135
  %td Reviewed
100
136
  %td= cpd_audit.reviewed_at&.strftime('%F') || '-'
@@ -106,16 +142,22 @@
106
142
  Reviews Completed
107
143
 
108
144
  %td
109
- - if cpd_audit.was_submitted? && !cpd_audit.was_reviewed?
145
+ - if cpd_audit.was_submitted? && !cpd_audit.was_reviewed? && !cpd_audit.closed?
110
146
  = link_to 'Audit Reviews', '#audit-reviews', 'data-click-tab': true, class: 'btn btn-sm btn-primary'
111
147
 
148
+ - unless cpd_audit.closed?
149
+ %tr
150
+ %td Waiting to Close
151
+ %td= cpd_audit.reviewed_at&.strftime('%F') || '-'
152
+ %td
153
+ %td
154
+ - if cpd_audit.was_reviewed?
155
+ = link_to 'Close Audit with Determination', '#process', 'data-click-tab': true, class: 'btn btn-sm btn-primary'
156
+
112
157
  %tr
113
158
  %td Closed
114
159
  %td= cpd_audit.closed_at&.strftime('%F') || '-'
115
160
  %td
116
- - if cpd_audit.completed?
161
+ - if cpd_audit.done?
117
162
  = cpd_audit.determination
118
-
119
163
  %td
120
- - if cpd_audit.reviewed? && !cpd_audit.completed?
121
- = link_to 'Determination', '#determination', 'data-click-tab': true, class: 'btn btn-sm btn-primary'
@@ -13,3 +13,10 @@
13
13
  %h2 Audits
14
14
  - datatable = Admin::EffectiveCpdAuditsDatatable.new(user: user)
15
15
  = render_datatable(datatable)
16
+
17
+ - if user.try(:cpd_audit_reviewer?)
18
+ %hr
19
+
20
+ %h2 Audit Reviews
21
+ - datatable = Admin::EffectiveCpdAuditReviewsDatatable.new(user: user)
22
+ = render_datatable(datatable)
@@ -0,0 +1,8 @@
1
+ - if user.try(:cpd_audit_reviewer?)
2
+ %h2 Audit Reviews
3
+ - datatable = Admin::EffectiveCpdAuditReviewsDatatable.new(user: user)
4
+ = render_datatable(datatable)
5
+ - else
6
+ %h2 Audits
7
+ - datatable = Admin::EffectiveCpdAuditsDatatable.new(user: user)
8
+ = render_datatable(datatable)
@@ -18,7 +18,7 @@
18
18
  .mt-4
19
19
  %p Please submit a CPD statement for the following available #{cpd_cycles_label}:
20
20
  = render_datatable(available, simple: true)
21
- - else
21
+ - elsif current_user.try(:cpd_audit_cpd_required?)
22
22
  %p There are no #{cpd_cycles_label} available to submit. When there are, we'll show them here.
23
23
 
24
24
  - completed = EffectiveCpdCompletedStatementsDatatable.new(self)
@@ -27,15 +27,18 @@
27
27
  %p You have completed these past statements:
28
28
  = render_datatable(completed, simple: true)
29
29
 
30
- - # Auditor / Audit reviewer datatables (2)
31
- - reviewing = EffectiveCpdAvailableAuditReviewsDatatable.new(self)
32
- - if reviewing.present?
33
- .mt-4
34
- %p You have been selected to assess the following audits:
35
- = render_datatable(reviewing, simple: true)
30
+ - if current_user.try(:cpd_audit_reviewer?)
31
+ - # Auditor / Audit reviewer datatables (2)
32
+ - reviewing = EffectiveCpdAvailableAuditReviewsDatatable.new(self)
33
+ - if reviewing.present?
34
+ .mt-4
35
+ %p You have been selected to assess the following audits:
36
+ = render_datatable(reviewing, simple: true)
37
+ - else
38
+ %p There are no audits available to review. When there are, we'll show them here.
36
39
 
37
- - reviewed = EffectiveCpdCompletedAuditReviewsDatatable.new(self)
38
- - if reviewed.present?
39
- .mt-4
40
- %p You have completed these past audit assessments:
41
- = render_datatable(reviewed, simple: true)
40
+ - reviewed = EffectiveCpdCompletedAuditReviewsDatatable.new(self)
41
+ - if reviewed.present?
42
+ .mt-4
43
+ %p You have completed these past audit assessments:
44
+ = render_datatable(reviewed, simple: true)
@@ -1,5 +1,6 @@
1
1
  .cpd-audit-level-question
2
+ Question ##{cpd_audit_level_question.position + 1}:
2
3
  = cpd_audit_level_question
3
4
 
4
5
  - if cpd_audit_level_question.body.present?
5
- = cpd_audit_level_question.body.to_s
6
+ .mt-4= cpd_audit_level_question.body.to_s
@@ -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
@@ -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')
@@ -1,6 +1,6 @@
1
1
  .row
2
2
  .col-3
3
- = render_wizard_sidebar(resource)
3
+ = render_wizard_sidebar(resource, path: effective_cpd.cpd_audit_review_build_path(resource))
4
4
 
5
5
  %table.table.mt-4
6
6
  %tbody
@@ -11,6 +11,16 @@
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
17
+
18
+ - if EffectiveCpd.use_effective_messaging?
19
+ .list-group
20
+ - if (controller.action_name == 'chat')
21
+ %a.active.list-group-item.list-group-item-action Chat
22
+ - else
23
+ %a.list-group-item.list-group-item-action{href: effective_cpd.chat_cpd_audit_review_path(resource)} Chat
14
24
 
15
25
  .col-9
16
26
  %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'
@@ -0,0 +1,4 @@
1
+ - # This isn't a wizard screen. It's a show view.
2
+
3
+ = render('layout') do
4
+ = render(resource.cpd_audit.create_chat)
@@ -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
@@ -16,7 +16,7 @@
16
16
 
17
17
  %tr
18
18
  %th Reason
19
- %td= cpd_audit.exemption_request_reason
19
+ %td= cpd_audit.extension_request_reason
20
20
 
21
21
  %tr
22
22
  %th Status
@@ -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