effective_cpd 0.0.1 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +122 -10
  3. data/app/assets/javascripts/effective_cpd/activities.js +6 -0
  4. data/app/controllers/admin/cpd_audit_level_questions_controller.rb +13 -0
  5. data/app/controllers/admin/cpd_audit_levels_controller.rb +13 -0
  6. data/app/controllers/admin/cpd_audit_reviews_controller.rb +13 -0
  7. data/app/controllers/admin/cpd_audits_controller.rb +41 -0
  8. data/app/controllers/admin/cpd_special_rules_controller.rb +13 -0
  9. data/app/controllers/effective/cpd_audit_reviews_controller.rb +60 -0
  10. data/app/controllers/effective/cpd_audits_controller.rb +55 -0
  11. data/app/controllers/effective/cpd_cycles_controller.rb +1 -0
  12. data/app/controllers/effective/cpd_statements_controller.rb +1 -3
  13. data/app/datatables/admin/effective_cpd_audit_level_questions_datatable.rb +30 -0
  14. data/app/datatables/admin/effective_cpd_audit_levels_datatable.rb +34 -0
  15. data/app/datatables/admin/effective_cpd_audit_reviews_datatable.rb +29 -0
  16. data/app/datatables/admin/effective_cpd_audits_datatable.rb +67 -0
  17. data/app/datatables/admin/effective_cpd_special_rules_datatable.rb +23 -0
  18. data/app/datatables/admin/effective_cpd_statements_datatable.rb +3 -3
  19. data/app/datatables/effective_cpd_available_audit_reviews_datatable.rb +37 -0
  20. data/app/datatables/effective_cpd_available_audits_datatable.rb +30 -0
  21. data/app/datatables/{effective_cpd_datatable.rb → effective_cpd_available_cycles_datatable.rb} +3 -4
  22. data/app/datatables/effective_cpd_completed_audit_reviews_datatable.rb +32 -0
  23. data/app/datatables/effective_cpd_completed_audits_datatable.rb +24 -0
  24. data/app/datatables/effective_cpd_completed_statements_datatable.rb +28 -0
  25. data/app/helpers/effective_cpd_audits_helper.rb +48 -0
  26. data/app/helpers/effective_cpd_helper.rb +10 -0
  27. data/app/mailers/effective/cpd_mailer.rb +155 -3
  28. data/app/models/concerns/effective_cpd_user.rb +29 -0
  29. data/app/models/effective/cpd_activity.rb +16 -3
  30. data/app/models/effective/cpd_audit.rb +380 -0
  31. data/app/models/effective/cpd_audit_level.rb +87 -0
  32. data/app/models/effective/cpd_audit_level_question.rb +91 -0
  33. data/app/models/effective/cpd_audit_level_question_option.rb +34 -0
  34. data/app/models/effective/cpd_audit_level_section.rb +50 -0
  35. data/app/models/effective/cpd_audit_response.rb +86 -0
  36. data/app/models/effective/cpd_audit_response_option.rb +6 -0
  37. data/app/models/effective/cpd_audit_review.rb +222 -0
  38. data/app/models/effective/cpd_audit_review_item.rb +34 -0
  39. data/app/models/effective/cpd_category.rb +12 -3
  40. data/app/models/effective/cpd_cycle.rb +18 -2
  41. data/app/models/effective/cpd_rule.rb +23 -6
  42. data/app/models/effective/cpd_scorer.rb +23 -1
  43. data/app/models/effective/cpd_special_rule.rb +54 -0
  44. data/app/models/effective/cpd_special_rule_mate.rb +6 -0
  45. data/app/models/effective/cpd_statement.rb +25 -11
  46. data/app/views/admin/cpd_activities/_form.html.haml +1 -1
  47. data/app/views/admin/cpd_audit_level_questions/_form.html.haml +100 -0
  48. data/app/views/admin/cpd_audit_levels/_form.html.haml +24 -0
  49. data/app/views/admin/cpd_audit_levels/_form_content_audit.html.haml +15 -0
  50. data/app/views/admin/cpd_audit_levels/_form_content_audit_review.html.haml +15 -0
  51. data/app/views/admin/cpd_audit_levels/_form_cpd_audit_level.html.haml +52 -0
  52. data/app/views/admin/cpd_audit_levels/_form_cpd_audit_level_section.html.haml +10 -0
  53. data/app/views/admin/cpd_audit_reviews/_cpd_audit_review.html.haml +1 -0
  54. data/app/views/admin/cpd_audit_reviews/_form.html.haml +13 -0
  55. data/app/views/admin/cpd_audits/_audit_reviewer_fields.html.haml +2 -0
  56. data/app/views/admin/cpd_audits/_auditee_fields.html.haml +2 -0
  57. data/app/views/admin/cpd_audits/_form.html.haml +46 -0
  58. data/app/views/admin/cpd_audits/_form_conflict.html.haml +24 -0
  59. data/app/views/admin/cpd_audits/_form_determination.html.haml +10 -0
  60. data/app/views/admin/cpd_audits/_form_exemption.html.haml +24 -0
  61. data/app/views/admin/cpd_audits/_form_extension.html.haml +24 -0
  62. data/app/views/admin/cpd_audits/_form_new.html.haml +28 -0
  63. data/app/views/admin/cpd_audits/_status.html.haml +121 -0
  64. data/app/views/admin/cpd_categories/_form.html.haml +1 -1
  65. data/app/views/admin/cpd_cycles/_form.html.haml +6 -3
  66. data/app/views/admin/cpd_cycles/_form_content.html.haml +8 -0
  67. data/app/views/admin/cpd_cycles/_form_cpd_cycle.html.haml +3 -0
  68. data/app/views/admin/cpd_cycles/_form_cpd_rules.html.haml +12 -7
  69. data/app/views/admin/cpd_cycles/_form_cpd_special_rules.html.haml +4 -0
  70. data/app/views/admin/cpd_special_rules/_form.html.haml +18 -0
  71. data/app/views/admin/cpd_statements/_cpd_statement.html.haml +7 -0
  72. data/app/views/effective/cpd_audit_level_questions/_cpd_audit_level_question.html.haml +5 -0
  73. data/app/views/effective/cpd_audit_responses/_cpd_audit_response.html.haml +4 -0
  74. data/app/views/effective/cpd_audit_responses/_fields.html.haml +13 -0
  75. data/app/views/effective/cpd_audit_responses/fields/_choose_one.html.haml +1 -0
  76. data/app/views/effective/cpd_audit_responses/fields/_date.html.haml +2 -0
  77. data/app/views/effective/cpd_audit_responses/fields/_email.html.haml +2 -0
  78. data/app/views/effective/cpd_audit_responses/fields/_long_answer.html.haml +1 -0
  79. data/app/views/effective/cpd_audit_responses/fields/_number.html.haml +2 -0
  80. data/app/views/effective/cpd_audit_responses/fields/_select_all_that_apply.html.haml +1 -0
  81. data/app/views/effective/cpd_audit_responses/fields/_select_up_to_1.html.haml +1 -0
  82. data/app/views/effective/cpd_audit_responses/fields/_select_up_to_2.html.haml +1 -0
  83. data/app/views/effective/cpd_audit_responses/fields/_select_up_to_3.html.haml +1 -0
  84. data/app/views/effective/cpd_audit_responses/fields/_select_up_to_4.html.haml +1 -0
  85. data/app/views/effective/cpd_audit_responses/fields/_select_up_to_5.html.haml +1 -0
  86. data/app/views/effective/cpd_audit_responses/fields/_short_answer.html.haml +1 -0
  87. data/app/views/effective/cpd_audit_responses/fields/_upload_file.html.haml +1 -0
  88. data/app/views/effective/cpd_audit_responses/responses/_choose_one.html.haml +1 -0
  89. data/app/views/effective/cpd_audit_responses/responses/_date.html.haml +1 -0
  90. data/app/views/effective/cpd_audit_responses/responses/_email.html.haml +1 -0
  91. data/app/views/effective/cpd_audit_responses/responses/_long_answer.html.haml +1 -0
  92. data/app/views/effective/cpd_audit_responses/responses/_number.html.haml +1 -0
  93. data/app/views/effective/cpd_audit_responses/responses/_select_all_that_apply.html.haml +5 -0
  94. data/app/views/effective/cpd_audit_responses/responses/_select_up_to_1.html.haml +1 -0
  95. data/app/views/effective/cpd_audit_responses/responses/_select_up_to_2.html.haml +5 -0
  96. data/app/views/effective/cpd_audit_responses/responses/_select_up_to_3.html.haml +5 -0
  97. data/app/views/effective/cpd_audit_responses/responses/_select_up_to_4.html.haml +5 -0
  98. data/app/views/effective/cpd_audit_responses/responses/_select_up_to_5.html.haml +5 -0
  99. data/app/views/effective/cpd_audit_responses/responses/_short_answer.html.haml +1 -0
  100. data/app/views/effective/cpd_audit_responses/responses/_upload_file.html.haml +4 -0
  101. data/app/views/effective/cpd_audit_review_items/_cpd_audit_review_item.html.haml +6 -0
  102. data/app/views/effective/cpd_audit_review_items/_fields.html.haml +11 -0
  103. data/app/views/effective/cpd_audit_reviews/_conflict.html.haml +15 -0
  104. data/app/views/effective/cpd_audit_reviews/_cpd_audit_level_section.html.haml +23 -0
  105. data/app/views/effective/cpd_audit_reviews/_cpd_audit_review.html.haml +17 -0
  106. data/app/views/effective/cpd_audit_reviews/_cpd_statement.html.haml +15 -0
  107. data/app/views/effective/cpd_audit_reviews/_layout.html.haml +24 -0
  108. data/app/views/effective/cpd_audit_reviews/_recommendation.html.haml +9 -0
  109. data/app/views/effective/cpd_audit_reviews/_summary.html.haml +47 -0
  110. data/app/views/effective/cpd_audit_reviews/complete.html.haml +20 -0
  111. data/app/views/effective/cpd_audit_reviews/conflict.html.haml +21 -0
  112. data/app/views/effective/cpd_audit_reviews/cpd_audit_level_section.html.haml +43 -0
  113. data/app/views/effective/cpd_audit_reviews/cpd_statement.html.haml +35 -0
  114. data/app/views/effective/cpd_audit_reviews/information.html.haml +5 -0
  115. data/app/views/effective/cpd_audit_reviews/instructions.html.haml +10 -0
  116. data/app/views/effective/cpd_audit_reviews/questionnaire.html.haml +8 -0
  117. data/app/views/effective/cpd_audit_reviews/recommendation.html.haml +21 -0
  118. data/app/views/effective/cpd_audit_reviews/start.html.haml +10 -0
  119. data/app/views/effective/cpd_audit_reviews/statements.html.haml +29 -0
  120. data/app/views/effective/cpd_audit_reviews/submit.html.haml +14 -0
  121. data/app/views/effective/cpd_audit_reviews/waiting.html.haml +9 -0
  122. data/app/views/effective/cpd_audits/_conflict.html.haml +15 -0
  123. data/app/views/effective/cpd_audits/_cpd_audit.html.haml +12 -0
  124. data/app/views/effective/cpd_audits/_cpd_audit_level_section.html.haml +14 -0
  125. data/app/views/effective/cpd_audits/_exemption.html.haml +26 -0
  126. data/app/views/effective/cpd_audits/_extension.html.haml +30 -0
  127. data/app/views/effective/cpd_audits/_files.html.haml +12 -0
  128. data/app/views/effective/cpd_audits/_layout.html.haml +33 -0
  129. data/app/views/effective/cpd_audits/_summary.html.haml +54 -0
  130. data/app/views/effective/cpd_audits/_waiting.html.haml +6 -0
  131. data/app/views/effective/cpd_audits/complete.html.haml +24 -0
  132. data/app/views/effective/cpd_audits/conflict.html.haml +22 -0
  133. data/app/views/effective/cpd_audits/cpd_audit_level_section.html.haml +20 -0
  134. data/app/views/effective/cpd_audits/exemption.html.haml +19 -0
  135. data/app/views/effective/cpd_audits/extension.html.haml +21 -0
  136. data/app/views/effective/cpd_audits/files.html.haml +7 -0
  137. data/app/views/effective/cpd_audits/information.html.haml +5 -0
  138. data/app/views/effective/cpd_audits/instructions.html.haml +5 -0
  139. data/app/views/effective/cpd_audits/questionnaire.html.haml +5 -0
  140. data/app/views/effective/cpd_audits/start.html.haml +11 -0
  141. data/app/views/effective/cpd_audits/submit.html.haml +15 -0
  142. data/app/views/effective/cpd_audits/waiting.html.haml +24 -0
  143. data/app/views/effective/cpd_mailer/README.md +1 -0
  144. data/app/views/effective/cpd_mailer/cpd_audit_closed.liquid +15 -0
  145. data/app/views/effective/cpd_mailer/cpd_audit_conflict_resolved.liquid +15 -0
  146. data/app/views/effective/cpd_mailer/cpd_audit_conflicted.liquid +13 -0
  147. data/app/views/effective/cpd_mailer/cpd_audit_exemption_denied.liquid +13 -0
  148. data/app/views/effective/cpd_mailer/cpd_audit_exemption_granted.liquid +13 -0
  149. data/app/views/effective/cpd_mailer/cpd_audit_exemption_request.liquid +13 -0
  150. data/app/views/effective/cpd_mailer/cpd_audit_extension_denied.liquid +13 -0
  151. data/app/views/effective/cpd_mailer/cpd_audit_extension_granted.liquid +13 -0
  152. data/app/views/effective/cpd_mailer/cpd_audit_extension_request.liquid +13 -0
  153. data/app/views/effective/cpd_mailer/cpd_audit_opened.liquid +13 -0
  154. data/app/views/effective/cpd_mailer/cpd_audit_review_opened.liquid +15 -0
  155. data/app/views/effective/cpd_mailer/cpd_audit_review_ready.liquid +13 -0
  156. data/app/views/effective/cpd_mailer/cpd_audit_review_submitted.liquid +11 -0
  157. data/app/views/effective/cpd_mailer/cpd_audit_reviewed.liquid +13 -0
  158. data/app/views/effective/cpd_mailer/cpd_audit_submitted.liquid +13 -0
  159. data/app/views/effective/cpd_statement_activities/_cpd_statement_activity.html.haml +65 -0
  160. data/app/views/effective/cpd_statement_activities/_form.html.haml +10 -10
  161. data/app/views/effective/cpd_statements/_activities.html.haml +3 -64
  162. data/app/views/effective/cpd_statements/_activities_edit.html.haml +2 -0
  163. data/app/views/effective/cpd_statements/_activities_new.html.haml +3 -0
  164. data/app/views/effective/cpd_statements/_activities_table.html.haml +64 -0
  165. data/app/views/effective/cpd_statements/_agreements.html.haml +19 -5
  166. data/app/views/effective/cpd_statements/_cpd_statement.html.haml +6 -3
  167. data/app/views/effective/cpd_statements/_layout.html.haml +3 -4
  168. data/app/views/effective/cpd_statements/_summary.html.haml +26 -31
  169. data/app/views/effective/cpd_statements/activities.html.haml +1 -1
  170. data/app/views/effective/cpd_statements/agreements.html.haml +7 -1
  171. data/app/views/effective/cpd_statements/submit.html.haml +2 -3
  172. data/config/effective_cpd.rb +49 -10
  173. data/config/routes.rb +19 -1
  174. data/db/migrate/01_create_effective_cpd.rb.erb +175 -1
  175. data/db/seeds.rb +16 -13
  176. data/lib/effective_cpd.rb +42 -3
  177. data/lib/effective_cpd/engine.rb +7 -0
  178. data/lib/effective_cpd/version.rb +1 -1
  179. data/lib/generators/effective_cpd/install_generator.rb +18 -3
  180. metadata +175 -9
  181. data/app/datatables/effective_cpd_statements_datatable.rb +0 -23
  182. data/app/views/admin/cpd_statements/_form.html.haml +0 -6
@@ -0,0 +1,24 @@
1
+ = tabs do
2
+ = tab 'Audit Level' do
3
+ = render 'admin/cpd_audit_levels/form_cpd_audit_level', cpd_audit_level: cpd_audit_level
4
+
5
+ - if cpd_audit_level.persisted?
6
+ = tab 'Sections and Questions' do
7
+ %p
8
+ Each of the following sections is a step on the audit wizard.
9
+ The All Steps content will be displayed as well as the top and bottom content.
10
+
11
+ = tabs do
12
+ - cpd_audit_level.cpd_audit_level_sections.each do |cpd_audit_level_section|
13
+ = tab(cpd_audit_level_section.to_s) do
14
+ = render 'admin/cpd_audit_levels/form_cpd_audit_level_section', cpd_audit_level: cpd_audit_level, cpd_audit_level_section: cpd_audit_level_section
15
+
16
+ = tab 'Auditee Wizard' do
17
+ = render 'admin/cpd_audit_levels/form_content_audit', cpd_audit_level: cpd_audit_level
18
+
19
+ = tab 'Audit Reviewer Wizard' do
20
+ = render 'admin/cpd_audit_levels/form_content_audit_review', cpd_audit_level: cpd_audit_level
21
+
22
+ - if cpd_audit_level.respond_to?(:log_changes_datatable)
23
+ = tab 'Logs' do
24
+ = render_inline_datatable(cpd_audit_level.log_changes_datatable)
@@ -0,0 +1,15 @@
1
+ %p Each of the following content areas will be displayed on the auditee wizard.
2
+
3
+ = effective_form_with(model: [:admin, cpd_audit_level], engine: true) do |f|
4
+ = card("All Steps Content") do
5
+ = f.rich_text_area "rich_text_all_steps_audit_content", label: false,
6
+ hint: "displayed on all steps"
7
+
8
+ %hr
9
+
10
+ - Effective::CpdAudit::WIZARD_STEPS.each do |step, title|
11
+ = card("#{title} Content") do
12
+ = f.rich_text_area "rich_text_#{step}_audit_content", label: false,
13
+ hint: "displayed on the auditee wizard #{step} wizard step only"
14
+
15
+ = f.submit
@@ -0,0 +1,15 @@
1
+ %p Each of the following content areas will be displayed on the audit reviewer wizard.
2
+
3
+ = effective_form_with(model: [:admin, cpd_audit_level], engine: true) do |f|
4
+ = card("All Steps Content") do
5
+ = f.rich_text_area "rich_text_all_steps_audit_review_content", label: false,
6
+ hint: "displayed on all steps"
7
+
8
+ %hr
9
+
10
+ - Effective::CpdAuditReview::WIZARD_STEPS.each do |step, title|
11
+ = card("#{title} Content") do
12
+ = f.rich_text_area "rich_text_#{step}_audit_review_content", label: false,
13
+ hint: "displayed on the audit reviewer #{step} wizard step only"
14
+
15
+ = f.submit
@@ -0,0 +1,52 @@
1
+ = effective_form_with(model: [:admin, cpd_audit_level], engine: true) do |f|
2
+ = f.text_field :title, hint: 'A title for this kind of audit'
3
+
4
+ = f.select :recommendations, f.object.recommendations,
5
+ label: 'Audit Review recommendation choices', tags: true, placeholder: 'Type to add item...',
6
+ hint: 'The recommendation made by an audit reviewer when reviewing an audit. Begin typing and then press enter to add a choice'
7
+
8
+
9
+ = f.select :determinations, f.object.determinations,
10
+ label: 'Audit determination choices', tags: true, placeholder: 'Type to add item...',
11
+ hint: 'The final determination made by the auditor when closing an audit. Begin typing and then press enter to add a choice.'
12
+
13
+ %h2 Sections
14
+ %p
15
+ Please add at least one section.
16
+ Each section is a step on the audit wizard with its own content and questions.
17
+
18
+ = f.has_many :cpd_audit_level_sections, class: 'tight' do |fas|
19
+ = fas.text_field :title, label: false
20
+
21
+ %h2 Deadlines
22
+ %p.text-muted Leave blank for no deadlines
23
+ .row
24
+ .col= f.text_field :days_to_submit, label: 'Days for auditee to submit', hint: "The number of business days from the date of notification or approved extension that an auditee has to complete their submission."
25
+ .col= f.text_field :days_to_review, label: 'Days for auditor to review', hint: "The number of business days from the auditee's deadline that an auditor has to review the submission and provide a recommendation."
26
+
27
+ %h2 Workflows
28
+ %p.text-muted Each of these workflows will be displayed to the audittee and/or auditor on their wizard steps. Leave blank for no deadlines.
29
+
30
+ .row
31
+ .col
32
+ %h3 Conflict of Interest
33
+ = f.check_box :conflict_of_interest, label: 'Yes, the auditee and auditor may declare a conflict of interest with their matching'
34
+
35
+ = f.show_if :conflict_of_interest, true do
36
+ = f.text_field :days_to_declare_conflict, label: 'Days to declare conflict of interest', hint: "The number of business days from the date of notification that an auditee and auditors have to declare a conflict of interest with the matching."
37
+
38
+ .col
39
+ %h3 Exemption
40
+ = f.check_box :can_request_exemption, label: "Yes, the auditee may request an exemption<br><br>".html_safe
41
+
42
+ = f.show_if :can_request_exemption, true do
43
+ = f.text_field :days_to_request_exemption, label: 'Days to request exemption', hint: "The number of business days from the date of notification that an auditee may request an exemption."
44
+
45
+ .col
46
+ %h3 Extension
47
+ = f.check_box :can_request_extension, label: "Yes, the auditee may request an extension<br><br>"
48
+
49
+ = f.show_if :can_request_extension, true do
50
+ = f.text_field :days_to_request_extension, label: 'Days to request extension', hint: "The number of business days from the date of notification that an auditee may request an extension."
51
+
52
+ = effective_submit(f)
@@ -0,0 +1,10 @@
1
+ = effective_form_with(model: [:admin, cpd_audit_level], engine: true) do |f|
2
+ = f.fields_for :cpd_audit_level_sections, cpd_audit_level_section do |fas|
3
+ = fas.rich_text_area :top_content
4
+ = fas.rich_text_area :bottom_content
5
+
6
+ = f.submit
7
+
8
+ %h2 Questions
9
+ - datatable = Admin::EffectiveCpdAuditLevelQuestionsDatatable.new(cpd_audit_level_section_id: cpd_audit_level_section.id)
10
+ = render_datatable(datatable, inline: true, simple: true)
@@ -0,0 +1 @@
1
+ = render('effective/cpd_audit_reviews/cpd_audit_review', cpd_audit_review: cpd_audit_review)
@@ -0,0 +1,13 @@
1
+ = effective_form_with(model: [:admin, cpd_audit_review], engine: true) do |f|
2
+ - if inline_datatable?
3
+ = f.hidden_field :cpd_audit_id
4
+ = f.static_field :cpd_audit, label: 'CPD Audit'
5
+ - else
6
+ = f.select :cpd_audit_id, Effective::CpdAudit.available.sorted.all
7
+
8
+ = render('admin/cpd_audits/audit_reviewer_fields', f: f)
9
+
10
+ %p Send email
11
+ = email_form_fields(f, :cpd_audit_review_opened)
12
+
13
+ = effective_submit(f)
@@ -0,0 +1,2 @@
1
+ - collection = current_user.class.send(EffectiveCpd.audit_reviewer_user_scope)
2
+ = f.select :user, { 'Audit Reviewers' => collection }, label: 'Audit Reviewer', polymorphic: true
@@ -0,0 +1,2 @@
1
+ - collection = current_user.class.send(EffectiveCpd.auditee_user_scope)
2
+ = f.select :user, { 'Auditees' => collection }, label: 'Auditee', polymorphic: true
@@ -0,0 +1,46 @@
1
+ = tabs do
2
+ - if cpd_audit.new_record?
3
+ = tab 'New Audit' do
4
+ = render 'admin/cpd_audits/form_new', cpd_audit: cpd_audit
5
+
6
+ - if cpd_audit.persisted?
7
+ - if cpd_audit.completed?
8
+ = tab 'Audit' do
9
+ = render 'effective/cpd_audits/cpd_audit', cpd_audit: cpd_audit
10
+
11
+ = tab 'Status' do
12
+ = render 'admin/cpd_audits/status', cpd_audit: cpd_audit
13
+ - else
14
+ = tab 'Status' do
15
+ = render 'admin/cpd_audits/status', cpd_audit: cpd_audit
16
+
17
+ = tab 'Audit' do
18
+ = render 'effective/cpd_audits/cpd_audit', cpd_audit: cpd_audit
19
+
20
+ = tab 'Statements' do
21
+ - datatable = Admin::EffectiveCpdStatementsDatatable.new(user_id: cpd_audit.user.id, user_type: cpd_audit.user.class.name)
22
+ = render_datatable(datatable, inline: true, simple: true)
23
+
24
+ = tab 'Audit Reviews' do
25
+ - datatable = Admin::EffectiveCpdAuditReviewsDatatable.new(cpd_audit_id: cpd_audit.id)
26
+ = render_datatable(datatable, inline: true, simple: true)
27
+
28
+ - unless cpd_audit.closed?
29
+ = tab 'Determination' do
30
+ = render 'admin/cpd_audits/form_determination', cpd_audit: cpd_audit
31
+
32
+ - if cpd_audit.conflicted?
33
+ = tab 'Process Conflict of Interest' do
34
+ = render 'admin/cpd_audits/form_conflict', cpd_audit: cpd_audit
35
+
36
+ - if cpd_audit.exemption_requested?
37
+ = tab 'Process Exemption Request' do
38
+ = render 'admin/cpd_audits/form_exemption', cpd_audit: cpd_audit
39
+
40
+ - if cpd_audit.extension_requested?
41
+ = tab 'Process Extension Request' do
42
+ = render 'admin/cpd_audits/form_extension', cpd_audit: cpd_audit
43
+
44
+ - if cpd_audit.respond_to?(:log_changes_datatable)
45
+ = tab 'Logs' do
46
+ = render_inline_datatable(cpd_audit.log_changes_datatable)
@@ -0,0 +1,24 @@
1
+ - raise('expected a conflicted cpd audit') unless cpd_audit.conflicted? || cpd_audit.errors.present?
2
+
3
+ %h2 Conflict of Interest
4
+ %p The auditee has indicated a conflict of interest:
5
+ = render('effective/cpd_audits/conflict', cpd_audit: cpd_audit, step: :conflict)
6
+
7
+ %h2 Resolve Conflict of Interest
8
+ %p
9
+ Please use the table below to delete any conflicting audit reviews, and create another reviewer.
10
+
11
+ = card('Update Audit Reviewers') do
12
+ %p There should be at least one audit reviewer.
13
+
14
+ - datatable = Admin::EffectiveCpdAuditReviewsDatatable.new(cpd_audit_id: cpd_audit.id)
15
+ = render_datatable(datatable, inline: true, simple: true)
16
+
17
+ = card('Mark Resolved') do
18
+ %p Once resolved, the auditee will be ready to continue their audit questionnaire.
19
+
20
+ = effective_form_with(model: [:admin, cpd_audit], engine: true) do |f|
21
+ %p Send email
22
+ = email_form_fields(f, :cpd_audit_conflict_resolved)
23
+
24
+ = f.submit 'Resolve Conflict of Interest', center: true
@@ -0,0 +1,10 @@
1
+ = card('Determination') do
2
+ = effective_form_with(model: [:admin, cpd_audit], engine: true) do |f|
3
+ %p This action will complete this audit and mark it as closed.
4
+
5
+ = f.select :determination, cpd_audit.cpd_audit_level.determinations
6
+
7
+ %h2 Email to Send
8
+ = email_form_fields(f, :cpd_audit_closed)
9
+
10
+ = f.submit 'Close Audit', center: true
@@ -0,0 +1,24 @@
1
+ - raise('expected an exemption requested cpd audit') unless cpd_audit.exemption_requested? || cpd_audit.errors.present?
2
+
3
+ %h2 Exemption Request
4
+ %p The auditee has requested an exemption:
5
+ = render('effective/cpd_audits/exemption', cpd_audit: cpd_audit, step: :exemption)
6
+
7
+ %h2 Resolve Exemption Request
8
+ %p Please grant or deny the request. If granted, this audit will be closed.
9
+
10
+ = card('Exemption Request') do
11
+ %p The exemption request shall be
12
+
13
+ = effective_form_with(model: [:admin, cpd_audit], engine: true) do |f|
14
+ = f.radios :admin_process_request, Effective::CpdAudit::ADMIN_PROCESS_REQUEST_OPTIONS, label: false, buttons: true, required: true
15
+
16
+ = f.show_if :admin_process_request, 'Granted' do
17
+ %p Send email
18
+ = email_form_fields(f, :cpd_audit_exemption_granted)
19
+
20
+ = f.show_if :admin_process_request, 'Denied' do
21
+ %p Send email
22
+ = email_form_fields(f, :cpd_audit_exemption_denied)
23
+
24
+ = f.submit 'Process Exemption Request', center: true
@@ -0,0 +1,24 @@
1
+ - raise('expected an extension requested cpd audit') unless cpd_audit.extension_requested? || cpd_audit.errors.present?
2
+
3
+ %h2 Extension Request
4
+ %p The auditee has requested an extension:
5
+ = render('effective/cpd_audits/extension', cpd_audit: cpd_audit, step: :extension)
6
+
7
+ %h2 Resolve Extension Request
8
+ %p Please grant or deny the request. If granted, the auditee's deadline will be updated.
9
+
10
+ = card('Extension Request') do
11
+ %p The extension request shall be
12
+
13
+ = effective_form_with(model: [:admin, cpd_audit], engine: true) do |f|
14
+ = f.radios :admin_process_request, Effective::CpdAudit::ADMIN_PROCESS_REQUEST_OPTIONS, label: false, buttons: true, required: true
15
+
16
+ = f.show_if :admin_process_request, 'Granted' do
17
+ %p Send email
18
+ = email_form_fields(f, :cpd_audit_extension_granted)
19
+
20
+ = f.show_if :admin_process_request, 'Denied' do
21
+ %p Send email
22
+ = email_form_fields(f, :cpd_audit_extension_denied)
23
+
24
+ = f.submit 'Process Extension Request', center: true
@@ -0,0 +1,28 @@
1
+ = effective_form_with(model: [:admin, cpd_audit], engine: true) do |f|
2
+
3
+ %h2 Audit
4
+ = f.select :cpd_audit_level_id, Effective::CpdAuditLevel.all.sorted, label: 'Audit level'
5
+
6
+ = f.date_field :notification_date, label: 'Date of notification', required: false,
7
+ hint: "the starting date for any deadline calculations. leave blank for today's date"
8
+
9
+ %h2 Auditee
10
+ = card('Auditee') do
11
+ %p.text-muted The auditee is the person being audited
12
+ = render('admin/cpd_audits/auditee_fields', form: f, f: f)
13
+
14
+ %p Send email
15
+ = email_form_fields(f, :cpd_audit_opened)
16
+
17
+ %h2 Audit Reviewers
18
+ %p.text-muted An audit review will be created for each selected auditor.
19
+
20
+ = f.has_many :cpd_audit_reviews, class: 'tight' do |fr|
21
+ = card('Audit Reviewer') do
22
+ %p.text-muted The audit reviewer is the person reviewing an audit
23
+ = render('admin/cpd_audits/audit_reviewer_fields', form: fr, f: fr)
24
+
25
+ %p Send email
26
+ = email_form_fields(fr, :cpd_audit_review_opened)
27
+
28
+ = f.submit 'Open Audit', center: true
@@ -0,0 +1,121 @@
1
+ %p= cpd_audit_summary_text(cpd_audit)
2
+
3
+ %table.table.table-striped
4
+ %thead
5
+ %tr
6
+ %th Status
7
+ %th Date Reached
8
+ %th Details
9
+ %th
10
+ %tbody
11
+ %tr
12
+ %td Opened
13
+ %td= cpd_audit.opened_at.strftime('%F') || '-'
14
+ %td #{icon('check', class: 'small-1')} Done
15
+ %td
16
+
17
+ %tr
18
+ %td Started
19
+ %td= cpd_audit.started_at&.strftime('%F') || '-'
20
+ %td
21
+ - if cpd_audit.was_submitted?
22
+ = icon('check', class: 'small-1')
23
+ Done
24
+ - elsif cpd_audit.was_started?
25
+ = icon('check', class: 'small-1')
26
+ In Progress
27
+ %td
28
+
29
+ - if cpd_audit.cpd_audit_level.conflict_of_interest?
30
+ %tr
31
+ %td Conflict of Interest
32
+ %td= cpd_audit.conflicted_at&.strftime('%F') || '-'
33
+ %td
34
+ - if cpd_audit.conflicted?
35
+ = icon('x', class: 'small-1')
36
+ Auditee has indicated conflict of interest
37
+ - elsif cpd_audit.was_conflicted_resolved?
38
+ = icon('check', class: 'small-1')
39
+ Resolved
40
+ - elsif cpd_audit.was_submitted?
41
+ = icon('check', class: 'small-1')
42
+ No Conflict
43
+ %td
44
+ - if cpd_audit.conflicted?
45
+ = link_to 'Process Conflict of Interest', '#process-conflict-of-interest', 'data-click-tab': true, class: 'btn btn-sm btn-primary'
46
+
47
+ - if cpd_audit.cpd_audit_level.can_request_exemption?
48
+ %tr
49
+ %td Exemption Request
50
+ %td= cpd_audit.exemption_requested_at&.strftime('%F') || '-'
51
+ %td
52
+ - if cpd_audit.exemption_requested?
53
+ = icon('x', class: 'small-1')
54
+ Auditee has requested an exemption
55
+ - elsif cpd_audit.was_exemption_granted?
56
+ = icon('check', class: 'small-1')
57
+ Exemption Granted
58
+ - elsif cpd_audit.was_exemption_denied?
59
+ = icon('check', class: 'small-1')
60
+ Exemption Denied
61
+ - elsif cpd_audit.was_submitted?
62
+ = icon('check', class: 'small-1')
63
+ No Exemption
64
+ %td
65
+ - if cpd_audit.exemption_requested?
66
+ = link_to 'Process Exemption Request', '#process-exemption-request', 'data-click-tab': true, class: 'btn btn-sm btn-primary'
67
+
68
+ - if cpd_audit.cpd_audit_level.can_request_extension?
69
+ %tr
70
+ %td Extension Request
71
+ %td= cpd_audit.extension_requested_at&.strftime('%F') || '-'
72
+ %td
73
+ - if cpd_audit.extension_requested?
74
+ = icon('x', class: 'small-1')
75
+ Auditee has requested an extension
76
+ - elsif cpd_audit.was_extension_granted?
77
+ = icon('check', class: 'small-1')
78
+ Extension Granted
79
+ - elsif cpd_audit.was_extension_denied?
80
+ = icon('check', class: 'small-1')
81
+ Extension Denied
82
+ - elsif cpd_audit.was_submitted?
83
+ = icon('check', class: 'small-1')
84
+ No Extension
85
+ %td
86
+ - if cpd_audit.extension_requested?
87
+ = link_to 'Process Extension Request', '#process-extension-request', 'data-click-tab': true, class: 'btn btn-sm btn-primary'
88
+
89
+ %tr
90
+ %td Submitted
91
+ %td= cpd_audit.submitted_at&.strftime('%F') || '-'
92
+ %td
93
+ - if cpd_audit.was_submitted?
94
+ = icon('check', class: 'small-1')
95
+ Done
96
+ %td
97
+
98
+ %tr
99
+ %td Reviewed
100
+ %td= cpd_audit.reviewed_at&.strftime('%F') || '-'
101
+ %td
102
+ = cpd_audit.cpd_audit_reviews.count { |review| review.completed? }
103
+ = '/'
104
+ = cpd_audit.cpd_audit_reviews.count
105
+
106
+ Reviews Completed
107
+
108
+ %td
109
+ - if cpd_audit.was_submitted? && !cpd_audit.was_reviewed?
110
+ = link_to 'Audit Reviews', '#audit-reviews', 'data-click-tab': true, class: 'btn btn-sm btn-primary'
111
+
112
+ %tr
113
+ %td Closed
114
+ %td= cpd_audit.closed_at&.strftime('%F') || '-'
115
+ %td
116
+ - if cpd_audit.completed?
117
+ = cpd_audit.determination
118
+
119
+ %td
120
+ - if cpd_audit.reviewed? && !cpd_audit.completed?
121
+ = link_to 'Determination', '#determination', 'data-click-tab': true, class: 'btn btn-sm btn-primary'
@@ -18,4 +18,4 @@
18
18
 
19
19
  - if cpd_category.persisted? && cpd_category.respond_to?(:log_changes_datatable)
20
20
  = tab 'Logs' do
21
- = render_datatable(cpd_category.log_changes_datatable)
21
+ = render_inline_datatable(cpd_category.log_changes_datatable)