|
|
@@ -218,7 +218,7 @@ Route::get('/get_members', function () {
|
|
|
});
|
|
|
|
|
|
// All your existing filtering logic remains exactly the same
|
|
|
- if (isset($_GET["search"]["value"])) {
|
|
|
+ if (isset($_GET["search"]["value"]) && $_GET["search"]["value"] != "") {
|
|
|
$v = str_replace("'", "\'", stripcslashes($_GET["search"]["value"]));
|
|
|
$x = $x->where(function ($query) use ($v) {
|
|
|
$query->whereRaw("CONCAT(first_name, ' ', last_name) like '%" . $v . "%'")
|
|
|
@@ -372,8 +372,7 @@ Route::get('/get_members', function () {
|
|
|
|
|
|
$count = $x->count();
|
|
|
|
|
|
- $x = $x->orderBy('to_complete', 'DESC');
|
|
|
-
|
|
|
+
|
|
|
// Rest of the ordering logic remains the same
|
|
|
if (isset($_GET["order"])) {
|
|
|
$column = '';
|
|
|
@@ -393,13 +392,23 @@ Route::get('/get_members', function () {
|
|
|
$column = 'certificate';
|
|
|
|
|
|
if ($column != '') {
|
|
|
- $x = $x->orderBy($column, $_GET["order"][0]["dir"]);
|
|
|
+ if ($column == 'last_name') {
|
|
|
+ $x = $x->orderBy('to_complete', 'DESC');
|
|
|
+ }
|
|
|
if ($column == 'certificate')
|
|
|
$x = $x->orderBy('certificate_date', $_GET["order"][0]["dir"]);
|
|
|
+ elseif ($column == 'current_status') {
|
|
|
+ $x = $x->orderBy('to_complete', 'DESC');
|
|
|
+ $x = $x->orderBy($column, $_GET["order"][0]["dir"]);
|
|
|
+ } else {
|
|
|
+ $x = $x->orderBy($column, $_GET["order"][0]["dir"]);
|
|
|
+ }
|
|
|
} else {
|
|
|
+ $x = $x->orderBy('to_complete', 'DESC');
|
|
|
$x = $x->orderBy('last_name', 'ASC')->orderBy('first_name', 'ASC');
|
|
|
}
|
|
|
} else {
|
|
|
+ $x = $x->orderBy('to_complete', 'DESC');
|
|
|
$x = $x->orderBy('last_name', 'ASC')->orderBy('first_name', 'ASC');
|
|
|
}
|
|
|
|