Improve info cards on Punches/History page
This commit is contained in:
parent
accc804040
commit
3a9efd0670
@ -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"
|
||||
]);
|
@ -14,7 +14,7 @@ define("PAGES", [
|
||||
"title" => "404 error"
|
||||
],
|
||||
"punches" => [
|
||||
"title" => "punch card",
|
||||
"title" => "history",
|
||||
"navbar" => true,
|
||||
"icon" => "clock-o",
|
||||
"styles" => [
|
||||
|
@ -36,7 +36,7 @@ redirectifnotloggedin();
|
||||
?>
|
||||
<i class="fa fa-info-circle"></i> <span id="inmsg"<?php echo ($in ? '' : ' style="display: none;"') ?>><?php lang("you are punched in"); ?></span><span id="outmsg"<?php echo ($in ? ' style="display: none;"' : '') ?>><?php lang("you are not punched in"); ?></span>
|
||||
<br />
|
||||
<a href="app.php?page=punches" style="color: #01579b;"><i class="fa fa-arrow-right"></i> <?php lang("view punch card"); ?></a>
|
||||
<a href="app.php?page=punches#punches" style="color: #01579b;"><i class="fa fa-arrow-right"></i> <?php lang("view punch card"); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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);
|
||||
?>
|
||||
<p class="page-header h5"><i class="fa fa-calendar fa-fw"></i> <?php lang("this week") ?></p>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-6 col-md-4">
|
||||
|
||||
<div class="col-xs-12 col-sm-6 col-md-4 col-md-offset-2">
|
||||
<div class="panel panel-blue">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">
|
||||
<i class="fa fa-clock-o"></i> <?php lang("this week"); ?>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<h4>
|
||||
<?php
|
||||
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);
|
||||
lang2("x on the clock", ["time" => seconds2string($totalseconds, false)]);
|
||||
?>
|
||||
</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-sm-6 col-md-4">
|
||||
<div class="panel panel-blue">
|
||||
<div class="panel-body">
|
||||
<h4>
|
||||
<?php
|
||||
lang2("x punches", ["count" => $totalpunches]);
|
||||
?>
|
||||
</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a id="punches" style="height: 0px; width: 0px;"> </a>
|
||||
|
||||
<p class="page-header h5"><i class="fa fa-clock-o fa-fw"></i> <?php lang("punch card") ?></p>
|
||||
<table id="punchtable" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -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) {
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user