effective_memberships 0.3.8 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/datatables/admin/effective_applicants_datatable.rb +2 -1
- data/app/models/concerns/effective_memberships_applicant.rb +45 -27
- data/app/models/concerns/effective_memberships_category.rb +22 -2
- data/app/models/effective/applicant_reference.rb +6 -1
- data/app/views/admin/applicants/_form.html.haml +1 -1
- data/app/views/effective/applicants/_stamp.html.haml +36 -0
- data/app/views/effective/applicants/stamp.html.haml +28 -0
- data/lib/effective_memberships/version.rb +1 -1
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf72d5bb8220dd574786eceebb0f8722521e6b097c1aff7a97742681f74bd0de
|
4
|
+
data.tar.gz: 00564617a0a0b722d39aa4466fa16c8fff00dfa60ed372e7cca86d9f5f8b95bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67ee50afa73bd30d416a152d8e43b6ed3827733ab1c01565a270fb295f8eb47ffe327d5b9155ff584b8e1a6558f2a5b0c3f33e016e9cb966fe16d0ca250c1d6e
|
7
|
+
data.tar.gz: d2af28eea6edf0bc4790e819e712be0b7fe3eb4981b9a1068d9699b3274480a0b7e8ed78a44bbbb7fd8646cf0cca5579b0b712450e486b9fbe2388a18b5e597d
|
@@ -49,6 +49,7 @@ module EffectiveMembershipsApplicant
|
|
49
49
|
experience: 'Work Experience',
|
50
50
|
references: 'References',
|
51
51
|
files: 'Attach Files',
|
52
|
+
stamp: 'Professional Stamp',
|
52
53
|
declarations: 'Declarations',
|
53
54
|
summary: 'Review',
|
54
55
|
billing: 'Billing Address',
|
@@ -93,10 +94,14 @@ module EffectiveMembershipsApplicant
|
|
93
94
|
has_many :applicant_references, -> { order(:id) }, class_name: 'Effective::ApplicantReference', as: :applicant, inverse_of: :applicant, dependent: :destroy
|
94
95
|
accepts_nested_attributes_for :applicant_references, reject_if: :all_blank, allow_destroy: true
|
95
96
|
|
96
|
-
has_many :
|
97
|
+
has_many :stamps, -> { order(:id) }, class_name: 'Effective::Stamp', as: :applicant, inverse_of: :applicant, dependent: :destroy
|
98
|
+
accepts_nested_attributes_for :stamps, reject_if: :all_blank, allow_destroy: true
|
99
|
+
|
100
|
+
# Effective Namespace polymorphic
|
101
|
+
has_many :fees, -> { order(:id) }, class_name: 'Effective::Fee', as: :parent, inverse_of: :parent, dependent: :destroy
|
97
102
|
accepts_nested_attributes_for :fees, reject_if: :all_blank, allow_destroy: true
|
98
103
|
|
99
|
-
has_many :orders, -> { order(:id) }, as: :parent, inverse_of: :parent,
|
104
|
+
has_many :orders, -> { order(:id) }, class_name: 'Effective::Order', as: :parent, inverse_of: :parent, dependent: :destroy
|
100
105
|
accepts_nested_attributes_for :orders
|
101
106
|
|
102
107
|
effective_resource do
|
@@ -138,6 +143,8 @@ module EffectiveMembershipsApplicant
|
|
138
143
|
scope :in_progress, -> { where.not(status: [:approved, :declined]) }
|
139
144
|
scope :done, -> { where(status: [:approved, :declined]) }
|
140
145
|
|
146
|
+
scope :not_draft, -> { where.not(status: :draft) }
|
147
|
+
|
141
148
|
# Set Apply to Join or Reclassification
|
142
149
|
before_validation(if: -> { new_record? && owner.present? }) do
|
143
150
|
self.applicant_type ||= (owner.membership.blank? ? 'Apply to Join' : 'Apply to Reclassify')
|
@@ -274,6 +281,9 @@ module EffectiveMembershipsApplicant
|
|
274
281
|
|
275
282
|
applicant_steps = Array(category&.applicant_wizard_steps)
|
276
283
|
|
284
|
+
# Special logic for stamp step
|
285
|
+
applicant_steps.delete(:stamp) unless apply_to_join?
|
286
|
+
|
277
287
|
wizard_steps.select do |step|
|
278
288
|
required_steps.include?(step) || category.blank? || applicant_steps.include?(step)
|
279
289
|
end
|
@@ -282,30 +292,30 @@ module EffectiveMembershipsApplicant
|
|
282
292
|
|
283
293
|
# All Fees and Orders
|
284
294
|
def submit_fees
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
+
# Find or build submit fee
|
296
|
+
fee = fees.first || fees.build(owner: owner, fee_type: 'Applicant')
|
297
|
+
|
298
|
+
unless fee.purchased?
|
299
|
+
fee.assign_attributes(
|
300
|
+
category: category,
|
301
|
+
price: category.applicant_fee,
|
302
|
+
tax_exempt: category.applicant_fee_tax_exempt,
|
303
|
+
qb_item_name: category.applicant_fee_qb_item_name
|
304
|
+
)
|
305
|
+
end
|
295
306
|
|
296
|
-
|
297
|
-
|
307
|
+
# Update stamp price
|
308
|
+
stamp = stamps.first
|
298
309
|
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
)
|
310
|
+
if stamp.present? && !stamp.purchased?
|
311
|
+
stamp.assign_attributes(
|
312
|
+
price: category.stamp_fee,
|
313
|
+
tax_exempt: category.stamp_fee_tax_exempt,
|
314
|
+
qb_item_name: category.stamp_fee_qb_item_name
|
315
|
+
)
|
316
|
+
end
|
307
317
|
|
308
|
-
|
318
|
+
(fees + stamps)
|
309
319
|
end
|
310
320
|
|
311
321
|
# Draft -> Submitted requirements
|
@@ -315,7 +325,9 @@ module EffectiveMembershipsApplicant
|
|
315
325
|
|
316
326
|
wizard_steps[:checkout] ||= Time.zone.now
|
317
327
|
wizard_steps[:submitted] = Time.zone.now
|
328
|
+
|
318
329
|
submitted!
|
330
|
+
stamps.each { |stamp| stamp.submit! }
|
319
331
|
|
320
332
|
after_commit do
|
321
333
|
applicant_references.each { |reference| reference.notify! if reference.submitted? }
|
@@ -410,10 +422,6 @@ module EffectiveMembershipsApplicant
|
|
410
422
|
# Reset the progress so far. They have to click through screens again.
|
411
423
|
assign_attributes(wizard_steps: wizard_steps.slice(:start, :select))
|
412
424
|
|
413
|
-
# Delete any fees and orders. Keep all other data.
|
414
|
-
submit_fees.each { |fee| fee.mark_for_destruction }
|
415
|
-
submit_order.mark_for_destruction if submit_order
|
416
|
-
|
417
425
|
save!
|
418
426
|
end
|
419
427
|
|
@@ -463,6 +471,16 @@ module EffectiveMembershipsApplicant
|
|
463
471
|
category&.min_applicant_files.to_i
|
464
472
|
end
|
465
473
|
|
474
|
+
# Stamps step
|
475
|
+
def stamp
|
476
|
+
stamps.first || stamps.build(
|
477
|
+
owner: owner,
|
478
|
+
name: owner.to_s,
|
479
|
+
shipping_address: (owner.try(:shipping_address) || owner.try(:billing_address)),
|
480
|
+
price: 0
|
481
|
+
)
|
482
|
+
end
|
483
|
+
|
466
484
|
# The submit! method used to be here
|
467
485
|
# But it needs to be inside the included do block
|
468
486
|
# So see above. Sorry.
|
@@ -180,7 +180,7 @@ module EffectiveMembershipsCategory
|
|
180
180
|
end
|
181
181
|
|
182
182
|
def applicant_wizard_steps_collection
|
183
|
-
wizard_steps = EffectiveMemberships.Applicant.
|
183
|
+
wizard_steps = EffectiveMemberships.Applicant.wizard_steps_hash
|
184
184
|
required_steps = EffectiveMemberships.Applicant.required_wizard_steps
|
185
185
|
|
186
186
|
wizard_steps.map do |step, title|
|
@@ -189,7 +189,7 @@ module EffectiveMembershipsCategory
|
|
189
189
|
end
|
190
190
|
|
191
191
|
def fee_payment_wizard_steps_collection
|
192
|
-
wizard_steps = EffectiveMemberships.FeePayment.
|
192
|
+
wizard_steps = EffectiveMemberships.FeePayment.wizard_steps_hash
|
193
193
|
required_steps = EffectiveMemberships.FeePayment.required_wizard_steps
|
194
194
|
|
195
195
|
wizard_steps.map do |step, title|
|
@@ -197,4 +197,24 @@ module EffectiveMembershipsCategory
|
|
197
197
|
end
|
198
198
|
end
|
199
199
|
|
200
|
+
def applicant_fee_qb_item_name
|
201
|
+
'Applicant'
|
202
|
+
end
|
203
|
+
|
204
|
+
def applicant_fee_tax_exempt
|
205
|
+
tax_exempt
|
206
|
+
end
|
207
|
+
|
208
|
+
def stamp_fee
|
209
|
+
0
|
210
|
+
end
|
211
|
+
|
212
|
+
def stamp_fee_qb_item_name
|
213
|
+
qb_item_name
|
214
|
+
end
|
215
|
+
|
216
|
+
def stamp_fee_tax_exempt
|
217
|
+
tax_exempt
|
218
|
+
end
|
219
|
+
|
200
220
|
end
|
@@ -2,7 +2,12 @@ module Effective
|
|
2
2
|
class ApplicantReference < ActiveRecord::Base
|
3
3
|
acts_as_tokened
|
4
4
|
acts_as_addressable :reference
|
5
|
-
|
5
|
+
|
6
|
+
acts_as_statused(
|
7
|
+
:submitted, # Was submitted by the applicant
|
8
|
+
:completed # Was completed by the reference.
|
9
|
+
)
|
10
|
+
|
6
11
|
log_changes(to: :applicant) if respond_to?(:log_changes)
|
7
12
|
|
8
13
|
belongs_to :applicant, polymorphic: true
|
@@ -35,7 +35,7 @@
|
|
35
35
|
|
36
36
|
- if applicant.owner.applicants.any? { |other| other.was_submitted? && other.id != applicant.id }
|
37
37
|
= tab 'Other Applications' do
|
38
|
-
= render_datatable(Admin::EffectiveApplicantsDatatable.new(
|
38
|
+
= render_datatable(Admin::EffectiveApplicantsDatatable.new(owner: applicant.owner, except_id: applicant.id))
|
39
39
|
|
40
40
|
- if applicant.persisted? && applicant.respond_to?(:log_changes_datatable)
|
41
41
|
= tab 'Logs' do
|
@@ -0,0 +1,36 @@
|
|
1
|
+
.card
|
2
|
+
.card-body
|
3
|
+
.row
|
4
|
+
.col-sm
|
5
|
+
%h5.card-title= applicant.wizard_step_title(:stamp)
|
6
|
+
.col-sm-auto.text-right
|
7
|
+
= link_to('Edit', wizard_path(:stamp)) if edit_effective_wizard?
|
8
|
+
|
9
|
+
- applicant.stamps.each do |stamp|
|
10
|
+
%table.table.table-sm
|
11
|
+
%tbody
|
12
|
+
%tr
|
13
|
+
%th Name
|
14
|
+
%td= stamp.name
|
15
|
+
|
16
|
+
%tr
|
17
|
+
%th Name Confirmation
|
18
|
+
%td= stamp.name_confirmation
|
19
|
+
|
20
|
+
%tr
|
21
|
+
%th Category
|
22
|
+
%td= stamp.category
|
23
|
+
|
24
|
+
- if stamp.shipping_address.present?
|
25
|
+
%tr
|
26
|
+
%th Shipping Address
|
27
|
+
%td= stamp.shipping_address.to_html
|
28
|
+
|
29
|
+
- if applicant.was_approved?
|
30
|
+
%tr
|
31
|
+
%th Submitted
|
32
|
+
%td= stamp.submitted_at&.strftime('%F') || '-'
|
33
|
+
|
34
|
+
%tr
|
35
|
+
%th Issued
|
36
|
+
%td= stamp.issued_at&.strftime('%F') || 'Not Issued'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
= render 'layout' do
|
2
|
+
= render 'effective/applicants/content', resource: resource
|
3
|
+
|
4
|
+
.card
|
5
|
+
.card-body
|
6
|
+
%p Should your application be approved, you are eligible to receive a Professional Stamp.
|
7
|
+
|
8
|
+
%p Please confirm your name as it should appear on any Professional Stamp.
|
9
|
+
|
10
|
+
= effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
|
11
|
+
= f.hidden_field :id
|
12
|
+
|
13
|
+
= f.fields_for(:stamps, f.object.stamp) do |fs|
|
14
|
+
= fs.hidden_field :applicant_id
|
15
|
+
= fs.hidden_field :applicant_type
|
16
|
+
|
17
|
+
= fs.hidden_field :owner_id
|
18
|
+
= fs.hidden_field :owner_type
|
19
|
+
|
20
|
+
= fs.hidden_field :price
|
21
|
+
= fs.hidden_field :tax_exempt
|
22
|
+
= fs.hidden_field :qb_item_name
|
23
|
+
|
24
|
+
= render 'effective/stamps/fields', f: fs
|
25
|
+
|
26
|
+
%p Stamps will be processed after approval of this application.
|
27
|
+
|
28
|
+
= f.save 'Save and Continue'
|
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.3.
|
4
|
+
version: 0.3.9
|
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-02-
|
11
|
+
date: 2022-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: effective_products
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: effective_resources
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -349,6 +363,7 @@ files:
|
|
349
363
|
- app/views/effective/applicants/_orders.html.haml
|
350
364
|
- app/views/effective/applicants/_references.html.haml
|
351
365
|
- app/views/effective/applicants/_select.html.haml
|
366
|
+
- app/views/effective/applicants/_stamp.html.haml
|
352
367
|
- app/views/effective/applicants/_summary.html.haml
|
353
368
|
- app/views/effective/applicants/billing.html.haml
|
354
369
|
- app/views/effective/applicants/checkout.html.haml
|
@@ -360,6 +375,7 @@ files:
|
|
360
375
|
- app/views/effective/applicants/files.html.haml
|
361
376
|
- app/views/effective/applicants/references.html.haml
|
362
377
|
- app/views/effective/applicants/select.html.haml
|
378
|
+
- app/views/effective/applicants/stamp.html.haml
|
363
379
|
- app/views/effective/applicants/start.html.haml
|
364
380
|
- app/views/effective/applicants/submitted.html.haml
|
365
381
|
- app/views/effective/applicants/summary.html.haml
|