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.
- checksums.yaml +4 -4
- data/app/controllers/admin/cpd_audit_levels_controller.rb +7 -1
- data/app/controllers/admin/cpd_audit_reviews_controller.rb +7 -1
- data/app/controllers/admin/cpd_audits_controller.rb +21 -1
- data/app/controllers/admin/cpd_statements_controller.rb +1 -1
- data/app/controllers/effective/cpd_audit_reviews_controller.rb +3 -39
- data/app/controllers/effective/cpd_audits_controller.rb +3 -41
- data/app/datatables/admin/effective_cpd_audit_levels_datatable.rb +1 -1
- data/app/datatables/admin/effective_cpd_audit_reviews_datatable.rb +4 -2
- data/app/datatables/admin/effective_cpd_audits_datatable.rb +12 -10
- data/app/datatables/effective_cpd_available_audit_reviews_datatable.rb +4 -4
- data/app/datatables/effective_cpd_available_audits_datatable.rb +1 -1
- data/app/datatables/effective_cpd_completed_audit_reviews_datatable.rb +3 -3
- data/app/datatables/effective_cpd_completed_audits_datatable.rb +2 -2
- data/app/helpers/effective_cpd_audits_helper.rb +0 -32
- data/app/mailers/effective/cpd_mailer.rb +37 -24
- data/app/models/concerns/effective_cpd_audit.rb +594 -0
- data/app/models/concerns/effective_cpd_audit_level.rb +111 -0
- data/app/models/concerns/effective_cpd_audit_review.rb +297 -0
- data/app/models/concerns/effective_cpd_user.rb +16 -11
- data/app/models/effective/cpd_audit.rb +1 -397
- data/app/models/effective/cpd_audit_level.rb +1 -83
- data/app/models/effective/cpd_audit_level_question.rb +1 -1
- data/app/models/effective/cpd_audit_level_section.rb +4 -3
- data/app/models/effective/cpd_audit_response.rb +4 -2
- data/app/models/effective/cpd_audit_review.rb +1 -224
- data/app/models/effective/cpd_audit_review_item.rb +1 -1
- data/app/views/admin/cpd_audit_levels/_form_content_audit.html.haml +1 -1
- data/app/views/admin/cpd_audit_levels/_form_content_audit_review.html.haml +1 -1
- data/app/views/admin/cpd_audit_levels/_form_cpd_audit_level.html.haml +7 -1
- data/app/views/admin/cpd_audit_levels/_form_cpd_audit_level_section.html.haml +2 -0
- data/app/views/admin/cpd_audit_reviews/_form.html.haml +4 -1
- data/app/views/admin/cpd_audits/_form.html.haml +1 -49
- data/app/views/admin/cpd_audits/{_form_determination.html.haml → _form_close.html.haml} +1 -1
- data/app/views/admin/cpd_audits/_form_complete.html.haml +17 -0
- data/app/views/admin/cpd_audits/_form_cpd_audit.html.haml +56 -0
- data/app/views/admin/cpd_audits/_form_deadlines.html.haml +8 -9
- data/app/views/admin/cpd_audits/_form_exemption.html.haml +1 -1
- data/app/views/admin/cpd_audits/_form_extension.html.haml +1 -1
- data/app/views/admin/cpd_audits/_form_files.html.haml +6 -0
- data/app/views/admin/cpd_audits/_form_missing_info.html.haml +11 -0
- data/app/views/admin/cpd_audits/_form_new.html.haml +3 -1
- data/app/views/admin/cpd_audits/_form_process.html.haml +18 -0
- data/app/views/admin/cpd_audits/_status.html.haml +48 -6
- data/app/views/effective/cpd/_dashboard.html.haml +15 -12
- data/app/views/effective/cpd_audit_level_questions/_cpd_audit_level_question.html.haml +2 -1
- data/app/views/effective/cpd_audit_reviews/_conflict.html.haml +1 -1
- data/app/views/effective/cpd_audit_reviews/_cpd_audit_level_section.html.haml +3 -3
- data/app/views/effective/cpd_audit_reviews/_cpd_audit_review.html.haml +3 -1
- data/app/views/effective/cpd_audit_reviews/_cpd_statement.html.haml +3 -3
- data/app/views/effective/cpd_audit_reviews/_feedback.html.haml +9 -0
- data/app/views/effective/cpd_audit_reviews/_files.html.haml +12 -0
- data/app/views/effective/cpd_audit_reviews/_layout.html.haml +3 -0
- data/app/views/effective/cpd_audit_reviews/_recommendation.html.haml +6 -2
- data/app/views/effective/cpd_audit_reviews/_summary.html.haml +41 -14
- data/app/views/effective/cpd_audit_reviews/conflict.html.haml +5 -1
- data/app/views/effective/cpd_audit_reviews/cpd_audit_level_section.html.haml +2 -2
- data/app/views/effective/cpd_audit_reviews/feedback.html.haml +16 -0
- data/app/views/effective/cpd_audit_reviews/files.html.haml +17 -0
- data/app/views/effective/cpd_audit_reviews/recommendation.html.haml +5 -3
- data/app/views/effective/cpd_audit_reviews/start.html.haml +10 -3
- data/app/views/effective/cpd_audit_reviews/statements.html.haml +4 -5
- data/app/views/effective/cpd_audit_reviews/submit.html.haml +1 -1
- data/app/views/effective/cpd_audit_reviews/submitted.html.haml +20 -0
- data/app/views/effective/cpd_audit_reviews/waiting.html.haml +1 -1
- data/app/views/effective/cpd_audits/_conflict.html.haml +1 -1
- data/app/views/effective/cpd_audits/_cpd.html.haml +1 -1
- data/app/views/effective/cpd_audits/_cpd_audit.html.haml +3 -1
- data/app/views/effective/cpd_audits/_cpd_audit_level_section.html.haml +1 -1
- data/app/views/effective/cpd_audits/_exemption.html.haml +1 -1
- data/app/views/effective/cpd_audits/_extension.html.haml +1 -1
- data/app/views/effective/cpd_audits/_files.html.haml +1 -1
- data/app/views/effective/cpd_audits/_missing_info.html.haml +19 -0
- data/app/views/effective/cpd_audits/_summary.html.haml +30 -12
- data/app/views/effective/cpd_audits/_waiting.html.haml +1 -1
- data/app/views/effective/cpd_audits/conflict.html.haml +5 -1
- data/app/views/effective/cpd_audits/cpd_audit_level_section.html.haml +1 -0
- data/app/views/effective/cpd_audits/start.html.haml +10 -4
- data/app/views/effective/cpd_audits/submit.html.haml +5 -2
- data/app/views/effective/cpd_audits/{complete.html.haml → submitted.haml} +13 -8
- data/app/views/effective/cpd_audits/waiting.html.haml +1 -1
- data/app/views/effective/cpd_mailer/cpd_audit_missing_info.liquid +15 -0
- data/app/views/effective/cpd_mailer/cpd_audit_review_ready.liquid +1 -1
- data/app/views/effective/cpd_mailer/cpd_audit_submitted.liquid +3 -1
- data/config/effective_cpd.rb +5 -2
- data/db/migrate/01_create_effective_cpd.rb.erb +36 -7
- data/lib/effective_cpd/engine.rb +4 -0
- data/lib/effective_cpd/version.rb +1 -1
- data/lib/effective_cpd.rb +13 -1
- metadata +19 -5
- data/app/views/effective/cpd_audit_reviews/complete.html.haml +0 -20
@@ -1,228 +1,5 @@
|
|
1
1
|
module Effective
|
2
2
|
class CpdAuditReview < ActiveRecord::Base
|
3
|
-
|
4
|
-
attr_accessor :current_step
|
5
|
-
|
6
|
-
belongs_to :cpd_audit
|
7
|
-
belongs_to :cpd_audit_level
|
8
|
-
belongs_to :user, polymorphic: true # Auditor
|
9
|
-
|
10
|
-
has_many :cpd_audit_review_items, -> { CpdAuditReviewItem.sorted }, inverse_of: :cpd_audit_review, dependent: :destroy
|
11
|
-
accepts_nested_attributes_for :cpd_audit_review_items, reject_if: :all_blank, allow_destroy: true
|
12
|
-
|
13
|
-
if respond_to?(:log_changes)
|
14
|
-
log_changes(to: :cpd_audit, except: :wizard_steps)
|
15
|
-
end
|
16
|
-
|
17
|
-
acts_as_email_form
|
18
|
-
acts_as_tokened
|
19
|
-
acts_as_reportable if respond_to?(:acts_as_reportable)
|
20
|
-
|
21
|
-
acts_as_wizard(
|
22
|
-
start: 'Start',
|
23
|
-
information: 'Information',
|
24
|
-
instructions: 'Instructions',
|
25
|
-
|
26
|
-
# Optional based on cpd_audit_level options
|
27
|
-
conflict: 'Conflict of Interest',
|
28
|
-
|
29
|
-
waiting: 'Waiting on Auditee Submission',
|
30
|
-
|
31
|
-
statements: 'Review CPD Statements',
|
32
|
-
# ... There will be one step per cpd_statement here. "statement1"
|
33
|
-
|
34
|
-
questionnaire: 'Review Questionnaire Responses',
|
35
|
-
# ... There will be one step per cpd_audit_level_sections here
|
36
|
-
|
37
|
-
recommendation: 'Recommendation',
|
38
|
-
submit: 'Confirm & Submit',
|
39
|
-
complete: 'Complete'
|
40
|
-
)
|
41
|
-
|
42
|
-
effective_resource do
|
43
|
-
token :string
|
44
|
-
due_date :date
|
45
|
-
|
46
|
-
# Auditor response
|
47
|
-
conflict_of_interest :boolean
|
48
|
-
conflict_of_interest_reason :text
|
49
|
-
|
50
|
-
# Rolling comments
|
51
|
-
comments :text
|
52
|
-
|
53
|
-
# Recommendation Step
|
54
|
-
recommendation :string
|
55
|
-
|
56
|
-
# Status Dates
|
57
|
-
submitted_at :datetime
|
58
|
-
|
59
|
-
# acts_as_statused
|
60
|
-
# I'm not using acts_as_statused yet, but I probably will later
|
61
|
-
status :string
|
62
|
-
status_steps :text
|
63
|
-
|
64
|
-
# Wizard Progress
|
65
|
-
wizard_steps :text
|
66
|
-
|
67
|
-
timestamps
|
68
|
-
end
|
69
|
-
|
70
|
-
scope :deep, -> { includes(:cpd_audit, :cpd_audit_level, :user) }
|
71
|
-
scope :sorted, -> { order(:id) }
|
72
|
-
|
73
|
-
scope :available, -> { where(submitted_at: nil) }
|
74
|
-
scope :completed, -> { where.not(submitted_at: nil) }
|
75
|
-
|
76
|
-
# effective_reports
|
77
|
-
def reportable_scopes
|
78
|
-
{ available: nil, completed: nil }
|
79
|
-
end
|
80
|
-
|
81
|
-
before_validation(if: -> { new_record? }) do
|
82
|
-
self.cpd_audit_level ||= cpd_audit&.cpd_audit_level
|
83
|
-
self.due_date ||= deadline_to_review()
|
84
|
-
end
|
85
|
-
|
86
|
-
validate(if: -> { recommendation.present? }) do
|
87
|
-
unless cpd_audit_level.recommendations.include?(recommendation)
|
88
|
-
self.errors.add(:recommendation, 'must exist in this audit level')
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
after_commit(on: :create) { send_email(:cpd_audit_review_opened) }
|
93
|
-
after_commit(on: :destroy) { cpd_audit.review! }
|
94
|
-
|
95
|
-
def to_s
|
96
|
-
'audit review'
|
97
|
-
end
|
98
|
-
|
99
|
-
def to_s
|
100
|
-
persisted? ? "#{cpd_audit_level} Audit Review by #{user}" : 'audit review'
|
101
|
-
end
|
102
|
-
|
103
|
-
# Find or build
|
104
|
-
def cpd_audit_review_item(item)
|
105
|
-
unless item.kind_of?(CpdAuditResponse) || item.kind_of?(CpdStatementActivity)
|
106
|
-
raise("expected a cpd_audit_response or cpd_statement_activity")
|
107
|
-
end
|
108
|
-
|
109
|
-
cpd_audit_review_item = cpd_audit_review_items.find { |cari| cari.item == item }
|
110
|
-
cpd_audit_review_item ||= cpd_audit_review_items.build(item: item)
|
111
|
-
end
|
112
|
-
|
113
|
-
# The dynamic CPD Statement review steps
|
114
|
-
def auditee_cpd_statements
|
115
|
-
cpd_audit.user.cpd_statements.select do |cpd_statement|
|
116
|
-
cpd_statement.completed? && (submitted_at.blank? || cpd_statement.submitted_at < submitted_at)
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
def cpd_statement(wizard_step)
|
121
|
-
cpd_cycle_id = (wizard_step.to_s.split('statement').last.to_i rescue false)
|
122
|
-
auditee_cpd_statements.find { |cpd_statement| cpd_statement.cpd_cycle_id == cpd_cycle_id }
|
123
|
-
end
|
124
|
-
|
125
|
-
def dynamic_wizard_statement_steps
|
126
|
-
@statement_steps ||= auditee_cpd_statements.each_with_object({}) do |cpd_statement, h|
|
127
|
-
h["statement#{cpd_statement.cpd_cycle_id}".to_sym] = "#{cpd_statement.cpd_cycle.to_s} Activities"
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
# The dynamic CPD Audit Level Sections steps
|
132
|
-
def cpd_audit_level_section(wizard_step)
|
133
|
-
position = (wizard_step.to_s.split('section').last.to_i rescue false)
|
134
|
-
cpd_audit_level.cpd_audit_level_sections.find { |section| (section.position + 1) == position }
|
135
|
-
end
|
136
|
-
|
137
|
-
def dynamic_wizard_questionnaire_steps
|
138
|
-
@questionnaire_steps ||= cpd_audit_level.cpd_audit_level_sections.each_with_object({}) do |section, h|
|
139
|
-
h["section#{section.position+1}".to_sym] = section.title
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
def dynamic_wizard_steps
|
144
|
-
dynamic_wizard_statement_steps.merge(dynamic_wizard_questionnaire_steps)
|
145
|
-
end
|
146
|
-
|
147
|
-
def can_visit_step?(step)
|
148
|
-
return (step == :complete) if completed? # Can only view complete step once submitted
|
149
|
-
can_revisit_completed_steps(step)
|
150
|
-
end
|
151
|
-
|
152
|
-
def required_steps
|
153
|
-
steps = [:start, :information, :instructions]
|
154
|
-
|
155
|
-
steps << :conflict if cpd_audit_level.conflict_of_interest?
|
156
|
-
|
157
|
-
if conflict_of_interest?
|
158
|
-
return steps + [:submit, :complete]
|
159
|
-
end
|
160
|
-
|
161
|
-
steps += [:waiting] unless ready?
|
162
|
-
|
163
|
-
steps += [:statements] + dynamic_wizard_statement_steps.keys
|
164
|
-
steps += [:questionnaire] + dynamic_wizard_questionnaire_steps.keys
|
165
|
-
steps += [:recommendation, :submit, :complete]
|
166
|
-
|
167
|
-
steps
|
168
|
-
end
|
169
|
-
|
170
|
-
def wizard_step_title(step)
|
171
|
-
WIZARD_STEPS[step] || dynamic_wizard_steps.fetch(step)
|
172
|
-
end
|
173
|
-
|
174
|
-
# Called by CpdAudit.extension_granted
|
175
|
-
def extension_granted!
|
176
|
-
self.due_date = deadline_to_review()
|
177
|
-
end
|
178
|
-
|
179
|
-
# Called by CpdAudit.submit!
|
180
|
-
def ready!
|
181
|
-
send_email(:cpd_audit_review_ready)
|
182
|
-
end
|
183
|
-
|
184
|
-
# Called by review wizard submit step
|
185
|
-
def submit!
|
186
|
-
update!(submitted_at: Time.zone.now)
|
187
|
-
cpd_audit.review! # maybe go from submitted->removed
|
188
|
-
|
189
|
-
send_email(:cpd_audit_review_submitted)
|
190
|
-
end
|
191
|
-
|
192
|
-
# When ready, the applicant review wizard hides the waiting step
|
193
|
-
def ready?
|
194
|
-
cpd_audit&.was_submitted?
|
195
|
-
end
|
196
|
-
|
197
|
-
def in_progress?
|
198
|
-
submitted_at.blank?
|
199
|
-
end
|
200
|
-
|
201
|
-
def completed?
|
202
|
-
submitted_at.present?
|
203
|
-
end
|
204
|
-
|
205
|
-
def email_form_defaults(action)
|
206
|
-
{ from: EffectiveCpd.mailer_sender }
|
207
|
-
end
|
208
|
-
|
209
|
-
def send_email(email)
|
210
|
-
EffectiveCpd.send_email(email, self, email_form_params) unless email_form_skip?
|
211
|
-
true
|
212
|
-
end
|
213
|
-
|
214
|
-
def deadline_to_conflict_of_interest
|
215
|
-
cpd_audit.deadline_to_conflict_of_interest
|
216
|
-
end
|
217
|
-
|
218
|
-
def deadline_to_review
|
219
|
-
return nil unless cpd_audit_level&.days_to_review.present?
|
220
|
-
|
221
|
-
date = cpd_audit.deadline_to_submit
|
222
|
-
return nil unless date.present?
|
223
|
-
|
224
|
-
EffectiveResources.advance_date(date, business_days: cpd_audit_level.days_to_review)
|
225
|
-
end
|
226
|
-
|
3
|
+
effective_cpd_audit_review
|
227
4
|
end
|
228
5
|
end
|
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
%hr
|
11
11
|
|
12
|
-
-
|
12
|
+
- EffectiveCpd.CpdAudit::WIZARD_STEPS.each do |step, title|
|
13
13
|
= card("#{title} Content") do
|
14
14
|
- if defined?(EffectiveArticleEditor)
|
15
15
|
= f.article_editor "rich_text_#{step}_audit_content", label: false, hint: "displayed on the auditee wizard #{step} wizard step only"
|
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
%hr
|
11
11
|
|
12
|
-
-
|
12
|
+
- EffectiveCpd.CpdAuditReview::WIZARD_STEPS.each do |step, title|
|
13
13
|
= card("#{title} Content") do
|
14
14
|
- if defined?(EffectiveArticleEditor)
|
15
15
|
= f.article_editor "rich_text_#{step}_audit_review_content", label: false, hint: "displayed on the audit reviewer #{step} wizard step only"
|
@@ -1,11 +1,17 @@
|
|
1
1
|
= effective_form_with(model: [:admin, cpd_audit_level], engine: true) do |f|
|
2
2
|
= f.text_field :title, hint: 'A title for this kind of audit'
|
3
3
|
|
4
|
+
= f.check_box :anonymous, label: 'Yes, this is an anonymous audit'
|
5
|
+
|
6
|
+
= f.show_if(:anonymous, true) do
|
7
|
+
.row
|
8
|
+
.col= f.text_field :anonymous_audits_prefix, hint: 'Used to prefix audits. Something like A23'
|
9
|
+
.col= f.text_field :anonymous_audit_reviews_prefix, hint: 'Used to prefix audit reviewers. Something like R23'
|
10
|
+
|
4
11
|
= f.select :recommendations, f.object.recommendations,
|
5
12
|
label: 'Audit Review recommendation choices', tags: true, placeholder: 'Type to add item...',
|
6
13
|
hint: 'The recommendation made by an audit reviewer when reviewing an audit. Begin typing and then press enter to add a choice'
|
7
14
|
|
8
|
-
|
9
15
|
= f.select :determinations, f.object.determinations,
|
10
16
|
label: 'Audit determination choices', tags: true, placeholder: 'Type to add item...',
|
11
17
|
hint: 'The final determination made by the auditor when closing an audit. Begin typing and then press enter to add a choice.'
|
@@ -1,9 +1,12 @@
|
|
1
1
|
= effective_form_with(model: [:admin, cpd_audit_review], engine: true) do |f|
|
2
2
|
- if inline_datatable?
|
3
3
|
= f.hidden_field :cpd_audit_id
|
4
|
+
= f.hidden_field :cpd_audit_type
|
5
|
+
|
4
6
|
= f.static_field :cpd_audit, label: 'CPD Audit'
|
5
7
|
- else
|
6
|
-
= f.
|
8
|
+
= f.hidden_field :cpd_audit_type, value: EffectiveCpd.CpdAudit.class.name
|
9
|
+
= f.select :cpd_audit_id, EffectiveCpd.CpdAudit.available.sorted.all
|
7
10
|
|
8
11
|
= render('admin/cpd_audits/audit_reviewer_fields', f: f)
|
9
12
|
|
@@ -1,49 +1 @@
|
|
1
|
-
=
|
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 'Deadlines' do
|
21
|
-
= render 'admin/cpd_audits/form_deadlines', cpd_audit: cpd_audit
|
22
|
-
|
23
|
-
= tab 'Statements' do
|
24
|
-
- datatable = Admin::EffectiveCpdStatementsDatatable.new(user_id: cpd_audit.user.id, user_type: cpd_audit.user.class.name)
|
25
|
-
= render_datatable(datatable, inline: true, simple: true)
|
26
|
-
|
27
|
-
= tab 'Audit Reviews' do
|
28
|
-
- datatable = Admin::EffectiveCpdAuditReviewsDatatable.new(cpd_audit_id: cpd_audit.id)
|
29
|
-
= render_datatable(datatable, inline: true, simple: true)
|
30
|
-
|
31
|
-
- unless cpd_audit.closed?
|
32
|
-
= tab 'Determination' do
|
33
|
-
= render 'admin/cpd_audits/form_determination', cpd_audit: cpd_audit
|
34
|
-
|
35
|
-
- if cpd_audit.conflicted?
|
36
|
-
= tab 'Process Conflict of Interest' do
|
37
|
-
= render 'admin/cpd_audits/form_conflict', cpd_audit: cpd_audit
|
38
|
-
|
39
|
-
- if cpd_audit.exemption_requested?
|
40
|
-
= tab 'Process Exemption Request' do
|
41
|
-
= render 'admin/cpd_audits/form_exemption', cpd_audit: cpd_audit
|
42
|
-
|
43
|
-
- if cpd_audit.extension_requested?
|
44
|
-
= tab 'Process Extension Request' do
|
45
|
-
= render 'admin/cpd_audits/form_extension', cpd_audit: cpd_audit
|
46
|
-
|
47
|
-
- if cpd_audit.respond_to?(:log_changes_datatable)
|
48
|
-
= tab 'Logs' do
|
49
|
-
= render_inline_datatable(cpd_audit.log_changes_datatable)
|
1
|
+
= render('admin/cpd_audits/form_cpd_audit', cpd_audit: cpd_audit)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
= card('Determination') do
|
2
2
|
= effective_form_with(model: [:admin, cpd_audit], engine: true) do |f|
|
3
|
-
%p This action will
|
3
|
+
%p This action will close this audit with the following determination:
|
4
4
|
|
5
5
|
= f.select :determination, cpd_audit.cpd_audit_level.determinations
|
6
6
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
= effective_form_with(model: [:admin, cpd_audit], engine: true) do |f|
|
2
|
+
= f.hidden_field :id
|
3
|
+
|
4
|
+
%p The #{cpd_audit} will be marked <strong>completed</strong>. All deliverables have been received and all requirements completed.
|
5
|
+
|
6
|
+
%p The audit reviewer(s) will be notified that this audit is ready to review.
|
7
|
+
|
8
|
+
%h3 Email to send
|
9
|
+
%p
|
10
|
+
|
11
|
+
An
|
12
|
+
- email = Effective::EmailTemplate.where(template_name: :cpd_audit_review_ready).first!
|
13
|
+
= link_to('cpd_audit_review_ready email', effective_email_templates.edit_admin_email_template_path(email))
|
14
|
+
|
15
|
+
email will be sent to each reviewer.
|
16
|
+
|
17
|
+
= f.submit 'Complete Audit', border: false, center: true, 'data-confirm': "Complete #{f.object}?"
|
@@ -0,0 +1,56 @@
|
|
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
|
+
- if cpd_audit.conflicted?
|
21
|
+
= tab 'Process Conflict of Interest' do
|
22
|
+
= render 'admin/cpd_audits/form_conflict', cpd_audit: cpd_audit
|
23
|
+
|
24
|
+
- if cpd_audit.exemption_requested?
|
25
|
+
= tab 'Process Exemption Request' do
|
26
|
+
= render 'admin/cpd_audits/form_exemption', cpd_audit: cpd_audit
|
27
|
+
|
28
|
+
- if cpd_audit.extension_requested?
|
29
|
+
= tab 'Process Extension Request' do
|
30
|
+
= render 'admin/cpd_audits/form_extension', cpd_audit: cpd_audit
|
31
|
+
|
32
|
+
- if cpd_audit.was_submitted? == false
|
33
|
+
= tab 'Deadlines' do
|
34
|
+
= render 'admin/cpd_audits/form_deadlines', cpd_audit: cpd_audit
|
35
|
+
|
36
|
+
- if cpd_audit.was_submitted? && !cpd_audit.closed?
|
37
|
+
= tab 'Process' do
|
38
|
+
= render 'admin/cpd_audits/form_process', cpd_audit: cpd_audit
|
39
|
+
|
40
|
+
= yield
|
41
|
+
|
42
|
+
= tab 'Files' do
|
43
|
+
= render 'admin/cpd_audits/form_files', cpd_audit: cpd_audit
|
44
|
+
|
45
|
+
- if cpd_audit.user_cpd_required?
|
46
|
+
= tab 'Statements' do
|
47
|
+
- datatable = Admin::EffectiveCpdStatementsDatatable.new(user: cpd_audit.user)
|
48
|
+
= render_datatable(datatable, inline: true, simple: true)
|
49
|
+
|
50
|
+
= tab 'Audit Reviews' do
|
51
|
+
- datatable = EffectiveResources.best('Admin::EffectiveCpdAuditReviewsDatatable').new(cpd_audit: cpd_audit)
|
52
|
+
= render_datatable(datatable, inline: true, simple: true)
|
53
|
+
|
54
|
+
- if cpd_audit.respond_to?(:log_changes_datatable)
|
55
|
+
= tab 'Logs' do
|
56
|
+
= render_inline_datatable(cpd_audit.log_changes_datatable)
|
@@ -1,12 +1,11 @@
|
|
1
|
-
=
|
2
|
-
|
3
|
-
%p The audittee has the following deadlines:
|
1
|
+
= effective_form_with(model: [:admin, cpd_audit], engine: true) do |f|
|
2
|
+
%p The audittee has the following deadlines:
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
%ul
|
5
|
+
%li To declare conflict of interest: #{f.object.deadline_to_conflict_of_interest}
|
6
|
+
%li To request exemption: #{f.object.deadline_to_exemption}
|
7
|
+
%li To request extension: #{f.object.deadline_to_extension}
|
9
8
|
|
10
|
-
|
9
|
+
= f.check_box :ignore_deadlines, label: 'Yes, ignore audittee deadlines and allow these actions to be performed'
|
11
10
|
|
12
|
-
|
11
|
+
= f.submit 'Save', center: true
|
@@ -11,7 +11,7 @@
|
|
11
11
|
%p The exemption request shall be
|
12
12
|
|
13
13
|
= effective_form_with(model: [:admin, cpd_audit], engine: true) do |f|
|
14
|
-
= f.radios :admin_process_request,
|
14
|
+
= f.radios :admin_process_request, EffectiveCpd.CpdAudit.admin_process_request_options, label: false, buttons: true, required: true
|
15
15
|
|
16
16
|
= f.show_if :admin_process_request, 'Granted' do
|
17
17
|
%p Send email
|
@@ -11,7 +11,7 @@
|
|
11
11
|
%p The extension request shall be
|
12
12
|
|
13
13
|
= effective_form_with(model: [:admin, cpd_audit], engine: true) do |f|
|
14
|
-
= f.radios :admin_process_request,
|
14
|
+
= f.radios :admin_process_request, EffectiveCpd.CpdAudit.admin_process_request_options, label: false, buttons: true, required: true
|
15
15
|
|
16
16
|
= f.show_if :admin_process_request, 'Granted' do
|
17
17
|
%p Send email
|
@@ -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.
|
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=
|
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.
|
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'
|
@@ -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
|
-
-
|
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
|
-
-
|
31
|
-
-
|
32
|
-
-
|
33
|
-
.
|
34
|
-
|
35
|
-
|
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
|
-
|
40
|
-
|
41
|
-
|
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)
|