effective_memberships 0.3.14 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/admin/organizations_controller.rb +19 -0
  3. data/app/controllers/admin/representatives_controller.rb +19 -0
  4. data/app/controllers/effective/applicants_controller.rb +2 -3
  5. data/app/controllers/effective/fee_payments_controller.rb +1 -2
  6. data/app/controllers/effective/organizations_controller.rb +16 -0
  7. data/app/controllers/effective/representatives_controller.rb +19 -0
  8. data/app/datatables/admin/effective_applicants_datatable.rb +10 -5
  9. data/app/datatables/admin/effective_categories_datatable.rb +7 -0
  10. data/app/datatables/admin/effective_fee_payments_datatable.rb +11 -6
  11. data/app/datatables/admin/effective_organizations_datatable.rb +31 -0
  12. data/app/datatables/admin/effective_representatives_datatable.rb +28 -0
  13. data/app/datatables/effective_applicants_datatable.rb +1 -1
  14. data/app/datatables/effective_fee_payments_datatable.rb +5 -4
  15. data/app/datatables/effective_organizations_datatable.rb +18 -0
  16. data/app/datatables/effective_representatives_datatable.rb +40 -0
  17. data/app/helpers/effective_memberships_helper.rb +25 -0
  18. data/app/mailers/effective/memberships_mailer.rb +7 -7
  19. data/app/models/concerns/effective_memberships_applicant.rb +63 -30
  20. data/app/models/concerns/effective_memberships_category.rb +32 -5
  21. data/app/models/concerns/effective_memberships_fee_payment.rb +44 -45
  22. data/app/models/concerns/effective_memberships_organization.rb +94 -0
  23. data/app/models/concerns/effective_memberships_owner.rb +0 -55
  24. data/app/models/concerns/effective_memberships_registrar.rb +2 -2
  25. data/app/models/concerns/effective_memberships_user.rb +70 -0
  26. data/app/models/effective/fee.rb +1 -1
  27. data/app/models/effective/organization.rb +8 -0
  28. data/app/models/effective/representative.rb +56 -0
  29. data/app/views/admin/categories/_form_applicant_eligibility.html.haml +1 -1
  30. data/app/views/admin/categories/_form_applicant_steps.html.haml +29 -24
  31. data/app/views/admin/categories/_form_category.html.haml +3 -0
  32. data/app/views/admin/categories/_form_renewals.html.haml +0 -2
  33. data/app/views/admin/organizations/_fields.html.haml +6 -0
  34. data/app/views/admin/organizations/_form.html.haml +31 -0
  35. data/app/views/admin/organizations/_form_organization.html.haml +23 -0
  36. data/app/views/admin/representatives/_form.html.haml +38 -0
  37. data/app/views/{effective/applicants/_demographics_fields.html.haml → admin/representatives/_user_fields.html.haml} +2 -6
  38. data/app/views/effective/applicants/_dashboard.html.haml +24 -5
  39. data/app/views/effective/applicants/_demographics.html.haml +1 -1
  40. data/app/views/effective/applicants/_missing_info.html.haml +7 -3
  41. data/app/views/effective/applicants/_organization.html.haml +9 -0
  42. data/app/views/effective/applicants/_select_organization.html.haml +21 -0
  43. data/app/views/effective/applicants/_summary.html.haml +17 -9
  44. data/app/views/effective/applicants/billing.html.haml +2 -2
  45. data/app/views/effective/applicants/demographics.html.haml +7 -6
  46. data/app/views/effective/applicants/education.html.haml +2 -2
  47. data/app/views/effective/applicants/organization.html.haml +19 -0
  48. data/app/views/effective/applicants/references.html.haml +1 -1
  49. data/app/views/effective/applicants/select.html.haml +11 -1
  50. data/app/views/effective/applicants/stamp.html.haml +2 -2
  51. data/app/views/effective/applicants/start.html.haml +17 -11
  52. data/app/views/effective/applicants/submitted.html.haml +5 -5
  53. data/app/views/effective/applicants/summary.html.haml +1 -1
  54. data/app/views/effective/fee_payments/_demographics.html.haml +1 -1
  55. data/app/views/effective/fee_payments/_organization.html.haml +9 -0
  56. data/app/views/effective/fee_payments/_summary.html.haml +39 -1
  57. data/app/views/effective/fee_payments/billing.html.haml +2 -2
  58. data/app/views/effective/fee_payments/demographics.html.haml +2 -2
  59. data/app/views/effective/fee_payments/organization.html.haml +18 -0
  60. data/app/views/effective/fee_payments/start.html.haml +20 -17
  61. data/app/views/effective/fee_payments/submitted.html.haml +10 -3
  62. data/app/views/effective/fees/_dashboard.html.haml +20 -8
  63. data/app/views/effective/memberships/_dashboard.html.haml +16 -5
  64. data/app/views/effective/organizations/_dashboard.html.haml +10 -0
  65. data/app/views/effective/organizations/_form.html.haml +8 -0
  66. data/app/views/effective/organizations/_form_organization.html.haml +11 -0
  67. data/app/views/effective/representatives/_form.html.haml +33 -0
  68. data/app/views/effective/{fee_payments/_demographics_fields.html.haml → representatives/_user_fields.html.haml} +2 -6
  69. data/app/views/organizations/_demographics.html.haml +45 -0
  70. data/app/views/organizations/_fields_demographics.html.haml +29 -0
  71. data/app/views/users/_demographics.html.haml +50 -0
  72. data/app/views/users/_fields_demographics.html.haml +29 -0
  73. data/config/effective_memberships.rb +3 -0
  74. data/config/routes.rb +9 -0
  75. data/db/migrate/01_create_effective_memberships.rb.erb +57 -10
  76. data/db/seeds.rb +18 -0
  77. data/lib/effective_memberships/engine.rb +3 -0
  78. data/lib/effective_memberships/version.rb +1 -1
  79. data/lib/effective_memberships.rb +6 -2
  80. metadata +33 -20
  81. data/app/views/effective/applicants/_demographics_owner.html.haml +0 -20
  82. data/app/views/effective/fee_payments/_demographics_owner.html.haml +0 -20
@@ -0,0 +1,31 @@
1
+ = tabs do
2
+ = tab 'Company Info' do
3
+ = render 'admin/organizations/form_organization', organization: organization
4
+
5
+ - if organization.persisted?
6
+ - if can?(:index, Effective::Membership)
7
+ = tab 'Membership' do
8
+ = render 'admin/registrar_actions/form', owner: organization
9
+
10
+ = tab 'Representatives' do
11
+ = render_datatable(Admin::EffectiveRepresentativesDatatable.new(organization: organization), inline: true, namespace: :admin)
12
+
13
+ - if can?(:index, Effective::Fee)
14
+ = tab 'Fees' do
15
+ = render_inline_datatable(Admin::EffectiveFeesDatatable.new(owner: organization))
16
+
17
+ - if can?(:index, EffectiveMemberships.FeePayment)
18
+ = tab 'Fee Payments' do
19
+ = render_inline_datatable(Admin::EffectiveFeePaymentsDatatable.new(organization: organization))
20
+
21
+ - if can?(:index, Effective::MembershipHistory)
22
+ = tab 'History' do
23
+ = render_datatable(Admin::EffectiveMembershipHistoriesDatatable.new(owner: organization))
24
+
25
+ - if can?(:index, Effective::Order)
26
+ = tab 'Orders' do
27
+ = render_datatable(Admin::EffectiveOrdersDatatable.new(user: organization))
28
+
29
+ - if can?(:index, Effective::Log)
30
+ = tab 'Logs' do
31
+ = render_datatable(organization.log_changes_datatable, inline: true, namespace: :admin)
@@ -0,0 +1,23 @@
1
+ = effective_form_with(model: [:admin, organization], engine: true) do |f|
2
+ .row
3
+ .col-sm-6
4
+ %h2 Demographics
5
+ = render 'admin/organizations/fields', f: f
6
+
7
+ %h2 Billing Address
8
+ = effective_address_fields(f, :billing)
9
+
10
+ .col-sm-6
11
+ %h2 Membership
12
+ = render 'admin/memberships/status', owner: f.object
13
+
14
+ - f.object.users.each do |user|
15
+ %p
16
+ = link_to(user, "/admin/users/#{user.to_param}/edit")
17
+ - if user.try(:archived?)
18
+ %span.badge.badge-warning Archived
19
+
20
+ %h2 Admin Only
21
+ %p No additional fields
22
+
23
+ = effective_submit(f)
@@ -0,0 +1,38 @@
1
+ = effective_form_with(model: [:admin, 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.radios :new_representative_user_action, ['Invite new user', 'Add existing user'], inline: true, label: 'Representative'
17
+
18
+ = f.show_if :new_representative_user_action, 'Add existing user' do
19
+ = f.select :user, {'Users' => current_user.class.sorted }, polymorphic: true
20
+
21
+ = f.show_if :new_representative_user_action, 'Invite new user' do
22
+ = f.fields_for :user, (f.object.user || f.object.build_user) do |fu|
23
+ = render 'admin/representatives/user_fields', f: fu
24
+
25
+ - if f.object.persisted?
26
+ - unless inline_datatable? && inline_datatable.attributes[:organization_id].present?
27
+ = f.static_field :organization
28
+
29
+ - unless inline_datatable? && inline_datatable.attributes[:user_id].present?
30
+ = f.static_field :user
31
+
32
+ = f.checks :roles, EffectiveRoles.roles_collection(f.object, skip_disabled: true)
33
+
34
+ - unless inline_datatable? && inline_datatable.attributes[:user_id].present?
35
+ = f.fields_for :user, f.object.user do |fu|
36
+ = render 'admin/representatives/user_fields', f: fu
37
+
38
+ = 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
@@ -1,12 +1,31 @@
1
1
  - authorized = EffectiveResources.authorized?(self, :new, EffectiveMemberships.Applicant)
2
2
  - datatable = EffectiveResources.best('EffectiveApplicantsDatatable').new(self)
3
- - in_progress = current_user.effective_memberships_owner.applicants.in_progress
4
3
 
5
- - if in_progress.present?
4
+ - # In progress
5
+ - applicant = current_user.applicants.in_progress.first
6
+
7
+ - if applicant.present? && applicant.draft?
8
+ %h2 In-Progress Application
9
+
10
+ %p
11
+ Your submission is incomplete.
12
+
13
+ %p
14
+ Please
15
+ = link_to("Continue application", effective_memberships.applicant_build_path(applicant, applicant.next_step), 'data-turbolinks' => false, class: 'btn btn-primary')
16
+ or you can
17
+ = link_to('Abandon application', effective_memberships.applicant_path(applicant), 'data-confirm': "Really delete #{applicant}?", 'data-method': :delete, class: 'btn btn-danger')
18
+ to apply again.
19
+
20
+ %hr
21
+
22
+ - elsif applicant.present?
6
23
  %h2 Active Applications
7
24
 
8
- - in_progress.each do |applicant|
9
- = render 'effective/applicants/summary', applicant: applicant
25
+ = render 'effective/applicants/summary', applicant: applicant
26
+ = link_to("View application", effective_memberships.applicant_build_path(applicant, applicant.next_step), 'data-turbolinks' => false, class: 'btn btn-primary')
27
+
28
+ %hr
10
29
 
11
30
  %h2 Application History
12
31
 
@@ -15,5 +34,5 @@
15
34
  - else
16
35
  %p You have not yet created any applications. When you do, we'll show them here.
17
36
 
18
- - if authorized && in_progress.blank?
37
+ - if authorized && applicant.blank?
19
38
  %p= link_to 'Apply to join, reclassify, or provide a change of status notification', effective_memberships.new_applicant_path, class: 'btn btn-primary'
@@ -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/applicants/demographics_owner', applicant: applicant, owner: applicant.owner
9
+ = render 'users/demographics', parent: applicant, user: applicant.user
@@ -1,9 +1,11 @@
1
1
  %h3 Missing Information
2
- %p The following information is missing: #{resource.missing_info_reason}.
2
+ %p The following information is missing:
3
+ %ul
4
+ %li= resource.missing_info_reason
3
5
 
4
6
  %p
5
7
  Please revisit each wizard step and
6
- = link_to 'complete all missing information', wizard_path(:demographics)
8
+ = link_to 'Complete all missing information', wizard_path(:demographics), class: 'btn btn-primary'
7
9
  for this application.
8
10
 
9
11
  %p
@@ -12,7 +14,9 @@
12
14
  %p
13
15
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
14
16
  = f.hidden_field :id
15
- = f.save 'Submit Application', 'data-confirm': "Really submit application?"
17
+
18
+ - # If you change this label, update EffectiveMemberships ApplicantsController
19
+ = f.save 'Resubmit Application', 'data-confirm': "Really re-submit application?", class: 'btn-sm'
16
20
 
17
21
  %p
18
22
  %small * No additional payment required.
@@ -0,0 +1,9 @@
1
+ .card
2
+ .card-body
3
+ .row
4
+ .col-sm
5
+ %h5.card-title= applicant.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: applicant, organization: applicant.organization
@@ -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'