@osimatic/helpers-js 1.0.84 → 1.0.86
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/form_helper.js +2 -1
- package/location.js +19 -13
- package/package.json +1 -1
package/form_helper.js
CHANGED
|
@@ -15,7 +15,8 @@ class FormHelper {
|
|
|
15
15
|
|
|
16
16
|
static reset(form, submitButton) {
|
|
17
17
|
submitButton = typeof submitButton != 'undefined' && null != submitButton ? submitButton : form.find('button[name="validate"]');
|
|
18
|
-
form.find('input[name]:not([type="checkbox"], [type="radio"]), select, textarea').each((idx, el) => $(el).val('')).off('change');
|
|
18
|
+
form.find('input[name]:not([type="checkbox"], [type="radio"]), select:not(.selectpicker), textarea').each((idx, el) => $(el).val('')).off('change');
|
|
19
|
+
form.find('select.selectpicker').each((idx, el) => $(el).val(''));
|
|
19
20
|
FormHelper.buttonLoader(submitButton, 'reset');
|
|
20
21
|
FormHelper.hideFormErrors(form);
|
|
21
22
|
return form;
|
package/location.js
CHANGED
|
@@ -310,6 +310,10 @@ class PostalAddress {
|
|
|
310
310
|
separator = '<br/>';
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
+
function empty(value) {
|
|
314
|
+
return typeof value == 'undefined' || value == null || value === '';
|
|
315
|
+
}
|
|
316
|
+
|
|
313
317
|
/*
|
|
314
318
|
var address = new Address({
|
|
315
319
|
country: "USA",
|
|
@@ -324,23 +328,25 @@ class PostalAddress {
|
|
|
324
328
|
console.log(formatted);
|
|
325
329
|
*/
|
|
326
330
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
331
|
+
addressData['countryCode'] = !empty(addressData['countryCode'])?addressData['countryCode']:null;
|
|
332
|
+
|
|
333
|
+
let addressDataForPluging = {
|
|
334
|
+
streetAddress: (!empty(addressData['streetAddress'])?addressData['streetAddress']:'')+(!empty(addressData['additionalAddress'])?"\n"+addressData['additionalAddress']:''),
|
|
335
|
+
postalCode: !empty(addressData['postalCode'])?addressData['postalCode']:null,
|
|
336
|
+
locality: !empty(addressData['locality'])?addressData['locality']:null,
|
|
337
|
+
region: !empty(addressData['state'])?addressData['state']:null,
|
|
338
|
+
countryCode: addressData['countryCode'],
|
|
339
|
+
country: Country.getCountryName(addressData['countryCode']),
|
|
334
340
|
};
|
|
335
|
-
if (addressDataForPluging
|
|
336
|
-
addressDataForPluging
|
|
341
|
+
if (addressDataForPluging['locality'] == null && !empty(addressData['suburb'])) {
|
|
342
|
+
addressDataForPluging['locality'] = addressData['suburb'];
|
|
337
343
|
}
|
|
338
|
-
if (addressDataForPluging
|
|
339
|
-
addressDataForPluging
|
|
344
|
+
if (addressDataForPluging['locality'] == null && !empty(addressData['stateDistrict'])) {
|
|
345
|
+
addressDataForPluging['locality'] = addressData['stateDistrict'];
|
|
340
346
|
}
|
|
341
347
|
|
|
342
|
-
|
|
343
|
-
|
|
348
|
+
let af = new AddressFmt();
|
|
349
|
+
let formattedAddress = af.format(new Address(addressDataForPluging));
|
|
344
350
|
return formattedAddress.replace(/\n+/g, separator);
|
|
345
351
|
}
|
|
346
352
|
|