diff --git a/includes/sys_form.php b/includes/sys_form.php
index fccdfacc..3e2222f2 100644
--- a/includes/sys_form.php
+++ b/includes/sys_form.php
@@ -94,12 +94,12 @@ function form_datetime(string $name, string $label, $value)
}
return form_element($label, sprintf('
-
+
'
- . '' . icon('grid-3x3-gap-fill') . '
+ class="form-control" value="%s" autocomplete="off" data-target="#%s">'
+ . '' . icon('grid-3x3-gap-fill') . '
- ', $dom_id, $name, htmlspecialchars($value ? $value->format('Y-m-d H:i') : '')), $dom_id);
+ ', $dom_id, $name, htmlspecialchars($value ? $value->format('Y-m-d H:i') : ''), $dom_id), $dom_id);
}
/**
diff --git a/package.json b/package.json
index 28ccfee8..0c97ee68 100644
--- a/package.json
+++ b/package.json
@@ -16,13 +16,13 @@
"bootstrap": "^5.0.0",
"chart.js": "^2.9.3",
"core-js": "^3.6.5",
- "eonasdan-bootstrap-datetimepicker": "^4.17.47",
"jquery": "^3.5.1",
"jquery-ui": "^1.11.2",
"moment": "^2.27.0",
"moment-timezone": "^0.5.31",
"select2": "^4.0.13",
- "select2-bootstrap-5-theme": "^1.1.1"
+ "select2-bootstrap-5-theme": "^1.1.1",
+ "tempusdominus-bootstrap-4": "^5.39.0"
},
"devDependencies": {
"@babel/core": "^7.11.5",
diff --git a/resources/assets/js/forms.js b/resources/assets/js/forms.js
index ed0f9a46..323b6290 100644
--- a/resources/assets/js/forms.js
+++ b/resources/assets/js/forms.js
@@ -108,7 +108,13 @@ $(function () {
maxDate: '',
locale: $('html').attr('lang'),
format: element.format,
- widgetPositioning: {horizontal: 'auto', vertical: 'bottom'}
+ widgetPositioning: {horizontal: 'auto', vertical: 'bottom'},
+ icons: {
+ time: 'bi bi-clock',
+ date: 'bi bi-calendar',
+ up: 'bi bi-arrow-up',
+ down: 'bi bi-arrow-down'
+ }
};
$.extend(opts, elem.data());
if (opts.minDate.length === 0) {
@@ -120,13 +126,19 @@ $(function () {
elem.children('input').attr('type', 'text');
elem.children().on('click', function (ev) {
ev.stopImmediatePropagation();
- if (typeof elem.data('DateTimePicker') === 'undefined') {
+ if (typeof elem.data('datetimepicker') === 'undefined') {
elem.datetimepicker(opts);
- elem.data('DateTimePicker').show();
+ elem.data('datetimepicker').show();
+
+ // close on click anywhere outside
+ $(document).on('click', () => {
+ elem.data('datetimepicker').hide()
+ })
} else {
- elem.data('DateTimePicker').toggle();
+ elem.data('datetimepicker').toggle();
}
});
+
});
});
});
@@ -140,19 +152,29 @@ $(function () {
var opts = {
locale: $('html').attr('lang'),
format: 'HH:mm',
- widgetPositioning: {horizontal: 'auto', vertical: 'bottom'}
+ widgetPositioning: {horizontal: 'auto', vertical: 'bottom'},
+ icons: {
+ up: 'bi bi-arrow-up',
+ down: 'bi bi-arrow-down'
+ }
};
$.extend(opts, elem.data());
elem.children('input').attr('type', 'text');
elem.children('input').on('click', function (ev) {
ev.stopImmediatePropagation();
- if (typeof elem.data('DateTimePicker') === 'undefined') {
+ if (typeof elem.data('datetimepicker') === 'undefined') {
elem.datetimepicker(opts);
- elem.data('DateTimePicker').show();
+ elem.data('datetimepicker').show();
+
+ // close on click anywhere outside
+ $(document).on('click', () => {
+ elem.data('datetimepicker').hide()
+ })
} else {
- elem.data('DateTimePicker').toggle();
+ elem.data('datetimepicker').toggle();
}
});
+
});
});
diff --git a/resources/assets/js/vendor.js b/resources/assets/js/vendor.js
index e0fc09f2..d0c1731c 100644
--- a/resources/assets/js/vendor.js
+++ b/resources/assets/js/vendor.js
@@ -4,7 +4,7 @@ require('jquery-ui');
window.bootstrap = require('bootstrap');
window.moment = require('moment');
require('moment/locale/de');
-require('eonasdan-bootstrap-datetimepicker');
+require('tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4');
require('chart.js');
require('./offcanvas');
require('./forms');
diff --git a/resources/assets/themes/base.scss b/resources/assets/themes/base.scss
index 49cacf5d..26470aa3 100644
--- a/resources/assets/themes/base.scss
+++ b/resources/assets/themes/base.scss
@@ -17,7 +17,7 @@ $theme-colors: map-merge($theme-colors, $custom-colors);
@import "~bootstrap/scss/bootstrap";
@import "~bootstrap-icons/font/bootstrap-icons.css";
-@import "~eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.css";
+@import "~tempusdominus-bootstrap-4/build/css/tempusdominus-bootstrap-4";
@import "~select2/src/scss/core";
@import "~select2-bootstrap-5-theme/src/include-all";
@import "error";
@@ -82,6 +82,17 @@ table a > .icon-icon_angel {
background-color: $body-color;
}
+.table .form-group {
+ margin-bottom: 0;
+}
+
+.input-group.datetime,
+.input-group.time {
+ .bootstrap-datetimepicker-widget {
+ inset: 42px auto auto 0 !important;
+ }
+}
+
.stats {
font-size: 20px;
height: 150px;
diff --git a/resources/views/pages/user-shifts.html b/resources/views/pages/user-shifts.html
index 479aa823..bd2179d5 100644
--- a/resources/views/pages/user-shifts.html
+++ b/resources/views/pages/user-shifts.html
@@ -3,32 +3,34 @@
%title%
-
%start_select%
-