removed all references to credits. now credits are completely replaced by addons.
This commit is contained in:
@@ -1,60 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets;
|
||||
|
||||
use App\Models\PurchaseHistory;
|
||||
use App\Models\Tenant;
|
||||
use Filament\Widgets\StatsOverviewWidget;
|
||||
use Filament\Widgets\StatsOverviewWidget\Stat;
|
||||
|
||||
class CreditAlertsWidget extends StatsOverviewWidget
|
||||
{
|
||||
protected static ?int $sort = 0;
|
||||
|
||||
protected int|string|array $columnSpan = 'full';
|
||||
|
||||
protected function getStats(): array
|
||||
{
|
||||
$lowBalanceCount = Tenant::query()
|
||||
->where('is_active', true)
|
||||
->where('event_credits_balance', '<', 5)
|
||||
->count();
|
||||
|
||||
$monthStart = now()->startOfMonth();
|
||||
$monthlyRevenue = PurchaseHistory::query()
|
||||
->where('purchased_at', '>=', $monthStart)
|
||||
->sum('price');
|
||||
|
||||
$activeSubscriptions = Tenant::query()
|
||||
->whereNotNull('subscription_expires_at')
|
||||
->where('subscription_expires_at', '>', now())
|
||||
->count();
|
||||
|
||||
return [
|
||||
Stat::make(
|
||||
__('admin.widgets.credit_alerts.low_balance_label'),
|
||||
$lowBalanceCount
|
||||
)
|
||||
->description(__('admin.widgets.credit_alerts.low_balance_desc'))
|
||||
->descriptionIcon('heroicon-m-exclamation-triangle')
|
||||
->color('warning')
|
||||
->url(route('filament.superadmin.resources.tenants.index')),
|
||||
Stat::make(
|
||||
__('admin.widgets.credit_alerts.monthly_revenue_label'),
|
||||
number_format((float) $monthlyRevenue, 2).' €'
|
||||
)
|
||||
->description(__('admin.widgets.credit_alerts.monthly_revenue_desc', [
|
||||
'month' => $monthStart->translatedFormat('F'),
|
||||
]))
|
||||
->descriptionIcon('heroicon-m-currency-euro')
|
||||
->color('success'),
|
||||
Stat::make(
|
||||
__('admin.widgets.credit_alerts.active_subscriptions_label'),
|
||||
$activeSubscriptions
|
||||
)
|
||||
->description(__('admin.widgets.credit_alerts.active_subscriptions_desc'))
|
||||
->descriptionIcon('heroicon-m-arrow-trending-up')
|
||||
->color('info'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -42,12 +42,7 @@ class TopTenantsByRevenue extends BaseWidget
|
||||
->label(__('admin.widgets.top_tenants_by_revenue.count'))
|
||||
->badge()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('event_credits_balance')
|
||||
->label(__('admin.common.credits'))
|
||||
->badge()
|
||||
->sortable(),
|
||||
])
|
||||
->paginated(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user