diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index f8cf71cd..ef21ff1b 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -242,7 +242,14 @@ function view_user_shifts() page_link_to('shifts_json_export', ['key' => $user['api_key']]), page_link_to('user_myshifts', ['reset' => 1]) ) . '

', - 'filter' => _('Filter') + 'filter' => _('Filter'), + 'set_yesterday' => _('Yesterday'), + 'set_today' => _('Today'), + 'set_tomorrow' => _('Tomorrow'), + 'set_last_8h' => _('last 8h'), + 'set_last_4h' => _('last 4h'), + 'set_next_4h' => _('next 4h'), + 'set_next_8h' => _('next 8h'), ]) ]) ]); diff --git a/locale/de_DE.UTF-8/LC_MESSAGES/default.mo b/locale/de_DE.UTF-8/LC_MESSAGES/default.mo index bfe3aa42..fd3f822a 100644 Binary files a/locale/de_DE.UTF-8/LC_MESSAGES/default.mo and b/locale/de_DE.UTF-8/LC_MESSAGES/default.mo differ diff --git a/locale/de_DE.UTF-8/LC_MESSAGES/default.po b/locale/de_DE.UTF-8/LC_MESSAGES/default.po index c8319882..6963cbe6 100644 --- a/locale/de_DE.UTF-8/LC_MESSAGES/default.po +++ b/locale/de_DE.UTF-8/LC_MESSAGES/default.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: Engelsystem 2.0\n" "POT-Creation-Date: 2017-11-24 11:59+0100\n" -"PO-Revision-Date: 2017-11-24 12:00+0100\n" +"PO-Revision-Date: 2017-11-29 13:20+0100\n" "Last-Translator: msquare \n" "Language-Team: \n" "Language: de_DE\n" @@ -1837,6 +1837,34 @@ msgstr "" msgid "Filter" msgstr "Filter" +#: engelsystem/includes/pages/user_shifts.php:246 +msgid "Yesterday" +msgstr "Gestern" + +#: engelsystem/includes/pages/user_shifts.php:247 +msgid "Today" +msgstr "Heute" + +#: engelsystem/includes/pages/user_shifts.php:248 +msgid "Tomorrow" +msgstr "Morgen" + +#: engelsystem/includes/pages/user_shifts.php:249 +msgid "last 8h" +msgstr "letzte 8h" + +#: engelsystem/includes/pages/user_shifts.php:250 +msgid "last 4h" +msgstr "letzte 4h" + +#: engelsystem/includes/pages/user_shifts.php:251 +msgid "next 4h" +msgstr "nächste 4h" + +#: engelsystem/includes/pages/user_shifts.php:252 +msgid "next 8h" +msgstr "nächste 8h" + #: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:278 #: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:49 msgid "All" diff --git a/public/js/forms.js b/public/js/forms.js index c4eb68df..97a89465 100644 --- a/public/js/forms.js +++ b/public/js/forms.js @@ -17,6 +17,63 @@ function checkAll(id, checked) { } } +/** + * @param {moment} date + */ +function formatDay(date) { + return date.format("YYYY-MM-DD"); +} + +/** + * @param {moment} date + */ +function formatTime(date) { + return date.format("HH:mm"); +} + +/** + * @param {moment} from + * @param {moment} to + */ +function setInput(from, to) { + var fromDay = $("#start_day"), fromTime = $("#start_time"), toDay = $("#end_day"), toTime = $("#end_time"); + + fromDay.val(formatDay(from)); + fromTime.val(formatTime(from)); + + toDay.val(formatDay(to)); + toTime.val(formatTime(to)); +} + +function setDay(days) { + days = days || 0; + + var from = moment(); + from.hours(0).minutes(0).seconds(0); + + from.add(days, "d"); + + var to = from.clone(); + to.hours(23).minutes(59); + + setInput(from, to); +} + +function setHours(hours) { + hours = hours || 1; + + var from = moment(); + var to = from.clone(); + + to.add(hours, "h"); + if (to < from) { + setInput(to, from); + return; + } + + setInput(from, to); +} + $(function () { /** * Disable every submit button after clicking (to prevent double-clicking) diff --git a/templates/user_shifts.html b/templates/user_shifts.html index c3fb7718..446c4b82 100644 --- a/templates/user_shifts.html +++ b/templates/user_shifts.html @@ -41,6 +41,19 @@ +
+ + +
%room_select%
%type_select%