diff --git a/lang/en_us.php b/lang/en_us.php index 2620fcb..d8b24c5 100644 --- a/lang/en_us.php +++ b/lang/en_us.php @@ -41,6 +41,8 @@ define("STRINGS", [ "notes" => "Notes", "view punch card" => "View punch card", "na" => "N/A", - "this week" => "This week", - "x on the clock" => "{time} on the clock" + "this week" => "This Week", + "x on the clock" => "{time} on the clock", + "x punches" => "{count} punches", + "history" => "History" ]); \ No newline at end of file diff --git a/pages.php b/pages.php index 840a68e..e9bf776 100644 --- a/pages.php +++ b/pages.php @@ -14,7 +14,7 @@ define("PAGES", [ "title" => "404 error" ], "punches" => [ - "title" => "punch card", + "title" => "history", "navbar" => true, "icon" => "clock-o", "styles" => [ diff --git a/pages/home.php b/pages/home.php index 6d2e3d7..b05a541 100644 --- a/pages/home.php +++ b/pages/home.php @@ -36,7 +36,7 @@ redirectifnotloggedin(); ?>
- + diff --git a/pages/punches.php b/pages/punches.php index 0202678..72b3709 100644 --- a/pages/punches.php +++ b/pages/punches.php @@ -2,33 +2,49 @@ require_once __DIR__ . '/../required.php'; redirectifnotloggedin(); + + +require_once __DIR__ . "/../lib/dates.php"; +$weekstart = sqldatetime(getstartofweek(WEEK_START)); +$punches = $database->select('punches', ['in', 'out'], ['AND' => ['uid' => $_SESSION['uid'], 'in[>]' => $weekstart]]); +$punchtimes = []; +foreach ($punches as $p) { + $punchtimes[] = [$p['in'], $p['out']]; +} +$totalseconds = sumelapsedtimearray($punchtimes); +$totalpunches = count($punches); ?> +
-
+ +
-
-

- -

-

select('punches', ['in', 'out'], ['AND' => ['uid' => $_SESSION['uid'], 'in[>]' => $weekstart]]); - $punchtimes = []; - foreach ($punches as $p) { - $punchtimes[] = [$p['in'], $p['out']]; - } - $totalseconds = sumelapsedtimearray($punchtimes); lang2("x on the clock", ["time" => seconds2string($totalseconds, false)]); ?>

+ +
+
+
+

+ $totalpunches]); + ?> +

+
+
+
+ +  + + diff --git a/static/js/app.js b/static/js/app.js index 54219a5..b9342ef 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -4,6 +4,15 @@ $(document).ready(function () { $(".alert .close").click(function (e) { $(this).parent().fadeOut("slow"); }); + + try { + window.history.replaceState("", "", getniceurl()); + if (window.location.hash) { + document.getElementById(window.location.hash.replace("#", "")).scrollIntoView(); + } + } catch (ex) { + + } }); @@ -11,13 +20,8 @@ $(document).ready(function () { * Remove feedback params from the URL so they don't stick around too long */ function getniceurl() { - var url = window.location.search; + var url = window.location.search + window.location.hash; url = url.substring(url.lastIndexOf("/") + 1); url = url.replace(/&?msg=([^&]$|[^&]*)/i, ""); return url; -} -try { - window.history.replaceState("", "", getniceurl()); -} catch (ex) { - } \ No newline at end of file