egov_utils 1.5.0.alpha1 → 1.5.0.alpha3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/egov_utils/person.rb +2 -5
- data/app/services/egov_utils/iszr/legal_people/search.rb +3 -3
- data/app/services/egov_utils/iszr/natural_people/search.rb +3 -3
- data/app/views/egov_utils/people/_form.html.haml +5 -7
- data/app/views/egov_utils/people/_new_form.html.haml +50 -34
- data/db/migrate/20240711130901_add_remote_id_to_people.rb +5 -0
- data/lib/egov_utils/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00ea00706e2722fb8728d9c844bd50438b452a8de9445ef23390fb995b989db9
|
4
|
+
data.tar.gz: 9e678b274e4aa700191e2973675d94442a3545ed4c829ba5f2cc7e87015a5fbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ee1188c124f50fa5fc766c6438eb4883902972a75706ba9dd8ffc169396a3d91a0faca955c6aa8da70660a1b9da18febd9ffc89ed7b664842e70a64057363c9
|
7
|
+
data.tar.gz: 1b8233de8f1b144cf788e1d2b3bce95407dfeb54a01c9db26e1b6ecc22912e39407b5dd0191f8f176e6fec6022490874e176c77b0f2f0a5d0ba0cb3c697e1bde
|
@@ -11,14 +11,12 @@ module EgovUtils
|
|
11
11
|
enum person_type: { natural: 1, legal: 16 }
|
12
12
|
|
13
13
|
validates :person_entity, presence: true
|
14
|
-
before_validation :
|
14
|
+
before_validation :set_person_from_remote_id
|
15
15
|
|
16
16
|
accepts_nested_attributes_for :residence, :natural_person, :legal_person
|
17
17
|
|
18
18
|
delegate :fullname, :fullname=, to: :person_entity
|
19
19
|
|
20
|
-
attr_accessor :remote_id
|
21
|
-
|
22
20
|
def initialize(attributes = {})
|
23
21
|
if attributes&.fetch(:remote_id, nil).present?
|
24
22
|
super(attributes.slice(:remote_id, :person_type))
|
@@ -61,10 +59,9 @@ module EgovUtils
|
|
61
59
|
|
62
60
|
private
|
63
61
|
|
64
|
-
def
|
62
|
+
def set_person_from_remote_id
|
65
63
|
return unless remote_id.present?
|
66
64
|
|
67
|
-
# binding.pry
|
68
65
|
attributes =
|
69
66
|
if person_type == 'natural'
|
70
67
|
Iszr::NaturalPeople::SearchByRemoteId.run!(remote_id:)
|
@@ -18,10 +18,10 @@ module EgovUtils
|
|
18
18
|
private
|
19
19
|
|
20
20
|
def find_person_service
|
21
|
-
if Rails.env.
|
22
|
-
EgovUtils::Iszr::LegalPeople::DevSearch
|
23
|
-
else
|
21
|
+
if Rails.env.production?
|
24
22
|
EgovUtils::Iszr::LegalPeople::ProdSearch
|
23
|
+
else
|
24
|
+
EgovUtils::Iszr::LegalPeople::DevSearch
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -19,10 +19,10 @@ module EgovUtils
|
|
19
19
|
private
|
20
20
|
|
21
21
|
def find_person_service
|
22
|
-
if Rails.env.
|
23
|
-
EgovUtils::Iszr::NaturalPeople::DevSearch
|
24
|
-
else
|
22
|
+
if Rails.env.production?
|
25
23
|
EgovUtils::Iszr::NaturalPeople::ProdSearch
|
24
|
+
else
|
25
|
+
EgovUtils::Iszr::NaturalPeople::DevSearch
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -1,6 +1,4 @@
|
|
1
1
|
.person-form
|
2
|
-
.row
|
3
|
-
.col-12= form.select :person_type, enum_values_for_select(person.class, :person_type), {}, class: 'person-type-toggle'
|
4
2
|
.natural_person.row
|
5
3
|
= form.fields_for(:natural_person, person.natural_person || EgovUtils::NaturalPerson.new) do |fields|
|
6
4
|
.col-12.col-md-2= fields.text_field(:title)
|
@@ -9,11 +7,11 @@
|
|
9
7
|
.col-12.col-md-2= fields.text_field(:higher_title)
|
10
8
|
.col-12.col-md-6= fields.date_field(:birth_date, min: Date.new(1920, 1, 1), max: Date.today, data: {'date-view-mode' => 'decades', 'date-use-current' => false, 'date-view-date' => Date.new(1950, 1, 1).to_s })
|
11
9
|
.col-12.col-sm-6= fields.text_field(:birth_place)
|
12
|
-
.legal_person.row
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
-# .legal_person.row
|
11
|
+
-# = form.fields_for(:legal_person, person.legal_person || EgovUtils::LegalPerson.new) do |fields|
|
12
|
+
-# .col-12= fields.text_field(:name)
|
13
|
+
-# .col-12.col-sm-6= fields.text_field(:ico)
|
14
|
+
-# .col-12.col-sm-6= fields.select2 :legal_form, list_values_for_select(azahara_attribute_for(EgovUtils::LegalPerson, 'legal_form'))
|
17
15
|
.row
|
18
16
|
.col-12
|
19
17
|
= form.fields_for(:residence, person.residence || EgovUtils::Address.new) do |fields|
|
@@ -1,36 +1,38 @@
|
|
1
|
-
|
2
|
-
.
|
3
|
-
.
|
4
|
-
|
5
|
-
.
|
6
|
-
.
|
7
|
-
.card
|
8
|
-
|
9
|
-
.
|
10
|
-
.form
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
.
|
22
|
-
.
|
23
|
-
.card
|
24
|
-
|
25
|
-
.
|
26
|
-
.form
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
1
|
+
%div{id: key}
|
2
|
+
.person-form
|
3
|
+
.row
|
4
|
+
.col-12= form.select :person_type, enum_values_for_select(person.class, :person_type), {}, class: 'person-type-toggle'
|
5
|
+
.natural-person-row.identification-form.natural_person.row
|
6
|
+
.col-12
|
7
|
+
.card
|
8
|
+
.card-header Ztotožnění fyzické osoby
|
9
|
+
.card-body
|
10
|
+
.form
|
11
|
+
.form-group
|
12
|
+
= label_tag 'firstname', 'Jméno'
|
13
|
+
= text_field_tag :firstname, {}, class: 'form-control'
|
14
|
+
.form-group
|
15
|
+
= label_tag 'lastname', 'Příjmení'
|
16
|
+
= text_field_tag :lastname, {}, class: 'form-control'
|
17
|
+
.form-group
|
18
|
+
= label_tag 'birth_date', 'Datum narození'
|
19
|
+
= date_field_tag :birth_date, {}, class: 'form-control'
|
20
|
+
= link_to 'Vyhledat', {}, class: 'btn btn-primary'
|
21
|
+
.legal-person-row.identification-form.legal_person.row
|
22
|
+
.col-12
|
23
|
+
.card
|
24
|
+
.card-header Ztotožnění právnické osoby
|
25
|
+
.card-body
|
26
|
+
.form
|
27
|
+
.form-group
|
28
|
+
= label_tag 'ico', 'IČO'
|
29
|
+
= text_field_tag :ico, {}, class: 'form-control'
|
30
|
+
= link_to 'Vyhledat', nil, class: 'btn btn-primary'
|
31
|
+
= form.hidden_field :remote_id
|
31
32
|
|
32
33
|
:javascript
|
33
|
-
|
34
|
+
var key = "#{key}";
|
35
|
+
$('body').on('click', `\#${key} .natural-person-row a`, function(e) {
|
34
36
|
e.preventDefault();
|
35
37
|
$this = $(this);
|
36
38
|
$npr = $this.closest('.natural-person-row');
|
@@ -66,8 +68,22 @@
|
|
66
68
|
|
67
69
|
if(error_kind == 'not_found') {
|
68
70
|
$icon = $('<i>').addClass('fa').addClass('fa-times');
|
69
|
-
$error_div = $('<div>').addClass('alert').addClass('alert-danger').append($icon).append('
|
70
|
-
|
71
|
+
$error_div = $('<div>').addClass('alert').addClass('alert-danger').append($icon).append(' Dle zadaných údajů nebyla nalezena žádná osoba, pokračujte, prosím, ručním zadáním údajů');
|
72
|
+
|
73
|
+
$new_person_form = $this.closest('.new-person-form');
|
74
|
+
$old_person_form = $new_person_form.siblings('.old-person-form');
|
75
|
+
|
76
|
+
$old_person_form.prepend($error_div);
|
77
|
+
$new_person_form.addClass('hidden').hide();
|
78
|
+
$old_person_form.removeClass('hidden').show();
|
79
|
+
|
80
|
+
eGovUtilities.initPeople($old_person_form);
|
81
|
+
|
82
|
+
// Fill in the form with the data
|
83
|
+
$old_person_form.find("input[name*='[firstname]']").val(form_data.firstname);
|
84
|
+
$old_person_form.find("input[name*='[lastname]']").val(form_data.lastname);
|
85
|
+
$old_person_form.find("input[name*='[birth_place]']").val(form_data.birth_place);
|
86
|
+
$old_person_form.find("input[name*='[birth_date]']").val(form_data.birth_date);
|
71
87
|
}
|
72
88
|
else if(error_kind == 'multiple_results_found') {
|
73
89
|
$form_group = $('<div>').addClass('form-group');
|
@@ -98,7 +114,7 @@
|
|
98
114
|
}
|
99
115
|
});
|
100
116
|
});
|
101
|
-
$('.legal-person-row a'
|
117
|
+
$('body').on('click', '.legal-person-row a', function(e) {
|
102
118
|
e.preventDefault();
|
103
119
|
$this = $(this);
|
104
120
|
$lpr = $this.closest('.legal-person-row');
|
data/lib/egov_utils/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: egov_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.0.
|
4
|
+
version: 1.5.0.alpha3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ondřej Ezr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -757,6 +757,7 @@ files:
|
|
757
757
|
- db/migrate/20230412063325_add_days_before_archive_to_egov_utils_users.rb
|
758
758
|
- db/migrate/20230427091407_add_fields_to_registration_requests.rb
|
759
759
|
- db/migrate/20231006131159_add_supervisor_assignment_to_registration_requests.rb
|
760
|
+
- db/migrate/20240711130901_add_remote_id_to_people.rb
|
760
761
|
- lib/azahara_schema_currency.rb
|
761
762
|
- lib/azahara_schema_currency/aggregation_attribute_patch.rb
|
762
763
|
- lib/azahara_schema_currency/association_attribute_patch.rb
|