effective_memberships 0.4.10 → 0.4.11

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: b7d09ef68f61058a8ee29567caa3a008d887482edab0fa3e8d251ea69f9ea3cb
4
- data.tar.gz: 10a88e200464a6d2d7dbb8fbdcaa3aed77337b067e12fc3577b31a8032cbd2ce
3
+ metadata.gz: a08504cb78fd8324ad3a72904249556ba0761b490a4574e1be3a4f6ac22ef51f
4
+ data.tar.gz: 409b51e03245bd8e331aeaf2acd038c111eb060e2852ffdfdbd282e4a20d7e9a
5
5
  SHA512:
6
- metadata.gz: 3adbdb1ab5f18df509ebc6631f39a142f2857213ce9ee0a23b83eec2fa44dda3d8b77c42afe7e4e4b494bb938dac7aee672cc26dacbd398fd9f34cc3c55ed222
7
- data.tar.gz: ab80c7ff8b01736429ecabc774b81c45702d21ae521e2e7db276191802fa212171f8e81e448a06e452fb97745c5aec3723fe37537669f3a3ed87b9cd30d03746
6
+ metadata.gz: ca160549bff37e5194ca4eaea87f1479426b9f019631497892d564ec4e4be828dc41513085418c89a5b08aa3fa5b2190ee7eb30a3b84acec7f6b5f03a15ff82e
7
+ data.tar.gz: 184c786911efb0309e0d988e288f3d61f7ce9cb440e850e45a2c6fb13903e9a2f5eb79ef6b414a4b9f1365c3af9dfdd5536e050f780d1f50f60b19fd47008586
@@ -2,6 +2,7 @@
2
2
  class EffectiveApplicantEndorsementsDatatable < Effective::Datatable
3
3
 
4
4
  datatable do
5
+ length :all
5
6
  order :name
6
7
 
7
8
  col :name do |endorsement|
@@ -0,0 +1,23 @@
1
+ class EffectiveApplicantEquivalencesDatatable < Effective::Datatable
2
+ datatable do
3
+ length :all
4
+ order :start_on
5
+
6
+ col :start_on
7
+
8
+ col :end_on do |applicant_equivalence|
9
+ applicant_equivalence.end_on&.strftime('%F') || '-'
10
+ end
11
+
12
+ col :name
13
+ col :notes
14
+ end
15
+
16
+ collection do
17
+ Effective::ApplicantEquivalence.deep.where(applicant: applicant)
18
+ end
19
+
20
+ def applicant
21
+ @applicant ||= EffectiveMemberships.Applicant.where(id: attributes[:applicant_id]).first!
22
+ end
23
+ end
@@ -1,6 +1,7 @@
1
1
  class EffectiveApplicantExperiencesDatatable < Effective::Datatable
2
2
  datatable do
3
3
  length :all
4
+
4
5
  order :start_on
5
6
 
6
7
  col :start_on
@@ -96,6 +96,9 @@ module EffectiveMembershipsApplicant
96
96
  has_many :applicant_endorsements, -> { order(:id) }, class_name: 'Effective::ApplicantEndorsement', as: :applicant, inverse_of: :applicant, dependent: :destroy
97
97
  accepts_nested_attributes_for :applicant_endorsements, reject_if: :all_blank, allow_destroy: true
98
98
 
99
+ has_many :applicant_equivalences, -> { order(:id) }, class_name: 'Effective::ApplicantEquivalence', as: :applicant, inverse_of: :applicant, dependent: :destroy
100
+ accepts_nested_attributes_for :applicant_equivalences, reject_if: :all_blank, allow_destroy: true
101
+
99
102
  has_many :applicant_experiences, -> { order(:id) }, class_name: 'Effective::ApplicantExperience', as: :applicant, inverse_of: :applicant, dependent: :destroy
100
103
  accepts_nested_attributes_for :applicant_experiences, reject_if: :all_blank, allow_destroy: true
101
104
 
@@ -251,6 +254,16 @@ module EffectiveMembershipsApplicant
251
254
  end
252
255
  end
253
256
 
257
+ # Applicant Equivalences Step
258
+ with_options(if: -> { current_step == :equivalences }) do
259
+ validate do
260
+ required = min_applicant_equivalences()
261
+ existing = applicant_equivalences().reject(&:marked_for_destruction?).length
262
+
263
+ self.errors.add(:applicant_equivalences, "please include #{required} or more equivalences") if existing < required
264
+ end
265
+ end
266
+
254
267
  # Applicant References Step
255
268
  with_options(if: -> { current_step == :references }) do
256
269
  validate do
@@ -540,6 +553,11 @@ module EffectiveMembershipsApplicant
540
553
  category&.min_applicant_endorsements.to_i
541
554
  end
542
555
 
556
+ # Equivalences Step
557
+ def min_applicant_equivalences
558
+ category&.min_applicant_equivalences.to_i
559
+ end
560
+
543
561
  # Files Step
544
562
  def min_applicant_files
545
563
  category&.min_applicant_files.to_i
@@ -55,6 +55,8 @@ module EffectiveMembershipsCategory
55
55
  applicant_wizard_steps :text
56
56
 
57
57
  min_applicant_educations :integer
58
+ min_applicant_endorsements :integer
59
+ min_applicant_equivalences :integer
58
60
  min_applicant_experiences_months :integer
59
61
  min_applicant_references :integer
60
62
  min_applicant_courses :integer
@@ -42,7 +42,7 @@ module Effective
42
42
 
43
43
  # All step validations
44
44
  validates :applicant, presence: true
45
- validates :endorser, presence: true, unless: -> { unknown_member? }
45
+ validates :endorser_id, presence: true, unless: -> { unknown_member? }
46
46
 
47
47
  with_options(if: -> { unknown_member? }) do
48
48
  validates :endorser_email, presence: true, email: true
@@ -0,0 +1,32 @@
1
+ module Effective
2
+ class ApplicantEquivalence < ActiveRecord::Base
3
+ belongs_to :applicant, polymorphic: true
4
+
5
+ log_changes(to: :applicant) if respond_to?(:log_changes)
6
+
7
+ effective_resource do
8
+ name :string
9
+
10
+ start_on :date
11
+ end_on :date
12
+
13
+ notes :text
14
+
15
+ timestamps
16
+ end
17
+
18
+ scope :deep, -> { all }
19
+
20
+ validates :name, presence: true
21
+ validates :start_on, presence: true
22
+
23
+ validate(if: -> { start_on.present? && end_on.present? }) do
24
+ errors.add(:end_on, 'must be after start date') unless start_on < end_on
25
+ end
26
+
27
+ def to_s
28
+ name || 'equivalence'
29
+ end
30
+
31
+ end
32
+ end
@@ -38,6 +38,12 @@
38
38
  %td= f.number_field :min_applicant_endorsements, label: false
39
39
  %td minimimum number of endorsements
40
40
 
41
+ - if applicant.wizard_step_keys.include?(:equivalences)
42
+ %tr
43
+ %td= applicant.wizard_step_title(:equivalences)
44
+ %td= f.number_field :min_applicant_equivalences, label: false
45
+ %td minimimum number of equivalent memberships
46
+
41
47
  - if applicant.wizard_step_keys.include?(:references)
42
48
  %tr
43
49
  %td= applicant.wizard_step_title(:references)
@@ -0,0 +1,10 @@
1
+ .card
2
+ .card-body
3
+ .row
4
+ .col-sm
5
+ %h5.card-title= applicant.wizard_step_title(:equivalences)
6
+ .col-sm-auto.text-right
7
+ = link_to('Edit', wizard_path(:equivalences)) if edit_effective_wizard?
8
+
9
+ - datatable = EffectiveApplicantEquivalencesDatatable.new(applicant: applicant)
10
+ .mb-4= render_simple_datatable(datatable)
@@ -47,4 +47,6 @@
47
47
  .col
48
48
  = f.static_field :min_applicant_courses, label: 'Required Courses'
49
49
 
50
+ = render_if_exists("effective/applicants/course_amounts_fields", f: f)
51
+
50
52
  = f.save 'Save and Continue'
@@ -16,4 +16,6 @@
16
16
  = f.check_box :declare_truth,
17
17
  label: 'Yes, I hereby certify that the statements and information contained herein are correct'
18
18
 
19
+ = render_if_exists("effective/applicants/declarations_fields", f: f)
20
+
19
21
  = f.save 'Save and Continue'
@@ -22,6 +22,6 @@
22
22
 
23
23
  = aef.text_field :degree_obtained, label: 'Degree, diploma or program'
24
24
 
25
- /= f.text_area :applicant_educations_details, label: 'Additional Education Details'
25
+ = render_if_exists("effective/applicants/education_fields", f: f)
26
26
 
27
27
  = f.save 'Save and Continue'
@@ -9,17 +9,26 @@
9
9
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
10
10
  = f.hidden_field :id
11
11
 
12
+ - endorders_collection = Effective::ApplicantEndorsement.endorser_collection(resource)
13
+
12
14
  = f.has_many(:applicant_endorsements, cards: true) do |aef|
15
+ - aef.object.endorser_type ||= endorders_collection.klass.name
16
+
13
17
  %h4 Endorsement
14
18
 
15
- = aef.select :endorser, Effective::ApplicantEndorsement.endorser_collection(resource), required: false,
19
+ = aef.hidden_field :endorser_id
20
+ = aef.hidden_field :endorser_type
21
+
22
+ = aef.select :endorser_id, endorders_collection, required: false,
16
23
  ajax_url: effective_memberships.select2_ajax_endorser_applicant_endorsement_path(applicant_id: resource)
17
24
 
18
25
  = aef.check_box :unknown_member, label: 'I cant find my endorser in the above list'
19
26
 
20
27
  = aef.show_if(:unknown_member, true) do
21
- = aef.email_field :endorser_email, required: true
22
- = aef.text_field :name, required: true
28
+ = aef.text_field :name, label: 'Endorser name', required: true
29
+ = aef.email_field :endorser_email, label: 'Email', required: true
23
30
  = aef.phone_field :phone, required: true
24
31
 
32
+ = render_if_exists("effective/applicants/endorsements_fields", f: f)
33
+
25
34
  = f.save 'Save and Continue'
@@ -0,0 +1,25 @@
1
+ = render 'layout' do
2
+ = render 'effective/applicants/content', resource: resource
3
+
4
+ .card
5
+ .card-body
6
+ - if resource.min_applicant_equivalences > 0
7
+ .alert.alert-danger You must include #{resource.min_applicant_equivalences} or more equivalent memberships.
8
+
9
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
10
+ = f.hidden_field :id
11
+
12
+ = f.has_many(:applicant_equivalences, cards: true) do |aef|
13
+ %h4.mb-4 Equivalent Membership
14
+
15
+ = aef.text_field :name
16
+
17
+ .row
18
+ .col= aef.date_field :start_on, label: 'Start Date'
19
+ .col= aef.date_field :end_on, label: 'End Date'
20
+
21
+ = aef.text_area :notes
22
+
23
+ = render_if_exists("effective/applicants/equivalences_fields", f: f)
24
+
25
+ = f.save 'Save and Continue'
@@ -21,7 +21,7 @@
21
21
  .row
22
22
  .col= aef.date_field :start_on, label: 'Start Date', 'data-applicant-experiences-month': true
23
23
  .col
24
- = aef.date_field :end_on, label: 'End Date', 'data-applicant-experiences-month': true
24
+ = aef.date_field :end_on, label: 'End Date', required: false, 'data-applicant-experiences-month': true
25
25
  = aef.check_box :still_work_here, label: 'I still work here'
26
26
 
27
27
  .row
@@ -46,6 +46,6 @@
46
46
 
47
47
  = f.error :applicant_experiences_months
48
48
 
49
- /= f.text_area :applicant_experiences_details, label: 'Additional Experiences Details'
49
+ = render_if_exists("effective/applicants/experience_fields", f: f)
50
50
 
51
51
  = f.save 'Save and Continue'
@@ -11,4 +11,6 @@
11
11
 
12
12
  = f.file_field :applicant_files, attachment_style: :table
13
13
 
14
+ = render_if_exists("effective/applicants/files_fields", f: f)
15
+
14
16
  = f.save 'Save and Continue'
@@ -21,4 +21,6 @@
21
21
  .col= arf.select :relationship, Effective::ApplicantReference::RELATIONSHIPS
22
22
  .col= arf.select :known, Effective::ApplicantReference::KNOWNS, label: 'Known for'
23
23
 
24
+ = render_if_exists("effective/applicants/references_fields", f: f)
25
+
24
26
  = f.save 'Save and Continue'
@@ -25,6 +25,7 @@ class CreateEffectiveMemberships < ActiveRecord::Migration[6.0]
25
25
  t.integer :min_applicant_experiences_months
26
26
  t.integer :min_applicant_references
27
27
  t.integer :min_applicant_endorsements
28
+ t.integer :min_applicant_equivalences
28
29
  t.integer :min_applicant_courses
29
30
  t.integer :min_applicant_files
30
31
 
@@ -325,6 +326,24 @@ class CreateEffectiveMemberships < ActiveRecord::Migration[6.0]
325
326
  add_index :applicant_endorsements, :applicant_id
326
327
  add_index :applicant_endorsements, :token
327
328
 
329
+ # Applicant Equivalences
330
+ create_table :applicant_equivalences do |t|
331
+ t.integer :applicant_id
332
+ t.string :applicant_type
333
+
334
+ t.string :name
335
+
336
+ t.date :start_on
337
+ t.date :end_on
338
+
339
+ t.text :notes
340
+
341
+ t.datetime :created_at
342
+ t.datetime :updated_at
343
+ end
344
+
345
+ add_index :applicant_equivalences, :applicant_id
346
+
328
347
  # Applicant Courses
329
348
  create_table :applicant_course_areas do |t|
330
349
  t.string :title
@@ -1,3 +1,3 @@
1
1
  module EffectiveMemberships
2
- VERSION = '0.4.10'
2
+ VERSION = '0.4.11'
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.4.10
4
+ version: 0.4.11
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-06-24 00:00:00.000000000 Z
11
+ date: 2022-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -290,6 +290,7 @@ files:
290
290
  - app/datatables/effective_applicant_courses_datatable.rb
291
291
  - app/datatables/effective_applicant_educations_datatable.rb
292
292
  - app/datatables/effective_applicant_endorsements_datatable.rb
293
+ - app/datatables/effective_applicant_equivalences_datatable.rb
293
294
  - app/datatables/effective_applicant_experiences_datatable.rb
294
295
  - app/datatables/effective_applicant_references_datatable.rb
295
296
  - app/datatables/effective_applicants_datatable.rb
@@ -314,6 +315,7 @@ files:
314
315
  - app/models/effective/applicant_course_name.rb
315
316
  - app/models/effective/applicant_education.rb
316
317
  - app/models/effective/applicant_endorsement.rb
318
+ - app/models/effective/applicant_equivalence.rb
317
319
  - app/models/effective/applicant_experience.rb
318
320
  - app/models/effective/applicant_reference.rb
319
321
  - app/models/effective/applicant_review.rb
@@ -393,6 +395,7 @@ files:
393
395
  - app/views/effective/applicants/_demographics.html.haml
394
396
  - app/views/effective/applicants/_education.html.haml
395
397
  - app/views/effective/applicants/_endorsements.html.haml
398
+ - app/views/effective/applicants/_equivalences.html.haml
396
399
  - app/views/effective/applicants/_experience.html.haml
397
400
  - app/views/effective/applicants/_files.html.haml
398
401
  - app/views/effective/applicants/_layout.html.haml
@@ -411,6 +414,7 @@ files:
411
414
  - app/views/effective/applicants/demographics.html.haml
412
415
  - app/views/effective/applicants/education.html.haml
413
416
  - app/views/effective/applicants/endorsements.html.haml
417
+ - app/views/effective/applicants/equivalences.html.haml
414
418
  - app/views/effective/applicants/experience.html.haml
415
419
  - app/views/effective/applicants/files.html.haml
416
420
  - app/views/effective/applicants/organization.html.haml