effective_memberships 0.9.3 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f57ff3c095107ed08c1fb5d61bdb0a942199a18401a35f5a4eb58628ada269e3
4
- data.tar.gz: c73dd52a349cc82ef354d022fe896d4b6ede70e8e0f049f4b37027e4042a9c71
3
+ metadata.gz: bea643081128f664a7c004dbc49a3e8e06f940781267f85f63c7c6d4e69fe6d1
4
+ data.tar.gz: a769c9c7216ccdc090fc8a3e6107d654e49eeca2b20a171c48769b46d27a0cb0
5
5
  SHA512:
6
- metadata.gz: 976725ff16f1b3cf32613f0a5ac941e28fdb26ba417dd70e1d4f11518ac76417de00a769839c65d849ea746f8bbddf5ff95e381ede4c5b03a978f4af0eb28033
7
- data.tar.gz: de46c665dbe1985743eeddafd51e9b56b67bd06bd301140111c238953e903f0abf69ee50e52a4cd409be9d28a77e5adb923096930b481fd301be119fc1d41185
6
+ metadata.gz: 4553d6b65132b346f36882658baac0ae47ec8945f2f592c19fac705b2e5414d1f4597e5473d2209cdb6a6c0528768a4aa65fe75b59b9712f14ffccdc6c5203ca
7
+ data.tar.gz: f6c02642c63397a2484fb0d9cd4b3fd471767b9c1b8449528e720ac2f73946a86520094ba39bd0b7056df0544e230a0f1a3bd60ddeb64ba689431664d9c3938b
@@ -21,6 +21,13 @@ module Admin
21
21
 
22
22
  col :fee_type, search: EffectiveMemberships.fee_types
23
23
 
24
+ col :period, search: { collection: EffectiveMemberships.Registrar.periods_collection } do |fee|
25
+ EffectiveMemberships.Registrar.period_end_on(date: fee.period)
26
+ end
27
+
28
+ col :category, search: { collection: EffectiveMemberships.Category.all, polymorphic: false }
29
+ col :title
30
+
24
31
  col :price, as: :price
25
32
  col :qb_item_name, label: 'Quickbooks Item Name'
26
33
  col :tax_exempt, visible: false
@@ -31,9 +38,8 @@ module Admin
31
38
  col :parent, search: :string, visible: false
32
39
  end
33
40
 
34
- col :purchased_order, visible: false
41
+ col :purchased_order
35
42
 
36
- col :category, search: { collection: EffectiveMemberships.Category.all, polymorphic: false }
37
43
  col :checkout_type, search: Effective::Fee::CHECKOUT_TYPES, visible: false
38
44
 
39
45
  unless attributes[:total] == false
@@ -6,15 +6,21 @@ class EffectiveApplicantReviewsDatatable < Effective::Datatable
6
6
  col :created_at, visible: false
7
7
  col :id, visible: false
8
8
 
9
- col :applicant
9
+ val :applicant, search: :string
10
10
  col :reviewer, visible: false
11
11
 
12
12
  col :submitted_at, label: 'Reviewed', as: :date
13
+
14
+ col :reviews do |applicant_review|
15
+ pluralize(applicant_review.applicant.applicant_reviews.count { |review| review.submitted? }, 'review')
16
+ end
17
+
13
18
  col :recommendation
14
19
  col :comments
15
20
 
16
21
  actions_col(show: false) do |applicant_review|
17
22
  dropdown_link_to('Show', effective_memberships.applicant_applicant_review_path(applicant_review.applicant, applicant_review))
23
+ dropdown_link_to('Review Again', effective_memberships.new_applicant_applicant_review_path(applicant_review.applicant))
18
24
  end
19
25
  end
20
26
 
@@ -7,15 +7,18 @@ class EffectiveAvailableApplicantReviewsDatatable < Effective::Datatable
7
7
 
8
8
  col :created_at, label: 'Created', as: :date, visible: false
9
9
  col :updated_at, label: 'Updated', as: :date, visible: false
10
- col :submitted_at, label: 'Submitted', as: :date, visible: false
11
10
 
12
11
  # This is when they become available for review
13
- col :completed_at, label: 'Date', as: :date
12
+ col :submitted_at, label: 'Submitted', as: :date
14
13
 
15
14
  col :user
16
15
  col :category, label: 'Category'
17
16
  col :to_status, label: 'Status'
18
17
 
18
+ col :reviews do |applicant|
19
+ pluralize(applicant.applicant_reviews.count { |review| review.submitted? }, 'review')
20
+ end
21
+
19
22
  actions_col(show: false) do |applicant|
20
23
  applicant_review = applicant.applicant_review(reviewer: current_user)
21
24
 
@@ -187,7 +187,7 @@ module EffectiveMembershipsApplicant
187
187
 
188
188
  scope :not_draft, -> { where.not(status: :draft) }
189
189
 
190
- scope :reviewable, -> { where(status: :completed) }
190
+ scope :reviewable, -> { where.not(status: [:draft, :declined, :approved]) }
191
191
 
192
192
  scope :for, -> (user) {
193
193
  raise('expected a effective memberships user') unless user.class.try(:effective_memberships_user?)
@@ -623,6 +623,7 @@ module EffectiveMembershipsApplicant
623
623
  category_ids = user.membership.category_ids
624
624
 
625
625
  categories.select do |cat|
626
+ cat.can_apply_new? ||
626
627
  cat.can_apply_existing? ||
627
628
  (cat.can_apply_restricted? && (category_ids & cat.can_apply_restricted_ids).present?)
628
629
  end
@@ -59,7 +59,7 @@ module EffectiveMembershipsApplicantReview
59
59
  timestamps
60
60
  end
61
61
 
62
- scope :deep, -> { includes(:reviewer, applicant: :user) }
62
+ scope :deep, -> { includes(:reviewer, applicant: [:user, :applicant_reviews]) }
63
63
 
64
64
  scope :for, -> (user) {
65
65
  raise('expected a effective memberships user') unless user.class.try(:effective_memberships_user?)
@@ -375,6 +375,11 @@ module EffectiveMembershipsRegistrar
375
375
  retval
376
376
  end
377
377
 
378
+ def periods_collection(from: nil, to: nil)
379
+ from ||= Time.zone.now - 10.years
380
+ periods(from: from, to: to).reverse.map { |period| [period_end_on(date: period), period] }
381
+ end
382
+
378
383
  # This is intended to be run once per day in a rake task
379
384
  # rake effective_memberships:create_fees
380
385
  # Create Renewal and Late fees
@@ -44,9 +44,13 @@ module Effective
44
44
  self.with_status ||= owner.membership.statuses.first if owner.membership.statuses.length == 1
45
45
  end
46
46
 
47
+ before_validation(if: -> { changes['title'].blank? && (changes.keys & ['period', 'category_id', 'fee_type']).present? }) do
48
+ self.title = default_title()
49
+ end
50
+
47
51
  before_validation do
48
52
  self.period ||= EffectiveMemberships.Registrar.current_period
49
- self.title ||= default_title()
53
+ self.title = default_title() if self.title.blank?
50
54
  end
51
55
 
52
56
  before_validation(if: -> { fee_type == 'Renewal' && category.present? && period.present? }) do
@@ -6,45 +6,38 @@
6
6
  - collection = { 'Users' => current_user.class.sorted, 'Organizations' => EffectiveMemberships.Organization.sorted }
7
7
  = f.select :owner, collection, polymorphic: true
8
8
 
9
+ - registrar = EffectiveMemberships.Registrar
9
10
  - fee_types = EffectiveMemberships.fee_types
10
11
  - membership_period_fee_types = fee_types.select { |fee_type| Effective::Fee.new(fee_type: fee_type).membership_period_fee? }
11
12
 
12
- - if f.object.new_record?
13
- = f.select :fee_type, fee_types
14
- - else
15
- = f.static_field :fee_type
16
-
17
- = f.show_if_any(:fee_type, membership_period_fee_types) do
18
- = card do
19
- %p This is a membership period fee. It will advance the membership fees paid through period when purchased.
20
- %p Only one membership period fee -- Prorated or Renewal -- is expected to exist per membership period.
21
-
22
- - registrar = EffectiveMemberships.Registrar
23
- - periods = registrar.periods(from: Time.zone.now - 10.years)
24
- - collection = periods.reverse.map { |period| [registrar.period_end_on(date: period), period] }
13
+ - f.object.period ||= registrar.current_period
14
+ - f.object.checkout_type ||= 'Default'
25
15
 
26
- - f.object.period ||= registrar.current_period
27
- = f.select :period, collection, label: 'Membership period', hint: 'When purchased, set the membership fees paid through period to this period'
16
+ - f.object.category_id ||= f.object.owner&.membership&.categories&.first&.id
17
+ - f.object.category ||= f.object.owner&.membership&.categories&.first
28
18
 
29
- - # Renewal Fees Only
30
- - if f.object.persisted? && f.object.renewal_fee?
31
- - if f.object.category.create_late_fees?
32
- = f.date_field :late_on, hint: 'A late fee will be applied on this date unless purchased'
19
+ = f.select :period, registrar.periods_collection, label: 'Membership period'
20
+ = f.select :fee_type, fee_types
21
+ = f.select :category_id, EffectiveMemberships.Category.all
33
22
 
34
- - if f.object.category.create_not_in_good_standing?
35
- = f.date_field :not_in_good_standing_on, hint: 'The membership will be marked NIGS on this date unless purchased'
23
+ = f.show_if_any(:fee_type, membership_period_fee_types) do
24
+ %p.text-muted
25
+ This is a membership period fee. It will advance the membership fees paid through period when purchased.
26
+ %br
27
+ Only one membership period fee -- Prorated or Renewal -- is expected to exist per membership period.
36
28
 
37
- - f.object.category_id = f.object.owner&.membership&.categories&.first&.id
38
- = f.select :category_id, EffectiveMemberships.Category.all
29
+ - if f.object.category.present?
30
+ = f.show_if(:fee_type, 'Renewal') do
31
+ - if f.object.category.create_late_fees?
32
+ = f.date_field :late_on, hint: 'A late fee will be applied on this date unless purchased. Leave blank to assign the default.'
39
33
 
40
- - if f.object.parent.blank?
41
- - f.object.checkout_type ||= 'Default'
34
+ - if f.object.category.create_not_in_good_standing?
35
+ = f.date_field :not_in_good_standing_on, hint: 'The membership will be marked NIGS on this date unless purchased. Leave blank to assign the default.'
42
36
 
43
- = f.radios :checkout_type, Effective::Fee::CHECKOUT_TYPES, inline: true, label: 'Checkout wizard',
44
- hint: 'When default, Applicant and Reinstatement fees will be charged from the applicant wizard, and all other fee types from the fee payment wizard'
45
- - else
46
- = f.static_field :parent
37
+ = f.radios :checkout_type, Effective::Fee::CHECKOUT_TYPES, inline: true, label: 'Checkout wizard',
38
+ hint: 'When default, Applicant and Reinstatement fees will be charged from the applicant wizard, and all other fee types from the fee payment wizard'
47
39
 
40
+ = f.text_field :title, hint: 'Leave blank to assign the default', required: false
48
41
  = f.price_field :price
49
42
  = f.text_field :qb_item_name, label: 'Quickbooks Item Name'
50
43
  = f.check_box :tax_exempt, label: 'Yes, this fee is tax exempt'
@@ -26,11 +26,11 @@
26
26
  - if available.present?
27
27
  %p The following applicants are available for your review:
28
28
 
29
- = render_simple_datatable(available)
29
+ = render_datatable(available, simple: true)
30
30
  - else
31
31
  %p There are no applicants available for your review. When there are, we'll show them here.
32
32
 
33
33
  - if datatable.present?
34
34
  .mt-4
35
35
  %h2 Review History
36
- = render_datatable(datatable, simple: true)
36
+ = render_datatable(datatable)
@@ -0,0 +1,7 @@
1
+ - other_reviews = applicant_review.applicant.applicant_reviews.select { |review| review != applicant_review }
2
+
3
+ - if other_reviews.present?
4
+ .mb-4
5
+ = collapse('Show other reviews') do
6
+ - other_reviews.each do |applicant_review|
7
+ = render('effective/applicant_reviews/applicant_review', applicant_review: applicant_review)
@@ -8,6 +8,8 @@
8
8
  = collapse('Show application...', card_class: 'my-2') do
9
9
  = render 'effective/applicants/applicant', applicant: resource.applicant
10
10
 
11
+ = render 'effective/applicant_reviews/other_reviews', applicant_review: resource
12
+
11
13
  = card('Recommendation') do
12
14
 
13
15
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
@@ -5,6 +5,8 @@
5
5
  = render 'effective/applicants/summary', applicant: resource.applicant
6
6
  = render 'effective/applicants/applicant', applicant: resource.applicant
7
7
 
8
+ = render 'effective/applicant_reviews/other_reviews', applicant_review: resource
9
+
8
10
  = card do
9
11
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
10
12
  = f.hidden_field :id
@@ -10,6 +10,8 @@
10
10
  = collapse('Show application...', card_class: 'my-2') do
11
11
  = render 'effective/applicants/applicant', applicant: resource.applicant
12
12
 
13
+ = render 'effective/applicant_reviews/other_reviews', applicant_review: resource
14
+
13
15
  = render 'effective/applicant_reviews/applicant_review', applicant_review: resource
14
16
 
15
- = link_to "Return to Dashboard", root_path, class: 'btn btn-lg btn-primary btn-block'
17
+ = link_to "Return to Dashboard", return_to_dashboard_path, class: 'btn btn-lg btn-primary btn-block'
@@ -39,4 +39,4 @@
39
39
  = collapse('Show orders...', card_class: 'my-2') do
40
40
  = render 'effective/applicants/orders', applicant: resource
41
41
 
42
- = link_to "Return to Dashboard", root_path, class: 'btn btn-lg btn-primary btn-block'
42
+ = link_to "Return to Dashboard", return_to_dashboard_path, class: 'btn btn-lg btn-primary btn-block'
@@ -7,7 +7,7 @@
7
7
  .alert.alert-warning.mb-4
8
8
  Successfully paid on #{resource.submit_order.purchased_at.strftime('%F')}.
9
9
 
10
- = link_to "Return to Dashboard", root_path, class: 'btn btn-lg btn-primary mb-4'
10
+ = link_to "Return to Dashboard", return_to_dashboard_path, class: 'btn btn-lg btn-primary btn-block'
11
11
 
12
12
  = card do
13
13
  = render 'effective/fee_payments/summary', fee_payment: resource
@@ -20,4 +20,4 @@
20
20
  = collapse('Show orders...', card_class: 'my-2') do
21
21
  = render 'effective/fee_payments/orders', fee_payment: resource
22
22
 
23
- = link_to "Return to Dashboard", root_path, class: 'btn btn-lg btn-primary'
23
+ = link_to "Return to Dashboard", return_to_dashboard_path, class: 'btn btn-lg btn-primary btn-block'
data/config/routes.rb CHANGED
@@ -52,7 +52,7 @@ EffectiveMemberships::Engine.routes.draw do
52
52
 
53
53
  resources :applicant_reviews, only: [:index, :show]
54
54
 
55
- resources :fees
55
+ resources :fees, except: [:show]
56
56
  resources :categories, only: [:index, :edit, :update]
57
57
 
58
58
  resources :applicant_course_areas, except: [:show]
@@ -1,3 +1,3 @@
1
1
  module EffectiveMemberships
2
- VERSION = '0.9.3'
2
+ VERSION = '0.9.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_memberships
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-23 00:00:00.000000000 Z
11
+ date: 2022-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -407,6 +407,7 @@ files:
407
407
  - app/views/effective/applicant_reviews/_content.html.haml
408
408
  - app/views/effective/applicant_reviews/_dashboard.html.haml
409
409
  - app/views/effective/applicant_reviews/_layout.html.haml
410
+ - app/views/effective/applicant_reviews/_other_reviews.html.haml
410
411
  - app/views/effective/applicant_reviews/_recommendation.html.haml
411
412
  - app/views/effective/applicant_reviews/_review.html.haml
412
413
  - app/views/effective/applicant_reviews/recommendation.html.haml