QoL 50: sortLink and sortFirstOrder in functions/format.php replace the 48 copied sort_link closures and 115 hand-written header links, the first click on a new column sorts names A-Z and dates, money and counts newest or largest first, with changelog lines

This commit is contained in:
johnnyq
2026-11-21 00:59:32 -05:00
parent 3f70c5e2e4
commit 15aeab602d
70 changed files with 348 additions and 621 deletions

View File

@@ -49,10 +49,6 @@ $numbers = mysqli_fetch_row(mysqli_query($mysqli, "SELECT COALESCE(SUM(sms_numbe
$opted_out = intval($numbers[0]);
$blocked = intval($numbers[1]);
$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) {
return '<a class="text-reset text-decoration-none" href="?' . escapeHtml($url_query_strings_sort) . '&amp;sort=' . $column . '&amp;order=' . $disp . '">'
. $label . ($sort === $column ? " $order_icon" : '') . '</a>';
};
$add_url = 'modals/sms_provider/sms_provider_add.php';
$csrf = $_SESSION['csrf_token'];
@@ -93,10 +89,10 @@ $csrf = $_SESSION['csrf_token'];
<table class="table table-hover align-middle mb-0">
<thead class="table-light text-nowrap <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th class="ps-3"><?= $sort_link('sms_provider_name', 'Provider') ?></th>
<th class="d-none d-md-table-cell"><?= $sort_link('sms_provider_number', 'Number') ?></th>
<th class="ps-3"><?= sortLink('sms_provider_name', 'Provider') ?></th>
<th class="d-none d-md-table-cell"><?= sortLink('sms_provider_number', 'Number') ?></th>
<th class="d-none d-lg-table-cell">Texts come back to</th>
<th class="d-none d-md-table-cell"><?= $sort_link('sms_provider_last_inbound_at', 'Last text in') ?></th>
<th class="d-none d-md-table-cell"><?= sortLink('sms_provider_last_inbound_at', 'Last text in') ?></th>
<th></th>
</tr>
</thead>