mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-24 04:41:01 +00:00
Add sort column to account overview. and some css fixes
This commit is contained in:
@@ -137,6 +137,17 @@ class AccountTransformer extends AbstractTransformer
|
||||
return $rightBalance <=> $leftBalance;
|
||||
});
|
||||
}
|
||||
if ('last_activity' === $column) {
|
||||
$dates = $this->lastActivity;
|
||||
$objects = $objects->sort(function (Account $left, Account $right) use ($dates, $direction) {
|
||||
$leftDate = $dates[$left->id] ?? Carbon::create(1900, 1, 1, 0, 0, 0);
|
||||
$rightDate = $dates[$right->id] ?? Carbon::create(1900, 1, 1, 0, 0, 0);
|
||||
if ('asc' === $direction) {
|
||||
return $leftDate->gt($rightDate) ? 1 : -1;
|
||||
}
|
||||
return $rightDate->gt($leftDate) ? 1 : -1;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user