From f83e754f8491d895502484637db289f7321bfc1a Mon Sep 17 00:00:00 2001 From: MichiK <6341204+der-michik@users.noreply.github.com> Date: Fri, 7 Dec 2018 23:34:30 +0100 Subject: Fix the timepicker in shifts view This is one part of #516. --- resources/assets/js/forms.js | 8 ++++---- resources/views/pages/user-shifts.html | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/resources/assets/js/forms.js b/resources/assets/js/forms.js index 24f94cf3..2531f04e 100644 --- a/resources/assets/js/forms.js +++ b/resources/assets/js/forms.js @@ -118,7 +118,7 @@ $(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(); } else { @@ -133,16 +133,16 @@ $(function () { */ $(function () { $('.input-group.time').each(function () { - var elem = $(this); + var elem = $(this).children('input').first(); var opts = { locale: 'en', format: 'HH:mm', widgetPositioning: {horizontal: 'auto', vertical: 'bottom'} }; $.extend(opts, elem.data()); - elem.children('input').attr('type', 'text'); + elem.attr('type', 'text'); elem.datetimepicker(opts); - elem.children('input').on('click', function (ev) { + elem.on('click', function (ev) { ev.stopImmediatePropagation(); elem.data('DateTimePicker').toggle(); }); diff --git a/resources/views/pages/user-shifts.html b/resources/views/pages/user-shifts.html index f467c6fd..4a2dc04d 100644 --- a/resources/views/pages/user-shifts.html +++ b/resources/views/pages/user-shifts.html @@ -5,9 +5,10 @@

%title%

%start_select%
-
+
+ pattern="^\d{1,2}:\d{2}$" placeholder="HH:MM" maxlength="5" value="%start_time%" + data-locale="%short_locale%">