Skip to content

Commit

Permalink
updated formatAmount
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsin-shaikh committed Feb 1, 2022
1 parent 3b68b3a commit 7e7c949
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion app/Filament/Widgets/RecentActivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class RecentActivity extends Widget implements Tables\Contracts\HasTable

protected int | string | array $columnSpan = 'full';

protected function formatAmount ($value) {
protected function formatAmount($value)
{
$currency = auth()->user()->currency ? auth()->user()->currency : 'usd';
return Currency::find($currency)->format($value, true);
}
Expand Down
9 changes: 5 additions & 4 deletions app/Filament/Widgets/StatsOverview.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class StatsOverview extends BaseWidget
protected int $total_expense = 0;
protected int $total_revenue = 0;

protected function formatAmount ($value) {
protected function formatAmount($value)
{
$currency = auth()->user()->currency ? auth()->user()->currency : 'usd';
return Currency::find($currency)->format($value, true);
}
Expand All @@ -29,9 +30,9 @@ protected function getCards(): array
Card::make('Total Income', $this->formatAmount($this->total_income)),
Card::make('Total Expense', $this->formatAmount($this->total_expense)),
Card::make('Total Revenue', $this->formatAmount($this->total_revenue))
->description($this->total_revenue > 0 ? 'Profit' : 'Loss')
->descriptionIcon($this->total_revenue > 0 ? 'heroicon-s-trending-up' : 'heroicon-s-trending-down')
->color($this->total_revenue > 0 ? 'success' : 'danger'),
// ->description($this->total_revenue > 0 ? 'Profit' : 'Loss')
// ->descriptionIcon($this->total_revenue > 0 ? 'heroicon-s-trending-up' : 'heroicon-s-trending-down')
// ->color($this->total_revenue > 0 ? 'success' : 'danger'),
];
}
}

0 comments on commit 7e7c949

Please sign in to comment.