summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/pages/user_shifts.php9
-rw-r--r--locale/de_DE.UTF-8/LC_MESSAGES/default.mobin41242 -> 41508 bytes
-rw-r--r--locale/de_DE.UTF-8/LC_MESSAGES/default.po30
-rw-r--r--public/js/forms.js57
-rw-r--r--templates/user_shifts.html13
5 files changed, 107 insertions, 2 deletions
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])
) . '</p>',
- '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
--- a/locale/de_DE.UTF-8/LC_MESSAGES/default.mo
+++ b/locale/de_DE.UTF-8/LC_MESSAGES/default.mo
Binary files 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 <msquare@notrademark.de>\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..d75a4391 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 from_day = $('#start_day'), from_time = $('#start_time'), to_day = $('#end_day'), to_time = $('#end_time');
+
+ from_day.val(formatDay(from));
+ from_time.val(formatTime(from));
+
+ to_day.val(formatDay(to));
+ to_time.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 @@
</div>
</div>
</div>
+ <div class="form-group" style="margin-top: .5em">
+ <div class="btn-group">
+ <a href="javascript:setDay(-1)" class="btn btn-default ">%set_yesterday%</a>
+ <a href="javascript:setDay()" class="btn btn-default ">%set_today%</a>
+ <a href="javascript:setDay(1)" class="btn btn-default ">%set_tomorrow%</a>
+ </div>
+ <div class="btn-group">
+ <a href="javascript:setHours(-8)" class="btn btn-default ">%set_last_8h%</a>
+ <a href="javascript:setHours(-4)" class="btn btn-default ">%set_last_4h%</a>
+ <a href="javascript:setHours(4)" class="btn btn-default ">%set_next_4h%</a>
+ <a href="javascript:setHours(8)" class="btn btn-default ">%set_next_8h%</a>
+ </div>
+ </div>
</div>
<div class="col-md-2">%room_select%</div>
<div class="col-md-2">%type_select%</div>