Skip to content

Commit

Permalink
Feature: Inititial functionality for sort order icons on table headers
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyq committed Sep 20, 2024
1 parent 5a20c7f commit 55c832b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
19 changes: 16 additions & 3 deletions clients.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,22 @@ class="collapse mt-3
<table class="table table-striped table-hover table-borderless">
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=client_name&order=<?php echo $disp; ?>">Client Name</a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=location_city&order=<?php echo $disp; ?>">Primary Location </a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=contact_name&order=<?php echo $disp; ?>">Primary Contact</a></th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=client_name&order=<?php echo $disp; ?>">
Client Name <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=location_city&order=<?php echo $disp; ?>">
Primary Location <?php if ($sort == 'location_city') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=contact_name&order=<?php echo $disp; ?>">
Primary Contact
<?php if ($sort == 'contact_name') { echo $order_icon; } ?>
</a>
</th>
<?php if (($session_user_role == 3 || $session_user_role == 1) && $config_module_enable_accounting == 1) { ?> <th class="text-right">Billing</th> <?php } ?>
<?php if ($session_user_role == 3) { ?> <th class="text-center">Action</th> <?php } ?>
</tr>
Expand Down
9 changes: 9 additions & 0 deletions pagination_head.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@
}
}

// Set the order Icon
if ($sort) {
if ($order == "ASC") {
$order_icon = "<i class='fas fa-fw fa-sort-up'></i>";
} else {
$order_icon = "<i class='fas fa-fw fa-sort-down'></i>";
}
}

// Search
if (isset($_GET['q'])) {
$q = sanitizeInput($_GET['q']);
Expand Down

0 comments on commit 55c832b

Please sign in to comment.