cloudlog/application/views/accumulate/index.php
Peter Goodhall d1446a6c22 Add HTMX component and refactor accumulated UI/JS
Introduce a new partial view and controller endpoint for rendering accumulated-results as an HTMX component, and refactor the accumulated statistics page and JS. Changes include: adding component_accumulated_results() in the Accumulated controller and a new view (accumulate/component_results.php) exposing filter params via data-attributes; updating accumulate/index.php to use a card-based layout, improved form markup, and HTMX attributes to load the results component; and a major rewrite of assets/js/sections/accumulatedstatistics.js to modularize logic (getAwardText, setAccumulateLoading, accumulateRender), improve loading/error handling, rebuild chart/table markup, update DataTables usage, and hook into htmx:afterSwap to render the chart when the component is swapped in. Overall this enables partial updates, better UX, and cleaner client-side code.
2026-04-26 22:05:52 +01:00

103 lines
5.2 KiB
PHP

<div class="container">
<div class="d-flex align-items-center justify-content-between flex-wrap gap-2 mb-3">
<div>
<h1 class="mb-0"><?php echo $page_title; ?></h1>
<p class="text-muted mb-0">Track cumulative award progress over time by band, mode, and period.</p>
</div>
</div>
<div class="card shadow-sm mb-4">
<div class="card-header py-3">
<h2 class="h5 mb-0">Filters</h2>
</div>
<div class="card-body">
<form id="accumulatedFiltersForm"
class="form"
hx-post="<?php echo site_url('accumulated/component_accumulated_results'); ?>"
hx-target="#accumulateResults"
hx-swap="innerHTML"
hx-trigger="change from:select, change from:input[type='radio'], submit">
<div class="row g-3 align-items-end mb-2">
<div class="col-md-4">
<label class="form-label" for="band">Band</label>
<select id="band" name="band" class="form-select">
<option value="All">All</option>
<?php foreach($worked_bands as $band) {
echo '<option value="' . $band . '">' . $band . '</option>' . "\n";
} ?>
</select>
</div>
<div class="col-md-4">
<label class="form-label" for="mode">Mode</label>
<select id="mode" name="mode" class="form-select">
<option value="All">All</option>
<?php
foreach($modes->result() as $mode){
if ($mode->submode == null) {
printf("<option value=\"%s\">%s</option>", $mode->mode, $mode->mode);
} else {
printf("<option value=\"%s\">%s</option>", $mode->submode, $mode->submode);
}
}
?>
</select>
</div>
</div>
<div class="row g-3 align-items-end">
<div class="col-md-5">
<label class="form-label d-block mb-2">Award</label>
<div class="d-flex flex-wrap gap-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="awardradio" id="dxcc" value="dxcc" checked>
<label class="form-check-label" for="dxcc">DXCC</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="awardradio" id="was" value="was">
<label class="form-check-label" for="was">WAS</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="awardradio" id="iota" value="iota">
<label class="form-check-label" for="iota">IOTA</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="awardradio" id="waz" value="waz">
<label class="form-check-label" for="waz">WAZ</label>
</div>
</div>
</div>
<div class="col-md-3">
<label class="form-label d-block mb-2">Period</label>
<div class="d-flex flex-wrap gap-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="periodradio" id="yearly" value="year" checked>
<label class="form-check-label" for="yearly">Yearly</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="periodradio" id="monthly" value="month">
<label class="form-check-label" for="monthly">Monthly</label>
</div>
</div>
</div>
<div class="col-md-4 d-flex justify-content-md-end gap-2">
<button id="accumulateShowButton" type="submit" class="btn btn-primary ld-ext-right">
Show
<div class="ld ld-ring ld-spin"></div>
</button>
</div>
</div>
</form>
</div>
</div>
<div id="accumulateResults"
hx-post="<?php echo site_url('accumulated/component_accumulated_results'); ?>"
hx-target="this"
hx-swap="innerHTML"
hx-include="#accumulatedFiltersForm"
hx-trigger="load"></div>
</div>