From 86606c8055fdd6c5e0b59f06bf9e8c687d05c150 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Sat, 11 Sep 2021 10:46:21 +0200 Subject: [PATCH] fix css and datepicker --- includes/sys_form.php | 2 +- includes/view/ShiftCalendarRenderer.php | 5 +- resources/assets/js/forms.js | 39 ++++++++----- resources/assets/js/sticky-headers.js | 1 + resources/assets/themes/base.scss | 1 + resources/views/layouts/maintenance.html | 72 +++++++++--------------- resources/views/pages/design.twig | 20 +++++++ 7 files changed, 76 insertions(+), 64 deletions(-) diff --git a/includes/sys_form.php b/includes/sys_form.php index 7b21f1c4..9be7173a 100644 --- a/includes/sys_form.php +++ b/includes/sys_form.php @@ -68,7 +68,7 @@ function form_date($name, $label, $value, $start_date = '', $end_date = '') $end_date = is_numeric($end_date) ? date('Y-m-d', $end_date) : ''; return form_element($label, ' -
+
' . '' . icon('grid-3x3-gap-fill') . '
diff --git a/includes/view/ShiftCalendarRenderer.php b/includes/view/ShiftCalendarRenderer.php index 3f7616d1..27a82433 100644 --- a/includes/view/ShiftCalendarRenderer.php +++ b/includes/view/ShiftCalendarRenderer.php @@ -204,10 +204,7 @@ class ShiftCalendarRenderer $rendered_until += ShiftCalendarRenderer::SECONDS_PER_ROW; } - $bg = ''; - if (theme_type() === 'light') { - $bg = 'bg-light'; - } + $bg = 'bg-' . theme_type(); return div('lane', [ div('header ' . $bg, $lane->getHeader()), diff --git a/resources/assets/js/forms.js b/resources/assets/js/forms.js index 204a0fe9..3d64509a 100644 --- a/resources/assets/js/forms.js +++ b/resources/assets/js/forms.js @@ -98,8 +98,16 @@ $(function () { */ $(function () { $([ - {'select': $('.input-group.date'), 'format': 'YYYY-MM-DD'}, - {'select': $('.input-group.datetime'), 'format': 'YYYY-MM-DD HH:mm'}, + { + 'select': $('.input-group.date'), + 'format': 'YYYY-MM-DD', + 'extraFormats': [] + }, + { + 'select': $('.input-group.datetime'), + 'format': 'YYYY-MM-DD HH:mm', + 'extraFormats': ['YYYY-MM-DDTHH:mm'] + }, ]).each(function (_, element) { element.select.each(function () { var elem = $(this); @@ -108,6 +116,7 @@ $(function () { maxDate: '', locale: $('html').attr('lang'), format: element.format, + extraFormats: element.extraFormats, widgetPositioning: {horizontal: 'auto', vertical: 'bottom'}, icons: { time: 'bi bi-clock', @@ -116,29 +125,29 @@ $(function () { down: 'bi bi-arrow-down' } }; + $.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) { + elem.datetimepicker(opts); + + // close on click anywhere outside + $(document).on('click', () => { + elem.data('datetimepicker').hide() + }) + + elem.children().on('click', (ev) => { ev.stopImmediatePropagation(); - if (typeof elem.data('datetimepicker') === 'undefined') { - elem.datetimepicker(opts); - 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/sticky-headers.js b/resources/assets/js/sticky-headers.js index c664387c..a8e139af 100644 --- a/resources/assets/js/sticky-headers.js +++ b/resources/assets/js/sticky-headers.js @@ -23,6 +23,7 @@ $(document).ready(function () { }); headers.css({ 'top': Math.max(0, $(window).scrollTop() - top + - 13 + topReference.offset().top) + 'px' }); diff --git a/resources/assets/themes/base.scss b/resources/assets/themes/base.scss index 5ddb42ec..b68113d2 100644 --- a/resources/assets/themes/base.scss +++ b/resources/assets/themes/base.scss @@ -106,6 +106,7 @@ table a > .icon-icon_angel { margin-bottom: 0; } +.input-group.date, .input-group.datetime, .input-group.time { .bootstrap-datetimepicker-widget { diff --git a/resources/views/layouts/maintenance.html b/resources/views/layouts/maintenance.html index c0b52b44..c2473b70 100644 --- a/resources/views/layouts/maintenance.html +++ b/resources/views/layouts/maintenance.html @@ -8,59 +8,43 @@ -