Introduce more granular Date-Filter for Stats-Page

This commit is contained in:
int2001
2025-12-31 09:03:13 +00:00
parent 461a0f3819
commit 08d90aec24
5 changed files with 352 additions and 306 deletions

View File

@@ -50,14 +50,30 @@
<small class="text-muted"><?= __("Explore the logbook."); ?></small>
</h2>
<br/>
<select class="form-select form-select-sm me-2 w-auto" style="display:none;" id="yr" name="yr">
<option value='All'><?= __("All Years"); ?></option>
<?php
foreach($years as $yr) {
echo '<option value="'.$yr.'">'.__("Year")." ".$yr.'</option>';
}
?>
</select>
<div class="mb-3" id="dateFilterContainer" style="display:none;">
<label class="form-label"><?= __("Date Presets") . ": " ?></label>
<div class="d-flex gap-1 d-flex flex-wrap mb-2">
<button type="button" class="btn btn-primary btn-sm flex-shrink-0" onclick="applyPreset('today')"><?= __("Today") ?></button>
<button type="button" class="btn btn-primary btn-sm flex-shrink-0" onclick="applyPreset('yesterday')"><?= __("Yesterday") ?></button>
<button type="button" class="btn btn-primary btn-sm flex-shrink-0" onclick="applyPreset('last7days')"><?= __("Last 7 Days") ?></button>
<button type="button" class="btn btn-primary btn-sm flex-shrink-0" onclick="applyPreset('last30days')"><?= __("Last 30 Days") ?></button>
<button type="button" class="btn btn-primary btn-sm flex-shrink-0" onclick="applyPreset('thismonth')"><?= __("This Month") ?></button>
<button type="button" class="btn btn-primary btn-sm flex-shrink-0" onclick="applyPreset('lastmonth')"><?= __("Last Month") ?></button>
<button type="button" class="btn btn-primary btn-sm flex-shrink-0" onclick="applyPreset('thisyear')"><?= __("This Year") ?></button>
<button type="button" class="btn btn-primary btn-sm flex-shrink-0" onclick="applyPreset('lastyear')"><?= __("Last Year") ?></button>
<button type="button" class="btn btn-danger btn-sm flex-shrink-0" onclick="resetDates()"><i class="fas fa-times"></i> <?= __("All") ?></button>
</div>
<div class="row g-2">
<div class="col-auto">
<label class="col-form-label col-form-label-sm" for="dateFrom"><?= __("Date from") ?></label>
<input name="dateFrom" id="dateFrom" type="date" class="form-control form-control-sm w-auto border border-secondary">
</div>
<div class="col-auto">
<label class="col-form-label col-form-label-sm" for="dateTo"><?= __("Date to") ?></label>
<input name="dateTo" id="dateTo" type="date" class="form-control form-control-sm w-auto border border-secondary">
</div>
</div>
</div>
<br>
<div hidden class="tabs">
<ul class="nav nav-tabs" id="myTab" role="tablist">