Show remaining budget in mobile category buttons
Each category button now displays "X € restants" below the name, alongside the existing progress gauge and percentage — so the user sees both how much of the budget is used and how much is left without leaving the entry form. Remaining is floored at 0 to match the gauge's 100% cap. categoryProgress now returns a ['pct', 'remaining'] pair per category instead of a bare percentage; tests updated accordingly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
613220f43a
commit
1b3906ade2
@@ -199,7 +199,10 @@ class Index extends Component
|
||||
|
||||
$tracked = $this->trackedForCategoryThisMonth($category, $year, $month);
|
||||
|
||||
return [$category->id => min(100, round($tracked / $budget * 100))];
|
||||
return [$category->id => [
|
||||
'pct' => min(100, round($tracked / $budget * 100)),
|
||||
'remaining' => max(0, $budget - $tracked),
|
||||
]];
|
||||
});
|
||||
|
||||
return view('livewire.suivi.index', [
|
||||
|
||||
Reference in New Issue
Block a user