From 0b45d2a88febf2aac299fe504bb68b2fafcef068 Mon Sep 17 00:00:00 2001
From: Igor Scheller
Date: Wed, 29 Nov 2017 13:23:38 +0100
Subject: #366 Feature: Time Interval Buttons (on Shifts page), closes #366
---
includes/pages/user_shifts.php | 9 ++++-
locale/de_DE.UTF-8/LC_MESSAGES/default.mo | Bin 41242 -> 41508 bytes
locale/de_DE.UTF-8/LC_MESSAGES/default.po | 30 +++++++++++++++-
public/js/forms.js | 57 ++++++++++++++++++++++++++++++
templates/user_shifts.html | 13 +++++++
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])
) . '
',
- '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..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 @@
+
%room_select%
%type_select%
--
cgit v1.2.3-54-g00ecf
From b29e23f0864edad3c20716581de73e81c335b615 Mon Sep 17 00:00:00 2001
From: Igor Scheller
Date: Wed, 29 Nov 2017 13:49:21 +0100
Subject: #366 Feature: Time Interval Buttons (on Shifts page): Formatting
mimimi
---
public/js/forms.js | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/public/js/forms.js b/public/js/forms.js
index d75a4391..97a89465 100644
--- a/public/js/forms.js
+++ b/public/js/forms.js
@@ -21,14 +21,14 @@ function checkAll(id, checked) {
* @param {moment} date
*/
function formatDay(date) {
- return date.format('YYYY-MM-DD')
+ return date.format("YYYY-MM-DD");
}
/**
* @param {moment} date
*/
function formatTime(date) {
- return date.format('HH:mm')
+ return date.format("HH:mm");
}
/**
@@ -36,13 +36,13 @@ function formatTime(date) {
* @param {moment} to
*/
function setInput(from, to) {
- var from_day = $('#start_day'), from_time = $('#start_time'), to_day = $('#end_day'), to_time = $('#end_time');
+ var fromDay = $("#start_day"), fromTime = $("#start_time"), toDay = $("#end_day"), toTime = $("#end_time");
- from_day.val(formatDay(from));
- from_time.val(formatTime(from));
+ fromDay.val(formatDay(from));
+ fromTime.val(formatTime(from));
- to_day.val(formatDay(to));
- to_time.val(formatTime(to));
+ toDay.val(formatDay(to));
+ toTime.val(formatTime(to));
}
function setDay(days) {
@@ -51,12 +51,12 @@ function setDay(days) {
var from = moment();
from.hours(0).minutes(0).seconds(0);
- from.add(days, 'd');
+ from.add(days, "d");
var to = from.clone();
to.hours(23).minutes(59);
- setInput(from, to)
+ setInput(from, to);
}
function setHours(hours) {
@@ -65,7 +65,7 @@ function setHours(hours) {
var from = moment();
var to = from.clone();
- to.add(hours, 'h');
+ to.add(hours, "h");
if (to < from) {
setInput(to, from);
return;
--
cgit v1.2.3-54-g00ecf