@kigi/components 1.5.1 → 1.5.2
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.
package/package.json
CHANGED
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
<div class="mbg-input-wrapper input-cep-wrapper">
|
|
32
32
|
<input autocomplete="{{ $ctrl.autocompleteValue }}"
|
|
33
33
|
autocorrect="{{ $ctrl.autocompleteValue }}"
|
|
34
|
-
ng-class="{'mbg-error': !$ctrl.entity.zipCode && $ctrl.inputErrors}"
|
|
35
|
-
mbg-error="!$ctrl.entity.zipCode"
|
|
34
|
+
ng-class="{'mbg-error': (!$ctrl.entity.zipCode && $ctrl.inputErrors) || $ctrl.notFoundCep}"
|
|
35
|
+
mbg-error="!$ctrl.entity.zipCode || $ctrl.notFoundCep"
|
|
36
36
|
mbg-error-when="$ctrl.inputErrors"
|
|
37
37
|
mbg-error-message="É necessário informar o CEP"
|
|
38
38
|
spellcheck="false"
|
|
@@ -27,6 +27,7 @@ class MbgAddressManualController {
|
|
|
27
27
|
public entity: any = {}
|
|
28
28
|
public countries: any[]
|
|
29
29
|
public inputErrors: boolean = false
|
|
30
|
+
public notFoundCep: boolean = false
|
|
30
31
|
|
|
31
32
|
constructor(
|
|
32
33
|
public $scope,
|
|
@@ -35,6 +36,7 @@ class MbgAddressManualController {
|
|
|
35
36
|
public $http,
|
|
36
37
|
public mbgAddressService,
|
|
37
38
|
public EX,
|
|
39
|
+
public notFound,
|
|
38
40
|
) {}
|
|
39
41
|
|
|
40
42
|
$onInit() {
|
|
@@ -104,6 +106,7 @@ class MbgAddressManualController {
|
|
|
104
106
|
if (this.entity && this.entity.zipCode) {
|
|
105
107
|
this.mbgAddressService.getCep(this.entity.zipCode).then((response) => {
|
|
106
108
|
if (response && response.data && response.data.cep) {
|
|
109
|
+
this.notFoundCep = false
|
|
107
110
|
const formalCode = response.data.ibge || ''
|
|
108
111
|
const premisse = this.formatFromPremisse(response.data.logradouro)
|
|
109
112
|
this.entity = {
|
|
@@ -121,6 +124,9 @@ class MbgAddressManualController {
|
|
|
121
124
|
formalCode,
|
|
122
125
|
state: response.data.uf,
|
|
123
126
|
}
|
|
127
|
+
} else {
|
|
128
|
+
this.notFoundCep = true
|
|
129
|
+
this.notFound()
|
|
124
130
|
}
|
|
125
131
|
})
|
|
126
132
|
}
|
|
@@ -166,6 +172,7 @@ MbgAddressManualController['$inject'] = [
|
|
|
166
172
|
'$http',
|
|
167
173
|
'mbgAddressService',
|
|
168
174
|
'EX',
|
|
175
|
+
'notFound',
|
|
169
176
|
]
|
|
170
177
|
|
|
171
178
|
export { MbgAddressManualController }
|