@osimatic/helpers-js 1.0.83 → 1.0.85
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 +7 -5
- package/location.js +17 -0
- package/package.json +1 -1
package/form_helper.js
CHANGED
|
@@ -13,9 +13,11 @@ class FormHelper {
|
|
|
13
13
|
return form;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
static reset(form) {
|
|
17
|
-
form.find('
|
|
18
|
-
|
|
16
|
+
static reset(form, submitButton) {
|
|
17
|
+
submitButton = typeof submitButton != 'undefined' && null != submitButton ? submitButton : form.find('button[name="validate"]');
|
|
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(''));
|
|
20
|
+
FormHelper.buttonLoader(submitButton, 'reset');
|
|
19
21
|
FormHelper.hideFormErrors(form);
|
|
20
22
|
return form;
|
|
21
23
|
}
|
|
@@ -300,7 +302,7 @@ class FormHelper {
|
|
|
300
302
|
return self;
|
|
301
303
|
}
|
|
302
304
|
button.attr('disabled', true);
|
|
303
|
-
button.
|
|
305
|
+
button.data('btn-text', button.html());
|
|
304
306
|
//let text = '<span class="spinner"><i class=\'fa fa-circle-notch fa-spin\'></i></span>Traitement en cours…';
|
|
305
307
|
let text = '<i class=\'fa fa-circle-notch fa-spin\'></i> Traitement en cours…';
|
|
306
308
|
if (button.data('load-text') != undefined && button.data('load-text') != null && button.data('load-text') != '') {
|
|
@@ -313,7 +315,7 @@ class FormHelper {
|
|
|
313
315
|
button.addClass('disabled');
|
|
314
316
|
}
|
|
315
317
|
if (action === 'stop' || action === 'reset') {
|
|
316
|
-
button.html(button.
|
|
318
|
+
button.html(button.data('btn-text'));
|
|
317
319
|
button.removeClass('disabled');
|
|
318
320
|
button.attr('disabled', false);
|
|
319
321
|
//button.removeAttr("disabled");
|
package/location.js
CHANGED
|
@@ -288,6 +288,23 @@ class Country {
|
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
class PostalAddress {
|
|
291
|
+
static setAutocomplete(input, onPlaceChanged) {
|
|
292
|
+
let autocomplete = new google.maps.places.Autocomplete(
|
|
293
|
+
input[0],
|
|
294
|
+
{types: ['geocode']}
|
|
295
|
+
);
|
|
296
|
+
//console.log(autocomplete);
|
|
297
|
+
|
|
298
|
+
// When the user selects an address from the dropdown, populate the address fields in the form.
|
|
299
|
+
autocomplete.addListener('place_changed', function() {
|
|
300
|
+
let place = autocomplete.getPlace();
|
|
301
|
+
input.val('');
|
|
302
|
+
if (typeof onPlaceChanged == 'function') {
|
|
303
|
+
onPlaceChanged(place['formatted_address']);
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
|
|
291
308
|
static format(addressData, separator) {
|
|
292
309
|
if (typeof separator == 'undefined') {
|
|
293
310
|
separator = '<br/>';
|