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
@@ -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
+ = '-'
@@ -0,0 +1,29 @@
1
+ -# This is a placeholder file that should be overriden by the main application
2
+
3
+ - if f.object.respond_to?(:title)
4
+ = f.text_field :title
5
+
6
+ - if f.object.respond_to?(:name)
7
+ = f.text_field :name
8
+
9
+ - if f.object.respond_to?(:email)
10
+ = f.email_field :email
11
+
12
+ - if f.object.respond_to?(:website)
13
+ = f.url_field :website
14
+
15
+ - if f.object.respond_to?(:phone)
16
+ = f.tel_field :phone
17
+
18
+ - if f.object.respond_to?(:company_phone)
19
+ = f.tel_field :company_phone
20
+
21
+ - if f.object.respond_to?(:cell_phone)
22
+ = f.tel_field :cell_phone
23
+
24
+ - if f.object.respond_to?(:fax)
25
+ = f.tel_field :fax
26
+
27
+ - if f.object.respond_to?(:billing_address)
28
+ %h2 Billing Address
29
+ = effective_address_fields(f, :billing_address)
@@ -0,0 +1,50 @@
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= user.to_s
8
+
9
+ %tr
10
+ %th Email
11
+ %td= mail_to user.email
12
+
13
+ - if user.respond_to?(:job_title)
14
+ %tr
15
+ %th Job Title:
16
+ %td= user.job_title.presence || '-'
17
+
18
+ - if user.respond_to?(:date_of_birth)
19
+ %tr
20
+ %th Date of Birth
21
+ %td= user.date_of_birth&.strftime('%F').presence || '-'
22
+
23
+ - if user.respond_to?(:phone)
24
+ %tr
25
+ %th Phone:
26
+ %td= user.phone.presence || '-'
27
+
28
+ - if user.respond_to?(:home_phone)
29
+ %tr
30
+ %th Home Phone:
31
+ %td= user.home_phone.presence || '-'
32
+
33
+ - if user.respond_to?(:cell_phone)
34
+ %tr
35
+ %th Cell Phone:
36
+ %td= user.cell_phone.presence || '-'
37
+
38
+ - if user.respond_to?(:fax)
39
+ %tr
40
+ %th Fax:
41
+ %td= user.fax.presence || '-'
42
+
43
+ - if user.respond_to?(:billing_address)
44
+ %tr
45
+ %th Billing Address:
46
+ %td
47
+ - if user.billing_address.present?
48
+ = user.billing_address.to_html
49
+ - else
50
+ = '-'
@@ -0,0 +1,29 @@
1
+ -# This is a placeholder file that should be overriden by the main application
2
+
3
+ - if f.object.respond_to?(:first_name)
4
+ = f.text_field :first_name
5
+
6
+ - if f.object.respond_to?(:last_name)
7
+ = f.text_field :last_name
8
+
9
+ - if f.object.respond_to?(:job_title)
10
+ = f.text_field :job_title
11
+
12
+ - if f.object.respond_to?(:date_of_birth)
13
+ = f.date_field :date_of_birth
14
+
15
+ - if f.object.respond_to?(:phone)
16
+ = f.tel_field :phone
17
+
18
+ - if f.object.respond_to?(:home_phone)
19
+ = f.tel_field :home_phone
20
+
21
+ - if f.object.respond_to?(:cell_phone)
22
+ = f.tel_field :cell_phone
23
+
24
+ - if f.object.respond_to?(:fax)
25
+ = f.tel_field :fax
26
+
27
+ - if f.object.respond_to?(:billing_address)
28
+ %h2 Billing Address
29
+ = effective_address_fields(f, :billing_address)
@@ -3,6 +3,8 @@ EffectiveMemberships.setup do |config|
3
3
  config.applicants_table_name = :applicants
4
4
  config.applicant_reviews_table_name = :applicant_reviews
5
5
  config.fee_payments_table_name = :fee_payments
6
+ config.organizations_table_name = :organizations
7
+ config.representatives_table_name = :representatives
6
8
 
7
9
  # Layout Settings
8
10
  # Configure the Layout per controller, or all at once
@@ -16,6 +18,7 @@ EffectiveMemberships.setup do |config|
16
18
  # config.applicant_class_name = 'Effective::Applicant'
17
19
  # config.applicant_review_class_name = 'Effective::ApplicantReview'
18
20
  # config.registrar_class_name = 'Effective::Registrar'
21
+ # config.organization_class_name = 'Effective::Organization'
19
22
 
20
23
  # Fee Categories
21
24
  # The defaults include: Applicant, Prorated, Renewal, Late, Admin
@@ -39,6 +42,7 @@ EffectiveMemberships.setup do |config|
39
42
  # config.mailer_layout = nil # Default mailer layout
40
43
  # config.mailer_sender = nil # Default From value
41
44
  # config.mailer_admin = nil # Default To value for Admin correspondence
45
+ # config.mailer_subject = nil # Proc.new method used to customize Subject
42
46
 
43
47
  # Will work with effective_email_templates gem
44
48
  config.use_effective_email_templates = true
data/config/routes.rb CHANGED
@@ -25,6 +25,8 @@ EffectiveMemberships::Engine.routes.draw do
25
25
  get :membership_card, on: :member, to: 'membership_cards#show'
26
26
  end
27
27
 
28
+ resources :organizations, except: [:show, :destroy]
29
+ resources :representatives, except: [:show]
28
30
  end
29
31
 
30
32
  namespace :admin do
@@ -43,6 +45,13 @@ EffectiveMemberships::Engine.routes.draw do
43
45
  resources :fee_payments, only: [:index, :show]
44
46
  resources :memberships, only: [:index]
45
47
  resources :registrar_actions, only: [:create]
48
+
49
+ resources :organizations, except: [:show] do
50
+ post :archive, on: :member
51
+ post :unarchive, on: :member
52
+ end
53
+
54
+ resources :representatives, except: [:show]
46
55
  end
47
56
 
48
57
  end