|
|
@@ -442,7 +442,7 @@ Route::group(['middleware' => 'tenant'], function () {
|
|
|
if ($_GET["order"][0]["column"] == 2)
|
|
|
$column = 'phone';
|
|
|
if ($_GET["order"][0]["column"] == 3)
|
|
|
- $column = 'birth_date';
|
|
|
+ $column = 'years';
|
|
|
if ($_GET["order"][0]["column"] == 4)
|
|
|
$column = 'birth_date';
|
|
|
if ($_GET["order"][0]["column"] == 5)
|
|
|
@@ -459,6 +459,11 @@ Route::group(['middleware' => 'tenant'], function () {
|
|
|
elseif ($column == 'current_status') {
|
|
|
$x = $x->orderBy('to_complete', 'DESC');
|
|
|
$x = $x->orderBy($column, $_GET["order"][0]["dir"]);
|
|
|
+ } elseif ($column == 'years') {
|
|
|
+ $column = 'birth_date';
|
|
|
+ $dirs = ['asc' => 'desc', 'desc' => 'asc'];
|
|
|
+ $x = $x->orderByRaw($column . ' IS NULL ' . $dirs[$_GET["order"][0]["dir"]])
|
|
|
+ ->orderBy($column, $dirs[$_GET["order"][0]["dir"]]);
|
|
|
} elseif ($column == 'birth_date') {
|
|
|
$x = $x->orderByRaw($column . ' IS NULL ' . $_GET["order"][0]["dir"])
|
|
|
->orderBy($column, $_GET["order"][0]["dir"]);
|