effective_memberships 0.3.13 → 0.4.1

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 (84) 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 +34 -15
  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 +5 -3
  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/registrar_action.rb +16 -1
  29. data/app/models/effective/representative.rb +56 -0
  30. data/app/views/admin/categories/_form_applicant_eligibility.html.haml +1 -1
  31. data/app/views/admin/categories/_form_applicant_steps.html.haml +29 -24
  32. data/app/views/admin/categories/_form_category.html.haml +3 -0
  33. data/app/views/admin/categories/_form_renewals.html.haml +0 -2
  34. data/app/views/admin/organizations/_fields.html.haml +6 -0
  35. data/app/views/admin/organizations/_form.html.haml +31 -0
  36. data/app/views/admin/organizations/_form_organization.html.haml +23 -0
  37. data/app/views/admin/registrar_actions/_form_fees_paid.html.haml +16 -0
  38. data/app/views/admin/representatives/_form.html.haml +38 -0
  39. data/app/views/{effective/applicants/_demographics_fields.html.haml → admin/representatives/_user_fields.html.haml} +2 -6
  40. data/app/views/effective/applicants/_dashboard.html.haml +24 -5
  41. data/app/views/effective/applicants/_demographics.html.haml +1 -1
  42. data/app/views/effective/applicants/_missing_info.html.haml +7 -3
  43. data/app/views/effective/applicants/_organization.html.haml +9 -0
  44. data/app/views/effective/applicants/_select_organization.html.haml +21 -0
  45. data/app/views/effective/applicants/_summary.html.haml +17 -9
  46. data/app/views/effective/applicants/billing.html.haml +2 -2
  47. data/app/views/effective/applicants/demographics.html.haml +7 -6
  48. data/app/views/effective/applicants/education.html.haml +2 -2
  49. data/app/views/effective/applicants/organization.html.haml +19 -0
  50. data/app/views/effective/applicants/references.html.haml +1 -1
  51. data/app/views/effective/applicants/select.html.haml +11 -1
  52. data/app/views/effective/applicants/stamp.html.haml +2 -2
  53. data/app/views/effective/applicants/start.html.haml +17 -11
  54. data/app/views/effective/applicants/submitted.html.haml +5 -5
  55. data/app/views/effective/applicants/summary.html.haml +1 -1
  56. data/app/views/effective/fee_payments/_demographics.html.haml +1 -1
  57. data/app/views/effective/fee_payments/_organization.html.haml +9 -0
  58. data/app/views/effective/fee_payments/_summary.html.haml +39 -1
  59. data/app/views/effective/fee_payments/billing.html.haml +2 -2
  60. data/app/views/effective/fee_payments/demographics.html.haml +2 -2
  61. data/app/views/effective/fee_payments/organization.html.haml +18 -0
  62. data/app/views/effective/fee_payments/start.html.haml +20 -17
  63. data/app/views/effective/fee_payments/submitted.html.haml +10 -3
  64. data/app/views/effective/fees/_dashboard.html.haml +20 -8
  65. data/app/views/effective/memberships/_dashboard.html.haml +16 -5
  66. data/app/views/effective/organizations/_dashboard.html.haml +10 -0
  67. data/app/views/effective/organizations/_form.html.haml +8 -0
  68. data/app/views/effective/organizations/_form_organization.html.haml +11 -0
  69. data/app/views/effective/representatives/_form.html.haml +33 -0
  70. data/app/views/effective/{fee_payments/_demographics_fields.html.haml → representatives/_user_fields.html.haml} +2 -6
  71. data/app/views/organizations/_demographics.html.haml +45 -0
  72. data/app/views/organizations/_fields_demographics.html.haml +29 -0
  73. data/app/views/users/_demographics.html.haml +50 -0
  74. data/app/views/users/_fields_demographics.html.haml +29 -0
  75. data/config/effective_memberships.rb +4 -0
  76. data/config/routes.rb +9 -0
  77. data/db/migrate/01_create_effective_memberships.rb.erb +57 -10
  78. data/db/seeds.rb +18 -0
  79. data/lib/effective_memberships/engine.rb +3 -0
  80. data/lib/effective_memberships/version.rb +1 -1
  81. data/lib/effective_memberships.rb +7 -3
  82. metadata +33 -20
  83. data/app/views/effective/applicants/_demographics_owner.html.haml +0 -20
  84. data/app/views/effective/fee_payments/_demographics_owner.html.haml +0 -20
@@ -0,0 +1,70 @@
1
+ # EffectiveMembershipsUser
2
+ #
3
+ # Mark your user model with effective_memberships_user to get all the includes
4
+
5
+ module EffectiveMembershipsUser
6
+ extend ActiveSupport::Concern
7
+
8
+ module Base
9
+ def effective_memberships_user
10
+ include ::EffectiveMembershipsUser
11
+ end
12
+ end
13
+
14
+ module ClassMethods
15
+ def effective_memberships_user?; true; end
16
+ end
17
+
18
+ included do
19
+ effective_memberships_owner
20
+
21
+ # App scoped
22
+ has_many :applicants, -> { order(:id) }, inverse_of: :user, as: :user
23
+ has_many :fee_payments, -> { order(:id) }, inverse_of: :user, as: :user
24
+
25
+ # Effective Scoped
26
+ has_many :representatives, -> { Effective::Representative.sorted },
27
+ class_name: 'Effective::Representative', inverse_of: :user, dependent: :delete_all
28
+
29
+ accepts_nested_attributes_for :representatives, allow_destroy: true
30
+ end
31
+
32
+ # Instance Methods
33
+ def memberships
34
+ Array(membership) + membership_organizations.map(&:membership)
35
+ end
36
+
37
+ def memberships_owners
38
+ Array(is?(:member) ? self : nil) + membership_organizations
39
+ end
40
+
41
+ def membership_present?
42
+ individual_membership_present? || organization_membership_present?
43
+ end
44
+
45
+ def individual_membership_present?
46
+ membership.present? && !membership.marked_for_destruction?
47
+ end
48
+
49
+ def organization_membership_present?(except: nil)
50
+ organizations.reject(&:archived?).any? { |organization| organization != except && organization.membership_present? }
51
+ end
52
+
53
+ def representative(organization:)
54
+ representatives.find { |rep| rep.organization_id == organization.id } if organization
55
+ end
56
+
57
+ # Find or build
58
+ def build_representative(organization:)
59
+ representative(organization: organization) || representatives.build(organization: organization)
60
+ end
61
+
62
+ def organizations
63
+ representatives.reject(&:marked_for_destruction?).map(&:organization)
64
+ end
65
+
66
+ def membership_organizations
67
+ organizations.select { |organization| organization.is?(:member) && !organization.archived? }
68
+ end
69
+
70
+ end
@@ -4,7 +4,7 @@ module Effective
4
4
 
5
5
  log_changes(to: :owner) if respond_to?(:log_changes)
6
6
 
7
- # Every fee is charged to a owner
7
+ # Every fee is charged to a owner: a user or an organization
8
8
  belongs_to :owner, polymorphic: true
9
9
 
10
10
  # This fee may belong to an application, fee payment, or other parent model
@@ -0,0 +1,8 @@
1
+ module Effective
2
+ class Organization < ActiveRecord::Base
3
+ self.table_name = EffectiveMemberships.organizations_table_name.to_s
4
+
5
+ effective_memberships_organization
6
+
7
+ end
8
+ end
@@ -20,6 +20,12 @@ module Effective
20
20
  # Assign
21
21
  attr_accessor :category_ids
22
22
 
23
+ # Mark Fees Paid - Order Attributes
24
+ attr_accessor :payment_provider
25
+ attr_accessor :payment_card
26
+ attr_accessor :note_to_buyer
27
+ attr_accessor :note_internal
28
+
23
29
  # All Action Validations
24
30
  validates :current_action, presence: true
25
31
  validates :current_user, presence: true
@@ -65,7 +71,7 @@ module Effective
65
71
 
66
72
  def fees_paid!
67
73
  update!(current_action: :fees_paid)
68
- EffectiveMemberships.Registrar.fees_paid!(owner)
74
+ EffectiveMemberships.Registrar.fees_paid!(owner, order_attributes: order_attributes)
69
75
  end
70
76
 
71
77
  def remove!
@@ -103,6 +109,15 @@ module Effective
103
109
  EffectiveMemberships.Category.where(id: @category_ids) if @category_ids
104
110
  end
105
111
 
112
+ def order_attributes
113
+ {
114
+ payment_provider: @payment_provider.presence,
115
+ payment_card: @payment_card.presence,
116
+ note_to_buyer: @note_to_buyer.presence,
117
+ note_internal: @note_internal.presence
118
+ }.compact
119
+ end
120
+
106
121
  def skip_fees?
107
122
  EffectiveResources.truthy?(@skip_fees)
108
123
  end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Effective
4
+ class Representative < ActiveRecord::Base
5
+ attr_accessor :new_representative_user_action
6
+
7
+ acts_as_role_restricted
8
+
9
+ log_changes(to: :organization) if respond_to?(:log_changes)
10
+
11
+ belongs_to :organization, polymorphic: true, counter_cache: true
12
+ belongs_to :user, polymorphic: true
13
+
14
+ accepts_nested_attributes_for :organization
15
+ accepts_nested_attributes_for :user
16
+
17
+ effective_resource do
18
+ roles_mask :integer
19
+
20
+ timestamps
21
+ end
22
+
23
+ scope :sorted, -> { order(:id) }
24
+ scope :deep, -> { includes(:user, :organization) }
25
+
26
+ before_validation(if: -> { user && user.new_record? }) do
27
+ user.password ||= SecureRandom.base64(12) + '!@#123abcABC-'
28
+ end
29
+
30
+ after_commit(on: [:create, :destroy], if: -> { user.class.respond_to?(:effective_memberships_owner?) }) do
31
+ user.representatives.reload
32
+ user.update_member_role!
33
+ end
34
+
35
+ validates :organization, presence: true
36
+ validates :user, presence: true
37
+
38
+ validates :user_id, if: -> { user_id && user_type && organization_id && organization_type },
39
+ uniqueness: { scope: [:organization_id, :organization_type], message: 'already belongs to this organization' }
40
+
41
+ def to_s
42
+ user.to_s
43
+ end
44
+
45
+ def build_user(attributes = {})
46
+ raise('please assign user_type first') if user_type.blank?
47
+ self.user = user_type.constantize.new(attributes)
48
+ end
49
+
50
+ def build_organization(attributes = {})
51
+ raise('please assign organization_type first') if organization_type.blank?
52
+ self.organization = organization_type.constantize.new(attributes)
53
+ end
54
+
55
+ end
56
+ end
@@ -2,7 +2,7 @@
2
2
  %h3 Eligibility
3
3
  %p Please configure who may apply for this membership category.
4
4
 
5
- = f.check_box :can_apply_new, label: 'Yes, new users may apply to join'
5
+ = f.check_box :can_apply_new, label: 'Yes, new applicants may apply to join'
6
6
  = f.check_box :can_apply_existing, label: 'Yes, existing members of any category may apply to join'
7
7
  = f.check_box :can_apply_restricted, label: 'Only existing members of the following categories may apply to join'
8
8
 
@@ -14,29 +14,34 @@
14
14
 
15
15
  %table.table.table-sm
16
16
  %tbody
17
- %tr
18
- %td= applicant.wizard_step_title(:education)
19
- %td= f.number_field :min_applicant_educations, label: false
20
- %td minimum number of degrees
21
-
22
- %tr
23
- %td= applicant.wizard_step_title(:course_amounts)
24
- %td= f.number_field :min_applicant_courses, label: false
25
- %td minimum number of courses
26
-
27
- %tr
28
- %td= applicant.wizard_step_title(:experience)
29
- %td= f.number_field :min_applicant_experiences_months, label: false
30
- %td minimimum months of work experience
31
-
32
- %tr
33
- %td= applicant.wizard_step_title(:references)
34
- %td= f.number_field :min_applicant_references, label: false
35
- %td minimimum number of references
36
-
37
- %tr
38
- %td= applicant.wizard_step_title(:files)
39
- %td= f.number_field :min_applicant_files, label: false
40
- %td minimimum number of attached files
17
+ - if applicant.wizard_step_keys.include?(:education)
18
+ %tr
19
+ %td= applicant.wizard_step_title(:education)
20
+ %td= f.number_field :min_applicant_educations, label: false
21
+ %td minimum number of degrees
22
+
23
+ - if applicant.wizard_step_keys.include?(:course_amounts)
24
+ %tr
25
+ %td= applicant.wizard_step_title(:course_amounts)
26
+ %td= f.number_field :min_applicant_courses, label: false
27
+ %td minimum number of courses
28
+
29
+ - if applicant.wizard_step_keys.include?(:experience)
30
+ %tr
31
+ %td= applicant.wizard_step_title(:experience)
32
+ %td= f.number_field :min_applicant_experiences_months, label: false
33
+ %td minimimum months of work experience
34
+
35
+ - if applicant.wizard_step_keys.include?(:references)
36
+ %tr
37
+ %td= applicant.wizard_step_title(:references)
38
+ %td= f.number_field :min_applicant_references, label: false
39
+ %td minimimum number of references
40
+
41
+ - if applicant.wizard_step_keys.include?(:files)
42
+ %tr
43
+ %td= applicant.wizard_step_title(:files)
44
+ %td= f.number_field :min_applicant_files, label: false
45
+ %td minimimum number of attached files
41
46
 
42
47
  = f.submit
@@ -1,6 +1,9 @@
1
1
  = effective_form_with(model: [:admin, category], engine: true) do |f|
2
2
  = f.text_field :title
3
3
 
4
+ = f.select :category_type, f.object.class.category_types,
5
+ hint: 'When Organization, the organization will be given membership. Otherwise the individual user'
6
+
4
7
  - if f.object.class.categories.present?
5
8
  = f.select :category, f.object.class.categories
6
9
 
@@ -1,6 +1,4 @@
1
1
  = effective_form_with(model: [:admin, category], engine: true) do |f|
2
- %h2 Renewals
3
-
4
2
  %h3 Renewal Fees
5
3
  = f.check_box :create_renewal_fees, label: 'Yes, renewal fees should be created'
6
4
 
@@ -0,0 +1,6 @@
1
+ - categories = EffectiveMemberships.Organization.categories
2
+
3
+ - if categories.present?
4
+ = f.select :category, categories, required: true
5
+
6
+ = f.text_field :title
@@ -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)
@@ -25,6 +25,22 @@
25
25
  = f.check_box :current_action, label: 'Yes, mark this members fees paid in full'
26
26
 
27
27
  = f.show_if :current_action, true do
28
+ - if fees.blank?
29
+ %p There are no outstanding fee payment fees, so no order will be created.
30
+ - else
31
+ %p An order will be created and marked as paid with the following information:
32
+
33
+ = f.select :payment_provider, EffectiveOrders.admin_payment_providers, required: true
34
+
35
+ = f.text_field :payment_card,
36
+ label: 'Payment card type, cheque or transaction number',
37
+ hint: 'Do not enter credit card numbers here, or anywhere.'
38
+
39
+ .row
40
+ .col
41
+ = f.text_area :note_to_buyer, hint: 'This message will be displayed to the buyer on the receipt.'
42
+ .col
43
+ = f.text_area :note_internal, hint: 'For or internal admin use only. This note will never be displayed to the buyer.'
28
44
 
29
45
  = f.submit 'Mark Fees Paid', border: false, center: true,
30
46
  'data-confirm': "Really mark #{f.object.owner} fees paid?"
@@ -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