datetime-picker.js: Show an icon inside the flatpickr input

This commit is contained in:
Johannes Meyer 2021-04-16 11:17:19 +02:00
parent 5a6e3cf32f
commit 4236dd84d9
1 changed files with 7 additions and 0 deletions

View File

@ -9,6 +9,7 @@
try {
var Flatpickr = require('icinga/ipl/vendor/flatpickr');
var notjQuery = require('icinga/ipl/notjQuery');
} catch (e) {
console.warn('Unable to provide datetime picker. Libraries not available:', e);
return;
@ -102,6 +103,8 @@
var fp = Flatpickr(this, options);
fp.calendarContainer.classList.add('icinga-datetime-picker');
this.parentNode.insertBefore(_this.renderIcon(), fp.altInput.nextSibling);
_this._pickers.set(fp, containerId);
});
};
@ -174,6 +177,10 @@
}
};
DatetimePicker.prototype.renderIcon = function () {
return notjQuery.render('<i class="icon fa fa-calendar" role="image"></i>');
};
Icinga.Behaviors.DatetimePicker = DatetimePicker;
})(Icinga, jQuery);