From 0b45d2a88febf2aac299fe504bb68b2fafcef068 Mon Sep 17 00:00:00 2001
From: Igor Scheller
Date: Wed, 29 Nov 2017 13:23:38 +0100
Subject: [PATCH 1/2] #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 bfe3aa4240bfc2f5c01576bb47ec944db91552b0..fd3f822a3c08970824677dea172ac960f7caf70e 100644
GIT binary patch
delta 11584
zcmYk?2YgTW{>Skn$P!7cgb+evBoPsUP&2i6D|U+@L=Z((5j{pLidwO0?NL>#TC-|Y
zin>*_RsSlb#WhN=Rdn!wy?@_t`sjJwPoAIe_l)m6C%NujcGzp(5ij>*@j?q7j$kjx
zDTgb99VbtDMb$b^&FYR*2@|k9reIMVjm2;>24ODhmbF*~^Dq*BwFbwT=Om)q>5fGl
z$91wuXw#X5{x}a~aE0|KdQ-k>R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w~43ERrY)CW>p^{^zj-_{bZsE
zWgQnNHzWE|o=0p^B}YF(zi)JW&-u14e%vK==&Pk;kiq@41V8I>{(bZ(u2bfBlKc1j
zemqOuviG0BNaBvo%i=>@_QvwWcQ(I|KM<})JV3|42oE-)j*Xo7k10CEDTh;TM?_K9
z@dEZFVkw`-d?K0f;{N8;HKF`a7jg_HHjuwTR3dbILo738=AR>zpzZy9~Eba#rDJi
z{DS(HL}lVl;y#f<9OB$cTtz%0o*nv|@N1$J=Z_NeiLK2R?m@b4JNYW2)N?nzW3TxYrxG(bR}$lGz3W4JaYa=S5kzxht#Xb~
z;ux{W<{w$7U^n6_@jK^d63-vn*z2jNgZ&8|xkNR}b={f!hs*h!iYxYl1nNfF^0RBa
z?WR*wfRrv|Dv2qoS^K3MNvmr;u3i)OhFy(t&x;(6Z46#wvM9vn8MGt
z#C2jE=bGyMKSJRi6{CoPgg^OT|L4Y^ZSHF=%=GElNnVih0m|3hHT)Z&y2q3++G}@P
zd`r29)?de1Vg)gQ7(>JmIYcYYcO-TYFOp9src-`)6rx<(=2dXXbLVu;
z2;wd3Dq^TT_pwe?>Kiej-{9ff>s4zSo#jdn-kzO&)MNX|ZgqUJK1++wdXRRtQ0<8L
lnhoN%|J*w>E~{Tw#P+#aqYG~LSsvz_RWGM`){>ls{{>szTVMbH
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%
From b29e23f0864edad3c20716581de73e81c335b615 Mon Sep 17 00:00:00 2001
From: Igor Scheller
Date: Wed, 29 Nov 2017 13:49:21 +0100
Subject: [PATCH 2/2] #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;