effective_memberships 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +114 -0
- data/Rakefile +18 -0
- data/app/assets/config/effective_memberships_manifest.js +3 -0
- data/app/assets/javascripts/effective_memberships/applicant_courses.js +29 -0
- data/app/assets/javascripts/effective_memberships/applicant_experiences.js +38 -0
- data/app/assets/javascripts/effective_memberships/base.js +0 -0
- data/app/assets/javascripts/effective_memberships.js +1 -0
- data/app/assets/stylesheets/effective_memberships/base.scss +5 -0
- data/app/assets/stylesheets/effective_memberships.scss +1 -0
- data/app/controllers/admin/applicant_course_areas_controller.rb +15 -0
- data/app/controllers/admin/applicant_course_names_controller.rb +15 -0
- data/app/controllers/admin/applicants_controller.rb +33 -0
- data/app/controllers/admin/categories_controller.rb +19 -0
- data/app/controllers/admin/fees_controller.rb +18 -0
- data/app/controllers/admin/registrar_actions_controller.rb +49 -0
- data/app/controllers/effective/applicant_references_controller.rb +37 -0
- data/app/controllers/effective/applicants_controller.rb +34 -0
- data/app/controllers/effective/fee_payments_controller.rb +29 -0
- data/app/datatables/admin/effective_applicant_course_areas_datatable.rb +17 -0
- data/app/datatables/admin/effective_applicant_course_names_datatable.rb +17 -0
- data/app/datatables/admin/effective_applicants_datatable.rb +55 -0
- data/app/datatables/admin/effective_categories_datatable.rb +23 -0
- data/app/datatables/admin/effective_fees_datatable.rb +69 -0
- data/app/datatables/admin/effective_membership_histories_datatable.rb +35 -0
- data/app/datatables/effective_applicant_courses_datatable.rb +30 -0
- data/app/datatables/effective_applicant_educations_datatable.rb +22 -0
- data/app/datatables/effective_applicant_experiences_datatable.rb +42 -0
- data/app/datatables/effective_applicant_references_datatable.rb +34 -0
- data/app/datatables/effective_applicants_datatable.rb +34 -0
- data/app/helpers/effective_memberships_helper.rb +15 -0
- data/app/mailers/effective/memberships_mailer.rb +84 -0
- data/app/models/concerns/effective_memberships_applicant.rb +612 -0
- data/app/models/concerns/effective_memberships_applicant_review.rb +149 -0
- data/app/models/concerns/effective_memberships_category.rb +196 -0
- data/app/models/concerns/effective_memberships_fee_payment.rb +229 -0
- data/app/models/concerns/effective_memberships_owner.rb +263 -0
- data/app/models/concerns/effective_memberships_registrar.rb +300 -0
- data/app/models/effective/applicant.rb +7 -0
- data/app/models/effective/applicant_course.rb +40 -0
- data/app/models/effective/applicant_course_area.rb +31 -0
- data/app/models/effective/applicant_course_name.rb +29 -0
- data/app/models/effective/applicant_education.rb +36 -0
- data/app/models/effective/applicant_experience.rb +79 -0
- data/app/models/effective/applicant_reference.rb +81 -0
- data/app/models/effective/applicant_review.rb +7 -0
- data/app/models/effective/category.rb +7 -0
- data/app/models/effective/fee.rb +142 -0
- data/app/models/effective/fee_payment.rb +7 -0
- data/app/models/effective/membership.rb +119 -0
- data/app/models/effective/membership_category.rb +11 -0
- data/app/models/effective/membership_history.rb +40 -0
- data/app/models/effective/registrar.rb +19 -0
- data/app/models/effective/registrar_action.rb +97 -0
- data/app/views/admin/applicant_course_areas/_form.html.haml +8 -0
- data/app/views/admin/applicant_course_areas/_form_applicant_course_area.html.haml +8 -0
- data/app/views/admin/applicant_course_areas/index.html.haml +8 -0
- data/app/views/admin/applicant_course_name/_form.html.haml +9 -0
- data/app/views/admin/applicants/_form.html.haml +38 -0
- data/app/views/admin/applicants/_form_approve.html.haml +34 -0
- data/app/views/admin/applicants/_form_decline.html.haml +11 -0
- data/app/views/admin/applicants/_form_process.html.haml +18 -0
- data/app/views/admin/applicants/_status.html.haml +133 -0
- data/app/views/admin/categories/_form.html.haml +14 -0
- data/app/views/admin/categories/_form_applicant.html.haml +12 -0
- data/app/views/admin/categories/_form_applicant_content.html.haml +19 -0
- data/app/views/admin/categories/_form_applicant_eligibility.html.haml +13 -0
- data/app/views/admin/categories/_form_applicant_fees.html.haml +29 -0
- data/app/views/admin/categories/_form_applicant_steps.html.haml +42 -0
- data/app/views/admin/categories/_form_category.html.haml +10 -0
- data/app/views/admin/categories/_form_fee_payment.html.haml +9 -0
- data/app/views/admin/categories/_form_fee_payment_content.html.haml +19 -0
- data/app/views/admin/categories/_form_fee_payment_steps.html.haml +9 -0
- data/app/views/admin/categories/_form_renewals.html.haml +32 -0
- data/app/views/admin/fees/_fee.html.haml +1 -0
- data/app/views/admin/fees/_form.html.haml +14 -0
- data/app/views/admin/memberships/_status.html.haml +6 -0
- data/app/views/admin/registrar_actions/_form.html.haml +10 -0
- data/app/views/admin/registrar_actions/_form_bad_standing.html.haml +43 -0
- data/app/views/admin/registrar_actions/_form_fees_paid.html.haml +30 -0
- data/app/views/admin/registrar_actions/_form_reclassify.html.haml +43 -0
- data/app/views/admin/registrar_actions/_form_register.html.haml +44 -0
- data/app/views/admin/registrar_actions/_form_remove.html.haml +17 -0
- data/app/views/effective/applicant_references/_applicant_reference.html.haml +51 -0
- data/app/views/effective/applicant_references/_datatable_actions.html.haml +4 -0
- data/app/views/effective/applicant_references/_form.html.haml +18 -0
- data/app/views/effective/applicant_references/_form_declaration.html.haml +37 -0
- data/app/views/effective/applicant_references/complete.html.haml +3 -0
- data/app/views/effective/applicant_references/edit.html.haml +8 -0
- data/app/views/effective/applicants/_applicant.html.haml +6 -0
- data/app/views/effective/applicants/_content.html.haml +10 -0
- data/app/views/effective/applicants/_course_amounts.html.haml +19 -0
- data/app/views/effective/applicants/_dashboard.html.haml +19 -0
- data/app/views/effective/applicants/_declarations.html.haml +16 -0
- data/app/views/effective/applicants/_demographics.html.haml +9 -0
- data/app/views/effective/applicants/_demographics_fields.html.haml +11 -0
- data/app/views/effective/applicants/_demographics_owner.html.haml +20 -0
- data/app/views/effective/applicants/_education.html.haml +14 -0
- data/app/views/effective/applicants/_experience.html.haml +28 -0
- data/app/views/effective/applicants/_files.html.haml +27 -0
- data/app/views/effective/applicants/_layout.html.haml +3 -0
- data/app/views/effective/applicants/_orders.html.haml +4 -0
- data/app/views/effective/applicants/_references.html.haml +15 -0
- data/app/views/effective/applicants/_summary.html.haml +40 -0
- data/app/views/effective/applicants/billing.html.haml +14 -0
- data/app/views/effective/applicants/checkout.html.haml +6 -0
- data/app/views/effective/applicants/course_amounts.html.haml +50 -0
- data/app/views/effective/applicants/declarations.html.haml +19 -0
- data/app/views/effective/applicants/demographics.html.haml +11 -0
- data/app/views/effective/applicants/education.html.haml +27 -0
- data/app/views/effective/applicants/experience.html.haml +51 -0
- data/app/views/effective/applicants/files.html.haml +14 -0
- data/app/views/effective/applicants/references.html.haml +24 -0
- data/app/views/effective/applicants/select.html.haml +27 -0
- data/app/views/effective/applicants/start.html.haml +18 -0
- data/app/views/effective/applicants/submitted.html.haml +44 -0
- data/app/views/effective/applicants/summary.html.haml +8 -0
- data/app/views/effective/fee_payments/_content.html.haml +8 -0
- data/app/views/effective/fee_payments/_declarations.html.haml +16 -0
- data/app/views/effective/fee_payments/_demographics.html.haml +9 -0
- data/app/views/effective/fee_payments/_demographics_fields.html.haml +11 -0
- data/app/views/effective/fee_payments/_demographics_owner.html.haml +20 -0
- data/app/views/effective/fee_payments/_fee_payment.html.haml +6 -0
- data/app/views/effective/fee_payments/_layout.html.haml +3 -0
- data/app/views/effective/fee_payments/_orders.html.haml +4 -0
- data/app/views/effective/fee_payments/billing.html.haml +14 -0
- data/app/views/effective/fee_payments/checkout.html.haml +6 -0
- data/app/views/effective/fee_payments/declarations.html.haml +20 -0
- data/app/views/effective/fee_payments/demographics.html.haml +12 -0
- data/app/views/effective/fee_payments/start.html.haml +20 -0
- data/app/views/effective/fee_payments/submitted.html.haml +14 -0
- data/app/views/effective/fee_payments/summary.html.haml +8 -0
- data/app/views/effective/fees/_dashboard.html.haml +22 -0
- data/app/views/effective/fees/_fee.html.haml +37 -0
- data/app/views/effective/memberships/_dashboard.html.haml +29 -0
- data/app/views/effective/memberships/_membership.html.haml +40 -0
- data/app/views/effective/memberships_mailer/applicant_approved.liquid +15 -0
- data/app/views/effective/memberships_mailer/applicant_declined.liquid +13 -0
- data/app/views/effective/memberships_mailer/applicant_reference_notification.liquid +15 -0
- data/app/views/layouts/effective_memberships_mailer_layout.html.haml +7 -0
- data/config/effective_memberships.rb +47 -0
- data/config/routes.rb +32 -0
- data/db/migrate/01_create_effective_memberships.rb.erb +380 -0
- data/db/seeds.rb +59 -0
- data/lib/effective_memberships/engine.rb +23 -0
- data/lib/effective_memberships/version.rb +3 -0
- data/lib/effective_memberships.rb +86 -0
- data/lib/generators/effective_memberships/install_generator.rb +40 -0
- data/lib/generators/templates/effective_memberships_mailer_preview.rb +4 -0
- data/lib/tasks/effective_memberships_tasks.rake +17 -0
- metadata +377 -0
@@ -0,0 +1,380 @@
|
|
1
|
+
class CreateEffectiveMemberships < ActiveRecord::Migration[6.0]
|
2
|
+
def change
|
3
|
+
|
4
|
+
# Categories
|
5
|
+
create_table :categories do |t|
|
6
|
+
t.string :title
|
7
|
+
t.string :category
|
8
|
+
|
9
|
+
t.integer :position
|
10
|
+
|
11
|
+
# Applicants
|
12
|
+
t.boolean :can_apply_new, default: false
|
13
|
+
t.boolean :can_apply_existing, default: false
|
14
|
+
t.boolean :can_apply_restricted, default: false
|
15
|
+
t.text :can_apply_restricted_ids
|
16
|
+
|
17
|
+
t.text :applicant_wizard_steps
|
18
|
+
t.integer :applicant_fee
|
19
|
+
|
20
|
+
t.text :applicant_review_wizard_steps
|
21
|
+
|
22
|
+
t.integer :min_applicant_educations
|
23
|
+
t.integer :min_applicant_experiences_months
|
24
|
+
t.integer :min_applicant_references
|
25
|
+
t.integer :min_applicant_courses
|
26
|
+
t.integer :min_applicant_files
|
27
|
+
|
28
|
+
t.integer :min_applicant_reviews
|
29
|
+
|
30
|
+
t.text :fee_payment_wizard_steps
|
31
|
+
|
32
|
+
t.integer :prorated_jan
|
33
|
+
t.integer :prorated_feb
|
34
|
+
t.integer :prorated_mar
|
35
|
+
t.integer :prorated_apr
|
36
|
+
t.integer :prorated_may
|
37
|
+
t.integer :prorated_jun
|
38
|
+
t.integer :prorated_jul
|
39
|
+
t.integer :prorated_aug
|
40
|
+
t.integer :prorated_sep
|
41
|
+
t.integer :prorated_oct
|
42
|
+
t.integer :prorated_nov
|
43
|
+
t.integer :prorated_dec
|
44
|
+
|
45
|
+
# Renewals
|
46
|
+
t.boolean :create_renewal_fees, default: false
|
47
|
+
t.integer :renewal_fee
|
48
|
+
|
49
|
+
t.boolean :create_late_fees, default: false
|
50
|
+
t.integer :late_fee
|
51
|
+
|
52
|
+
t.boolean :create_bad_standing, default: false
|
53
|
+
|
54
|
+
t.string :qb_item_name
|
55
|
+
t.boolean :tax_exempt, default: false
|
56
|
+
|
57
|
+
t.datetime :updated_at
|
58
|
+
t.datetime :created_at
|
59
|
+
end
|
60
|
+
|
61
|
+
add_index :categories, :title
|
62
|
+
add_index :categories, :position
|
63
|
+
|
64
|
+
# Memberships
|
65
|
+
create_table :memberships do |t|
|
66
|
+
t.integer :owner_id
|
67
|
+
t.string :owner_type
|
68
|
+
|
69
|
+
t.string :number
|
70
|
+
t.integer :number_as_integer
|
71
|
+
|
72
|
+
t.date :joined_on
|
73
|
+
t.date :registration_on
|
74
|
+
t.date :fees_paid_period
|
75
|
+
t.date :fees_paid_through_period
|
76
|
+
|
77
|
+
t.boolean :bad_standing, default: false
|
78
|
+
t.boolean :bad_standing_admin, default: false
|
79
|
+
t.text :bad_standing_reason
|
80
|
+
|
81
|
+
t.datetime :updated_at
|
82
|
+
t.datetime :created_at
|
83
|
+
end
|
84
|
+
|
85
|
+
add_index :memberships, [:owner_id, :owner_type], unique: true
|
86
|
+
add_index :memberships, :number
|
87
|
+
|
88
|
+
# Membership Categories Join table
|
89
|
+
create_table :membership_categories do |t|
|
90
|
+
t.integer :category_id
|
91
|
+
t.string :category_type
|
92
|
+
|
93
|
+
t.integer :membership_id
|
94
|
+
t.string :membership_type
|
95
|
+
end
|
96
|
+
|
97
|
+
# Membership Histories
|
98
|
+
create_table :membership_histories do |t|
|
99
|
+
t.integer :owner_id
|
100
|
+
t.string :owner_type
|
101
|
+
|
102
|
+
t.text :categories
|
103
|
+
t.text :category_ids
|
104
|
+
|
105
|
+
t.date :start_on
|
106
|
+
t.date :end_on
|
107
|
+
|
108
|
+
t.string :number
|
109
|
+
|
110
|
+
t.boolean :bad_standing, default: false
|
111
|
+
t.boolean :removed, default: false
|
112
|
+
|
113
|
+
t.text :notes
|
114
|
+
|
115
|
+
t.datetime :updated_at
|
116
|
+
t.datetime :created_at
|
117
|
+
end
|
118
|
+
|
119
|
+
add_index :membership_histories, [:owner_id, :owner_type]
|
120
|
+
add_index :membership_histories, :start_on
|
121
|
+
|
122
|
+
# Applicants
|
123
|
+
create_table :applicants do |t|
|
124
|
+
t.string :token
|
125
|
+
|
126
|
+
t.integer :owner_id
|
127
|
+
t.string :owner_type
|
128
|
+
|
129
|
+
t.integer :category_id
|
130
|
+
t.string :category_type
|
131
|
+
|
132
|
+
t.integer :from_category_id
|
133
|
+
t.string :from_category_type
|
134
|
+
|
135
|
+
t.string :applicant_type
|
136
|
+
|
137
|
+
# Acts as Statused
|
138
|
+
t.string :status
|
139
|
+
t.text :status_steps
|
140
|
+
|
141
|
+
# Acts as Wizard
|
142
|
+
t.text :wizard_steps
|
143
|
+
|
144
|
+
# Dates
|
145
|
+
t.datetime :submitted_at
|
146
|
+
t.datetime :completed_at
|
147
|
+
t.datetime :reviewed_at
|
148
|
+
t.datetime :approved_at
|
149
|
+
|
150
|
+
# Declined
|
151
|
+
t.datetime :declined_at
|
152
|
+
t.text :declined_reason
|
153
|
+
|
154
|
+
# Applicant Educations
|
155
|
+
t.text :applicant_educations_details
|
156
|
+
|
157
|
+
# Applicant Experiences
|
158
|
+
t.integer :applicant_experiences_months
|
159
|
+
t.text :applicant_experiences_details
|
160
|
+
|
161
|
+
# Additional Information
|
162
|
+
t.text :additional_information
|
163
|
+
|
164
|
+
t.datetime :updated_at
|
165
|
+
t.datetime :created_at
|
166
|
+
end
|
167
|
+
|
168
|
+
add_index :applicants, [:owner_id, :owner_type]
|
169
|
+
add_index :applicants, :status
|
170
|
+
add_index :applicants, :token
|
171
|
+
|
172
|
+
# Applicant Educations
|
173
|
+
create_table :applicant_educations do |t|
|
174
|
+
t.integer :applicant_id
|
175
|
+
|
176
|
+
t.date :start_on
|
177
|
+
t.date :end_on
|
178
|
+
|
179
|
+
t.string :institution
|
180
|
+
t.string :location
|
181
|
+
|
182
|
+
t.string :degree_obtained
|
183
|
+
|
184
|
+
t.datetime :updated_at
|
185
|
+
t.datetime :created_at
|
186
|
+
end
|
187
|
+
|
188
|
+
add_index :applicant_educations, :applicant_id
|
189
|
+
add_index :applicant_educations, :start_on
|
190
|
+
|
191
|
+
# Applicant Experiences
|
192
|
+
create_table :applicant_experiences do |t|
|
193
|
+
t.integer :applicant_id
|
194
|
+
|
195
|
+
t.string :level
|
196
|
+
t.integer :months
|
197
|
+
|
198
|
+
t.date :start_on
|
199
|
+
t.date :end_on
|
200
|
+
|
201
|
+
t.string :position
|
202
|
+
t.string :employer
|
203
|
+
|
204
|
+
t.boolean :still_work_here, default: false
|
205
|
+
t.integer :percent_worked
|
206
|
+
|
207
|
+
t.text :tasks_performed
|
208
|
+
|
209
|
+
t.datetime :created_at
|
210
|
+
t.datetime :updated_at
|
211
|
+
end
|
212
|
+
|
213
|
+
add_index :applicant_experiences, :applicant_id
|
214
|
+
add_index :applicant_experiences, :start_on
|
215
|
+
|
216
|
+
# Applicant References
|
217
|
+
create_table :applicant_references do |t|
|
218
|
+
t.integer :applicant_id
|
219
|
+
|
220
|
+
t.string :name
|
221
|
+
t.string :email
|
222
|
+
t.string :phone
|
223
|
+
|
224
|
+
t.string :status
|
225
|
+
t.text :status_steps
|
226
|
+
t.string :known
|
227
|
+
t.string :relationship
|
228
|
+
|
229
|
+
t.boolean :reservations
|
230
|
+
t.text :reservations_reason
|
231
|
+
|
232
|
+
t.text :work_history
|
233
|
+
t.boolean :accept_declaration
|
234
|
+
|
235
|
+
t.string :token
|
236
|
+
t.datetime :last_notified_at
|
237
|
+
|
238
|
+
t.datetime :created_at
|
239
|
+
t.datetime :updated_at
|
240
|
+
end
|
241
|
+
|
242
|
+
add_index :applicant_references, :applicant_id
|
243
|
+
add_index :applicant_references, :token
|
244
|
+
|
245
|
+
# Applicant Courses
|
246
|
+
create_table :applicant_course_areas do |t|
|
247
|
+
t.string :title
|
248
|
+
t.integer :position
|
249
|
+
|
250
|
+
t.datetime :created_at
|
251
|
+
t.datetime :updated_at
|
252
|
+
end
|
253
|
+
|
254
|
+
create_table :applicant_course_names do |t|
|
255
|
+
t.integer :applicant_course_area_id
|
256
|
+
|
257
|
+
t.string :title
|
258
|
+
t.integer :position
|
259
|
+
|
260
|
+
t.datetime :created_at
|
261
|
+
t.datetime :updated_at
|
262
|
+
end
|
263
|
+
|
264
|
+
create_table :applicant_courses do |t|
|
265
|
+
t.integer :applicant_course_area_id
|
266
|
+
t.integer :applicant_course_name_id
|
267
|
+
t.integer :applicant_id
|
268
|
+
|
269
|
+
t.string :title
|
270
|
+
t.integer :amount
|
271
|
+
|
272
|
+
t.string :code
|
273
|
+
t.text :description
|
274
|
+
|
275
|
+
t.datetime :created_at
|
276
|
+
t.datetime :updated_at
|
277
|
+
end
|
278
|
+
|
279
|
+
# Applicant Reviews
|
280
|
+
create_table :applicant_reviews do |t|
|
281
|
+
t.string :token
|
282
|
+
t.integer :applicant_id
|
283
|
+
|
284
|
+
t.integer :reviewer_id
|
285
|
+
t.string :reviewer_type
|
286
|
+
|
287
|
+
# Acts as Statused
|
288
|
+
t.string :status
|
289
|
+
t.text :status_steps
|
290
|
+
|
291
|
+
# Acts as Wizard
|
292
|
+
t.text :wizard_steps
|
293
|
+
|
294
|
+
# Dates
|
295
|
+
t.datetime :submitted_at
|
296
|
+
|
297
|
+
# Recommendation
|
298
|
+
t.string :recommendation
|
299
|
+
t.text :comments
|
300
|
+
|
301
|
+
# Steps
|
302
|
+
t.boolean :conflict_of_interest
|
303
|
+
t.boolean :education_accepted
|
304
|
+
t.boolean :course_amounts_accepted
|
305
|
+
t.boolean :courses_accepted
|
306
|
+
t.boolean :experience_accepted
|
307
|
+
t.boolean :references_accepted
|
308
|
+
t.boolean :files_accepted
|
309
|
+
|
310
|
+
t.timestamps
|
311
|
+
end
|
312
|
+
|
313
|
+
# Fees
|
314
|
+
create_table :fees do |t|
|
315
|
+
t.integer :category_id
|
316
|
+
t.string :category_type
|
317
|
+
|
318
|
+
t.string :fee_type
|
319
|
+
|
320
|
+
t.integer :purchased_order_id
|
321
|
+
|
322
|
+
t.integer :owner_id
|
323
|
+
t.string :owner_type
|
324
|
+
|
325
|
+
t.integer :parent_id
|
326
|
+
t.string :parent_type
|
327
|
+
|
328
|
+
t.date :period
|
329
|
+
t.date :late_on
|
330
|
+
t.date :bad_standing_on
|
331
|
+
|
332
|
+
t.string :title
|
333
|
+
t.integer :price
|
334
|
+
|
335
|
+
t.string :qb_item_name
|
336
|
+
t.boolean :tax_exempt, default: false
|
337
|
+
|
338
|
+
t.datetime :created_at
|
339
|
+
t.datetime :updated_at
|
340
|
+
end
|
341
|
+
|
342
|
+
add_index :fees, :fee_type
|
343
|
+
add_index :fees, :purchased_order_id
|
344
|
+
add_index :fees, :category_id
|
345
|
+
|
346
|
+
add_index :fees, [:owner_id, :owner_type]
|
347
|
+
add_index :fees, [:parent_id, :parent_type]
|
348
|
+
|
349
|
+
# Fee Payments
|
350
|
+
create_table :fee_payments do |t|
|
351
|
+
t.string :token
|
352
|
+
|
353
|
+
t.integer :owner_id
|
354
|
+
t.string :owner_type
|
355
|
+
|
356
|
+
t.integer :category_id
|
357
|
+
t.string :category_type
|
358
|
+
|
359
|
+
t.date :period
|
360
|
+
|
361
|
+
# Acts as Statused
|
362
|
+
t.string :status
|
363
|
+
t.text :status_steps
|
364
|
+
|
365
|
+
# Acts as Wizard
|
366
|
+
t.text :wizard_steps
|
367
|
+
|
368
|
+
# Dates
|
369
|
+
t.datetime :submitted_at
|
370
|
+
|
371
|
+
t.datetime :updated_at
|
372
|
+
t.datetime :created_at
|
373
|
+
end
|
374
|
+
|
375
|
+
add_index :fee_payments, [:owner_id, :owner_type]
|
376
|
+
add_index :fee_payments, :status
|
377
|
+
add_index :fee_payments, :token
|
378
|
+
|
379
|
+
end
|
380
|
+
end
|
data/db/seeds.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
puts "Running effective_memberships seeds"
|
2
|
+
|
3
|
+
now = Time.zone.now
|
4
|
+
|
5
|
+
if Rails.env.test?
|
6
|
+
ActionText::RichText.where(record_type: ['Effective::Category']).delete_all
|
7
|
+
Effective::Category.delete_all
|
8
|
+
Effective::ApplicantCourseArea.delete_all
|
9
|
+
Effective::ApplicantCourseName.delete_all
|
10
|
+
end
|
11
|
+
|
12
|
+
member = Effective::Category.create!(
|
13
|
+
title: "Full Member",
|
14
|
+
can_apply_new: true,
|
15
|
+
can_apply_existing: true,
|
16
|
+
create_renewal_fees: true,
|
17
|
+
create_late_fees: true,
|
18
|
+
min_applicant_references: 2,
|
19
|
+
min_applicant_reviews: 2,
|
20
|
+
applicant_fee: 100_00,
|
21
|
+
renewal_fee: 250_00,
|
22
|
+
late_fee: 50_00,
|
23
|
+
prorated_jan: 120_00, prorated_feb: 110_00, prorated_mar: 100_00, prorated_apr: 90_00, prorated_may: 80_00, prorated_jun: 70_00,
|
24
|
+
prorated_jul: 60_00, prorated_aug: 50_00, prorated_sep: 40_00, prorated_oct: 30_00, prorated_nov: 20_00, prorated_dec: 10_00
|
25
|
+
)
|
26
|
+
|
27
|
+
student = Effective::Category.create!(
|
28
|
+
title: "Student",
|
29
|
+
can_apply_new: true,
|
30
|
+
create_renewal_fees: true,
|
31
|
+
create_late_fees: true,
|
32
|
+
min_applicant_references: 0,
|
33
|
+
min_applicant_reviews: 0,
|
34
|
+
applicant_fee: 50_00,
|
35
|
+
renewal_fee: 125_00,
|
36
|
+
late_fee: 25_00,
|
37
|
+
prorated_jan: 120_00, prorated_feb: 110_00, prorated_mar: 100_00, prorated_apr: 90_00, prorated_may: 80_00, prorated_jun: 70_00,
|
38
|
+
prorated_jul: 60_00, prorated_aug: 50_00, prorated_sep: 40_00, prorated_oct: 30_00, prorated_nov: 20_00, prorated_dec: 10_00
|
39
|
+
)
|
40
|
+
|
41
|
+
retired = Effective::Category.create!(
|
42
|
+
title: "Retired",
|
43
|
+
can_apply_new: false,
|
44
|
+
can_apply_existing: false,
|
45
|
+
can_apply_restricted: true,
|
46
|
+
can_apply_restricted_ids: [member.id],
|
47
|
+
applicant_fee: 0,
|
48
|
+
renewal_fee: 0,
|
49
|
+
prorated_jan: 120_00, prorated_feb: 110_00, prorated_mar: 100_00, prorated_apr: 90_00, prorated_may: 80_00, prorated_jun: 70_00,
|
50
|
+
prorated_jul: 60_00, prorated_aug: 50_00, prorated_sep: 40_00, prorated_oct: 30_00, prorated_nov: 20_00, prorated_dec: 10_00
|
51
|
+
)
|
52
|
+
|
53
|
+
area = Effective::ApplicantCourseArea.create!(title: 'Science')
|
54
|
+
area.applicant_course_names.create!(title: 'Science 100')
|
55
|
+
area.applicant_course_names.create!(title: 'Science 200')
|
56
|
+
|
57
|
+
area = Effective::ApplicantCourseArea.create!(title: 'Arts')
|
58
|
+
area.applicant_course_names.create!(title: 'Arts 100')
|
59
|
+
area.applicant_course_names.create!(title: 'Arts 200')
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module EffectiveMemberships
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
engine_name 'effective_memberships'
|
4
|
+
|
5
|
+
# Set up our default configuration options.
|
6
|
+
initializer 'effective_memberships.defaults', before: :load_config_initializers do |app|
|
7
|
+
eval File.read("#{config.root}/config/effective_memberships.rb")
|
8
|
+
end
|
9
|
+
|
10
|
+
# Include acts_as_addressable concern and allow any ActiveRecord object to call it
|
11
|
+
initializer 'effective_memberships.active_record' do |app|
|
12
|
+
ActiveSupport.on_load :active_record do
|
13
|
+
ActiveRecord::Base.extend(EffectiveMembershipsOwner::Base)
|
14
|
+
ActiveRecord::Base.extend(EffectiveMembershipsCategory::Base)
|
15
|
+
|
16
|
+
ActiveRecord::Base.extend(EffectiveMembershipsApplicant::Base)
|
17
|
+
ActiveRecord::Base.extend(EffectiveMembershipsApplicantReview::Base)
|
18
|
+
ActiveRecord::Base.extend(EffectiveMembershipsFeePayment::Base)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'effective_resources'
|
2
|
+
require 'effective_datatables'
|
3
|
+
require 'effective_memberships/engine'
|
4
|
+
require 'effective_memberships/version'
|
5
|
+
|
6
|
+
module EffectiveMemberships
|
7
|
+
|
8
|
+
def self.config_keys
|
9
|
+
[
|
10
|
+
:categories_table_name, :applicants_table_name, :applicant_reviews_table_name, :fee_payments_table_name,
|
11
|
+
:category_class_name, :applicant_class_name, :applicant_review_class_name, :fee_payment_class_name, :registrar_class_name,
|
12
|
+
:additional_fee_types,
|
13
|
+
:layout,
|
14
|
+
:mailer, :parent_mailer, :deliver_method, :mailer_layout, :mailer_sender, :mailer_admin, :use_effective_email_templates
|
15
|
+
]
|
16
|
+
end
|
17
|
+
|
18
|
+
include EffectiveGem
|
19
|
+
|
20
|
+
def self.Category
|
21
|
+
category_class_name&.constantize || Effective::Category
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.Applicant
|
25
|
+
applicant_class_name&.constantize || Effective::Applicant
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.ApplicantReview
|
29
|
+
applicant_review_class_name&.constantize || Effective::ApplicantReview
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.FeePayment
|
33
|
+
fee_payment_class_name&.constantize || Effective::FeePayment
|
34
|
+
end
|
35
|
+
|
36
|
+
# Singleton
|
37
|
+
def self.Registrar
|
38
|
+
klass = registrar_class_name&.constantize || Effective::Registrar
|
39
|
+
klass.new
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.mailer_class
|
43
|
+
mailer&.constantize || Effective::MembershipsMailer
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.parent_mailer_class
|
47
|
+
return parent_mailer.constantize if parent_mailer.present?
|
48
|
+
|
49
|
+
if use_effective_email_templates
|
50
|
+
require 'effective_email_templates'
|
51
|
+
Effective::EmailTemplatesMailer
|
52
|
+
else
|
53
|
+
ActionMailer::Base
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.fee_types
|
58
|
+
required = ['Applicant', 'Prorated', 'Discount', 'Renewal', 'Late', 'Admin']
|
59
|
+
additional = Array(additional_fee_types)
|
60
|
+
|
61
|
+
(required + additional).uniq.sort
|
62
|
+
end
|
63
|
+
|
64
|
+
# You can delete these if unpurchased
|
65
|
+
def self.custom_fee_types
|
66
|
+
['Admin']
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.send_email(email, *args)
|
70
|
+
raise('expected args to be an Array') unless args.kind_of?(Array)
|
71
|
+
|
72
|
+
if defined?(Tenant)
|
73
|
+
tenant = Tenant.current || raise('expected a current tenant')
|
74
|
+
args.last.kind_of?(Hash) ? args.last.merge!(tenant: tenant) : args << { tenant: tenant }
|
75
|
+
end
|
76
|
+
|
77
|
+
deliver_method = EffectiveMemberships.deliver_method || EffectiveResources.deliver_method
|
78
|
+
|
79
|
+
begin
|
80
|
+
EffectiveMemberships.mailer_class.send(email, *args).send(deliver_method)
|
81
|
+
rescue => e
|
82
|
+
raise if Rails.env.development? || Rails.env.test?
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module EffectiveMemberships
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
include Rails::Generators::Migration
|
5
|
+
|
6
|
+
desc 'Creates an EffectiveMemberships initializer in your application.'
|
7
|
+
|
8
|
+
source_root File.expand_path('../../templates', __FILE__)
|
9
|
+
|
10
|
+
def self.next_migration_number(dirname)
|
11
|
+
if not ActiveRecord::Base.timestamped_migrations
|
12
|
+
Time.new.utc.strftime("%Y%m%d%H%M%S")
|
13
|
+
else
|
14
|
+
'%.3d' % (current_migration_number(dirname) + 1)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def copy_initializer
|
19
|
+
template ('../' * 3) + 'config/effective_memberships.rb', 'config/initializers/effective_memberships.rb'
|
20
|
+
end
|
21
|
+
|
22
|
+
def create_migration_file
|
23
|
+
@categories_table_name = ':' + EffectiveMemberships.categories_table_name.to_s
|
24
|
+
|
25
|
+
migration_template ('../' * 3) + 'db/migrate/01_create_effective_memberships.rb.erb', 'db/migrate/create_effective_memberships.rb'
|
26
|
+
end
|
27
|
+
|
28
|
+
def copy_mailer_preview
|
29
|
+
mailer_preview_path = (Rails.application.config.action_mailer.preview_path rescue nil)
|
30
|
+
|
31
|
+
if mailer_preview_path.present?
|
32
|
+
template 'effective_memberships_mailer_preview.rb', File.join(mailer_preview_path, 'effective_memberships_mailer_preview.rb')
|
33
|
+
else
|
34
|
+
puts "couldn't find action_mailer.preview_path. Skipping effective_memberships_mailer_preview."
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
namespace :effective_memberships do
|
2
|
+
|
3
|
+
# bundle exec rake effective_memberships:seed
|
4
|
+
task seed: :environment do
|
5
|
+
load "#{__dir__}/../../db/seeds.rb"
|
6
|
+
end
|
7
|
+
|
8
|
+
# rake effective_memberships:create_fees
|
9
|
+
desc 'Run daily to create Renewal and Late fees'
|
10
|
+
task create_fees: :environment do
|
11
|
+
if ActiveRecord::Base.connection.table_exists?(:memberships)
|
12
|
+
EffectiveLogger.info "Running effective_memberships:create_fees scheduled task" if defined?(EffectiveLogger)
|
13
|
+
EffectiveMemberships.Registrar.create_fees!
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|