effective_cpd 0.0.1 → 0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +89 -10
  3. data/app/controllers/admin/cpd_audit_level_questions_controller.rb +13 -0
  4. data/app/controllers/admin/cpd_audit_levels_controller.rb +13 -0
  5. data/app/controllers/admin/cpd_audit_reviews_controller.rb +13 -0
  6. data/app/controllers/admin/cpd_audits_controller.rb +41 -0
  7. data/app/controllers/effective/cpd_audit_reviews_controller.rb +60 -0
  8. data/app/controllers/effective/cpd_audits_controller.rb +55 -0
  9. data/app/controllers/effective/cpd_cycles_controller.rb +1 -0
  10. data/app/controllers/effective/cpd_statements_controller.rb +1 -3
  11. data/app/datatables/admin/effective_cpd_audit_level_questions_datatable.rb +30 -0
  12. data/app/datatables/admin/effective_cpd_audit_levels_datatable.rb +34 -0
  13. data/app/datatables/admin/effective_cpd_audit_reviews_datatable.rb +29 -0
  14. data/app/datatables/admin/effective_cpd_audits_datatable.rb +67 -0
  15. data/app/datatables/admin/effective_cpd_statements_datatable.rb +3 -3
  16. data/app/datatables/effective_cpd_available_audit_reviews_datatable.rb +37 -0
  17. data/app/datatables/effective_cpd_available_audits_datatable.rb +30 -0
  18. data/app/datatables/{effective_cpd_datatable.rb → effective_cpd_available_cycles_datatable.rb} +3 -4
  19. data/app/datatables/effective_cpd_completed_audit_reviews_datatable.rb +32 -0
  20. data/app/datatables/effective_cpd_completed_audits_datatable.rb +24 -0
  21. data/app/datatables/effective_cpd_completed_statements_datatable.rb +28 -0
  22. data/app/helpers/effective_cpd_audits_helper.rb +48 -0
  23. data/app/mailers/effective/cpd_mailer.rb +155 -3
  24. data/app/models/effective/cpd_activity.rb +16 -3
  25. data/app/models/effective/cpd_audit.rb +380 -0
  26. data/app/models/effective/cpd_audit_level.rb +87 -0
  27. data/app/models/effective/cpd_audit_level_question.rb +91 -0
  28. data/app/models/effective/cpd_audit_level_question_option.rb +34 -0
  29. data/app/models/effective/cpd_audit_level_section.rb +50 -0
  30. data/app/models/effective/cpd_audit_response.rb +86 -0
  31. data/app/models/effective/cpd_audit_response_option.rb +6 -0
  32. data/app/models/effective/cpd_audit_review.rb +222 -0
  33. data/app/models/effective/cpd_audit_review_item.rb +34 -0
  34. data/app/models/effective/cpd_category.rb +12 -3
  35. data/app/models/effective/cpd_cycle.rb +7 -0
  36. data/app/models/effective/cpd_rule.rb +3 -1
  37. data/app/models/effective/cpd_statement.rb +15 -8
  38. data/app/views/admin/cpd_activities/_form.html.haml +1 -1
  39. data/app/views/admin/cpd_audit_level_questions/_form.html.haml +100 -0
  40. data/app/views/admin/cpd_audit_levels/_form.html.haml +24 -0
  41. data/app/views/admin/cpd_audit_levels/_form_content_audit.html.haml +15 -0
  42. data/app/views/admin/cpd_audit_levels/_form_content_audit_review.html.haml +15 -0
  43. data/app/views/admin/cpd_audit_levels/_form_cpd_audit_level.html.haml +52 -0
  44. data/app/views/admin/cpd_audit_levels/_form_cpd_audit_level_section.html.haml +10 -0
  45. data/app/views/admin/cpd_audit_reviews/_cpd_audit_review.html.haml +1 -0
  46. data/app/views/admin/cpd_audit_reviews/_form.html.haml +13 -0
  47. data/app/views/admin/cpd_audits/_audit_reviewer_fields.html.haml +2 -0
  48. data/app/views/admin/cpd_audits/_auditee_fields.html.haml +2 -0
  49. data/app/views/admin/cpd_audits/_form.html.haml +46 -0
  50. data/app/views/admin/cpd_audits/_form_conflict.html.haml +24 -0
  51. data/app/views/admin/cpd_audits/_form_determination.html.haml +10 -0
  52. data/app/views/admin/cpd_audits/_form_exemption.html.haml +24 -0
  53. data/app/views/admin/cpd_audits/_form_extension.html.haml +24 -0
  54. data/app/views/admin/cpd_audits/_form_new.html.haml +28 -0
  55. data/app/views/admin/cpd_audits/_status.html.haml +121 -0
  56. data/app/views/admin/cpd_categories/_form.html.haml +1 -1
  57. data/app/views/admin/cpd_cycles/_form.html.haml +4 -4
  58. data/app/views/admin/cpd_cycles/_form_cpd_cycle.html.haml +3 -0
  59. data/app/views/admin/cpd_statements/_cpd_statement.html.haml +7 -0
  60. data/app/views/effective/cpd_audit_level_questions/_cpd_audit_level_question.html.haml +5 -0
  61. data/app/views/effective/cpd_audit_responses/_cpd_audit_response.html.haml +4 -0
  62. data/app/views/effective/cpd_audit_responses/_fields.html.haml +13 -0
  63. data/app/views/effective/cpd_audit_responses/fields/_choose_one.html.haml +1 -0
  64. data/app/views/effective/cpd_audit_responses/fields/_date.html.haml +2 -0
  65. data/app/views/effective/cpd_audit_responses/fields/_email.html.haml +2 -0
  66. data/app/views/effective/cpd_audit_responses/fields/_long_answer.html.haml +1 -0
  67. data/app/views/effective/cpd_audit_responses/fields/_number.html.haml +2 -0
  68. data/app/views/effective/cpd_audit_responses/fields/_select_all_that_apply.html.haml +1 -0
  69. data/app/views/effective/cpd_audit_responses/fields/_select_up_to_1.html.haml +1 -0
  70. data/app/views/effective/cpd_audit_responses/fields/_select_up_to_2.html.haml +1 -0
  71. data/app/views/effective/cpd_audit_responses/fields/_select_up_to_3.html.haml +1 -0
  72. data/app/views/effective/cpd_audit_responses/fields/_select_up_to_4.html.haml +1 -0
  73. data/app/views/effective/cpd_audit_responses/fields/_select_up_to_5.html.haml +1 -0
  74. data/app/views/effective/cpd_audit_responses/fields/_short_answer.html.haml +1 -0
  75. data/app/views/effective/cpd_audit_responses/fields/_upload_file.html.haml +1 -0
  76. data/app/views/effective/cpd_audit_responses/responses/_choose_one.html.haml +1 -0
  77. data/app/views/effective/cpd_audit_responses/responses/_date.html.haml +1 -0
  78. data/app/views/effective/cpd_audit_responses/responses/_email.html.haml +1 -0
  79. data/app/views/effective/cpd_audit_responses/responses/_long_answer.html.haml +1 -0
  80. data/app/views/effective/cpd_audit_responses/responses/_number.html.haml +1 -0
  81. data/app/views/effective/cpd_audit_responses/responses/_select_all_that_apply.html.haml +5 -0
  82. data/app/views/effective/cpd_audit_responses/responses/_select_up_to_1.html.haml +1 -0
  83. data/app/views/effective/cpd_audit_responses/responses/_select_up_to_2.html.haml +5 -0
  84. data/app/views/effective/cpd_audit_responses/responses/_select_up_to_3.html.haml +5 -0
  85. data/app/views/effective/cpd_audit_responses/responses/_select_up_to_4.html.haml +5 -0
  86. data/app/views/effective/cpd_audit_responses/responses/_select_up_to_5.html.haml +5 -0
  87. data/app/views/effective/cpd_audit_responses/responses/_short_answer.html.haml +1 -0
  88. data/app/views/effective/cpd_audit_responses/responses/_upload_file.html.haml +4 -0
  89. data/app/views/effective/cpd_audit_review_items/_cpd_audit_review_item.html.haml +6 -0
  90. data/app/views/effective/cpd_audit_review_items/_fields.html.haml +11 -0
  91. data/app/views/effective/cpd_audit_reviews/_conflict.html.haml +15 -0
  92. data/app/views/effective/cpd_audit_reviews/_cpd_audit_level_section.html.haml +23 -0
  93. data/app/views/effective/cpd_audit_reviews/_cpd_audit_review.html.haml +17 -0
  94. data/app/views/effective/cpd_audit_reviews/_cpd_statement.html.haml +15 -0
  95. data/app/views/effective/cpd_audit_reviews/_layout.html.haml +24 -0
  96. data/app/views/effective/cpd_audit_reviews/_recommendation.html.haml +9 -0
  97. data/app/views/effective/cpd_audit_reviews/_summary.html.haml +47 -0
  98. data/app/views/effective/cpd_audit_reviews/complete.html.haml +20 -0
  99. data/app/views/effective/cpd_audit_reviews/conflict.html.haml +21 -0
  100. data/app/views/effective/cpd_audit_reviews/cpd_audit_level_section.html.haml +43 -0
  101. data/app/views/effective/cpd_audit_reviews/cpd_statement.html.haml +35 -0
  102. data/app/views/effective/cpd_audit_reviews/information.html.haml +5 -0
  103. data/app/views/effective/cpd_audit_reviews/instructions.html.haml +10 -0
  104. data/app/views/effective/cpd_audit_reviews/questionnaire.html.haml +8 -0
  105. data/app/views/effective/cpd_audit_reviews/recommendation.html.haml +21 -0
  106. data/app/views/effective/cpd_audit_reviews/start.html.haml +10 -0
  107. data/app/views/effective/cpd_audit_reviews/statements.html.haml +29 -0
  108. data/app/views/effective/cpd_audit_reviews/submit.html.haml +14 -0
  109. data/app/views/effective/cpd_audit_reviews/waiting.html.haml +9 -0
  110. data/app/views/effective/cpd_audits/_conflict.html.haml +15 -0
  111. data/app/views/effective/cpd_audits/_cpd_audit.html.haml +12 -0
  112. data/app/views/effective/cpd_audits/_cpd_audit_level_section.html.haml +14 -0
  113. data/app/views/effective/cpd_audits/_exemption.html.haml +26 -0
  114. data/app/views/effective/cpd_audits/_extension.html.haml +30 -0
  115. data/app/views/effective/cpd_audits/_files.html.haml +12 -0
  116. data/app/views/effective/cpd_audits/_layout.html.haml +33 -0
  117. data/app/views/effective/cpd_audits/_summary.html.haml +54 -0
  118. data/app/views/effective/cpd_audits/_waiting.html.haml +6 -0
  119. data/app/views/effective/cpd_audits/complete.html.haml +24 -0
  120. data/app/views/effective/cpd_audits/conflict.html.haml +22 -0
  121. data/app/views/effective/cpd_audits/cpd_audit_level_section.html.haml +20 -0
  122. data/app/views/effective/cpd_audits/exemption.html.haml +19 -0
  123. data/app/views/effective/cpd_audits/extension.html.haml +21 -0
  124. data/app/views/effective/cpd_audits/files.html.haml +7 -0
  125. data/app/views/effective/cpd_audits/information.html.haml +5 -0
  126. data/app/views/effective/cpd_audits/instructions.html.haml +5 -0
  127. data/app/views/effective/cpd_audits/questionnaire.html.haml +5 -0
  128. data/app/views/effective/cpd_audits/start.html.haml +11 -0
  129. data/app/views/effective/cpd_audits/submit.html.haml +15 -0
  130. data/app/views/effective/cpd_audits/waiting.html.haml +24 -0
  131. data/app/views/effective/cpd_mailer/README.md +1 -0
  132. data/app/views/effective/cpd_mailer/cpd_audit_closed.liquid +15 -0
  133. data/app/views/effective/cpd_mailer/cpd_audit_conflict_resolved.liquid +15 -0
  134. data/app/views/effective/cpd_mailer/cpd_audit_conflicted.liquid +13 -0
  135. data/app/views/effective/cpd_mailer/cpd_audit_exemption_denied.liquid +13 -0
  136. data/app/views/effective/cpd_mailer/cpd_audit_exemption_granted.liquid +13 -0
  137. data/app/views/effective/cpd_mailer/cpd_audit_exemption_request.liquid +13 -0
  138. data/app/views/effective/cpd_mailer/cpd_audit_extension_denied.liquid +13 -0
  139. data/app/views/effective/cpd_mailer/cpd_audit_extension_granted.liquid +13 -0
  140. data/app/views/effective/cpd_mailer/cpd_audit_extension_request.liquid +13 -0
  141. data/app/views/effective/cpd_mailer/cpd_audit_opened.liquid +13 -0
  142. data/app/views/effective/cpd_mailer/cpd_audit_review_opened.liquid +15 -0
  143. data/app/views/effective/cpd_mailer/cpd_audit_review_ready.liquid +13 -0
  144. data/app/views/effective/cpd_mailer/cpd_audit_review_submitted.liquid +11 -0
  145. data/app/views/effective/cpd_mailer/cpd_audit_reviewed.liquid +13 -0
  146. data/app/views/effective/cpd_mailer/cpd_audit_submitted.liquid +13 -0
  147. data/app/views/effective/cpd_statement_activities/_cpd_statement_activity.html.haml +65 -0
  148. data/app/views/effective/cpd_statement_activities/_form.html.haml +9 -10
  149. data/app/views/effective/cpd_statements/_activities.html.haml +3 -64
  150. data/app/views/effective/cpd_statements/_activities_edit.html.haml +2 -0
  151. data/app/views/effective/cpd_statements/_activities_table.html.haml +64 -0
  152. data/app/views/effective/cpd_statements/_agreements.html.haml +19 -5
  153. data/app/views/effective/cpd_statements/_cpd_statement.html.haml +6 -3
  154. data/app/views/effective/cpd_statements/_summary.html.haml +26 -31
  155. data/app/views/effective/cpd_statements/activities.html.haml +1 -1
  156. data/app/views/effective/cpd_statements/agreements.html.haml +7 -1
  157. data/app/views/effective/cpd_statements/submit.html.haml +1 -1
  158. data/config/effective_cpd.rb +47 -10
  159. data/config/routes.rb +18 -1
  160. data/db/migrate/01_create_effective_cpd.rb.erb +157 -1
  161. data/db/seeds.rb +2 -1
  162. data/lib/effective_cpd.rb +42 -3
  163. data/lib/effective_cpd/version.rb +1 -1
  164. data/lib/generators/effective_cpd/install_generator.rb +16 -3
  165. metadata +168 -9
  166. data/app/datatables/effective_cpd_statements_datatable.rb +0 -23
  167. data/app/views/admin/cpd_statements/_form.html.haml +0 -6
@@ -13,7 +13,7 @@
13
13
  .mb-2= resource.cpd_cycle.activities_content
14
14
 
15
15
  - if resource.cpd_statement_activities.present?
16
- = render('activities', cpd_statement: resource)
16
+ = render('activities_edit', cpd_statement: resource)
17
17
 
18
18
  .mt-3= link_to 'Add Activity', '#', 'data-cpd-new-activity': true, class: 'btn btn-primary'
19
19
 
@@ -8,7 +8,13 @@
8
8
  .mb-2= resource.cpd_cycle.agreements_content
9
9
 
10
10
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
11
- = render('agreements', f: f, form: f)
12
11
  = f.hidden_field :current_step
13
12
 
13
+ %h2 Agreements
14
+ = f.check_box :confirm_read, label: "Yes, I have read the above content and agreements"
15
+ = f.check_box :confirm_factual, label: "Yes, I declare all provided information to be factual and complete"
16
+
17
+ %h2 Resume
18
+ = f.file_field :files, label: 'Attach resume', hint: 'Please attach your resume or other CPD related documents'
19
+
14
20
  = f.submit 'Save and Continue', center: true
@@ -17,4 +17,4 @@
17
17
  = f.check_box :confirm_readonly,
18
18
  label: 'Yes, I understand that I will not be able to modify this statement after submission'
19
19
 
20
- = f.submit 'Save and Continue', center: true
20
+ = f.submit 'Submit Statement', center: true
@@ -1,10 +1,24 @@
1
1
  EffectiveCpd.setup do |config|
2
- config.cpd_cycles_table_name = :cpd_cycles
3
2
  config.cpd_categories_table_name = :cpd_categories
4
3
  config.cpd_activities_table_name = :cpd_activities
4
+
5
+ config.cpd_cycles_table_name = :cpd_cycles
5
6
  config.cpd_rules_table_name = :cpd_rules
6
- config.cpd_statement_activities_table_name = :cpd_statement_activities
7
+
7
8
  config.cpd_statements_table_name = :cpd_statements
9
+ config.cpd_statement_activities_table_name = :cpd_statement_activities
10
+
11
+ config.cpd_audit_levels_table_name = :cpd_audit_levels
12
+ config.cpd_audit_level_sections_table_name = :cpd_audit_level_sections
13
+ config.cpd_audit_level_questions_table_name = :cpd_audit_level_questions
14
+ config.cpd_audit_level_question_options_table_name = :cpd_audit_level_question_options
15
+
16
+ config.cpd_audits_table_name = :cpd_audits
17
+ config.cpd_audit_responses_table_name = :cpd_audit_responses
18
+ config.cpd_audit_response_options_table_name = :cpd_audit_response_options
19
+
20
+ config.cpd_audit_reviews_table_name = :cpd_audit_reviews
21
+ config.cpd_audit_review_items_table_name = :cpd_audit_review_items
8
22
 
9
23
  # Layout Settings
10
24
  # Configure the Layout per controller, or all at once
@@ -13,17 +27,40 @@ EffectiveCpd.setup do |config|
13
27
  admin: 'admin'
14
28
  }
15
29
 
30
+ # Program label settings
16
31
  config.cycle_label = 'year' # 'cycle', 'season'
17
32
  config.credit_label = 'credit' # 'credit', 'PDH', 'PDU', 'CCC'
18
33
 
19
- # Notifications Mailer Settings
34
+ # Auditee Scope Collection
20
35
  #
21
- # Schedule rake effective_cpd:notify to run every 10 minutes
22
- # to send out email poll notifications
23
- #
24
- config.mailer = {
25
- layout: 'effective_cpd_mailer_layout',
26
- default_from: 'no-reply@example.com'
27
- }
36
+ # When creating a new audit, these are used to select the auditee
37
+ # The User model must respond to these
38
+ config.auditee_user_scope = :all
39
+
40
+ # Audit Reviewer Scope Collection
41
+ config.audit_reviewer_user_scope = :all
42
+
43
+ # Mailer Configuration
44
+ # Configure the class responsible to send e-mails.
45
+ # config.mailer = 'Effective::CpdMailer'
46
+
47
+ # Configure the parent class responsible to send e-mails.
48
+ # config.parent_mailer = 'ActionMailer::Base'
49
+
50
+ # Default deliver method
51
+ # config.deliver_method = :deliver_later
52
+
53
+ # Default layout
54
+ config.mailer_layout = 'effective_cpd_mailer_layout'
55
+
56
+ # Default From
57
+ config.mailer_sender = "no-reply@example.com"
58
+
59
+ # Send Admin correspondence To
60
+ config.mailer_admin = "admin@example.com"
28
61
 
62
+ # Will work with effective_email_templates gem:
63
+ # - The audit and audit review email content will be preopulated based off the template
64
+ # - Uses an EmailTemplatesMailer mailer instead of ActionMailer::Base for default parent_mailer
65
+ config.use_effective_email_templates = false
29
66
  end
data/config/routes.rb CHANGED
@@ -4,16 +4,27 @@ end
4
4
 
5
5
  EffectiveCpd::Engine.routes.draw do
6
6
  scope module: 'effective' do
7
+ # Statements wizard
7
8
  resources :cpd_cycles, path: "cpd_#{EffectiveCpd.cycle_label.pluralize.parameterize.underscore}", only: [:show] do
8
9
  resources :cpd_statements, path: :statements, only: [:new, :show] do
9
10
  resources :build, controller: :cpd_statements, only: [:show, :update]
10
11
  end
11
12
  end
12
13
 
14
+ # CRUD StatementActivities
13
15
  resources :cpd_statements, only: [] do
14
16
  resources :cpd_statement_activities, except: [:index, :show]
15
17
  end
16
18
 
19
+ # Audits Auditee wizard
20
+ resources :cpd_audits, only: [:new, :show] do
21
+ resources :build, controller: :cpd_audits, only: [:show, :update]
22
+ end
23
+
24
+ # Audits Auditor / Audit Reviewer wizard
25
+ resources :cpd_audit_reviews, only: [:new, :show] do
26
+ resources :build, controller: :cpd_audit_reviews, only: [:show, :update]
27
+ end
17
28
  end
18
29
 
19
30
  namespace :admin do
@@ -22,7 +33,13 @@ EffectiveCpd::Engine.routes.draw do
22
33
  resources :cpd_cycles, except: [:show]
23
34
  resources :cpd_rules, only: [:index]
24
35
 
25
- resources :cpd_statements, only: [:index, :edit, :update]
36
+ resources :cpd_statements, only: [:index, :show]
37
+
38
+ resources :cpd_audit_levels, except: [:show]
39
+ resources :cpd_audit_level_questions, except: [:show]
40
+
41
+ resources :cpd_audits, except: [:show, :destroy]
42
+ resources :cpd_audit_reviews
26
43
  end
27
44
 
28
45
  end
@@ -86,7 +86,7 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
86
86
  t.boolean :confirm_factual
87
87
  t.boolean :confirm_readonly
88
88
 
89
- t.datetime :completed_at
89
+ t.datetime :submitted_at
90
90
 
91
91
  t.text :wizard_steps
92
92
 
@@ -94,5 +94,161 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
94
94
  t.datetime :created_at
95
95
  end
96
96
 
97
+ create_table <%= @cpd_audit_levels_table_name %> do |t|
98
+ t.string :title
99
+ t.text :determinations
100
+ t.text :recommendations
101
+
102
+ t.boolean :conflict_of_interest
103
+ t.boolean :can_request_exemption
104
+ t.boolean :can_request_extension
105
+
106
+ t.integer :days_to_submit
107
+ t.integer :days_to_review
108
+ t.integer :days_to_declare_conflict
109
+ t.integer :days_to_request_exemption
110
+ t.integer :days_to_request_extension
111
+
112
+ t.datetime :updated_at
113
+ t.datetime :created_at
114
+ end
115
+
116
+ create_table <%= @cpd_audit_level_sections_table_name %> do |t|
117
+ t.references :cpd_audit_level
118
+
119
+ t.string :title
120
+ t.integer :position
121
+
122
+ t.datetime :updated_at
123
+ t.datetime :created_at
124
+ end
125
+
126
+ create_table <%= @cpd_audit_level_questions_table_name %> do |t|
127
+ t.references :cpd_audit_level
128
+ t.references :cpd_audit_level_section
129
+
130
+ t.text :title
131
+ t.string :category
132
+ t.boolean :required, default: true
133
+
134
+ t.integer :position
135
+
136
+ t.datetime :updated_at
137
+ t.datetime :created_at
138
+ end
139
+
140
+ create_table <%= @cpd_audit_level_question_options_table_name %> do |t|
141
+ t.references :cpd_audit_level_question, index: false
142
+
143
+ t.text :title
144
+ t.integer :position
145
+
146
+ t.datetime :updated_at
147
+ t.datetime :created_at
148
+ end
149
+
150
+ create_table <%= @cpd_audits_table_name %> do |t|
151
+ t.references :cpd_audit_level
152
+
153
+ t.integer :user_id
154
+ t.string :user_type
155
+
156
+ t.date :due_date
157
+
158
+ t.date :notification_date
159
+ t.date :extension_date
160
+
161
+ t.string :determination
162
+
163
+ t.boolean :conflict_of_interest
164
+ t.text :conflict_of_interest_reason
165
+
166
+ t.boolean :exemption_request
167
+ t.text :exemption_request_reason
168
+
169
+ t.boolean :extension_request
170
+ t.text :extension_request_reason
171
+ t.date :extension_request_date
172
+
173
+ t.datetime :started_at
174
+ t.datetime :submitted_at
175
+ t.datetime :reviewed_at
176
+ t.datetime :closed_at
177
+
178
+ t.string :status
179
+ t.text :status_steps
180
+
181
+ t.text :wizard_steps
182
+
183
+ t.string :token
184
+
185
+ t.datetime :updated_at
186
+ t.datetime :created_at
187
+ end
188
+
189
+ create_table <%= @cpd_audit_reviews_table_name %> do |t|
190
+ t.references :cpd_audit_level
191
+ t.references :cpd_audit
192
+
193
+ t.integer :user_id
194
+ t.string :user_type
195
+
196
+ t.date :due_date
197
+
198
+ t.text :comments
199
+ t.string :recommendation
200
+
201
+ t.boolean :conflict_of_interest
202
+ t.text :conflict_of_interest_reason
203
+
204
+ t.datetime :submitted_at
205
+
206
+ t.string :status
207
+ t.text :status_steps
208
+
209
+ t.text :wizard_steps
210
+
211
+ t.string :token
212
+
213
+ t.datetime :updated_at
214
+ t.datetime :created_at
215
+ end
216
+
217
+ create_table <%= @cpd_audit_review_items_table_name %> do |t|
218
+ t.references :cpd_audit_review
219
+
220
+ t.integer :item_id
221
+ t.string :item_type
222
+
223
+ t.string :recommendation
224
+ t.text :comments
225
+
226
+ t.datetime :updated_at
227
+ t.datetime :created_at
228
+ end
229
+
230
+ create_table <%= @cpd_audit_responses_table_name %> do |t|
231
+ t.references :cpd_audit
232
+ t.references :cpd_audit_level_question
233
+ t.references :cpd_audit_level_section
234
+
235
+ t.date :date
236
+ t.string :email
237
+ t.integer :number
238
+ t.text :long_answer
239
+ t.text :short_answer
240
+
241
+ t.datetime :updated_at
242
+ t.datetime :created_at
243
+ end
244
+
245
+ create_table <%= @cpd_audit_response_options_table_name %> do |t|
246
+ t.references :cpd_audit_response
247
+ t.references :cpd_audit_level_question_option, index: false
248
+
249
+ t.datetime :updated_at
250
+ t.datetime :created_at
251
+ end
252
+
97
253
  end
98
254
  end
data/db/seeds.rb CHANGED
@@ -8,7 +8,8 @@ if Rails.env.test?
8
8
  Effective::CpdActivity.delete_all
9
9
  Effective::CpdRule.delete_all
10
10
 
11
- ActionText::RichText.where(record_type: ['Effective::CpdCycle', 'Effective::CpdCycle', 'Effective::CpdActivity']).delete_all
11
+ ActionText::RichText.where(record_type: ['Effective::CpdCycle', 'Effective::CpdCycle', 'Effective::CpdActivity', 'Effective::CpdAudit', 'Effective::CpdAuditLevelSection', 'Effective::CpdAuditLevelQuestion']).delete_all
12
+
12
13
  end
13
14
 
14
15
  # Build the first CpdCycle
data/lib/effective_cpd.rb CHANGED
@@ -7,12 +7,51 @@ module EffectiveCpd
7
7
 
8
8
  def self.config_keys
9
9
  [
10
- :cpd_cycles_table_name, :cpd_categories_table_name, :cpd_activities_table_name, :cpd_rules_table_name,
11
- :cpd_statement_activities_table_name, :cpd_statements_table_name,
12
- :cycle_label, :credit_label, :layout, :mailer
10
+ :cpd_categories_table_name, :cpd_activities_table_name,
11
+ :cpd_cycles_table_name, :cpd_rules_table_name,
12
+ :cpd_statements_table_name, :cpd_statement_activities_table_name,
13
+ :cpd_audit_levels_table_name, :cpd_audit_level_sections_table_name,
14
+ :cpd_audit_level_questions_table_name, :cpd_audit_level_question_options_table_name,
15
+ :cpd_audits_table_name, :cpd_audit_responses_table_name, :cpd_audit_response_options_table_name,
16
+ :cpd_audit_reviews_table_name, :cpd_audit_review_items_table_name,
17
+ :cycle_label, :credit_label, :layout, :auditee_user_scope, :audit_reviewer_user_scope,
18
+ :mailer, :parent_mailer, :deliver_method, :mailer_layout, :mailer_sender, :mailer_admin, :use_effective_email_templates
13
19
  ]
14
20
  end
15
21
 
16
22
  include EffectiveGem
17
23
 
24
+ def self.mailer_class
25
+ return mailer.constantize if mailer.present?
26
+ Effective::CpdMailer
27
+ end
28
+
29
+ def self.parent_mailer_class
30
+ return parent_mailer.constantize if parent_mailer.present?
31
+
32
+ if use_effective_email_templates
33
+ require 'effective_email_templates'
34
+ Effective::EmailTemplatesMailer
35
+ else
36
+ ActionMailer::Base
37
+ end
38
+ end
39
+
40
+ def self.send_email(email, *args)
41
+ raise('expected args to be an Array') unless args.kind_of?(Array)
42
+
43
+ if defined?(Tenant)
44
+ tenant = Tenant.current || raise('expected a current tenant')
45
+ args << { tenant: tenant }
46
+ end
47
+
48
+ deliver_method = EffectiveCpd.deliver_method || EffectiveResources.deliver_method
49
+
50
+ begin
51
+ EffectiveCpd.mailer_class.send(email, *args).send(deliver_method)
52
+ rescue => e
53
+ raise if Rails.env.development? || Rails.env.test?
54
+ end
55
+ end
56
+
18
57
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveCpd
2
- VERSION = '0.0.1'
2
+ VERSION = '0.1'
3
3
  end
@@ -20,13 +20,26 @@ module EffectiveCpd
20
20
  end
21
21
 
22
22
  def create_migration_file
23
- @cpd_cycles_table_name = ':' + EffectiveCpd.cpd_cycles_table_name.to_s
24
23
  @cpd_categories_table_name = ':' + EffectiveCpd.cpd_categories_table_name.to_s
25
24
  @cpd_activities_table_name = ':' + EffectiveCpd.cpd_activities_table_name.to_s
25
+
26
+ @cpd_cycles_table_name = ':' + EffectiveCpd.cpd_cycles_table_name.to_s
26
27
  @cpd_rules_table_name = ':' + EffectiveCpd.cpd_rules_table_name.to_s
27
28
 
28
- @cpd_statement_activities = ':' + EffectiveCpd.cpd_statement_activities_table_name.to_s
29
- @cpd_statements = ':' + EffectiveCpd.cpd_statements_table_name.to_s
29
+ @cpd_statements_table_name = ':' + EffectiveCpd.cpd_statements_table_name.to_s
30
+ @cpd_statement_activities_table_name = ':' + EffectiveCpd.cpd_statement_activities_table_name.to_s
31
+
32
+ @cpd_audit_levels_table_name = ':' + EffectiveCpd.cpd_audit_levels_table_name.to_s
33
+ @cpd_audit_level_sections_table_name = ':' + EffectiveCpd.cpd_audit_level_sections_table_name.to_s
34
+ @cpd_audit_level_questions_table_name = ':' + EffectiveCpd.cpd_audit_level_questions_table_name.to_s
35
+ @cpd_audit_level_question_options_table_name = ':' + EffectiveCpd.cpd_audit_level_question_options_table_name.to_s
36
+
37
+ @cpd_audits_table_name = ':' + EffectiveCpd.cpd_audits_table_name.to_s
38
+ @cpd_audit_responses_table_name = ':' + EffectiveCpd.cpd_audit_responses_table_name.to_s
39
+ @cpd_audit_response_options_table_name = ':' + EffectiveCpd.cpd_audit_response_options_table_name.to_s
40
+
41
+ @cpd_audit_reviews_table_name = ':' + EffectiveCpd.cpd_audit_reviews_table_name.to_s
42
+ @cpd_audit_review_items_table_name = ':' + EffectiveCpd.cpd_audit_review_items_table_name.to_s
30
43
 
31
44
  migration_template ('../' * 3) + 'db/migrate/01_create_effective_cpd.rb.erb', 'db/migrate/create_effective_cpd.rb'
32
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_cpd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: '0.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-16 00:00:00.000000000 Z
11
+ date: 2021-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -66,6 +66,34 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: holidays
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: wicked
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: sqlite3
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -109,7 +137,7 @@ dependencies:
109
137
  - !ruby/object:Gem::Version
110
138
  version: '0'
111
139
  - !ruby/object:Gem::Dependency
112
- name: wicked
140
+ name: pry-byebug
113
141
  requirement: !ruby/object:Gem::Requirement
114
142
  requirements:
115
143
  - - ">="
@@ -123,7 +151,7 @@ dependencies:
123
151
  - !ruby/object:Gem::Version
124
152
  version: '0'
125
153
  - !ruby/object:Gem::Dependency
126
- name: pry-byebug
154
+ name: effective_email_templates
127
155
  requirement: !ruby/object:Gem::Requirement
128
156
  requirements:
129
157
  - - ">="
@@ -136,7 +164,7 @@ dependencies:
136
164
  - - ">="
137
165
  - !ruby/object:Gem::Version
138
166
  version: '0'
139
- description: Continuing professional development rails engine
167
+ description: Continuing professional development and audits rails engine
140
168
  email:
141
169
  - info@codeandeffect.com
142
170
  executables: []
@@ -153,23 +181,47 @@ files:
153
181
  - app/assets/stylesheets/effective_cpd.scss
154
182
  - app/assets/stylesheets/effective_cpd/_activities.scss
155
183
  - app/controllers/admin/cpd_activities_controller.rb
184
+ - app/controllers/admin/cpd_audit_level_questions_controller.rb
185
+ - app/controllers/admin/cpd_audit_levels_controller.rb
186
+ - app/controllers/admin/cpd_audit_reviews_controller.rb
187
+ - app/controllers/admin/cpd_audits_controller.rb
156
188
  - app/controllers/admin/cpd_categories_controller.rb
157
189
  - app/controllers/admin/cpd_cycles_controller.rb
158
190
  - app/controllers/admin/cpd_rules_controller.rb
159
191
  - app/controllers/admin/cpd_statements_controller.rb
192
+ - app/controllers/effective/cpd_audit_reviews_controller.rb
193
+ - app/controllers/effective/cpd_audits_controller.rb
160
194
  - app/controllers/effective/cpd_cycles_controller.rb
161
195
  - app/controllers/effective/cpd_statement_activities_controller.rb
162
196
  - app/controllers/effective/cpd_statements_controller.rb
163
197
  - app/datatables/admin/effective_cpd_activities_datatable.rb
198
+ - app/datatables/admin/effective_cpd_audit_level_questions_datatable.rb
199
+ - app/datatables/admin/effective_cpd_audit_levels_datatable.rb
200
+ - app/datatables/admin/effective_cpd_audit_reviews_datatable.rb
201
+ - app/datatables/admin/effective_cpd_audits_datatable.rb
164
202
  - app/datatables/admin/effective_cpd_categories_datatable.rb
165
203
  - app/datatables/admin/effective_cpd_cycles_datatable.rb
166
204
  - app/datatables/admin/effective_cpd_rules_datatable.rb
167
205
  - app/datatables/admin/effective_cpd_statements_datatable.rb
168
- - app/datatables/effective_cpd_datatable.rb
169
- - app/datatables/effective_cpd_statements_datatable.rb
206
+ - app/datatables/effective_cpd_available_audit_reviews_datatable.rb
207
+ - app/datatables/effective_cpd_available_audits_datatable.rb
208
+ - app/datatables/effective_cpd_available_cycles_datatable.rb
209
+ - app/datatables/effective_cpd_completed_audit_reviews_datatable.rb
210
+ - app/datatables/effective_cpd_completed_audits_datatable.rb
211
+ - app/datatables/effective_cpd_completed_statements_datatable.rb
212
+ - app/helpers/effective_cpd_audits_helper.rb
170
213
  - app/helpers/effective_cpd_helper.rb
171
214
  - app/mailers/effective/cpd_mailer.rb
172
215
  - app/models/effective/cpd_activity.rb
216
+ - app/models/effective/cpd_audit.rb
217
+ - app/models/effective/cpd_audit_level.rb
218
+ - app/models/effective/cpd_audit_level_question.rb
219
+ - app/models/effective/cpd_audit_level_question_option.rb
220
+ - app/models/effective/cpd_audit_level_section.rb
221
+ - app/models/effective/cpd_audit_response.rb
222
+ - app/models/effective/cpd_audit_response_option.rb
223
+ - app/models/effective/cpd_audit_review.rb
224
+ - app/models/effective/cpd_audit_review_item.rb
173
225
  - app/models/effective/cpd_category.rb
174
226
  - app/models/effective/cpd_cycle.rb
175
227
  - app/models/effective/cpd_rule.rb
@@ -177,16 +229,123 @@ files:
177
229
  - app/models/effective/cpd_statement.rb
178
230
  - app/models/effective/cpd_statement_activity.rb
179
231
  - app/views/admin/cpd_activities/_form.html.haml
232
+ - app/views/admin/cpd_audit_level_questions/_form.html.haml
233
+ - app/views/admin/cpd_audit_levels/_form.html.haml
234
+ - app/views/admin/cpd_audit_levels/_form_content_audit.html.haml
235
+ - app/views/admin/cpd_audit_levels/_form_content_audit_review.html.haml
236
+ - app/views/admin/cpd_audit_levels/_form_cpd_audit_level.html.haml
237
+ - app/views/admin/cpd_audit_levels/_form_cpd_audit_level_section.html.haml
238
+ - app/views/admin/cpd_audit_reviews/_cpd_audit_review.html.haml
239
+ - app/views/admin/cpd_audit_reviews/_form.html.haml
240
+ - app/views/admin/cpd_audits/_audit_reviewer_fields.html.haml
241
+ - app/views/admin/cpd_audits/_auditee_fields.html.haml
242
+ - app/views/admin/cpd_audits/_form.html.haml
243
+ - app/views/admin/cpd_audits/_form_conflict.html.haml
244
+ - app/views/admin/cpd_audits/_form_determination.html.haml
245
+ - app/views/admin/cpd_audits/_form_exemption.html.haml
246
+ - app/views/admin/cpd_audits/_form_extension.html.haml
247
+ - app/views/admin/cpd_audits/_form_new.html.haml
248
+ - app/views/admin/cpd_audits/_status.html.haml
180
249
  - app/views/admin/cpd_categories/_form.html.haml
181
250
  - app/views/admin/cpd_categories/_form_cpd_category.html.haml
182
251
  - app/views/admin/cpd_cycles/_form.html.haml
183
252
  - app/views/admin/cpd_cycles/_form_content.html.haml
184
253
  - app/views/admin/cpd_cycles/_form_cpd_cycle.html.haml
185
254
  - app/views/admin/cpd_cycles/_form_cpd_rules.html.haml
186
- - app/views/admin/cpd_statements/_form.html.haml
255
+ - app/views/admin/cpd_statements/_cpd_statement.html.haml
256
+ - app/views/effective/cpd_audit_level_questions/_cpd_audit_level_question.html.haml
257
+ - app/views/effective/cpd_audit_responses/_cpd_audit_response.html.haml
258
+ - app/views/effective/cpd_audit_responses/_fields.html.haml
259
+ - app/views/effective/cpd_audit_responses/fields/_choose_one.html.haml
260
+ - app/views/effective/cpd_audit_responses/fields/_date.html.haml
261
+ - app/views/effective/cpd_audit_responses/fields/_email.html.haml
262
+ - app/views/effective/cpd_audit_responses/fields/_long_answer.html.haml
263
+ - app/views/effective/cpd_audit_responses/fields/_number.html.haml
264
+ - app/views/effective/cpd_audit_responses/fields/_select_all_that_apply.html.haml
265
+ - app/views/effective/cpd_audit_responses/fields/_select_up_to_1.html.haml
266
+ - app/views/effective/cpd_audit_responses/fields/_select_up_to_2.html.haml
267
+ - app/views/effective/cpd_audit_responses/fields/_select_up_to_3.html.haml
268
+ - app/views/effective/cpd_audit_responses/fields/_select_up_to_4.html.haml
269
+ - app/views/effective/cpd_audit_responses/fields/_select_up_to_5.html.haml
270
+ - app/views/effective/cpd_audit_responses/fields/_short_answer.html.haml
271
+ - app/views/effective/cpd_audit_responses/fields/_upload_file.html.haml
272
+ - app/views/effective/cpd_audit_responses/responses/_choose_one.html.haml
273
+ - app/views/effective/cpd_audit_responses/responses/_date.html.haml
274
+ - app/views/effective/cpd_audit_responses/responses/_email.html.haml
275
+ - app/views/effective/cpd_audit_responses/responses/_long_answer.html.haml
276
+ - app/views/effective/cpd_audit_responses/responses/_number.html.haml
277
+ - app/views/effective/cpd_audit_responses/responses/_select_all_that_apply.html.haml
278
+ - app/views/effective/cpd_audit_responses/responses/_select_up_to_1.html.haml
279
+ - app/views/effective/cpd_audit_responses/responses/_select_up_to_2.html.haml
280
+ - app/views/effective/cpd_audit_responses/responses/_select_up_to_3.html.haml
281
+ - app/views/effective/cpd_audit_responses/responses/_select_up_to_4.html.haml
282
+ - app/views/effective/cpd_audit_responses/responses/_select_up_to_5.html.haml
283
+ - app/views/effective/cpd_audit_responses/responses/_short_answer.html.haml
284
+ - app/views/effective/cpd_audit_responses/responses/_upload_file.html.haml
285
+ - app/views/effective/cpd_audit_review_items/_cpd_audit_review_item.html.haml
286
+ - app/views/effective/cpd_audit_review_items/_fields.html.haml
287
+ - app/views/effective/cpd_audit_reviews/_conflict.html.haml
288
+ - app/views/effective/cpd_audit_reviews/_cpd_audit_level_section.html.haml
289
+ - app/views/effective/cpd_audit_reviews/_cpd_audit_review.html.haml
290
+ - app/views/effective/cpd_audit_reviews/_cpd_statement.html.haml
291
+ - app/views/effective/cpd_audit_reviews/_layout.html.haml
292
+ - app/views/effective/cpd_audit_reviews/_recommendation.html.haml
293
+ - app/views/effective/cpd_audit_reviews/_summary.html.haml
294
+ - app/views/effective/cpd_audit_reviews/complete.html.haml
295
+ - app/views/effective/cpd_audit_reviews/conflict.html.haml
296
+ - app/views/effective/cpd_audit_reviews/cpd_audit_level_section.html.haml
297
+ - app/views/effective/cpd_audit_reviews/cpd_statement.html.haml
298
+ - app/views/effective/cpd_audit_reviews/information.html.haml
299
+ - app/views/effective/cpd_audit_reviews/instructions.html.haml
300
+ - app/views/effective/cpd_audit_reviews/questionnaire.html.haml
301
+ - app/views/effective/cpd_audit_reviews/recommendation.html.haml
302
+ - app/views/effective/cpd_audit_reviews/start.html.haml
303
+ - app/views/effective/cpd_audit_reviews/statements.html.haml
304
+ - app/views/effective/cpd_audit_reviews/submit.html.haml
305
+ - app/views/effective/cpd_audit_reviews/waiting.html.haml
306
+ - app/views/effective/cpd_audits/_conflict.html.haml
307
+ - app/views/effective/cpd_audits/_cpd_audit.html.haml
308
+ - app/views/effective/cpd_audits/_cpd_audit_level_section.html.haml
309
+ - app/views/effective/cpd_audits/_exemption.html.haml
310
+ - app/views/effective/cpd_audits/_extension.html.haml
311
+ - app/views/effective/cpd_audits/_files.html.haml
312
+ - app/views/effective/cpd_audits/_layout.html.haml
313
+ - app/views/effective/cpd_audits/_summary.html.haml
314
+ - app/views/effective/cpd_audits/_waiting.html.haml
315
+ - app/views/effective/cpd_audits/complete.html.haml
316
+ - app/views/effective/cpd_audits/conflict.html.haml
317
+ - app/views/effective/cpd_audits/cpd_audit_level_section.html.haml
318
+ - app/views/effective/cpd_audits/exemption.html.haml
319
+ - app/views/effective/cpd_audits/extension.html.haml
320
+ - app/views/effective/cpd_audits/files.html.haml
321
+ - app/views/effective/cpd_audits/information.html.haml
322
+ - app/views/effective/cpd_audits/instructions.html.haml
323
+ - app/views/effective/cpd_audits/questionnaire.html.haml
324
+ - app/views/effective/cpd_audits/start.html.haml
325
+ - app/views/effective/cpd_audits/submit.html.haml
326
+ - app/views/effective/cpd_audits/waiting.html.haml
327
+ - app/views/effective/cpd_mailer/README.md
328
+ - app/views/effective/cpd_mailer/cpd_audit_closed.liquid
329
+ - app/views/effective/cpd_mailer/cpd_audit_conflict_resolved.liquid
330
+ - app/views/effective/cpd_mailer/cpd_audit_conflicted.liquid
331
+ - app/views/effective/cpd_mailer/cpd_audit_exemption_denied.liquid
332
+ - app/views/effective/cpd_mailer/cpd_audit_exemption_granted.liquid
333
+ - app/views/effective/cpd_mailer/cpd_audit_exemption_request.liquid
334
+ - app/views/effective/cpd_mailer/cpd_audit_extension_denied.liquid
335
+ - app/views/effective/cpd_mailer/cpd_audit_extension_granted.liquid
336
+ - app/views/effective/cpd_mailer/cpd_audit_extension_request.liquid
337
+ - app/views/effective/cpd_mailer/cpd_audit_opened.liquid
338
+ - app/views/effective/cpd_mailer/cpd_audit_review_opened.liquid
339
+ - app/views/effective/cpd_mailer/cpd_audit_review_ready.liquid
340
+ - app/views/effective/cpd_mailer/cpd_audit_review_submitted.liquid
341
+ - app/views/effective/cpd_mailer/cpd_audit_reviewed.liquid
342
+ - app/views/effective/cpd_mailer/cpd_audit_submitted.liquid
343
+ - app/views/effective/cpd_statement_activities/_cpd_statement_activity.html.haml
187
344
  - app/views/effective/cpd_statement_activities/_form.html.haml
188
345
  - app/views/effective/cpd_statements/_activities.html.haml
346
+ - app/views/effective/cpd_statements/_activities_edit.html.haml
189
347
  - app/views/effective/cpd_statements/_activities_new.html.haml
348
+ - app/views/effective/cpd_statements/_activities_table.html.haml
190
349
  - app/views/effective/cpd_statements/_agreements.html.haml
191
350
  - app/views/effective/cpd_statements/_cpd_statement.html.haml
192
351
  - app/views/effective/cpd_statements/_layout.html.haml
@@ -229,5 +388,5 @@ requirements: []
229
388
  rubygems_version: 3.1.2
230
389
  signing_key:
231
390
  specification_version: 4
232
- summary: Continuing professional development rails engine
391
+ summary: Continuing professional development and audits rails engine
233
392
  test_files: []