effective_memberships 0.3.14 → 0.4.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 +4 -4
- data/app/controllers/admin/membership_histories_controller.rb +24 -0
- data/app/controllers/admin/memberships_controller.rb +15 -0
- data/app/controllers/admin/organizations_controller.rb +19 -0
- data/app/controllers/admin/representatives_controller.rb +19 -0
- data/app/controllers/effective/applicants_controller.rb +2 -3
- data/app/controllers/effective/fee_payments_controller.rb +1 -2
- data/app/controllers/effective/organizations_controller.rb +16 -0
- data/app/controllers/effective/representatives_controller.rb +19 -0
- data/app/datatables/admin/effective_applicant_references_datatable.rb +22 -20
- data/app/datatables/admin/effective_applicants_datatable.rb +10 -5
- data/app/datatables/admin/effective_categories_datatable.rb +7 -0
- data/app/datatables/admin/effective_fee_payments_datatable.rb +11 -6
- data/app/datatables/admin/effective_fees_datatable.rb +2 -2
- data/app/datatables/admin/effective_membership_histories_datatable.rb +7 -3
- data/app/datatables/admin/effective_memberships_datatable.rb +2 -2
- data/app/datatables/admin/effective_organizations_datatable.rb +31 -0
- data/app/datatables/admin/effective_representatives_datatable.rb +28 -0
- data/app/datatables/effective_applicants_datatable.rb +1 -1
- data/app/datatables/effective_fee_payments_datatable.rb +5 -4
- data/app/datatables/effective_organizations_datatable.rb +18 -0
- data/app/datatables/effective_representatives_datatable.rb +40 -0
- data/app/helpers/effective_memberships_helper.rb +25 -0
- data/app/mailers/effective/memberships_mailer.rb +7 -7
- data/app/models/concerns/effective_memberships_applicant.rb +63 -30
- data/app/models/concerns/effective_memberships_category.rb +32 -5
- data/app/models/concerns/effective_memberships_fee_payment.rb +44 -45
- data/app/models/concerns/effective_memberships_organization.rb +94 -0
- data/app/models/concerns/effective_memberships_owner.rb +44 -55
- data/app/models/concerns/effective_memberships_registrar.rb +5 -3
- data/app/models/concerns/effective_memberships_user.rb +70 -0
- data/app/models/effective/fee.rb +1 -1
- data/app/models/effective/membership.rb +24 -2
- data/app/models/effective/membership_history.rb +15 -0
- data/app/models/effective/organization.rb +8 -0
- data/app/models/effective/registrar_action.rb +16 -1
- data/app/models/effective/representative.rb +56 -0
- data/app/views/admin/categories/_form_applicant_eligibility.html.haml +1 -1
- data/app/views/admin/categories/_form_applicant_steps.html.haml +29 -24
- data/app/views/admin/categories/_form_category.html.haml +3 -0
- data/app/views/admin/categories/_form_renewals.html.haml +0 -2
- data/app/views/admin/membership_histories/_form.html.haml +19 -0
- data/app/views/admin/membership_histories/_validation.html.haml +7 -0
- data/app/views/admin/memberships/_form.html.haml +17 -0
- data/app/views/admin/memberships/_form_membership.html.haml +22 -0
- data/app/views/admin/organizations/_fields.html.haml +6 -0
- data/app/views/admin/organizations/_form.html.haml +31 -0
- data/app/views/admin/organizations/_form_organization.html.haml +23 -0
- data/app/views/admin/registrar_actions/_form_fees_paid.html.haml +16 -0
- data/app/views/admin/representatives/_form.html.haml +38 -0
- data/app/views/{effective/applicants/_demographics_fields.html.haml → admin/representatives/_user_fields.html.haml} +2 -6
- data/app/views/effective/applicants/_dashboard.html.haml +24 -5
- data/app/views/effective/applicants/_demographics.html.haml +1 -1
- data/app/views/effective/applicants/_missing_info.html.haml +7 -3
- data/app/views/effective/applicants/_organization.html.haml +9 -0
- data/app/views/effective/applicants/_select_organization.html.haml +21 -0
- data/app/views/effective/applicants/_summary.html.haml +17 -9
- data/app/views/effective/applicants/billing.html.haml +2 -2
- data/app/views/effective/applicants/demographics.html.haml +7 -6
- data/app/views/effective/applicants/education.html.haml +2 -2
- data/app/views/effective/applicants/organization.html.haml +19 -0
- data/app/views/effective/applicants/references.html.haml +1 -1
- data/app/views/effective/applicants/select.html.haml +11 -1
- data/app/views/effective/applicants/stamp.html.haml +2 -2
- data/app/views/effective/applicants/start.html.haml +17 -11
- data/app/views/effective/applicants/submitted.html.haml +5 -5
- data/app/views/effective/applicants/summary.html.haml +1 -1
- data/app/views/effective/fee_payments/_demographics.html.haml +1 -1
- data/app/views/effective/fee_payments/_organization.html.haml +9 -0
- data/app/views/effective/fee_payments/_summary.html.haml +39 -1
- data/app/views/effective/fee_payments/billing.html.haml +2 -2
- data/app/views/effective/fee_payments/demographics.html.haml +2 -2
- data/app/views/effective/fee_payments/organization.html.haml +18 -0
- data/app/views/effective/fee_payments/start.html.haml +20 -17
- data/app/views/effective/fee_payments/submitted.html.haml +10 -3
- data/app/views/effective/fees/_dashboard.html.haml +20 -8
- data/app/views/effective/memberships/_dashboard.html.haml +16 -5
- data/app/views/effective/organizations/_dashboard.html.haml +10 -0
- data/app/views/effective/organizations/_form.html.haml +8 -0
- data/app/views/effective/organizations/_form_organization.html.haml +11 -0
- data/app/views/effective/representatives/_form.html.haml +33 -0
- data/app/views/effective/{fee_payments/_demographics_fields.html.haml → representatives/_user_fields.html.haml} +2 -6
- data/app/views/organizations/_demographics.html.haml +45 -0
- data/app/views/organizations/_fields_demographics.html.haml +29 -0
- data/app/views/users/_demographics.html.haml +50 -0
- data/app/views/users/_fields_demographics.html.haml +29 -0
- data/config/effective_memberships.rb +3 -0
- data/config/routes.rb +11 -1
- data/db/migrate/01_create_effective_memberships.rb.erb +57 -10
- data/db/seeds.rb +18 -0
- data/lib/effective_memberships/engine.rb +3 -0
- data/lib/effective_memberships/version.rb +1 -1
- data/lib/effective_memberships.rb +6 -2
- metadata +38 -20
- data/app/views/effective/applicants/_demographics_owner.html.haml +0 -20
- data/app/views/effective/fee_payments/_demographics_owner.html.haml +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 885423c81ffcee648c3ad06826b943ed31f9ed059432e9eda6a55b24a0f07ec0
|
4
|
+
data.tar.gz: 3b7c8ed91242b0cd0648cdca9f5e9b70af40bc5f7be7fb3ad585dfbe147c7909
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57654df20abfb3444de50023ea70cc011a28254ac8e986b54b158dc171fffb5c49c4b560128fe6d9ca937fb5f143031c4d4e3eaa372a12cede3968e476de1dfe
|
7
|
+
data.tar.gz: b15c8258ebfbeb653bf4cf5745ef0f63ded375c4326ed32ac5050f6adb7a4d92d6c79d35e914b288d1dbad70f0547e912379783224ef0b737bb6923f334c6029
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Admin
|
2
|
+
class MembershipHistoriesController < 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
|
+
submit :save, 'Update History',
|
9
|
+
success: -> { "Membership history successfully updated. Please double check the history is correct." },
|
10
|
+
redirect: -> { admin_owners_path(resource) }
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def permitted_params
|
15
|
+
model = (params.key?(:effective_membership_history) ? :effective_membership_history : :membership_history)
|
16
|
+
params.require(model).permit!
|
17
|
+
end
|
18
|
+
|
19
|
+
def admin_owners_path(resource)
|
20
|
+
Effective::Resource.new(resource.owner, namespace: :admin).action_path(:edit) + '?tab=membership'
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -5,5 +5,20 @@ module Admin
|
|
5
5
|
|
6
6
|
include Effective::CrudController
|
7
7
|
|
8
|
+
submit :save, 'Update Membership',
|
9
|
+
success: -> { "#{resource.owner} has been successfully updated. Please double check the membership history is correct" },
|
10
|
+
redirect: -> { admin_owners_path(resource) }
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def permitted_params
|
15
|
+
model = (params.key?(:effective_membership) ? :effective_membership : :membership)
|
16
|
+
params.require(model).permit!
|
17
|
+
end
|
18
|
+
|
19
|
+
def admin_owners_path(resource)
|
20
|
+
Effective::Resource.new(resource.owner, namespace: :admin).action_path(:edit) + '?tab=membership'
|
21
|
+
end
|
22
|
+
|
8
23
|
end
|
9
24
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Admin
|
2
|
+
class OrganizationsController < 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.Organization.deep.all }
|
9
|
+
datatable -> { EffectiveResources.best('Admin::EffectiveOrganizationsDatatable').new }
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def permitted_params
|
14
|
+
model = (params.key?(:effective_organization) ? :effective_organization : :organization)
|
15
|
+
params.require(model).permit!
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Admin
|
2
|
+
class RepresentativesController < 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::Representative.deep.all }
|
9
|
+
datatable -> { Admin::EffectiveRepresentativesDatatable.new }
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def permitted_params
|
14
|
+
model = (params.key?(:effective_representative) ? :effective_representative : :representative)
|
15
|
+
params.require(model).permit!
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -4,9 +4,8 @@ module Effective
|
|
4
4
|
|
5
5
|
include Effective::WizardController
|
6
6
|
|
7
|
-
resource_scope -> { EffectiveMemberships.Applicant.deep.where(
|
8
|
-
|
9
|
-
submit :resubmit, 'Submit Application'
|
7
|
+
resource_scope -> { EffectiveMemberships.Applicant.deep.where(user: current_user) }
|
10
8
|
|
9
|
+
submit :resubmit, 'Resubmit Application'
|
11
10
|
end
|
12
11
|
end
|
@@ -4,7 +4,6 @@ module Effective
|
|
4
4
|
|
5
5
|
include Effective::WizardController
|
6
6
|
|
7
|
-
resource_scope -> { EffectiveMemberships.FeePayment.deep.where(
|
8
|
-
|
7
|
+
resource_scope -> { EffectiveMemberships.FeePayment.deep.where(user: current_user) }
|
9
8
|
end
|
10
9
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Effective
|
2
|
+
class OrganizationsController < ApplicationController
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
4
|
+
|
5
|
+
include Effective::CrudController
|
6
|
+
|
7
|
+
resource_scope -> { EffectiveMemberships.Organization.deep.where(id: current_user.organizations) }
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def permitted_params
|
12
|
+
params.require(:organization).permit!
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Effective
|
2
|
+
class RepresentativesController < ApplicationController
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
4
|
+
|
5
|
+
include Effective::CrudController
|
6
|
+
|
7
|
+
resource_scope -> {
|
8
|
+
organizations = EffectiveMemberships.Organization.deep.where(id: current_user.organizations)
|
9
|
+
Effective::Representative.deep.where(organization: organizations)
|
10
|
+
}
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def permitted_params
|
15
|
+
params.require(:effective_representative).permit!
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -1,31 +1,33 @@
|
|
1
|
-
|
1
|
+
module Admin
|
2
|
+
class EffectiveApplicantReferencesDatatable < Effective::Datatable
|
2
3
|
|
3
|
-
|
4
|
-
|
4
|
+
datatable do
|
5
|
+
order :name
|
5
6
|
|
6
|
-
|
7
|
+
col :applicant
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
col :name
|
10
|
+
col :email
|
11
|
+
col :phone
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
col :status do |reference|
|
14
|
+
if reference.submitted?
|
15
|
+
'Waiting on response'
|
16
|
+
elsif reference.completed?
|
17
|
+
'Completed'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
col :last_notified_at do |reference|
|
22
|
+
reference.last_notified_at&.strftime('%F') unless reference.completed?
|
17
23
|
end
|
18
|
-
end
|
19
24
|
|
20
|
-
|
21
|
-
reference.last_notified_at&.strftime('%F') unless reference.completed?
|
25
|
+
actions_col
|
22
26
|
end
|
23
27
|
|
24
|
-
|
25
|
-
|
28
|
+
collection do
|
29
|
+
Effective::ApplicantReference.deep.all
|
30
|
+
end
|
26
31
|
|
27
|
-
collection do
|
28
|
-
Effective::ApplicantReference.deep.all
|
29
32
|
end
|
30
|
-
|
31
33
|
end
|
@@ -26,7 +26,8 @@ module Admin
|
|
26
26
|
|
27
27
|
col :approved_at, label: 'Approved', visible: false, as: :date
|
28
28
|
|
29
|
-
col :
|
29
|
+
col :user
|
30
|
+
col :organization
|
30
31
|
|
31
32
|
col :applicant_type
|
32
33
|
col :category, search: { collection: EffectiveMemberships.Category.all, polymorphic: false }
|
@@ -40,14 +41,18 @@ module Admin
|
|
40
41
|
collection do
|
41
42
|
applicants = EffectiveMemberships.Applicant.deep.all
|
42
43
|
|
43
|
-
raise('expected
|
44
|
+
raise('expected a user_id or organization_id, not owner_id') if attributes[:owner_id].present?
|
44
45
|
|
45
|
-
if scope == :in_progress && attributes[:
|
46
|
+
if scope == :in_progress && attributes[:user_id].blank? && attributes[:organization_id].blank?
|
46
47
|
applicants = applicants.where.not(status: :draft)
|
47
48
|
end
|
48
49
|
|
49
|
-
if attributes[:
|
50
|
-
applicants = applicants.where(
|
50
|
+
if attributes[:user_id].present?
|
51
|
+
applicants = applicants.where(user_id: attributes[:owner_id])
|
52
|
+
end
|
53
|
+
|
54
|
+
if attributes[:organization_id].present?
|
55
|
+
applicants = applicants.where(organization_id: attributes[:organization_id])
|
51
56
|
end
|
52
57
|
|
53
58
|
if attributes[:except_id].present?
|
@@ -8,13 +8,20 @@ module Admin
|
|
8
8
|
col :id, visible: false
|
9
9
|
|
10
10
|
col :title
|
11
|
+
col :can_apply_new, label: 'Can Apply'
|
11
12
|
col :applicant_fee, as: :price
|
13
|
+
|
12
14
|
col :renewal_fee, as: :price
|
13
15
|
col :late_fee, as: :price
|
14
16
|
col :rich_text_body, label: 'Body'
|
15
17
|
col :tax_exempt
|
16
18
|
col :qb_item_name, visible: false
|
17
19
|
|
20
|
+
col :category_type, search: EffectiveMemberships.Category.category_types
|
21
|
+
|
22
|
+
col :optional_applicant_wizard_steps, label: 'Applicant Steps'
|
23
|
+
col :optional_fee_payment_wizard_steps, label: 'Fee Payment Steps'
|
24
|
+
|
18
25
|
actions_col
|
19
26
|
end
|
20
27
|
|
@@ -18,7 +18,8 @@ module Admin
|
|
18
18
|
col :period, visible: false
|
19
19
|
col :submitted_at, label: 'Submitted', visible: false, as: :date
|
20
20
|
|
21
|
-
col :
|
21
|
+
col :user
|
22
|
+
col :organization
|
22
23
|
|
23
24
|
col :category, search: { collection: EffectiveMemberships.Category.all, polymorphic: false }
|
24
25
|
|
@@ -27,17 +28,21 @@ module Admin
|
|
27
28
|
actions_col
|
28
29
|
end
|
29
30
|
|
30
|
-
collection do
|
31
|
+
collection(apply_belongs_to: false) do
|
31
32
|
fee_payments = EffectiveMemberships.FeePayment.deep.all
|
32
33
|
|
33
|
-
raise('expected an
|
34
|
+
raise('expected an user_id but was given an owner_id') if attributes[:owner_id].present?
|
34
35
|
|
35
|
-
if fee_payments == :in_progress && attributes[:
|
36
|
+
if fee_payments == :in_progress && attributes[:user_id].blank? && attributes[:organization_id].blank?
|
36
37
|
fee_payments = fee_payments.where.not(status: :draft)
|
37
38
|
end
|
38
39
|
|
39
|
-
if attributes[:
|
40
|
-
fee_payments = fee_payments.where(
|
40
|
+
if attributes[:user_id].present?
|
41
|
+
fee_payments = fee_payments.where(user_id: attributes[:user_id])
|
42
|
+
end
|
43
|
+
|
44
|
+
if attributes[:organization_id].present?
|
45
|
+
fee_payments = fee_payments.where(organization_id: attributes[:organization_id])
|
41
46
|
end
|
42
47
|
|
43
48
|
if attributes[:except_id].present?
|
@@ -49,8 +49,8 @@ module Admin
|
|
49
49
|
|
50
50
|
raise('expected an owner_id, not user_id') if attributes[:user_id].present?
|
51
51
|
|
52
|
-
if attributes[:owner_id]
|
53
|
-
scope = scope.where(owner_id: attributes[:owner_id])
|
52
|
+
if attributes[:owner_id] && attributes[:owner_type]
|
53
|
+
scope = scope.where(owner_id: attributes[:owner_id], owner_type: attributes[:owner_type])
|
54
54
|
end
|
55
55
|
|
56
56
|
if attributes[:applicant_id]
|
@@ -12,8 +12,6 @@ module Admin
|
|
12
12
|
|
13
13
|
col :owner
|
14
14
|
|
15
|
-
col :number
|
16
|
-
|
17
15
|
col :categories, label: 'Category' do |history|
|
18
16
|
history.categories.map.with_index do |category, index|
|
19
17
|
category_id = history.category_ids[index]
|
@@ -23,6 +21,8 @@ module Admin
|
|
23
21
|
end.join.html_safe
|
24
22
|
end
|
25
23
|
|
24
|
+
col :number
|
25
|
+
|
26
26
|
col :category_ids, visible: false
|
27
27
|
|
28
28
|
col :bad_standing
|
@@ -35,7 +35,11 @@ module Admin
|
|
35
35
|
raise('expected an owner_id, not user_id') if attributes[:user_id].present?
|
36
36
|
|
37
37
|
scope = Effective::MembershipHistory.deep.all
|
38
|
-
|
38
|
+
|
39
|
+
if attributes[:owner_id] && attributes[:owner_type]
|
40
|
+
scope = scope.where(owner_id: attributes[:owner_id], owner_type: attributes[:owner_type])
|
41
|
+
end
|
42
|
+
|
39
43
|
scope
|
40
44
|
end
|
41
45
|
|
@@ -69,8 +69,8 @@ module Admin
|
|
69
69
|
|
70
70
|
raise('expected an owner_id, not user_id') if attributes[:user_id].present?
|
71
71
|
|
72
|
-
if attributes[:owner_id].present?
|
73
|
-
memberships = memberships.where(owner_id: attributes[:owner_id])
|
72
|
+
if attributes[:owner_id].present? && attributes[:owner_type].present?
|
73
|
+
memberships = memberships.where(owner_id: attributes[:owner_id], owner_type: attributes[:owner_type])
|
74
74
|
end
|
75
75
|
|
76
76
|
memberships
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Admin
|
2
|
+
class EffectiveOrganizationsDatatable < Effective::Datatable
|
3
|
+
datatable do
|
4
|
+
|
5
|
+
col :updated_at, visible: false
|
6
|
+
col :created_at, visible: false
|
7
|
+
|
8
|
+
col :id, visible: false
|
9
|
+
|
10
|
+
if categories.present?
|
11
|
+
col :category, search: categories
|
12
|
+
end
|
13
|
+
|
14
|
+
col :title
|
15
|
+
|
16
|
+
col :representatives_count
|
17
|
+
col :representatives
|
18
|
+
|
19
|
+
actions_col
|
20
|
+
end
|
21
|
+
|
22
|
+
collection do
|
23
|
+
EffectiveMemberships.Organization.deep.all
|
24
|
+
end
|
25
|
+
|
26
|
+
def categories
|
27
|
+
EffectiveMemberships.Organization.categories
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Admin
|
2
|
+
class EffectiveRepresentativesDatatable < Effective::Datatable
|
3
|
+
datatable do
|
4
|
+
col :id, visible: false
|
5
|
+
col :user_id, visible: false
|
6
|
+
|
7
|
+
col :organization
|
8
|
+
col :user
|
9
|
+
|
10
|
+
col :email do |representative|
|
11
|
+
mail_to(representative.user.email)
|
12
|
+
end
|
13
|
+
|
14
|
+
col :roles, search: roles_collection
|
15
|
+
|
16
|
+
actions_col
|
17
|
+
end
|
18
|
+
|
19
|
+
collection do
|
20
|
+
Effective::Representative.deep.all
|
21
|
+
end
|
22
|
+
|
23
|
+
def roles_collection
|
24
|
+
EffectiveRoles.roles_collection(Effective::Representative.new).map(&:second)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -6,7 +6,9 @@ class EffectiveFeePaymentsDatatable < Effective::Datatable
|
|
6
6
|
col :token, visible: false
|
7
7
|
col :created_at, visible: false
|
8
8
|
|
9
|
-
col :
|
9
|
+
col :user
|
10
|
+
col :organization
|
11
|
+
|
10
12
|
col :status, visible: false
|
11
13
|
col :submitted_at, label: 'Submitted', as: :date
|
12
14
|
col :period, visible: false
|
@@ -16,9 +18,8 @@ class EffectiveFeePaymentsDatatable < Effective::Datatable
|
|
16
18
|
actions_col(new: false)
|
17
19
|
end
|
18
20
|
|
19
|
-
collection do
|
20
|
-
EffectiveMemberships.FeePayment.deep.done
|
21
|
-
.where(owner: current_user.effective_memberships_owners)
|
21
|
+
collection(apply_belongs_to: false) do
|
22
|
+
scope = EffectiveMemberships.FeePayment.deep.done.for(current_user)
|
22
23
|
end
|
23
24
|
|
24
25
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Dashboard Organizations
|
2
|
+
class EffectiveOrganizationsDatatable < Effective::Datatable
|
3
|
+
datatable do
|
4
|
+
order :title
|
5
|
+
|
6
|
+
col :id, visible: false
|
7
|
+
|
8
|
+
col :title
|
9
|
+
col :representatives
|
10
|
+
|
11
|
+
actions_col
|
12
|
+
end
|
13
|
+
|
14
|
+
collection do
|
15
|
+
EffectiveMemberships.Organization.deep.where(id: current_user.organizations)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
class EffectiveRepresentativesDatatable < Effective::Datatable
|
2
|
+
datatable do
|
3
|
+
col :id, visible: false
|
4
|
+
|
5
|
+
col :organization
|
6
|
+
col :user
|
7
|
+
|
8
|
+
unless attributes[:user_id]
|
9
|
+
col :email do |representative|
|
10
|
+
mail_to(representative.user.email)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
col :roles, search: roles_collection
|
15
|
+
|
16
|
+
unless attributes[:actions] == false
|
17
|
+
actions_col
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
collection do
|
23
|
+
scope = Effective::Representative.deep.all.where(organization: current_user.organizations)
|
24
|
+
|
25
|
+
if attributes[:organization_id]
|
26
|
+
scope = scope.where(organization_id: attributes[:organization_id])
|
27
|
+
end
|
28
|
+
|
29
|
+
if attributes[:user_id]
|
30
|
+
scope = scope.where(user_id: attributes[:user_id])
|
31
|
+
end
|
32
|
+
|
33
|
+
scope
|
34
|
+
end
|
35
|
+
|
36
|
+
def roles_collection
|
37
|
+
EffectiveRoles.roles_collection(Effective::Representative.new).map(&:second)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -8,4 +8,29 @@ module EffectiveMembershipsHelper
|
|
8
8
|
end.compact
|
9
9
|
end
|
10
10
|
|
11
|
+
def effective_memberships_select_applicant_organization_collection(resource)
|
12
|
+
user = (resource.respond_to?(:user) ? resource.user : resource)
|
13
|
+
raise('expected an effective memberships user') unless user.class.try(:effective_memberships_user?)
|
14
|
+
|
15
|
+
representatives = user.representatives.select { |rep| rep.is?(:owner) || rep.is?(:billing) }
|
16
|
+
organizations = representatives.map { |rep| [rep.organization.to_s, rep.organization.id] }
|
17
|
+
|
18
|
+
organizations + [['New Organization...', 'new']]
|
19
|
+
end
|
20
|
+
|
21
|
+
# This is the select yourself or organization field on FeePayments#start
|
22
|
+
def effective_memberships_select_fee_payment_organization(resource)
|
23
|
+
user = (resource.respond_to?(:user) ? resource.user : resource)
|
24
|
+
raise('expected an effective memberships user') unless user.class.try(:effective_memberships_user?)
|
25
|
+
|
26
|
+
owners = user.memberships_owners.select { |owner| owner.outstanding_fee_payment_fees.present? }
|
27
|
+
|
28
|
+
owners.map do |owner|
|
29
|
+
[
|
30
|
+
owner.to_s,
|
31
|
+
(owner.to_param if owner.kind_of?(EffectiveMemberships.Organization)) # Nil when user
|
32
|
+
]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
11
36
|
end
|
@@ -11,7 +11,7 @@ module Effective
|
|
11
11
|
subject = subject_for(__method__, 'Applicant Completed', resource, opts)
|
12
12
|
headers = headers_for(resource, opts)
|
13
13
|
|
14
|
-
mail(to: resource.
|
14
|
+
mail(to: resource.user.email, subject: subject, **headers)
|
15
15
|
end
|
16
16
|
|
17
17
|
def applicant_missing_info(resource, opts = {})
|
@@ -21,7 +21,7 @@ module Effective
|
|
21
21
|
subject = subject_for(__method__, 'Applicant Missing Info', resource, opts)
|
22
22
|
headers = headers_for(resource, opts)
|
23
23
|
|
24
|
-
mail(to: resource.
|
24
|
+
mail(to: resource.user.email, subject: subject, **headers)
|
25
25
|
end
|
26
26
|
|
27
27
|
def applicant_approved(resource, opts = {})
|
@@ -31,7 +31,7 @@ module Effective
|
|
31
31
|
subject = subject_for(__method__, 'Applicant Approved', resource, opts)
|
32
32
|
headers = headers_for(resource, opts)
|
33
33
|
|
34
|
-
mail(to: resource.
|
34
|
+
mail(to: resource.user.email, subject: subject, **headers)
|
35
35
|
end
|
36
36
|
|
37
37
|
def applicant_declined(resource, opts = {})
|
@@ -41,7 +41,7 @@ module Effective
|
|
41
41
|
subject = subject_for(__method__, 'Applicant Declined', resource, opts)
|
42
42
|
headers = headers_for(resource, opts)
|
43
43
|
|
44
|
-
mail(to: resource.
|
44
|
+
mail(to: resource.user.email, subject: subject, **headers)
|
45
45
|
end
|
46
46
|
|
47
47
|
def applicant_reference_notification(resource, opts = {})
|
@@ -58,11 +58,11 @@ module Effective
|
|
58
58
|
|
59
59
|
def assigns_for(resource)
|
60
60
|
if resource.class.respond_to?(:effective_memberships_applicant?)
|
61
|
-
return applicant_assigns(resource).merge(
|
61
|
+
return applicant_assigns(resource).merge(owner_assigns(resource.owner))
|
62
62
|
end
|
63
63
|
|
64
64
|
if resource.kind_of?(Effective::ApplicantReference)
|
65
|
-
return reference_assigns(resource).merge(
|
65
|
+
return reference_assigns(resource).merge(owner_assigns(resource.applicant.owner))
|
66
66
|
end
|
67
67
|
|
68
68
|
raise('unexpected resource')
|
@@ -99,7 +99,7 @@ module Effective
|
|
99
99
|
{ reference: values }
|
100
100
|
end
|
101
101
|
|
102
|
-
def
|
102
|
+
def owner_assigns(owner)
|
103
103
|
raise('expected a owner') unless owner.class.respond_to?(:effective_memberships_owner?)
|
104
104
|
|
105
105
|
values = {
|