(feat): filter and direction dropdown

This commit is contained in:
boris
2024-12-03 20:05:15 +00:00
parent 214bfe20ac
commit f9d625e905
5 changed files with 183 additions and 44 deletions

View File

@@ -7,8 +7,6 @@
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/x-icon" href="/images/ecoBuddy_x32.png"
<!-- Bootstrap core CSS -->
<link href="/css/bootstrap.css" rel="stylesheet">
<!-- Bootstrap theme -->
@@ -35,32 +33,54 @@
<a class="nav-link" href="#">Link</a>
</li>
</ul>
<form class="row m-0 me-2 align-content-center align-content-center align-items-center" role="search" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<form class="row m-0 me-2 align-content-center align-content-center align-items-center" role="search" action="" method="POST">
<div class="col">
<div class="form-floating input-group">
<select name="filter" class="form-select border-3 border-success-subtle" id="filter">
<option selected></option>
<option value="1">Title</option>
<option value="2">Category</option>
<option value="0">Status</option>
<option value="3">Description</option>
<option value="4">Street Name</option>
<option value="5">County</option>
<option value="6">Town</option>
<option value="7">Postcode</option>
<option value="8">Contributor</option>
<select name="sort" class="form-select border-3 border-success-subtle" id="sort">
<option value="1" <?php if(isset($_GET['sort']) && $_GET['sort'] == '1') echo 'selected'; ?>>Title</option>
<option value="2" <?php if(isset($_GET['sort']) && $_GET['sort'] == '2') echo 'selected'; ?>>Category</option>
<option value="0" <?php if(isset($_GET['sort']) && $_GET['sort'] == '0') echo 'selected'; ?>>Status</option>
<option value="3" <?php if(isset($_GET['sort']) && $_GET['sort'] == '3') echo 'selected'; ?>>Description</option>
<option value="4" <?php if(isset($_GET['sort']) && $_GET['sort'] == '4') echo 'selected'; ?>>Street Name</option>
<option value="5" <?php if(isset($_GET['sort']) && $_GET['sort'] == '5') echo 'selected'; ?>>County</option>
<option value="6" <?php if(isset($_GET['sort']) && $_GET['sort'] == '6') echo 'selected'; ?>>Town</option>
<option value="7" <?php if(isset($_GET['sort']) && $_GET['sort'] == '7') echo 'selected'; ?>>Postcode</option>
<option value="8" <?php if(isset($_GET['sort']) && $_GET['sort'] == '8') echo 'selected'; ?>>Contributor</option>
</select>
<span class="input-group-text bi bi-filter-circle bg-success-subtle border-0 rounded-end" id="filter"></span>
<label for="filter">Column Filter</label>
<span class="form-floating input-group">
<select class="form-select border-3 border-start-0 rounded-end border-success-subtle" name="dir" id="dir">
<option value="asc" <?php if($_GET['dir'] == 'asc') echo 'selected'; ?>>Asc</option>
<option value="desc" <?php if($_GET['dir'] == 'desc') echo 'selected'; ?>>Desc</option>
</select>
<label for="dir">Order</label>
</span>
<label for="sort">Sort By</label>
</div>
</div>
<div class="col">
<div class="form-floating input-group">
<input class="form-control border-3 border-success-subtle" id="search" type="search" name="applyFilters" aria-label="Search">
<select name="filterCat" class="form-select border-3 border-success-subtle" id="filterCat">
<option value="1" <?php if(isset($_GET['category']) && $_GET['category'] == '1') echo 'selected'; ?>>Title</option>
<option value="2" <?php if(isset($_GET['category']) && $_GET['category'] == '2') echo 'selected'; ?>>Category</option>
<option value="0" <?php if(isset($_GET['category']) && $_GET['category'] == '0') echo 'selected'; ?>>Status</option>
<option value="3" <?php if(isset($_GET['category']) && $_GET['category'] == '3') echo 'selected'; ?>>Description</option>
<option value="4" <?php if(isset($_GET['category']) && $_GET['category'] == '4') echo 'selected'; ?>>Street Name</option>
<option value="5" <?php if(isset($_GET['category']) && $_GET['category'] == '5') echo 'selected'; ?>>County</option>
<option value="6" <?php if(isset($_GET['category']) && $_GET['category'] == '6') echo 'selected'; ?>>Town</option>
<option value="7" <?php if(isset($_GET['category']) && $_GET['category'] == '7') echo 'selected'; ?>>Postcode</option>
<option value="8" <?php if(isset($_GET['category']) && $_GET['category'] == '8') echo 'selected'; ?>>Contributor</option>
</select>
<span class="input-group-text bi bi-filter-circle bg-success-subtle border-0 rounded-end" id="filterCat"></span>
<label for="filterCat">Column Filter</label>
</div>
</div>
<div class="col">
<div class="form-floating input-group">
<label for="search"></label>
<input placeholder="<?php if(isset($_GET['filter'])) echo $_GET['filter']; ?>" class="form-control border-3 border-success-subtle" id="search" type="search" name="filter" aria-label="Search">
<span class="input-group-text bg-success-subtle border-0 rounded-end" id="search">
<button class="btn bg-light bg-success-subtle" type="submit"><span class="bi bi-search"></span></button>
</span>
<label for="search">Search</label>
</div>
</div>
</form>