egov_utils 1.5.0.alpha8 → 1.5.0.alpha10

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6a2e101cbf4b714b08ce70939e456be732a40ab86d7604353fb38305c0a1279
4
- data.tar.gz: f35085cfd393565d01c9e29ec2cf8fce368a969681bed47fe4764152443b892f
3
+ metadata.gz: 5be2f7d146ffd93939d4439e5499f8c6bb3850bb7c71f4e966b5c985497fa99f
4
+ data.tar.gz: dbe8a432e8db4a475b40507a6b30977c63f6503faa5055c2906fac9f49ef75f6
5
5
  SHA512:
6
- metadata.gz: a07adfc98c660f9bb8a109438df3c39c8012358a7185c3378eb273622c8b21aa6195b9a960c34c80955d7b292feaadf8a4fd66134e3b3843152b42049bd2a923
7
- data.tar.gz: c065f9700cfb5fa5cb5da42105c40935018db05cfedec59b138a6e0f33a10bf9581c56eccea52f3f05c7a7b8cc1d2ed84a32826630d0c70b957c788c26d233b8
6
+ metadata.gz: cfc3b34cad592a56c854f03a9f5831162718c2fcd817f3d421efec9383b0a918eb764623b9cbac2a54ed54371848cbd9a6e23d7407dd113612eb354a7663d9a6
7
+ data.tar.gz: f12174cc8e38f84ee8dcf1534e9ef6f4cb5fa913c669bb964dbf7f039b3d8b2d16a617c87600ac7faa6438953ac7c7bf04b7dec0de0aea11fd9516a8d2f4a143
@@ -70,6 +70,7 @@ window.eGovUtilities =
70
70
  $form = $(this).closest('.person-form');
71
71
  $form.find('.natural_person').toggle( val == 'natural').find(':input').prop('disabled', val != 'natural');
72
72
  $form.find('.legal_person').toggle( val == 'legal').find(':input').prop('disabled', val != 'legal');
73
+ $form.find("input[name*='[remote_id]']").val('');
73
74
  )
74
75
  $type_toggles.each (index)->
75
76
  $el = $(this)
@@ -11,6 +11,8 @@ module EgovUtils
11
11
  enum person_type: { natural: 1, legal: 16 }
12
12
 
13
13
  validates :person_entity, presence: true
14
+
15
+ before_validation :keep_correct_person_type
14
16
  before_validation :set_person_from_remote_id
15
17
 
16
18
  accepts_nested_attributes_for :residence, :natural_person, :legal_person
@@ -79,5 +81,14 @@ module EgovUtils
79
81
  self.residence =
80
82
  EgovUtils::Iszr::Addresses::Fetch.run!(remote_id:, person_type:)
81
83
  end
84
+
85
+ def keep_correct_person_type
86
+ case person_type
87
+ when 'natural'
88
+ self.legal_person = nil
89
+ when 'legal'
90
+ self.natural_person = nil
91
+ end
92
+ end
82
93
  end
83
94
  end
@@ -9,7 +9,8 @@ module EgovUtils
9
9
 
10
10
  def handle_response!
11
11
  EgovUtils::Address.new(
12
- street: response_body.xpath('//UliceNazev').text,
12
+ street:
13
+ response_body.xpath('//UliceNazev').text.presence || response_body.xpath('//CastObceNazev').text,
13
14
  house_number: response_body.xpath('//CisloDomovni').text,
14
15
  orientation_number: response_body.xpath('//CisloOrientacni').text,
15
16
  city: response_body.xpath('//ObecNazev').text,
@@ -1,3 +1,3 @@
1
1
  module EgovUtils
2
- VERSION = '1.5.0.alpha8'
2
+ VERSION = '1.5.0.alpha10'
3
3
  end
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.alpha8
4
+ version: 1.5.0.alpha10
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-09-17 00:00:00.000000000 Z
11
+ date: 2024-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails