effective_cpd 0.0.1 → 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +89 -10
- data/app/controllers/admin/cpd_audit_level_questions_controller.rb +13 -0
- data/app/controllers/admin/cpd_audit_levels_controller.rb +13 -0
- data/app/controllers/admin/cpd_audit_reviews_controller.rb +13 -0
- data/app/controllers/admin/cpd_audits_controller.rb +41 -0
- data/app/controllers/effective/cpd_audit_reviews_controller.rb +60 -0
- data/app/controllers/effective/cpd_audits_controller.rb +55 -0
- data/app/controllers/effective/cpd_cycles_controller.rb +1 -0
- data/app/controllers/effective/cpd_statements_controller.rb +1 -3
- data/app/datatables/admin/effective_cpd_audit_level_questions_datatable.rb +30 -0
- data/app/datatables/admin/effective_cpd_audit_levels_datatable.rb +34 -0
- data/app/datatables/admin/effective_cpd_audit_reviews_datatable.rb +29 -0
- data/app/datatables/admin/effective_cpd_audits_datatable.rb +67 -0
- data/app/datatables/admin/effective_cpd_statements_datatable.rb +3 -3
- data/app/datatables/effective_cpd_available_audit_reviews_datatable.rb +37 -0
- data/app/datatables/effective_cpd_available_audits_datatable.rb +30 -0
- data/app/datatables/{effective_cpd_datatable.rb → effective_cpd_available_cycles_datatable.rb} +3 -4
- data/app/datatables/effective_cpd_completed_audit_reviews_datatable.rb +32 -0
- data/app/datatables/effective_cpd_completed_audits_datatable.rb +24 -0
- data/app/datatables/effective_cpd_completed_statements_datatable.rb +28 -0
- data/app/helpers/effective_cpd_audits_helper.rb +48 -0
- data/app/mailers/effective/cpd_mailer.rb +155 -3
- data/app/models/effective/cpd_activity.rb +16 -3
- data/app/models/effective/cpd_audit.rb +380 -0
- data/app/models/effective/cpd_audit_level.rb +87 -0
- data/app/models/effective/cpd_audit_level_question.rb +91 -0
- data/app/models/effective/cpd_audit_level_question_option.rb +34 -0
- data/app/models/effective/cpd_audit_level_section.rb +50 -0
- data/app/models/effective/cpd_audit_response.rb +86 -0
- data/app/models/effective/cpd_audit_response_option.rb +6 -0
- data/app/models/effective/cpd_audit_review.rb +222 -0
- data/app/models/effective/cpd_audit_review_item.rb +34 -0
- data/app/models/effective/cpd_category.rb +12 -3
- data/app/models/effective/cpd_cycle.rb +7 -0
- data/app/models/effective/cpd_rule.rb +3 -1
- data/app/models/effective/cpd_statement.rb +15 -8
- data/app/views/admin/cpd_activities/_form.html.haml +1 -1
- data/app/views/admin/cpd_audit_level_questions/_form.html.haml +100 -0
- data/app/views/admin/cpd_audit_levels/_form.html.haml +24 -0
- data/app/views/admin/cpd_audit_levels/_form_content_audit.html.haml +15 -0
- data/app/views/admin/cpd_audit_levels/_form_content_audit_review.html.haml +15 -0
- data/app/views/admin/cpd_audit_levels/_form_cpd_audit_level.html.haml +52 -0
- data/app/views/admin/cpd_audit_levels/_form_cpd_audit_level_section.html.haml +10 -0
- data/app/views/admin/cpd_audit_reviews/_cpd_audit_review.html.haml +1 -0
- data/app/views/admin/cpd_audit_reviews/_form.html.haml +13 -0
- data/app/views/admin/cpd_audits/_audit_reviewer_fields.html.haml +2 -0
- data/app/views/admin/cpd_audits/_auditee_fields.html.haml +2 -0
- data/app/views/admin/cpd_audits/_form.html.haml +46 -0
- data/app/views/admin/cpd_audits/_form_conflict.html.haml +24 -0
- data/app/views/admin/cpd_audits/_form_determination.html.haml +10 -0
- data/app/views/admin/cpd_audits/_form_exemption.html.haml +24 -0
- data/app/views/admin/cpd_audits/_form_extension.html.haml +24 -0
- data/app/views/admin/cpd_audits/_form_new.html.haml +28 -0
- data/app/views/admin/cpd_audits/_status.html.haml +121 -0
- data/app/views/admin/cpd_categories/_form.html.haml +1 -1
- data/app/views/admin/cpd_cycles/_form.html.haml +4 -4
- data/app/views/admin/cpd_cycles/_form_cpd_cycle.html.haml +3 -0
- data/app/views/admin/cpd_statements/_cpd_statement.html.haml +7 -0
- data/app/views/effective/cpd_audit_level_questions/_cpd_audit_level_question.html.haml +5 -0
- data/app/views/effective/cpd_audit_responses/_cpd_audit_response.html.haml +4 -0
- data/app/views/effective/cpd_audit_responses/_fields.html.haml +13 -0
- data/app/views/effective/cpd_audit_responses/fields/_choose_one.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/fields/_date.html.haml +2 -0
- data/app/views/effective/cpd_audit_responses/fields/_email.html.haml +2 -0
- data/app/views/effective/cpd_audit_responses/fields/_long_answer.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/fields/_number.html.haml +2 -0
- data/app/views/effective/cpd_audit_responses/fields/_select_all_that_apply.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/fields/_select_up_to_1.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/fields/_select_up_to_2.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/fields/_select_up_to_3.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/fields/_select_up_to_4.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/fields/_select_up_to_5.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/fields/_short_answer.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/fields/_upload_file.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/responses/_choose_one.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/responses/_date.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/responses/_email.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/responses/_long_answer.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/responses/_number.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/responses/_select_all_that_apply.html.haml +5 -0
- data/app/views/effective/cpd_audit_responses/responses/_select_up_to_1.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/responses/_select_up_to_2.html.haml +5 -0
- data/app/views/effective/cpd_audit_responses/responses/_select_up_to_3.html.haml +5 -0
- data/app/views/effective/cpd_audit_responses/responses/_select_up_to_4.html.haml +5 -0
- data/app/views/effective/cpd_audit_responses/responses/_select_up_to_5.html.haml +5 -0
- data/app/views/effective/cpd_audit_responses/responses/_short_answer.html.haml +1 -0
- data/app/views/effective/cpd_audit_responses/responses/_upload_file.html.haml +4 -0
- data/app/views/effective/cpd_audit_review_items/_cpd_audit_review_item.html.haml +6 -0
- data/app/views/effective/cpd_audit_review_items/_fields.html.haml +11 -0
- data/app/views/effective/cpd_audit_reviews/_conflict.html.haml +15 -0
- data/app/views/effective/cpd_audit_reviews/_cpd_audit_level_section.html.haml +23 -0
- data/app/views/effective/cpd_audit_reviews/_cpd_audit_review.html.haml +17 -0
- data/app/views/effective/cpd_audit_reviews/_cpd_statement.html.haml +15 -0
- data/app/views/effective/cpd_audit_reviews/_layout.html.haml +24 -0
- data/app/views/effective/cpd_audit_reviews/_recommendation.html.haml +9 -0
- data/app/views/effective/cpd_audit_reviews/_summary.html.haml +47 -0
- data/app/views/effective/cpd_audit_reviews/complete.html.haml +20 -0
- data/app/views/effective/cpd_audit_reviews/conflict.html.haml +21 -0
- data/app/views/effective/cpd_audit_reviews/cpd_audit_level_section.html.haml +43 -0
- data/app/views/effective/cpd_audit_reviews/cpd_statement.html.haml +35 -0
- data/app/views/effective/cpd_audit_reviews/information.html.haml +5 -0
- data/app/views/effective/cpd_audit_reviews/instructions.html.haml +10 -0
- data/app/views/effective/cpd_audit_reviews/questionnaire.html.haml +8 -0
- data/app/views/effective/cpd_audit_reviews/recommendation.html.haml +21 -0
- data/app/views/effective/cpd_audit_reviews/start.html.haml +10 -0
- data/app/views/effective/cpd_audit_reviews/statements.html.haml +29 -0
- data/app/views/effective/cpd_audit_reviews/submit.html.haml +14 -0
- data/app/views/effective/cpd_audit_reviews/waiting.html.haml +9 -0
- data/app/views/effective/cpd_audits/_conflict.html.haml +15 -0
- data/app/views/effective/cpd_audits/_cpd_audit.html.haml +12 -0
- data/app/views/effective/cpd_audits/_cpd_audit_level_section.html.haml +14 -0
- data/app/views/effective/cpd_audits/_exemption.html.haml +26 -0
- data/app/views/effective/cpd_audits/_extension.html.haml +30 -0
- data/app/views/effective/cpd_audits/_files.html.haml +12 -0
- data/app/views/effective/cpd_audits/_layout.html.haml +33 -0
- data/app/views/effective/cpd_audits/_summary.html.haml +54 -0
- data/app/views/effective/cpd_audits/_waiting.html.haml +6 -0
- data/app/views/effective/cpd_audits/complete.html.haml +24 -0
- data/app/views/effective/cpd_audits/conflict.html.haml +22 -0
- data/app/views/effective/cpd_audits/cpd_audit_level_section.html.haml +20 -0
- data/app/views/effective/cpd_audits/exemption.html.haml +19 -0
- data/app/views/effective/cpd_audits/extension.html.haml +21 -0
- data/app/views/effective/cpd_audits/files.html.haml +7 -0
- data/app/views/effective/cpd_audits/information.html.haml +5 -0
- data/app/views/effective/cpd_audits/instructions.html.haml +5 -0
- data/app/views/effective/cpd_audits/questionnaire.html.haml +5 -0
- data/app/views/effective/cpd_audits/start.html.haml +11 -0
- data/app/views/effective/cpd_audits/submit.html.haml +15 -0
- data/app/views/effective/cpd_audits/waiting.html.haml +24 -0
- data/app/views/effective/cpd_mailer/README.md +1 -0
- data/app/views/effective/cpd_mailer/cpd_audit_closed.liquid +15 -0
- data/app/views/effective/cpd_mailer/cpd_audit_conflict_resolved.liquid +15 -0
- data/app/views/effective/cpd_mailer/cpd_audit_conflicted.liquid +13 -0
- data/app/views/effective/cpd_mailer/cpd_audit_exemption_denied.liquid +13 -0
- data/app/views/effective/cpd_mailer/cpd_audit_exemption_granted.liquid +13 -0
- data/app/views/effective/cpd_mailer/cpd_audit_exemption_request.liquid +13 -0
- data/app/views/effective/cpd_mailer/cpd_audit_extension_denied.liquid +13 -0
- data/app/views/effective/cpd_mailer/cpd_audit_extension_granted.liquid +13 -0
- data/app/views/effective/cpd_mailer/cpd_audit_extension_request.liquid +13 -0
- data/app/views/effective/cpd_mailer/cpd_audit_opened.liquid +13 -0
- data/app/views/effective/cpd_mailer/cpd_audit_review_opened.liquid +15 -0
- data/app/views/effective/cpd_mailer/cpd_audit_review_ready.liquid +13 -0
- data/app/views/effective/cpd_mailer/cpd_audit_review_submitted.liquid +11 -0
- data/app/views/effective/cpd_mailer/cpd_audit_reviewed.liquid +13 -0
- data/app/views/effective/cpd_mailer/cpd_audit_submitted.liquid +13 -0
- data/app/views/effective/cpd_statement_activities/_cpd_statement_activity.html.haml +65 -0
- data/app/views/effective/cpd_statement_activities/_form.html.haml +9 -10
- data/app/views/effective/cpd_statements/_activities.html.haml +3 -64
- data/app/views/effective/cpd_statements/_activities_edit.html.haml +2 -0
- data/app/views/effective/cpd_statements/_activities_table.html.haml +64 -0
- data/app/views/effective/cpd_statements/_agreements.html.haml +19 -5
- data/app/views/effective/cpd_statements/_cpd_statement.html.haml +6 -3
- data/app/views/effective/cpd_statements/_summary.html.haml +26 -31
- data/app/views/effective/cpd_statements/activities.html.haml +1 -1
- data/app/views/effective/cpd_statements/agreements.html.haml +7 -1
- data/app/views/effective/cpd_statements/submit.html.haml +1 -1
- data/config/effective_cpd.rb +47 -10
- data/config/routes.rb +18 -1
- data/db/migrate/01_create_effective_cpd.rb.erb +157 -1
- data/db/seeds.rb +2 -1
- data/lib/effective_cpd.rb +42 -3
- data/lib/effective_cpd/version.rb +1 -1
- data/lib/generators/effective_cpd/install_generator.rb +16 -3
- metadata +168 -9
- data/app/datatables/effective_cpd_statements_datatable.rb +0 -23
- data/app/views/admin/cpd_statements/_form.html.haml +0 -6
@@ -0,0 +1,67 @@
|
|
1
|
+
module Admin
|
2
|
+
class EffectiveCpdAuditsDatatable < Effective::Datatable
|
3
|
+
filters do
|
4
|
+
scope :all
|
5
|
+
scope :available, label: 'In Progress'
|
6
|
+
scope :completed
|
7
|
+
scope :waiting_on_admin
|
8
|
+
scope :waiting_on_auditee
|
9
|
+
scope :waiting_on_reviewers
|
10
|
+
end
|
11
|
+
|
12
|
+
datatable do
|
13
|
+
col :id, visible: false
|
14
|
+
col :created_at, visible: false
|
15
|
+
col :updated_at, visible: false
|
16
|
+
|
17
|
+
col :token, visible: false
|
18
|
+
|
19
|
+
col :cpd_audit_level, label: 'Audit Level'
|
20
|
+
|
21
|
+
col :user, search: :string, label: 'Auditee'
|
22
|
+
|
23
|
+
col(:cpd_audit_reviews, label: 'Auditor Reviewers', search: :string) do |cpd_audit|
|
24
|
+
cpd_audit.cpd_audit_reviews.map(&:user).map do |user|
|
25
|
+
content_tag(:div, class: 'col-resource_item') do
|
26
|
+
if view.respond_to?(:edit_admin_user_path)
|
27
|
+
link_to(user.to_s, edit_admin_user_path(user))
|
28
|
+
else
|
29
|
+
user.to_s
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end.join.html_safe
|
33
|
+
end
|
34
|
+
|
35
|
+
col :notification_date, label: 'Date of Notification'
|
36
|
+
col :extension_date, label: 'Approved Extension Date', visible: false
|
37
|
+
col :due_date
|
38
|
+
|
39
|
+
col :status
|
40
|
+
col :determination
|
41
|
+
|
42
|
+
col(:auditee_cpd_statements, label: 'Auditee Statements') do |cpd_audit|
|
43
|
+
cpd_audit.user.cpd_statements.map do |cpd_statement|
|
44
|
+
content_tag(:div, class: 'col-resource_item') do
|
45
|
+
link_to(cpd_statement.to_s, effective_cpd.admin_cpd_statement_path(cpd_statement))
|
46
|
+
end
|
47
|
+
end.join.html_safe
|
48
|
+
end
|
49
|
+
|
50
|
+
col :conflict_of_interest, visible: false
|
51
|
+
col :conflict_of_interest_reason, visible: false
|
52
|
+
|
53
|
+
col :exemption_request, visible: false
|
54
|
+
col :exemption_request_reason, visible: false
|
55
|
+
|
56
|
+
col :extension_request, visible: false
|
57
|
+
col :extension_request_date, visible: false
|
58
|
+
col :extension_request_reason, visible: false
|
59
|
+
|
60
|
+
actions_col
|
61
|
+
end
|
62
|
+
|
63
|
+
collection do
|
64
|
+
Effective::CpdAudit.all.deep
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Admin
|
2
2
|
class EffectiveCpdStatementsDatatable < Effective::Datatable
|
3
3
|
filters do
|
4
|
-
scope :completed
|
5
|
-
scope :draft
|
6
4
|
scope :all
|
5
|
+
scope :draft, label: 'In Progress'
|
6
|
+
scope :completed
|
7
7
|
end
|
8
8
|
|
9
9
|
datatable do
|
@@ -16,7 +16,7 @@ module Admin
|
|
16
16
|
|
17
17
|
col :cpd_cycle, label: cpd_cycle_label.titleize
|
18
18
|
col :user
|
19
|
-
col :
|
19
|
+
col :submitted_at, as: :date, label: 'Submitted'
|
20
20
|
col :score
|
21
21
|
col :carry_forward
|
22
22
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Displays cpd audits for this auditor reviewer user
|
2
|
+
|
3
|
+
class EffectiveCpdAvailableAuditReviewsDatatable < Effective::Datatable
|
4
|
+
datatable do
|
5
|
+
order :due_date
|
6
|
+
|
7
|
+
col :token, visible: false
|
8
|
+
|
9
|
+
col :cpd_audit_level, label: 'Audit'
|
10
|
+
col :due_date
|
11
|
+
col :user, label: 'Auditee', action: false
|
12
|
+
|
13
|
+
col :ready_to_review do |cpd_audit|
|
14
|
+
cpd_audit.was_submitted? ? 'Yes' : 'No'
|
15
|
+
end
|
16
|
+
|
17
|
+
actions_col(actions: []) do |cpd_audit|
|
18
|
+
cpd_audit_review = cpd_audit.cpd_audit_reviews.find { |r| r.user_id == current_user.id }
|
19
|
+
|
20
|
+
if cpd_audit_review.wizard_steps.blank?
|
21
|
+
dropdown_link_to('Start', effective_cpd.cpd_audit_review_build_path(cpd_audit_review, cpd_audit_review.next_step))
|
22
|
+
else
|
23
|
+
dropdown_link_to('Continue', effective_cpd.cpd_audit_review_build_path(cpd_audit_review, cpd_audit_review.next_step))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
collection do
|
29
|
+
raise('expected a current_user') unless current_user.present?
|
30
|
+
|
31
|
+
reviews = Effective::CpdAuditReview.available.where(user: current_user)
|
32
|
+
|
33
|
+
Effective::CpdAudit.available.includes(:cpd_audit_reviews)
|
34
|
+
.where(id: reviews.select('cpd_audit_id as id'))
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Displays cpd audits for this auditee user
|
2
|
+
|
3
|
+
class EffectiveCpdAvailableAuditsDatatable < Effective::Datatable
|
4
|
+
datatable do
|
5
|
+
order :due_date
|
6
|
+
|
7
|
+
col :token, visible: false
|
8
|
+
|
9
|
+
col :cpd_audit_level, label: 'Audit'
|
10
|
+
col :due_date
|
11
|
+
col :status
|
12
|
+
col :determination
|
13
|
+
|
14
|
+
actions_col(actions: []) do |cpd_audit|
|
15
|
+
if cpd_audit.opened?
|
16
|
+
dropdown_link_to('Start', effective_cpd.cpd_audit_build_path(cpd_audit, cpd_audit.next_step))
|
17
|
+
elsif cpd_audit.was_submitted?
|
18
|
+
dropdown_link_to('Show', effective_cpd.cpd_audit_build_path(cpd_audit, cpd_audit.last_completed_step))
|
19
|
+
else
|
20
|
+
dropdown_link_to('Continue', effective_cpd.cpd_audit_build_path(cpd_audit, cpd_audit.next_step))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
collection do
|
26
|
+
raise('expected a current_user') unless current_user.present?
|
27
|
+
Effective::CpdAudit.available.where(user: current_user)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/app/datatables/{effective_cpd_datatable.rb → effective_cpd_available_cycles_datatable.rb}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Displays available cpd_cycles that the current_user may complete
|
2
2
|
|
3
|
-
class
|
3
|
+
class EffectiveCpdAvailableCyclesDatatable < Effective::Datatable
|
4
4
|
datatable do
|
5
5
|
order :start_at
|
6
6
|
|
@@ -14,8 +14,6 @@ class EffectiveCpdDatatable < Effective::Datatable
|
|
14
14
|
|
15
15
|
if statement.blank?
|
16
16
|
dropdown_link_to('Start', effective_cpd.cpd_cycle_cpd_statement_build_path(cpd_cycle, :new, :start))
|
17
|
-
elsif statement.completed?
|
18
|
-
'Complete'
|
19
17
|
else
|
20
18
|
dropdown_link_to('Continue', effective_cpd.cpd_cycle_cpd_statement_build_path(cpd_cycle, statement, statement.next_step))
|
21
19
|
end
|
@@ -24,7 +22,8 @@ class EffectiveCpdDatatable < Effective::Datatable
|
|
24
22
|
|
25
23
|
collection do
|
26
24
|
raise('expected a current_user') unless current_user.present?
|
27
|
-
Effective::
|
25
|
+
completed = Effective::CpdStatement.completed.where(user: current_user)
|
26
|
+
Effective::CpdCycle.available.where.not(id: completed.select('cpd_cycle_id as id'))
|
28
27
|
end
|
29
28
|
|
30
29
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Displays cpd audits for this auditor reviewer user
|
2
|
+
|
3
|
+
class EffectiveCpdCompletedAuditReviewsDatatable < Effective::Datatable
|
4
|
+
datatable do
|
5
|
+
order :notification_date
|
6
|
+
|
7
|
+
col :token, visible: false
|
8
|
+
|
9
|
+
col :cpd_audit_level, label: 'Audit'
|
10
|
+
col :notification_date, label: 'Date of Notification'
|
11
|
+
col :user, label: 'Auditee', action: false
|
12
|
+
|
13
|
+
col :recommendation do |cpd_audit|
|
14
|
+
cpd_audit.cpd_audit_reviews.find { |r| r.user_id == current_user.id }.recommendation
|
15
|
+
end
|
16
|
+
|
17
|
+
actions_col(actions: []) do |cpd_audit|
|
18
|
+
cpd_audit_review = cpd_audit.cpd_audit_reviews.find { |r| r.user_id == current_user.id }
|
19
|
+
dropdown_link_to('Show', effective_cpd.cpd_audit_review_build_path(cpd_audit_review, cpd_audit_review.next_step))
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
collection do
|
24
|
+
raise('expected a current_user') unless current_user.present?
|
25
|
+
|
26
|
+
reviews = Effective::CpdAuditReview.completed.where(user: current_user)
|
27
|
+
|
28
|
+
Effective::CpdAudit.includes(:cpd_audit_reviews)
|
29
|
+
.where(id: reviews.select('cpd_audit_id as id'))
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Displays cpd audits for this auditee user
|
2
|
+
|
3
|
+
class EffectiveCpdCompletedAuditsDatatable < Effective::Datatable
|
4
|
+
datatable do
|
5
|
+
order :notification_date
|
6
|
+
|
7
|
+
col :token, visible: false
|
8
|
+
|
9
|
+
col :cpd_audit_level, label: 'Audit'
|
10
|
+
col :notification_date, label: 'Date of Notification'
|
11
|
+
col :status
|
12
|
+
col :determination
|
13
|
+
|
14
|
+
actions_col(actions: []) do |cpd_audit|
|
15
|
+
dropdown_link_to('Show', effective_cpd.cpd_audit_build_path(cpd_audit, cpd_audit.last_completed_step))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
collection do
|
20
|
+
raise('expected a current_user') unless current_user.present?
|
21
|
+
Effective::CpdAudit.completed.where(user: current_user)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Displays past cpd statements that were completed by the user
|
2
|
+
|
3
|
+
class EffectiveCpdCompletedStatementsDatatable < Effective::Datatable
|
4
|
+
datatable do
|
5
|
+
order :cpd_cycle_id
|
6
|
+
|
7
|
+
col(:cpd_cycle_id, label: 'Statement') do |statement|
|
8
|
+
statement.cpd_cycle.to_s
|
9
|
+
end
|
10
|
+
|
11
|
+
col :submitted_at, as: :date, label: 'Submitted'
|
12
|
+
col :score
|
13
|
+
col :carry_forward
|
14
|
+
|
15
|
+
unless attributes[:actions] == false
|
16
|
+
actions_col(actions: []) do |cpd_statement|
|
17
|
+
dropdown_link_to('Show', effective_cpd.cpd_cycle_cpd_statement_build_path(cpd_statement.cpd_cycle, cpd_statement, cpd_statement.last_completed_step))
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
collection do
|
23
|
+
raise('expected a current_user') unless current_user.present?
|
24
|
+
user = (current_user.class.find(attributes[:user_id]) if attributes[:user_id])
|
25
|
+
Effective::CpdStatement.completed.where(user: user || current_user).includes(:cpd_cycle)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module EffectiveCpdAuditsHelper
|
2
|
+
|
3
|
+
def cpd_audit_conflict_of_interest_collection
|
4
|
+
[['Yes, there is a conflict of interest', true], ['No conflict of interest', false]]
|
5
|
+
end
|
6
|
+
|
7
|
+
def cpd_audit_exemption_request_collection
|
8
|
+
[['Yes, I would like to request an exemption', true], ['No exemption request', false]]
|
9
|
+
end
|
10
|
+
|
11
|
+
def cpd_audit_extension_request_collection
|
12
|
+
[['Yes, I would like to request an extension', true], ['No extension request', false]]
|
13
|
+
end
|
14
|
+
|
15
|
+
def cpd_audit_summary_text(cpd_audit)
|
16
|
+
case cpd_audit.status
|
17
|
+
when 'opened'
|
18
|
+
"The audit has been opened. The auditee and audit reviewers have been notified. Waiting for the auditee to submit their audit questionnaire."
|
19
|
+
when 'started'
|
20
|
+
"The auditee has begun their audit questionnaire. Waiting for the auditee to submit their audit questionnaire."
|
21
|
+
when 'conflicted'
|
22
|
+
"The auditee has declared a conflict of interest. Waiting for a new reviewer to be assigned or otherwise resolved."
|
23
|
+
when 'conflicted_resolved'
|
24
|
+
"The auditee had declared a conflict of interest. This has been resolved. Waiting for the auditee to submit their audit questionnaire."
|
25
|
+
when 'exemption_requested'
|
26
|
+
"The auditee has requested an exemption. Waiting for request to be granted or denied."
|
27
|
+
when 'exemption_granted'
|
28
|
+
"The exemption request has been granted. This audit may now be closed."
|
29
|
+
when 'exemption_denied'
|
30
|
+
"The exemption request has been denied. The audit will continue. Waiting for the auditee to submit their audit questionnaire."
|
31
|
+
when 'extension_requested'
|
32
|
+
"The auditee has requested an extension. Waiting for request to be granted or denied."
|
33
|
+
when 'extension_granted'
|
34
|
+
"The extension request has been granted. There is a new deadline. Waiting for the auditee to submit their audit questionnaire."
|
35
|
+
when 'extension_denied'
|
36
|
+
"The extension request has been denied. The deadline remains. Waiting for the auditee to submit their audit questionnaire."
|
37
|
+
when 'submitted'
|
38
|
+
"The auditee has submitted their audit questionnaire. Waiting on review."
|
39
|
+
when 'reviewed'
|
40
|
+
"The audit has been reviewed and is ready for the final determination to be made."
|
41
|
+
when 'closed'
|
42
|
+
"This audit has been closed with a final determination. All done."
|
43
|
+
else
|
44
|
+
raise("unexpected cpd audit status: #{cpd_audit.status}")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -1,7 +1,159 @@
|
|
1
1
|
module Effective
|
2
|
-
class CpdMailer <
|
3
|
-
default from: EffectiveCpd.
|
4
|
-
layout EffectiveCpd.
|
2
|
+
class CpdMailer < EffectiveCpd.parent_mailer_class
|
3
|
+
default from: -> { EffectiveCpd.mailer_sender }
|
4
|
+
layout -> { EffectiveCpd.mailer_layout || 'effective_cpd_mailer_layout' }
|
5
|
+
|
6
|
+
# CPD Audit
|
7
|
+
def cpd_audit_opened(cpd_audit, opts = {})
|
8
|
+
@assigns = effective_cpd_email_assigns(cpd_audit)
|
9
|
+
@assigns.merge!(url: effective_cpd.cpd_audit_url(cpd_audit))
|
10
|
+
|
11
|
+
mail(to: cpd_audit.user.email, **headers_for(cpd_audit, opts))
|
12
|
+
end
|
13
|
+
|
14
|
+
def cpd_audit_conflicted(cpd_audit, opts = {})
|
15
|
+
@assigns = effective_cpd_email_assigns(cpd_audit)
|
16
|
+
@assigns.merge!(url: effective_cpd.edit_admin_cpd_audit_url(cpd_audit))
|
17
|
+
|
18
|
+
mail(to: EffectiveCpd.mailer_admin, **headers_for(cpd_audit, opts))
|
19
|
+
end
|
20
|
+
|
21
|
+
def cpd_audit_conflict_resolved(cpd_audit, opts = {})
|
22
|
+
@assigns = effective_cpd_email_assigns(cpd_audit)
|
23
|
+
@assigns.merge!(url: effective_cpd.cpd_audit_url(cpd_audit))
|
24
|
+
|
25
|
+
mail(to: cpd_audit.user.email, **headers_for(cpd_audit, opts))
|
26
|
+
end
|
27
|
+
|
28
|
+
def cpd_audit_exemption_request(cpd_audit, opts = {})
|
29
|
+
@assigns = effective_cpd_email_assigns(cpd_audit)
|
30
|
+
@assigns.merge!(url: effective_cpd.edit_admin_cpd_audit_url(cpd_audit))
|
31
|
+
|
32
|
+
mail(to: EffectiveCpd.mailer_admin, **headers_for(cpd_audit, opts))
|
33
|
+
end
|
34
|
+
|
35
|
+
def cpd_audit_exemption_denied(cpd_audit, opts = {})
|
36
|
+
@assigns = effective_cpd_email_assigns(cpd_audit)
|
37
|
+
@assigns.merge!(url: effective_cpd.cpd_audit_url(cpd_audit))
|
38
|
+
|
39
|
+
mail(to: cpd_audit.user.email, **headers_for(cpd_audit, opts))
|
40
|
+
end
|
41
|
+
|
42
|
+
def cpd_audit_exemption_granted(cpd_audit, opts = {})
|
43
|
+
@assigns = effective_cpd_email_assigns(cpd_audit)
|
44
|
+
@assigns.merge!(url: effective_cpd.cpd_audit_url(cpd_audit))
|
45
|
+
|
46
|
+
mail(to: cpd_audit.user.email, **headers_for(cpd_audit, opts))
|
47
|
+
end
|
48
|
+
|
49
|
+
def cpd_audit_extension_request(cpd_audit, opts = {})
|
50
|
+
@assigns = effective_cpd_email_assigns(cpd_audit)
|
51
|
+
@assigns.merge!(url: effective_cpd.edit_admin_cpd_audit_url(cpd_audit))
|
52
|
+
|
53
|
+
mail(to: EffectiveCpd.mailer_admin, **headers_for(cpd_audit, opts))
|
54
|
+
end
|
55
|
+
|
56
|
+
def cpd_audit_extension_denied(cpd_audit, opts = {})
|
57
|
+
@assigns = effective_cpd_email_assigns(cpd_audit)
|
58
|
+
@assigns.merge!(url: effective_cpd.cpd_audit_url(cpd_audit))
|
59
|
+
|
60
|
+
mail(to: cpd_audit.user.email, **headers_for(cpd_audit, opts))
|
61
|
+
end
|
62
|
+
|
63
|
+
def cpd_audit_extension_granted(cpd_audit, opts = {})
|
64
|
+
@assigns = effective_cpd_email_assigns(cpd_audit)
|
65
|
+
@assigns.merge!(url: effective_cpd.cpd_audit_url(cpd_audit))
|
66
|
+
|
67
|
+
mail(to: cpd_audit.user.email, **headers_for(cpd_audit, opts))
|
68
|
+
end
|
69
|
+
|
70
|
+
def cpd_audit_submitted(cpd_audit, opts = {})
|
71
|
+
@assigns = effective_cpd_email_assigns(cpd_audit)
|
72
|
+
@assigns.merge!(url: effective_cpd.edit_admin_cpd_audit_url(cpd_audit))
|
73
|
+
|
74
|
+
mail(to: EffectiveCpd.mailer_admin, **headers_for(cpd_audit, opts))
|
75
|
+
end
|
76
|
+
|
77
|
+
def cpd_audit_reviewed(cpd_audit, opts = {})
|
78
|
+
@assigns = effective_cpd_email_assigns(cpd_audit)
|
79
|
+
@assigns.merge!(url: effective_cpd.edit_admin_cpd_audit_url(cpd_audit))
|
80
|
+
|
81
|
+
mail(to: EffectiveCpd.mailer_admin, **headers_for(cpd_audit, opts))
|
82
|
+
end
|
83
|
+
|
84
|
+
def cpd_audit_closed(cpd_audit, opts = {})
|
85
|
+
@assigns = effective_cpd_email_assigns(cpd_audit)
|
86
|
+
@assigns.merge!(url: effective_cpd.cpd_audit_url(cpd_audit))
|
87
|
+
|
88
|
+
mail(to: cpd_audit.user.email, **headers_for(cpd_audit, opts))
|
89
|
+
end
|
90
|
+
|
91
|
+
# CPD Audit Review
|
92
|
+
def cpd_audit_review_opened(cpd_audit_review, opts = {})
|
93
|
+
@assigns = effective_cpd_email_assigns(cpd_audit_review)
|
94
|
+
@assigns.merge!(url: effective_cpd.cpd_audit_review_url(cpd_audit_review))
|
95
|
+
|
96
|
+
mail(to: cpd_audit_review.user.email, **headers_for(cpd_audit_review, opts))
|
97
|
+
end
|
98
|
+
|
99
|
+
def cpd_audit_review_ready(cpd_audit_review, opts = {})
|
100
|
+
@assigns = effective_cpd_email_assigns(cpd_audit_review)
|
101
|
+
@assigns.merge!(url: effective_cpd.cpd_audit_review_url(cpd_audit_review))
|
102
|
+
|
103
|
+
mail(to: cpd_audit_review.user.email, **headers_for(cpd_audit_review, opts))
|
104
|
+
end
|
105
|
+
|
106
|
+
def cpd_audit_review_submitted(cpd_audit_review, opts = {})
|
107
|
+
@assigns = effective_cpd_email_assigns(cpd_audit_review)
|
108
|
+
@assigns.merge!(url: effective_cpd.edit_admin_cpd_audit_url(cpd_audit_review.cpd_audit))
|
109
|
+
|
110
|
+
mail(to: EffectiveCpd.mailer_admin, **headers_for(cpd_audit_review, opts))
|
111
|
+
end
|
112
|
+
|
113
|
+
protected
|
114
|
+
|
115
|
+
def headers_for(resource, opts = {})
|
116
|
+
resource.respond_to?(:log_changes_datatable) ? opts.merge(log: resource) : opts
|
117
|
+
end
|
118
|
+
|
119
|
+
def effective_cpd_email_assigns(resource)
|
120
|
+
unless resource.kind_of?(Effective::CpdAudit) || resource.kind_of?(Effective::CpdAuditReview)
|
121
|
+
raise('expected an Effective::CpdAudit or Effective::CpdAuditReview')
|
122
|
+
end
|
123
|
+
|
124
|
+
@cpd_audit = (resource.kind_of?(Effective::CpdAudit) ? resource : resource.cpd_audit)
|
125
|
+
@cpd_audit_review = (resource if resource.kind_of?(Effective::CpdAuditReview))
|
126
|
+
|
127
|
+
@auditee = @cpd_audit.user
|
128
|
+
@reviewer = @cpd_audit_review.user if @cpd_audit_review.present?
|
129
|
+
|
130
|
+
audit_assigns = {
|
131
|
+
audit: {
|
132
|
+
title: @cpd_audit.to_s,
|
133
|
+
level: @cpd_audit.cpd_audit_level.to_s,
|
134
|
+
determination: @cpd_audit.determination.to_s
|
135
|
+
},
|
136
|
+
auditee: {
|
137
|
+
name: @auditee.to_s,
|
138
|
+
email: @auditee.email
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
review_assigns = if @cpd_audit_review.present?
|
143
|
+
{
|
144
|
+
review: {
|
145
|
+
title: @cpd_audit_review.to_s,
|
146
|
+
recommendation: @cpd_audit_review.recommendation.to_s
|
147
|
+
},
|
148
|
+
reviewer: {
|
149
|
+
name: @reviewer.to_s,
|
150
|
+
email: @reviewer.email
|
151
|
+
}
|
152
|
+
}
|
153
|
+
end
|
154
|
+
|
155
|
+
audit_assigns.merge(review_assigns || {})
|
156
|
+
end
|
5
157
|
|
6
158
|
end
|
7
159
|
end
|