summaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
Diffstat (limited to 'resources')
-rw-r--r--resources/assets/js/forms.js33
-rw-r--r--resources/assets/js/vendor.js7
2 files changed, 36 insertions, 4 deletions
diff --git a/resources/assets/js/forms.js b/resources/assets/js/forms.js
index 13e42d26..f1581907 100644
--- a/resources/assets/js/forms.js
+++ b/resources/assets/js/forms.js
@@ -92,3 +92,36 @@ $(function () {
return ($(window).height() - 50) + 'px';
}).css('overflow-y', 'scroll');
});
+
+/*
+ * Add a datepicker to all date input fields.
+ */
+$(function () {
+ $('.input-group.date').each(function () {
+ var elem = $(this);
+ var opts = {
+ minDate: '',
+ maxDate: '',
+ locale: 'en',
+ format: 'YYYY-MM-DD',
+ widgetPositioning: {horizontal: 'auto', vertical: 'bottom'}
+ };
+ $.extend(opts, elem.data());
+ if (opts.minDate.length === 0) {
+ delete opts.minDate;
+ }
+ if (opts.maxDate.length === 0) {
+ delete opts.maxDate;
+ }
+ elem.children('input').attr('type', 'text');
+ elem.children().on('click', function (ev) {
+ ev.stopImmediatePropagation();
+ if (elem.data('DateTimePicker') === undefined) {
+ elem.datetimepicker(opts);
+ elem.data('DateTimePicker').show();
+ } else {
+ elem.data('DateTimePicker').toggle();
+ }
+ });
+ });
+});
diff --git a/resources/assets/js/vendor.js b/resources/assets/js/vendor.js
index f9cddad6..07561fdf 100644
--- a/resources/assets/js/vendor.js
+++ b/resources/assets/js/vendor.js
@@ -1,12 +1,11 @@
window.$ = window.jQuery = require('jquery');
require('imports-loader?define=>false!jquery-ui');
require('bootstrap');
-require('imports-loader?define=>false&exports=>false!bootstrap-datepicker');
-require('bootstrap-datepicker/js/locales/bootstrap-datepicker.de');
-require('bootstrap-datepicker/dist/css/bootstrap-datepicker3.min.css');
-require('imports-loader?this=>window!chart.js');
require('imports-loader?this=>window&define=>false&exports=>false!moment');
require('imports-loader?this=>window&define=>false&exports=>false!moment/locale/de');
+require('imports-loader?define=>false&exports=>false!eonasdan-bootstrap-datetimepicker');
+require('eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css');
+require('imports-loader?this=>window!chart.js');
require('./forms');
require('./sticky-headers');
require('./moment-countdown');