effective_memberships 0.1.2
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.
- 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
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: d6e16095d62eababb9b14b78f65c13b45b744e15c16f92b79724b8e138b4b38d
|
|
4
|
+
data.tar.gz: e4a51731819350e85f49615a982614197fc05fcf3b4b5da4558a6a534eab1ea2
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: c333cb75909efad3f4400b0fead9397b5f3f89d3d4df9dc920e9b5867ad58223fa0baeb3170db00b0d652bbf41d48405832b103e3fb84b872ed042634a20a0a3
|
|
7
|
+
data.tar.gz: 859cea163d8380b4daf5e6dbc98f575a1b755fded7a27c3a227ddc36e1de61b1225304e091d44c9a4fa6096b1b464aeaf0f339013c57920ad5bd91e027575992
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2021 Code and Effect Inc.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Effective Memberships
|
|
2
|
+
|
|
3
|
+
TODO: This Readme is inaccurate and severely incomplete.
|
|
4
|
+
|
|
5
|
+
Membership categories, applications to join and reclassify, annual dues payments.
|
|
6
|
+
|
|
7
|
+
Works with action_text for content bodies, and active_storage for file uploads.
|
|
8
|
+
|
|
9
|
+
## Getting Started
|
|
10
|
+
|
|
11
|
+
This requires Rails 6+ and Twitter Bootstrap 4 and just works with Devise.
|
|
12
|
+
|
|
13
|
+
Please first install the [effective_datatables](https://github.com/code-and-effect/effective_datatables) gem.
|
|
14
|
+
|
|
15
|
+
Please download and install the [Twitter Bootstrap4](http://getbootstrap.com)
|
|
16
|
+
|
|
17
|
+
Add to your Gemfile:
|
|
18
|
+
|
|
19
|
+
```ruby
|
|
20
|
+
gem 'haml-rails' # or try using gem 'hamlit-rails'
|
|
21
|
+
gem 'effective_memberships'
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Run the bundle command to install it:
|
|
25
|
+
|
|
26
|
+
```console
|
|
27
|
+
bundle install
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Then run the generator:
|
|
31
|
+
|
|
32
|
+
```ruby
|
|
33
|
+
rails generate effective_memberships:install
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The generator will install an initializer which describes all configuration options and creates a database migration.
|
|
37
|
+
|
|
38
|
+
If you want to tweak the table names, manually adjust both the configuration file and the migration now.
|
|
39
|
+
|
|
40
|
+
Then migrate the database:
|
|
41
|
+
|
|
42
|
+
```ruby
|
|
43
|
+
rake db:migrate
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Please add the following to your User model:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
effective_memberships_owner
|
|
50
|
+
|
|
51
|
+
Use the following datatables to display to your user their applicants dues:
|
|
52
|
+
|
|
53
|
+
```haml
|
|
54
|
+
%h2 Applications to Join
|
|
55
|
+
- datatable = EffectiveMembershipsApplicantssDatatable.new(self)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
and
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
Add a link to the admin menu:
|
|
62
|
+
|
|
63
|
+
```haml
|
|
64
|
+
- if can? :admin, :effective_memberships
|
|
65
|
+
- if can? :index, Effective::Category
|
|
66
|
+
= nav_link_to 'Membership Categories', effective_memberships.admin_categories_path
|
|
67
|
+
|
|
68
|
+
- if can? :index, Effective::Applicants
|
|
69
|
+
= nav_link_to 'Applicants', effective_memberships.admin_applicants_path
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Configuration
|
|
73
|
+
|
|
74
|
+
## Authorization
|
|
75
|
+
|
|
76
|
+
All authorization checks are handled via the effective_resources gem found in the `config/initializers/effective_resources.rb` file.
|
|
77
|
+
|
|
78
|
+
## Permissions
|
|
79
|
+
|
|
80
|
+
The permissions you actually want to define are as follows (using CanCan):
|
|
81
|
+
|
|
82
|
+
```ruby
|
|
83
|
+
# Regular signed up user. Guest users not supported.
|
|
84
|
+
if user.persisted?
|
|
85
|
+
can :new, Effective::Applicant
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
if user.admin?
|
|
89
|
+
can :admin, :effective_memberships
|
|
90
|
+
can :manage, Effective::Category
|
|
91
|
+
can :manage, Effective::Applicant
|
|
92
|
+
end
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## License
|
|
96
|
+
|
|
97
|
+
MIT License. Copyright [Code and Effect Inc.](http://www.codeandeffect.com/)
|
|
98
|
+
|
|
99
|
+
## Testing
|
|
100
|
+
|
|
101
|
+
Run tests by:
|
|
102
|
+
|
|
103
|
+
```ruby
|
|
104
|
+
rails test
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Contributing
|
|
108
|
+
|
|
109
|
+
1. Fork it
|
|
110
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
111
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
112
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
113
|
+
5. Bonus points for test coverage
|
|
114
|
+
6. Create new Pull Request
|
data/Rakefile
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require "bundler/setup"
|
|
2
|
+
|
|
3
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
|
4
|
+
load "rails/tasks/engine.rake"
|
|
5
|
+
|
|
6
|
+
load "rails/tasks/statistics.rake"
|
|
7
|
+
|
|
8
|
+
require "bundler/gem_tasks"
|
|
9
|
+
|
|
10
|
+
require "rake/testtask"
|
|
11
|
+
|
|
12
|
+
Rake::TestTask.new(:test) do |t|
|
|
13
|
+
t.libs << 'test'
|
|
14
|
+
t.pattern = 'test/**/*_test.rb'
|
|
15
|
+
t.verbose = false
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
task default: :test
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// # When any data-applicant-experiences-month changes, sum them all up.
|
|
2
|
+
function sumApplicantCourses($form) {
|
|
3
|
+
// For each area
|
|
4
|
+
$form.find('.applicant-course-area').each(function() {
|
|
5
|
+
const $area = $(this);
|
|
6
|
+
|
|
7
|
+
let sum = 0;
|
|
8
|
+
|
|
9
|
+
$area.find('input[data-applicant-courses-amount]').each(function() {
|
|
10
|
+
sum += parseInt($(this).val() || 0);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
$area.find('[data-applicant-course-area-sum]').text(sum);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// For everything
|
|
17
|
+
let sum = 0;
|
|
18
|
+
|
|
19
|
+
$form.find('input[data-applicant-courses-amount]').each(function() {
|
|
20
|
+
sum += parseInt($(this).val() || 0);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
$form.find('[data-applicant-courses-sum]').text(sum);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
$(document).on('change dp.change keyup', "[data-applicant-courses-amount]", function(event) {
|
|
27
|
+
const $form = $(event.currentTarget).closest('form');
|
|
28
|
+
sumApplicantCourses($form);
|
|
29
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// # When any data-applicant-experiences-month changes, sum them all up.
|
|
2
|
+
function sumApplicantExperiences($form) {
|
|
3
|
+
let months = 0;
|
|
4
|
+
|
|
5
|
+
// Sum each nested fields
|
|
6
|
+
$form.find('.has-many-fields:visible').each(function() {
|
|
7
|
+
const $obj = $(this);
|
|
8
|
+
|
|
9
|
+
const start_on = $obj.find("input[name$='[start_on]']").val();
|
|
10
|
+
const end_on = $obj.find("input[name$='[end_on]']").val();
|
|
11
|
+
|
|
12
|
+
const level = $obj.find("input[name$='[level]']:checked").val();
|
|
13
|
+
const percent = $obj.find("input[name$='[percent_worked]']").val() || 0;
|
|
14
|
+
|
|
15
|
+
let diff = (moment(end_on).diff(moment(start_on), 'months') || 0);
|
|
16
|
+
|
|
17
|
+
if(level == 'Part Time') {
|
|
18
|
+
diff = Math.floor(diff * (percent / 100000.0)) // 100%
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
$obj.find("p[id$='_months']").text(diff);
|
|
22
|
+
|
|
23
|
+
if(diff > 0) { months += diff; }
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Sum Total
|
|
27
|
+
$form.find('p#applicant_applicant_experiences_months').text(months);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
$(document).on('change dp.change keyup', "[data-applicant-experiences-month]", function(event) {
|
|
31
|
+
const $form = $(event.currentTarget).closest('form');
|
|
32
|
+
sumApplicantExperiences($form);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
// $(document).on 'cocoon:after-remove', (event) ->
|
|
37
|
+
// $form = $(event.target).closest('form')
|
|
38
|
+
// sumMonths($form) if $form.find('[data-experience-month]').length > 0
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//= require_tree ./effective_memberships
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import 'effective_memberships/base';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Admin
|
|
2
|
+
class ApplicantCourseAreasController < ApplicationController
|
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
|
4
|
+
before_action { EffectiveResources.authorize!(self, :admin, :effective_memberships) }
|
|
5
|
+
|
|
6
|
+
include Effective::CrudController
|
|
7
|
+
|
|
8
|
+
private
|
|
9
|
+
|
|
10
|
+
def permitted_params
|
|
11
|
+
params.require(:effective_applicant_course_area).permit!
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Admin
|
|
2
|
+
class ApplicantCourseNamesController < ApplicationController
|
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
|
4
|
+
before_action { EffectiveResources.authorize!(self, :admin, :effective_memberships) }
|
|
5
|
+
|
|
6
|
+
include Effective::CrudController
|
|
7
|
+
|
|
8
|
+
private
|
|
9
|
+
|
|
10
|
+
def permitted_params
|
|
11
|
+
params.require(:effective_applicant_course_name).permit!
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Admin
|
|
2
|
+
class ApplicantsController < ApplicationController
|
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
|
4
|
+
before_action { EffectiveResources.authorize!(self, :admin, :effective_memberships) }
|
|
5
|
+
|
|
6
|
+
include Effective::CrudController
|
|
7
|
+
|
|
8
|
+
resource_scope -> { EffectiveMemberships.Applicant.deep.all }
|
|
9
|
+
datatable -> { Admin::EffectiveApplicantsDatatable.new }
|
|
10
|
+
|
|
11
|
+
submit :approve, 'Approve Applicant', success: -> {
|
|
12
|
+
[
|
|
13
|
+
"Successfully approved #{resource.owner} #{resource}",
|
|
14
|
+
("and sent #{resource.owner.email} a notification" unless resource.email_form_skip)
|
|
15
|
+
].compact.join(' ')
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
submit :decline, 'Decline Applicant', success: -> {
|
|
19
|
+
[
|
|
20
|
+
"Successfully declined #{resource.owner} #{resource}",
|
|
21
|
+
("and sent #{resource.owner.email} a notification" unless resource.email_form_skip)
|
|
22
|
+
].compact.join(' ')
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def permitted_params
|
|
28
|
+
model = (params.key?(:effective_applicant) ? :effective_applicant : :applicant)
|
|
29
|
+
params.require(model).permit!
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Admin
|
|
2
|
+
class CategoriesController < ApplicationController
|
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
|
4
|
+
before_action { EffectiveResources.authorize!(self, :admin, :effective_memberships) }
|
|
5
|
+
|
|
6
|
+
include Effective::CrudController
|
|
7
|
+
|
|
8
|
+
resource_scope -> { EffectiveMemberships.Category.deep.all }
|
|
9
|
+
datatable -> { Admin::EffectiveCategoriesDatatable.new }
|
|
10
|
+
|
|
11
|
+
private
|
|
12
|
+
|
|
13
|
+
def permitted_params
|
|
14
|
+
model = (params.key?(:effective_category) ? :effective_category : :category)
|
|
15
|
+
params.require(model).permit!
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Admin
|
|
2
|
+
class FeesController < ApplicationController
|
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
|
4
|
+
before_action { EffectiveResources.authorize!(self, :admin, :effective_memberships) }
|
|
5
|
+
|
|
6
|
+
include Effective::CrudController
|
|
7
|
+
|
|
8
|
+
resource_scope -> { Effective::Fee.deep.all }
|
|
9
|
+
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
def permitted_params
|
|
13
|
+
model = (params.key?(:effective_fee) ? :effective_fee : :fee)
|
|
14
|
+
params.require(model).permit!
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
module Admin
|
|
2
|
+
class RegistrarActionsController < ApplicationController
|
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
|
4
|
+
before_action { EffectiveResources.authorize!(self, :admin, :effective_memberships) }
|
|
5
|
+
|
|
6
|
+
include Effective::CrudController
|
|
7
|
+
resource_scope -> { Effective::RegistrarAction }
|
|
8
|
+
|
|
9
|
+
submit :register, 'Register',
|
|
10
|
+
success: -> { "#{resource.owner} is now a #{resource.owner.membership.category} member" },
|
|
11
|
+
redirect: -> { admin_owners_path(resource) }
|
|
12
|
+
|
|
13
|
+
submit :reclassify, 'Reclassify',
|
|
14
|
+
success: -> { "#{resource.owner} has been reclassified to #{resource.owner.membership.category}" },
|
|
15
|
+
redirect: -> { admin_owners_path(resource) }
|
|
16
|
+
|
|
17
|
+
submit :remove, 'Remove',
|
|
18
|
+
success: -> { "#{resource.owner} has been removed" },
|
|
19
|
+
redirect: -> { admin_owners_path(resource) }
|
|
20
|
+
|
|
21
|
+
submit :bad_standing, 'Set In Bad Standing',
|
|
22
|
+
success: -> { "#{resource.owner} is now In Bad Standing" },
|
|
23
|
+
redirect: -> { admin_owners_path(resource) }
|
|
24
|
+
|
|
25
|
+
submit :good_standing, 'Remove In Bad Standing',
|
|
26
|
+
success: -> { "#{resource.owner} is now In Good Standing" },
|
|
27
|
+
redirect: -> { admin_owners_path(resource) }
|
|
28
|
+
|
|
29
|
+
submit :fees_paid, 'Mark Fees Paid',
|
|
30
|
+
success: -> { "#{resource.owner} has now paid their fees through #{resource.owner.membership.fees_paid_through_period&.strftime('%F')}" },
|
|
31
|
+
redirect: -> { admin_owners_path(resource) }
|
|
32
|
+
|
|
33
|
+
after_error do
|
|
34
|
+
flash.keep
|
|
35
|
+
redirect_to admin_owners_path(resource)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
|
|
40
|
+
def permitted_params
|
|
41
|
+
params.require(:effective_registrar_action).permit!
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def admin_owners_path(resource)
|
|
45
|
+
Effective::Resource.new(resource.owner, namespace: :admin).action_path(:edit)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Effective
|
|
2
|
+
class ApplicantReferencesController < ApplicationController
|
|
3
|
+
include Effective::CrudController
|
|
4
|
+
|
|
5
|
+
page_title 'Confidential Reference Form'
|
|
6
|
+
|
|
7
|
+
# The show and update actions are public routes but can only be reached by the token.
|
|
8
|
+
# The reference must declare and submit the form
|
|
9
|
+
# To move an applicant reference from submitted to completed
|
|
10
|
+
|
|
11
|
+
submit :notify, 'Resend email notification',
|
|
12
|
+
success: -> { "Sent email notification to #{resource.email}" }
|
|
13
|
+
|
|
14
|
+
submit :complete, 'Complete Reference'
|
|
15
|
+
|
|
16
|
+
def show
|
|
17
|
+
@applicant_reference = ApplicantReference.submitted.find(params[:id])
|
|
18
|
+
EffectiveResources.authorize!(self, :show, @applicant_reference)
|
|
19
|
+
|
|
20
|
+
render 'edit'
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
protected
|
|
24
|
+
|
|
25
|
+
def permitted_params
|
|
26
|
+
permitted = params.require(:effective_applicant_reference).permit!.except(:token, :last_notified_at, :status, :status_steps)
|
|
27
|
+
|
|
28
|
+
if resource.submitted? && resource.applicant.was_submitted? && (resource.applicant.owner != current_user.effective_memberships_owner)
|
|
29
|
+
permitted
|
|
30
|
+
else
|
|
31
|
+
permitted.except(:reservations, :reservations_reason, :work_history, :accept_declaration)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module Effective
|
|
2
|
+
class ApplicantsController < ApplicationController
|
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
|
4
|
+
|
|
5
|
+
include Effective::WizardController
|
|
6
|
+
|
|
7
|
+
resource_scope -> { EffectiveMemberships.Applicant.deep.where(owner: current_user.effective_memberships_owner) }
|
|
8
|
+
|
|
9
|
+
# Allow only 1 in-progress application at a time
|
|
10
|
+
before_action(only: [:new, :show], unless: -> { resource&.done? }) do
|
|
11
|
+
existing = resource_scope.in_progress.where.not(id: resource).first
|
|
12
|
+
|
|
13
|
+
if existing.present?
|
|
14
|
+
flash[:success] = "You have been redirected to your existing in progress application"
|
|
15
|
+
redirect_to effective_memberships.applicant_build_path(existing, existing.next_step)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
after_save do
|
|
20
|
+
flash.now[:success] = ''
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def permitted_params
|
|
26
|
+
params.require(:applicant).permit!.except(
|
|
27
|
+
:owner_id, :owner_type, :status, :status_steps, :wizard_steps,
|
|
28
|
+
:submitted_at, :completed_at, :reviewed_at, :approved_at,
|
|
29
|
+
:declined_at, :declined_reason, :created_at, :updated_at
|
|
30
|
+
)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module Effective
|
|
2
|
+
class FeePaymentsController < ApplicationController
|
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
|
4
|
+
|
|
5
|
+
include Effective::WizardController
|
|
6
|
+
|
|
7
|
+
resource_scope -> { EffectiveMemberships.FeePayment.deep.where(owner: current_user.effective_memberships_owner) }
|
|
8
|
+
|
|
9
|
+
# Allow only 1 in-progress fee payment at a time
|
|
10
|
+
before_action(only: [:new, :show], unless: -> { resource&.done? }) do
|
|
11
|
+
existing = resource_scope.in_progress.where.not(id: resource).first
|
|
12
|
+
|
|
13
|
+
if existing.present?
|
|
14
|
+
flash[:success] = "You have been redirected to your existing in progress fee payment"
|
|
15
|
+
redirect_to effective_memberships.fee_payment_build_path(existing, existing.next_step)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def permitted_params
|
|
22
|
+
params.require(:fee_payment).permit!.except(
|
|
23
|
+
:owner_id, :owner_type, :status, :status_steps, :wizard_steps,
|
|
24
|
+
:submitted_at
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Admin
|
|
2
|
+
class EffectiveApplicantCourseAreasDatatable < Effective::Datatable
|
|
3
|
+
datatable do
|
|
4
|
+
reorder :position
|
|
5
|
+
|
|
6
|
+
col :title
|
|
7
|
+
col :applicant_course_names, label: 'Courses'
|
|
8
|
+
|
|
9
|
+
actions_col
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
collection do
|
|
13
|
+
Effective::ApplicantCourseArea.deep.all
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Admin
|
|
2
|
+
class EffectiveApplicantCourseNamesDatatable < Effective::Datatable
|
|
3
|
+
datatable do
|
|
4
|
+
reorder :position
|
|
5
|
+
|
|
6
|
+
col :applicant_course_area, label: 'Course Area'
|
|
7
|
+
col :title
|
|
8
|
+
|
|
9
|
+
actions_col
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
collection do
|
|
13
|
+
Effective::ApplicantCourseName.deep.all
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
module Admin
|
|
2
|
+
class EffectiveApplicantsDatatable < Effective::Datatable
|
|
3
|
+
filters do
|
|
4
|
+
scope :all
|
|
5
|
+
scope :in_progress, label: 'Open / Active'
|
|
6
|
+
scope :done, label: 'Done'
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
datatable do
|
|
10
|
+
order :id
|
|
11
|
+
col :id, visible: false
|
|
12
|
+
|
|
13
|
+
col :status
|
|
14
|
+
|
|
15
|
+
col :created_at, label: 'Created', as: :date, visible: false
|
|
16
|
+
col :updated_at, label: 'Updated', visible: false
|
|
17
|
+
|
|
18
|
+
col :submitted_at, label: 'Submitted', visible: false, as: :date
|
|
19
|
+
col :completed_at, label: 'Completed', visible: false, as: :date
|
|
20
|
+
col :reviewed_at, label: 'Reviewed', visible: false, as: :date
|
|
21
|
+
col :approved_at, label: 'Approved', visible: false, as: :date
|
|
22
|
+
|
|
23
|
+
col :owner
|
|
24
|
+
|
|
25
|
+
col :applicant_type
|
|
26
|
+
col :category, search: { collection: EffectiveMemberships.Category.all, polymorphic: false }
|
|
27
|
+
col :from_category, search: { collection: EffectiveMemberships.Category.all, polymorphic: false }, visible: false
|
|
28
|
+
|
|
29
|
+
col :orders, visible: false
|
|
30
|
+
|
|
31
|
+
actions_col
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
collection do
|
|
35
|
+
applicants = EffectiveMemberships.Applicant.deep.all
|
|
36
|
+
|
|
37
|
+
raise('expected an owner_id, not user_id') if attributes[:user_id].present?
|
|
38
|
+
|
|
39
|
+
if scope == :in_progress && attributes[:owner_id].blank?
|
|
40
|
+
applicants = applicants.where.not(status: :draft)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
if attributes[:owner_id].present?
|
|
44
|
+
applicants = applicants.where(owner_id: attributes[:owner_id])
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
if attributes[:except_id].present?
|
|
48
|
+
applicants = applicants.where.not(id: attributes[:except_id])
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
applicants
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Admin
|
|
2
|
+
class EffectiveCategoriesDatatable < Effective::Datatable
|
|
3
|
+
datatable do
|
|
4
|
+
reorder :position
|
|
5
|
+
|
|
6
|
+
col :updated_at, visible: false
|
|
7
|
+
col :created_at, visible: false
|
|
8
|
+
col :id, visible: false
|
|
9
|
+
|
|
10
|
+
col :title
|
|
11
|
+
col :applicant_fee, as: :price
|
|
12
|
+
col :renewal_fee, as: :price
|
|
13
|
+
col :late_fee, as: :price
|
|
14
|
+
col :rich_text_body, label: 'Body'
|
|
15
|
+
|
|
16
|
+
actions_col
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
collection do
|
|
20
|
+
EffectiveMemberships.Category.deep.all
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|