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.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/admin/membership_histories_controller.rb +24 -0
  3. data/app/controllers/admin/memberships_controller.rb +15 -0
  4. data/app/controllers/admin/organizations_controller.rb +19 -0
  5. data/app/controllers/admin/representatives_controller.rb +19 -0
  6. data/app/controllers/effective/applicants_controller.rb +2 -3
  7. data/app/controllers/effective/fee_payments_controller.rb +1 -2
  8. data/app/controllers/effective/organizations_controller.rb +16 -0
  9. data/app/controllers/effective/representatives_controller.rb +19 -0
  10. data/app/datatables/admin/effective_applicant_references_datatable.rb +22 -20
  11. data/app/datatables/admin/effective_applicants_datatable.rb +10 -5
  12. data/app/datatables/admin/effective_categories_datatable.rb +7 -0
  13. data/app/datatables/admin/effective_fee_payments_datatable.rb +11 -6
  14. data/app/datatables/admin/effective_fees_datatable.rb +2 -2
  15. data/app/datatables/admin/effective_membership_histories_datatable.rb +7 -3
  16. data/app/datatables/admin/effective_memberships_datatable.rb +2 -2
  17. data/app/datatables/admin/effective_organizations_datatable.rb +31 -0
  18. data/app/datatables/admin/effective_representatives_datatable.rb +28 -0
  19. data/app/datatables/effective_applicants_datatable.rb +1 -1
  20. data/app/datatables/effective_fee_payments_datatable.rb +5 -4
  21. data/app/datatables/effective_organizations_datatable.rb +18 -0
  22. data/app/datatables/effective_representatives_datatable.rb +40 -0
  23. data/app/helpers/effective_memberships_helper.rb +25 -0
  24. data/app/mailers/effective/memberships_mailer.rb +7 -7
  25. data/app/models/concerns/effective_memberships_applicant.rb +63 -30
  26. data/app/models/concerns/effective_memberships_category.rb +32 -5
  27. data/app/models/concerns/effective_memberships_fee_payment.rb +44 -45
  28. data/app/models/concerns/effective_memberships_organization.rb +94 -0
  29. data/app/models/concerns/effective_memberships_owner.rb +44 -55
  30. data/app/models/concerns/effective_memberships_registrar.rb +5 -3
  31. data/app/models/concerns/effective_memberships_user.rb +70 -0
  32. data/app/models/effective/fee.rb +1 -1
  33. data/app/models/effective/membership.rb +24 -2
  34. data/app/models/effective/membership_history.rb +15 -0
  35. data/app/models/effective/organization.rb +8 -0
  36. data/app/models/effective/registrar_action.rb +16 -1
  37. data/app/models/effective/representative.rb +56 -0
  38. data/app/views/admin/categories/_form_applicant_eligibility.html.haml +1 -1
  39. data/app/views/admin/categories/_form_applicant_steps.html.haml +29 -24
  40. data/app/views/admin/categories/_form_category.html.haml +3 -0
  41. data/app/views/admin/categories/_form_renewals.html.haml +0 -2
  42. data/app/views/admin/membership_histories/_form.html.haml +19 -0
  43. data/app/views/admin/membership_histories/_validation.html.haml +7 -0
  44. data/app/views/admin/memberships/_form.html.haml +17 -0
  45. data/app/views/admin/memberships/_form_membership.html.haml +22 -0
  46. data/app/views/admin/organizations/_fields.html.haml +6 -0
  47. data/app/views/admin/organizations/_form.html.haml +31 -0
  48. data/app/views/admin/organizations/_form_organization.html.haml +23 -0
  49. data/app/views/admin/registrar_actions/_form_fees_paid.html.haml +16 -0
  50. data/app/views/admin/representatives/_form.html.haml +38 -0
  51. data/app/views/{effective/applicants/_demographics_fields.html.haml → admin/representatives/_user_fields.html.haml} +2 -6
  52. data/app/views/effective/applicants/_dashboard.html.haml +24 -5
  53. data/app/views/effective/applicants/_demographics.html.haml +1 -1
  54. data/app/views/effective/applicants/_missing_info.html.haml +7 -3
  55. data/app/views/effective/applicants/_organization.html.haml +9 -0
  56. data/app/views/effective/applicants/_select_organization.html.haml +21 -0
  57. data/app/views/effective/applicants/_summary.html.haml +17 -9
  58. data/app/views/effective/applicants/billing.html.haml +2 -2
  59. data/app/views/effective/applicants/demographics.html.haml +7 -6
  60. data/app/views/effective/applicants/education.html.haml +2 -2
  61. data/app/views/effective/applicants/organization.html.haml +19 -0
  62. data/app/views/effective/applicants/references.html.haml +1 -1
  63. data/app/views/effective/applicants/select.html.haml +11 -1
  64. data/app/views/effective/applicants/stamp.html.haml +2 -2
  65. data/app/views/effective/applicants/start.html.haml +17 -11
  66. data/app/views/effective/applicants/submitted.html.haml +5 -5
  67. data/app/views/effective/applicants/summary.html.haml +1 -1
  68. data/app/views/effective/fee_payments/_demographics.html.haml +1 -1
  69. data/app/views/effective/fee_payments/_organization.html.haml +9 -0
  70. data/app/views/effective/fee_payments/_summary.html.haml +39 -1
  71. data/app/views/effective/fee_payments/billing.html.haml +2 -2
  72. data/app/views/effective/fee_payments/demographics.html.haml +2 -2
  73. data/app/views/effective/fee_payments/organization.html.haml +18 -0
  74. data/app/views/effective/fee_payments/start.html.haml +20 -17
  75. data/app/views/effective/fee_payments/submitted.html.haml +10 -3
  76. data/app/views/effective/fees/_dashboard.html.haml +20 -8
  77. data/app/views/effective/memberships/_dashboard.html.haml +16 -5
  78. data/app/views/effective/organizations/_dashboard.html.haml +10 -0
  79. data/app/views/effective/organizations/_form.html.haml +8 -0
  80. data/app/views/effective/organizations/_form_organization.html.haml +11 -0
  81. data/app/views/effective/representatives/_form.html.haml +33 -0
  82. data/app/views/effective/{fee_payments/_demographics_fields.html.haml → representatives/_user_fields.html.haml} +2 -6
  83. data/app/views/organizations/_demographics.html.haml +45 -0
  84. data/app/views/organizations/_fields_demographics.html.haml +29 -0
  85. data/app/views/users/_demographics.html.haml +50 -0
  86. data/app/views/users/_fields_demographics.html.haml +29 -0
  87. data/config/effective_memberships.rb +3 -0
  88. data/config/routes.rb +11 -1
  89. data/db/migrate/01_create_effective_memberships.rb.erb +57 -10
  90. data/db/seeds.rb +18 -0
  91. data/lib/effective_memberships/engine.rb +3 -0
  92. data/lib/effective_memberships/version.rb +1 -1
  93. data/lib/effective_memberships.rb +6 -2
  94. metadata +38 -20
  95. data/app/views/effective/applicants/_demographics_owner.html.haml +0 -20
  96. data/app/views/effective/fee_payments/_demographics_owner.html.haml +0 -20
@@ -0,0 +1,21 @@
1
+ %p Please select an organization to continue.
2
+
3
+ = f.radios :organization_id, effective_memberships_select_applicant_organization_collection(f.object), label: false
4
+ = f.hidden_field :organization_type, value: EffectiveMemberships.Organization.name
5
+
6
+ = f.show_if(:organization_id, 'new') do
7
+ - organization = f.object.build_organization(email: f.object.user.email)
8
+
9
+ = f.fields_for :organization, organization do |fo|
10
+ = fo.hidden_field :email
11
+
12
+ = fo.text_field :title, label: 'New Organization Name', required: true, hint: 'Please enter the name of your organization'
13
+
14
+ = fo.fields_for :representatives, fo.object.build_representative(user: f.object.user) do |fr|
15
+ = fr.hidden_field :user_id
16
+ = fr.hidden_field :user_type
17
+
18
+ - owner = EffectiveRoles.roles.find { |role| role == :owner }
19
+ - raise('expected the EffectiveRoles :owner role to be present') unless owner
20
+
21
+ = fr.hidden_field :roles, value: [owner]
@@ -9,10 +9,18 @@
9
9
 
10
10
  - if request.path.start_with?('/admin')
11
11
  %tr
12
- %th= applicant.owner_label
12
+ %th User
13
13
  %td
14
- - url = (polymorphic_admin_path(applicant.owner) rescue "/admin/users/#{applicant.owner.to_param}/edit")
15
- = link_to(applicant.owner, url)
14
+ - url = (polymorphic_admin_path(applicant.user) rescue "/admin/users/#{applicant.user.to_param}/edit")
15
+ = link_to(applicant.user, url)
16
+
17
+ %tr
18
+ %th Organization
19
+ %td
20
+ - if applicant.organization.present?
21
+ = link_to(applicant.organization, effective_memberships.edit_admin_organization_path(applicant.organization))
22
+ - else
23
+ None
16
24
 
17
25
  - if applicant.from_category.present?
18
26
  %tr
@@ -21,17 +29,17 @@
21
29
 
22
30
  %tr
23
31
  %th Category
24
- %td
25
- = applicant.applicant_type
26
- %br
27
- = applicant.category
32
+ %td= [applicant.applicant_type, applicant.category].join(' - ')
28
33
 
29
34
  - if applicant.orders.present?
30
35
  %tr
31
- %th Orders
36
+ %th Order#{'s' if applicant.orders.length > 1}
32
37
  %td
33
38
  - applicant.orders.each do |order|
34
- = link_to(order, effective_orders.order_path(order))
39
+ - if request.path.start_with?('/admin')
40
+ = link_to(order, effective_orders.edit_admin_order_path(order))
41
+ - else
42
+ = link_to(order, effective_orders.order_path(order))
35
43
 
36
44
  %tr
37
45
  %th Status
@@ -8,7 +8,7 @@
8
8
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
9
9
  = f.hidden_field :id
10
10
 
11
- = f.fields_for(:owner, f.object.owner) do |fu|
12
- = effective_address_fields(fu, :billing)
11
+ = f.fields_for(f.object.owner_symbol, f.object.owner) do |fo|
12
+ = effective_address_fields(fo, :billing)
13
13
 
14
14
  = f.save 'Save and Continue'
@@ -1,11 +1,12 @@
1
1
  = render 'layout' do
2
-
3
2
  = render 'effective/applicants/content', resource: resource
4
3
 
5
- = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
6
- = f.hidden_field :id
4
+ .card
5
+ .card-body
6
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
7
+ = f.hidden_field :id
7
8
 
8
- = f.fields_for(:owner, f.object.owner) do |fu|
9
- = render 'effective/applicants/demographics_fields', f: fu
9
+ = f.fields_for(:user, f.object.user) do |fu|
10
+ = render 'users/fields_demographics', f: fu, user: f.object.user, parent: resource
10
11
 
11
- = f.save 'Save and Continue'
12
+ = f.save 'Save and Continue'
@@ -10,7 +10,7 @@
10
10
  = f.hidden_field :id
11
11
 
12
12
  = f.has_many(:applicant_educations, cards: true) do |aef|
13
- %h4 Post-Secondary Education
13
+ %h4.mb-4 Post-Secondary Education
14
14
 
15
15
  .row
16
16
  .col= aef.text_field :institution
@@ -20,7 +20,7 @@
20
20
  .col= aef.date_field :start_on, label: 'Start Date'
21
21
  .col= aef.date_field :end_on, label: 'End Date'
22
22
 
23
- = aef.text_field :degree_obtained, label: 'Degree or diploma obtained'
23
+ = aef.text_field :degree_obtained, label: 'Degree, diploma or program'
24
24
 
25
25
  /= f.text_area :applicant_educations_details, label: 'Additional Education Details'
26
26
 
@@ -0,0 +1,19 @@
1
+ = render 'layout' do
2
+
3
+ = render 'effective/applicants/content', resource: resource
4
+
5
+ .card
6
+ .card-body
7
+ - datatable = EffectiveResources.best('EffectiveRepresentativesDatatable').new(self, organization: resource.organization)
8
+
9
+ %h2 Representatives
10
+ = render_datatable(datatable, inline: true, simple: true)
11
+
12
+ %h2 Organization Info
13
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
14
+ = f.hidden_field :id
15
+
16
+ = f.fields_for(:organization, f.object.organization) do |fo|
17
+ = render 'organizations/fields_demographics', f: fo, organization: f.object.organization, parent: resource
18
+
19
+ = f.save 'Save and Continue'
@@ -4,7 +4,7 @@
4
4
  .card
5
5
  .card-body
6
6
  - if resource.min_applicant_references > 0
7
- .alert.alert-danger You must include #{resource.min_applicant_references} or more references.
7
+ %p You must include #{resource.min_applicant_references} or more references.
8
8
 
9
9
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
10
10
  = f.hidden_field :id
@@ -2,6 +2,7 @@
2
2
  = render 'effective/applicants/content', resource: resource
3
3
 
4
4
  - categories = resource.can_apply_categories_collection()
5
+ - organization_categories = categories.select(&:organization?)
5
6
 
6
7
  .card
7
8
  .card-body
@@ -16,12 +17,21 @@
16
17
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
17
18
  = f.hidden_field :id
18
19
 
20
+ = f.hidden_field :organization_id, value: nil
21
+ = f.hidden_field :organization_type, value: nil
22
+ = f.hidden_field :category_type, value: EffectiveMemberships.Category.name
23
+
19
24
  = f.select :category_id, categories, required: true
20
25
 
21
26
  - categories.each do |mc|
22
27
  = f.show_if(:category_id, mc.id) do
23
- .my-4
28
+ .mb-4
24
29
  %h3= mc.to_s
30
+ %small.text-muted #{mc.category} #{mc.category_type} Membership
25
31
  = mc.rich_text_body
26
32
 
33
+ - if organization_categories.present?
34
+ = f.show_if_any(:category_id, organization_categories.map(&:id)) do
35
+ = render('effective/applicants/select_organization', f: f)
36
+
27
37
  = f.save 'Save and Continue'
@@ -14,8 +14,8 @@
14
14
  = fs.hidden_field :applicant_id
15
15
  = fs.hidden_field :applicant_type
16
16
 
17
- = fs.hidden_field :owner_id
18
- = fs.hidden_field :owner_type
17
+ = fs.hidden_field :user_id
18
+ = fs.hidden_field :user_type
19
19
 
20
20
  = fs.hidden_field :price
21
21
  = fs.hidden_field :tax_exempt
@@ -3,16 +3,22 @@
3
3
 
4
4
  .card
5
5
  .card-body
6
- - fees = resource.owner.outstanding_fee_payment_fees
6
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
7
+ = f.hidden_field :id
8
+ = f.save 'Save and Continue'
7
9
 
8
- - if fees.present?
9
- %p You have #{pluralize(fees.length , 'outstanding fee')}.
10
- %p
11
- Please
12
- = link_to 'Make a fee payment', effective_memberships.new_fee_payment_path
13
- before continuing with any applications
10
+ -# .card
11
+ -# .card-body
12
+ -# - fees = resource.user.outstanding_fee_payment_fees
14
13
 
15
- - if fees.blank?
16
- = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
17
- = f.hidden_field :id
18
- = f.save 'Save and Continue'
14
+ -# - if fees.present?
15
+ -# %p You have #{pluralize(fees.length , 'outstanding fee')}.
16
+ -# %p
17
+ -# Please
18
+ -# = link_to 'Make a fee payment', effective_memberships.new_fee_payment_path
19
+ -# before continuing with any applications
20
+
21
+ -# - if fees.blank?
22
+ -# = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
23
+ -# = f.hidden_field :id
24
+ -# = f.save 'Save and Continue'
@@ -7,22 +7,22 @@
7
7
  .alert.alert-success.mb-4
8
8
  This application was submitted on #{resource.submitted_at.strftime('%F')}
9
9
 
10
+ - if resource.missing_info?
11
+ = card do
12
+ = render 'effective/applicants/missing_info', applicant: resource
13
+
10
14
  - unless resource.approved?
11
15
  .card
12
16
  .card-body
13
17
  %p
14
18
  Your application must still be approved.
15
19
  We will send
16
- %strong= resource.owner.email
20
+ %strong= resource.user.email
17
21
  an email notifying you of the application's approval status.
18
22
 
19
23
  .card
20
24
  .card-body= render 'effective/applicants/summary', applicant: resource
21
25
 
22
- - if resource.missing_info?
23
- = card do
24
- = render 'effective/applicants/missing_info', applicant: resource
25
-
26
26
  - if resource.min_applicant_references.to_i > 0 || resource.applicant_references.present?
27
27
  = card do
28
28
  %h3 Confidential References
@@ -9,6 +9,6 @@
9
9
  = f.submit(border: false, left: true) do
10
10
  -# Missing Info
11
11
  - if EffectiveResources.authorized?(self, :resubmit, resource)
12
- = f.save 'Submit Application'
12
+ = f.save 'Resubmit Application'
13
13
  - else
14
14
  = f.save 'Save and Continue'
@@ -6,4 +6,4 @@
6
6
  .col-sm-auto.text-right
7
7
  = link_to('Edit', wizard_path(:demographics)) if edit_effective_wizard?
8
8
 
9
- = render 'effective/fee_payments/demographics_owner', fee_payment: fee_payment, owner: fee_payment.owner
9
+ = render 'users/demographics', parent: fee_payment, user: fee_payment.user
@@ -0,0 +1,9 @@
1
+ .card
2
+ .card-body
3
+ .row
4
+ .col-sm
5
+ %h5.card-title= fee_payment.wizard_step_title(:organization)
6
+ .col-sm-auto.text-right
7
+ = link_to('Edit', wizard_path(:organization)) if edit_effective_wizard?
8
+
9
+ = render 'organizations/demographics', parent: fee_payment, organization: fee_payment.organization
@@ -1 +1,39 @@
1
- -# Intentionally blank
1
+ %table.table.table-sm
2
+ %tbody
3
+ %tr
4
+ %th.border-0 Fee Payment
5
+ %td.border-0
6
+ = fee_payment.owner.to_s
7
+ %br
8
+ = mail_to(fee_payment.owner.email)
9
+
10
+ %tr
11
+ %th Purchased By
12
+ %td= fee_payment.user.to_s
13
+
14
+ - if request.path.start_with?('/admin')
15
+ %tr
16
+ %th User
17
+ %td
18
+ - url = (polymorphic_admin_path(fee_payment.user) rescue "/admin/users/#{fee_payment.user.to_param}/edit")
19
+ = link_to(fee_payment.user, url)
20
+
21
+ - if fee_payment.organization.present?
22
+ %tr
23
+ %th Organization
24
+ %td
25
+ = link_to(fee_payment.organization, effective_memberships.edit_admin_organization_path(fee_payment.organization))
26
+
27
+ - if fee_payment.orders.present?
28
+ %tr
29
+ %th Order#{'s' if fee_payment.orders.length > 1}
30
+ %td
31
+ - fee_payment.orders.each do |order|
32
+ - if request.path.start_with?('/admin')
33
+ = link_to(order, effective_orders.edit_admin_order_path(order))
34
+ - else
35
+ = link_to(order, effective_orders.order_path(order))
36
+
37
+ %tr
38
+ %th Period
39
+ %td= fee_payment.period.strftime('%F')
@@ -8,7 +8,7 @@
8
8
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
9
9
  = f.hidden_field :id
10
10
 
11
- = f.fields_for(:owner, f.object.owner) do |fu|
12
- = effective_address_fields(fu, :billing)
11
+ = f.fields_for(f.object.owner_symbol, f.object.owner) do |fo|
12
+ = effective_address_fields(fo, :billing)
13
13
 
14
14
  = f.save 'Save and Continue'
@@ -6,7 +6,7 @@
6
6
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
7
7
  = f.hidden_field :id
8
8
 
9
- = f.fields_for(:owner, f.object.owner) do |fu|
10
- = render 'effective/fee_payments/demographics_fields', f: fu
9
+ = f.fields_for(:user, f.object.user) do |fu|
10
+ = render 'users/fields_demographics', f: fu, user: f.object.user, parent: resource
11
11
 
12
12
  = f.save 'Save and Continue'
@@ -0,0 +1,18 @@
1
+ = render 'layout' do
2
+ = render 'effective/fee_payments/content', resource: resource
3
+
4
+ .card
5
+ .card-body
6
+ - datatable = EffectiveResources.best('EffectiveRepresentativesDatatable').new(self, organization: resource.organization)
7
+
8
+ %h2 Representatives
9
+ = render_datatable(datatable, inline: true, simple: true)
10
+
11
+ %h2 Organization Info
12
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
13
+ = f.hidden_field :id
14
+
15
+ = f.fields_for(:organization, f.object.organization) do |fo|
16
+ = render 'organizations/fields_demographics', f: fo, organization: f.object.organization, parent: resource
17
+
18
+ = f.save 'Save and Continue'
@@ -1,34 +1,37 @@
1
1
  = render 'layout' do
2
+ = render 'effective/fee_payments/content', resource: resource
2
3
 
3
4
  .card
4
5
  .card-body
5
- - current_owner = current_user.current_fee_payment_owner
6
+ - outstanding_owners = current_user.memberships_owners.select { |owner| owner.outstanding_fee_payment_fees.present? }
6
7
 
7
- %p Welcome #{current_owner}!
8
-
9
- = render 'effective/fee_payments/content', resource: resource
10
-
11
- - if current_owner.membership_fees_paid?
8
+ - if outstanding_owners.blank?
12
9
  %p You have no fees due at this time.
13
10
  = link_to 'Home', root_path, class: 'btn btn-primary'
14
11
 
15
12
  - else
16
- - if resource.outstanding_fees.present?
17
- %p You have the following fees due at this time:
18
- = render_purchasables(resource.outstanding_fees)
19
- - else
20
- %p You have fees due. Please continue.
13
+ %p You have the following fees due at this time:
21
14
 
22
- - resource.user = current_user
23
- - resource.owner = current_owner
15
+ - outstanding_owners.each do |owner|
16
+ %h3= owner
17
+ = render_purchasables(owner.outstanding_fee_payment_fees)
24
18
 
25
19
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
26
20
  = f.hidden_field :id
27
-
28
- = f.hidden_field :owner_type
29
- = f.hidden_field :owner_id
30
-
31
21
  = f.hidden_field :user_type
32
22
  = f.hidden_field :user_id
33
23
 
24
+ - if outstanding_owners.length == 1
25
+ - resource.organization = outstanding_owners.first if outstanding_owners.first.kind_of?(EffectiveMemberships.Organization)
26
+
27
+ %p Continue with fee payment for #{resource.owner}.
28
+
29
+ = f.hidden_field :organization_id
30
+
31
+ - if outstanding_owners.length > 1
32
+ %p You have multiple memberships that require a fee payment. They must be purchased separately.
33
+ %p Please select an individual or organization to continue:
34
+
35
+ = f.select :organization_id, effective_memberships_select_fee_payment_organization(resource)
36
+
34
37
  = f.save 'Save and Continue'
@@ -9,8 +9,15 @@
9
9
 
10
10
  = link_to "Return to Dashboard", root_path, class: 'btn btn-lg btn-primary mb-4'
11
11
 
12
- = render 'effective/fee_payments/summary', fee_payment: resource
13
- = render 'effective/fee_payments/fee_payment', fee_payment: resource
14
- = render 'effective/fee_payments/orders', fee_payment: resource
12
+ .card
13
+ .card-body= render 'effective/fee_payments/summary', fee_payment: resource
14
+
15
+ .mb-4
16
+ = collapse('Show fee payment...', card_class: 'my-2') do
17
+ = render 'effective/fee_payments/fee_payment', fee_payment: resource
18
+
19
+ .mb-4
20
+ = collapse('Show orders...', card_class: 'my-2') do
21
+ = render 'effective/fee_payments/orders', fee_payment: resource
15
22
 
16
23
  = link_to "Return to Dashboard", root_path, class: 'btn btn-lg btn-primary'
@@ -1,20 +1,32 @@
1
1
  %h2 Fees
2
- - current_owner = current_user.effective_memberships_owner
3
2
 
4
- - fees = current_owner.outstanding_fee_payment_fees
5
- - membership = current_owner.membership
3
+ - memberships = current_user.memberships
4
+ - outstanding_owners = current_user.memberships_owners.select { |owner| owner.outstanding_fee_payment_fees.present? }
6
5
 
7
- - if membership.present?
8
- - if membership.category.create_renewal_fees?
6
+ - if memberships.present?
7
+ - if memberships.any? { |membership| membership.category.create_renewal_fees? }
9
8
  - date = EffectiveMemberships.Registrar.renewal_fee_date(date: Time.zone.now)
10
9
  %p Annual fees become available for purchase on #{date.strftime('%B %e')} of each year.
11
10
 
12
- - if membership.category.create_late_fees?
11
+ - if memberships.any? { |membership| membership.category.create_late_fees? }
13
12
  - date = EffectiveMemberships.Registrar.late_fee_date(date: Time.zone.now)
14
13
  %p Late fees will be applied on #{date.strftime('%B %e')}.
15
14
 
16
- - if fees.present?
17
- .alert.alert-warning.mb-3 You have #{pluralize(fees.length , 'outstanding fee')}.
15
+ - if memberships.any? { |membership| membership.category.create_bad_standing? }
16
+ - date = EffectiveMemberships.Registrar.bad_standing_date(date: Time.zone.now)
17
+ %p Memberships with unpaid fees will be marked in bad standing on #{date.strftime('%B %e')}.
18
+
19
+ - if outstanding_owners.present?
20
+ .alert.alert-warning.mb-3 You have outstanding fees ready to purchase.
21
+
22
+ %ul
23
+ - outstanding_owners.each do |owner|
24
+ %li
25
+ = owner
26
+
27
+ - if owner.outstanding_fee_payment_fees.present?
28
+ = '-'
29
+ = pluralize(owner.outstanding_fee_payment_fees.length, 'outstanding fee')
18
30
 
19
31
  %p= link_to 'Pay Fees', effective_memberships.new_fee_payment_path, class: 'btn btn-primary'
20
32
 
@@ -1,8 +1,9 @@
1
- - current_owner = current_user.effective_memberships_owner
2
- - membership = current_owner.membership
1
+ - membership = current_user.membership
2
+ - membership_organizations = current_user.membership_organizations
3
3
 
4
4
  %h2 Membership
5
5
 
6
+ -# Individual membership
6
7
  - if membership.present?
7
8
  - if membership.categories.length == 0
8
9
  %p
@@ -29,8 +30,18 @@
29
30
  - if membership.bad_standing?
30
31
  %p Your membership is in bad standing with the following reason: #{membership.bad_standing_reason}.
31
32
 
32
- - elsif current_owner.membership_removed?
33
- %p Your membership was removed on #{current_owner.membership_removed_on.strftime('%F')}.
33
+ - if current_user.membership_removed?
34
+ %p Your membership was removed on #{current_user.membership_removed_on.strftime('%F')}.
34
35
 
35
- - else
36
+ - if membership_organizations.present?
37
+ %p You are a representative for #{pluralize(membership_organizations.length, 'member organization')}.
38
+
39
+ %ul
40
+ - membership_organizations.each do |organization|
41
+ %li
42
+ = organization
43
+ = '-'
44
+ = organization.membership.categories.to_sentence
45
+
46
+ - if current_user.is?(:member) == false
36
47
  %p You are not a member.
@@ -0,0 +1,10 @@
1
+ %h2 Organizations
2
+
3
+ - if current_user.organizations.present?
4
+ %p You are a representative for #{pluralize(current_user.organizations.length, 'organization')}.
5
+
6
+ - datatable = EffectiveResources.best('EffectiveOrganizationsDatatable').new(self, namespace: :effective)
7
+ = render_datatable(datatable, simple: true)
8
+
9
+ - else
10
+ %p You are not a representative. When you create an organization, or if someone else adds you to their organization, we'll show them here.
@@ -0,0 +1,8 @@
1
+ = tabs do
2
+ = tab 'Organization' do
3
+ = render 'effective/organizations/form_organization', organization: organization
4
+
5
+ - if organization.persisted?
6
+ - if organization.respond_to?(:log_changes_datatable)
7
+ = tab 'Logs' do
8
+ = render_inline_datatable(organization.log_changes_datatable)
@@ -0,0 +1,11 @@
1
+ - url = (organization.persisted? ? effective_memberships.organization_path(organization) : effective_memberships.organizations_path)
2
+
3
+ = effective_form_with(model: organization, url: url) do |f|
4
+ %h2 Organization Info
5
+ = render 'organizations/fields_demographics', f: f, organization: organization
6
+ = f.submit
7
+
8
+ - if organization.persisted?
9
+ %h2 Representatives
10
+ - datatable = EffectiveRepresentativesDatatable.new(organization: organization)
11
+ = render_inline_datatable(datatable)
@@ -0,0 +1,33 @@
1
+ = effective_form_with(model: representative, engine: true) do |f|
2
+ - f.object.user_type ||= current_user.class.name
3
+
4
+ = f.hidden_field :user_id
5
+ = f.hidden_field :user_type
6
+ = f.hidden_field :organization_id
7
+ = f.hidden_field :organization_type
8
+
9
+ - if f.object.new_record?
10
+ - unless inline_datatable? && inline_datatable.attributes[:organization_id].present?
11
+ = f.select :organization, { 'Organizations' => EffectiveMemberships.Organization.sorted }, polymorphic: true
12
+
13
+ = f.checks :roles, EffectiveRoles.roles_collection(f.object, skip_disabled: true)
14
+
15
+ - unless inline_datatable? && inline_datatable.attributes[:user_id].present?
16
+ = f.hidden_field :new_representative_user_action, value: 'Invite new user'
17
+
18
+ = f.fields_for :user, (f.object.user || f.object.build_user) do |fu|
19
+ = render 'effective/representatives/user_fields', f: fu
20
+
21
+ - if f.object.persisted?
22
+ - unless inline_datatable? && inline_datatable.attributes[:organization_id].present?
23
+ = f.static_field :organization
24
+
25
+ - unless inline_datatable? && inline_datatable.attributes[:user_id].present?
26
+ = f.static_field :user
27
+
28
+ = f.checks :roles, EffectiveRoles.roles_collection(f.object, skip_disabled: true)
29
+
30
+ = f.fields_for :user, f.object.user do |fu|
31
+ = render 'effective/representatives/user_fields', f: fu
32
+
33
+ = f.submit
@@ -1,11 +1,7 @@
1
+ = f.email_field :email
2
+
1
3
  - if f.object.respond_to?(:first_name)
2
4
  = f.text_field :first_name
3
5
 
4
6
  - if f.object.respond_to?(:last_name)
5
7
  = f.text_field :last_name
6
-
7
- - if f.object.respond_to?(:date_of_birth)
8
- = f.date_field :date_of_birth
9
-
10
- - if f.object.respond_to?(:phone)
11
- = f.tel_field :phone
@@ -0,0 +1,45 @@
1
+ -# This is a placeholder file that should be overriden by the main application
2
+
3
+ %table.table.table-sm
4
+ %tbody
5
+ %tr
6
+ %th Name
7
+ %td= organization.to_s
8
+
9
+ %tr
10
+ %th Email
11
+ %td= mail_to organization.email
12
+
13
+ - if organization.respond_to?(:website)
14
+ %tr
15
+ %th Website:
16
+ %td= organization.website.presence || '-'
17
+
18
+ - if organization.respond_to?(:phone)
19
+ %tr
20
+ %th Phone:
21
+ %td= organization.phone.presence || '-'
22
+
23
+ - if organization.respond_to?(:company_phone)
24
+ %tr
25
+ %th Company Phone:
26
+ %td= organization.company_phone.presence || '-'
27
+
28
+ - if organization.respond_to?(:cell_phone)
29
+ %tr
30
+ %th Cell Phone:
31
+ %td= organization.cell_phone.presence || '-'
32
+
33
+ - if organization.respond_to?(:fax)
34
+ %tr
35
+ %th Fax:
36
+ %td= organization.fax.presence || '-'
37
+
38
+ - if organization.respond_to?(:billing_address)
39
+ %tr
40
+ %th Billing Address:
41
+ %td
42
+ - if organization.billing_address.present?
43
+ = organization.billing_address.to_html
44
+ - else
45
+ = '-'