hooks in config/services.php/.env.example, and updated wizard steps/controllers to store session payloads, attach packages, and surface localized success/error states. - Retooled payment handling for both Stripe and PayPal, adding richer status management in CheckoutController/ PayPalController, fallback flows in the wizard’s PaymentStep.tsx, and fresh feature tests for intent creation, webhooks, and the wizard CTA. - Introduced a consent-aware Matomo analytics stack: new consent context, cookie-banner UI, useAnalytics/ useCtaExperiment hooks, and MatomoTracker component, then instrumented marketing pages (Home, Packages, Checkout) with localized copy and experiment tracking. - Polished package presentation across marketing UIs by centralizing formatting in PresentsPackages, surfacing localized description tables/placeholders, tuning badges/layouts, and syncing guest/marketing translations. - Expanded docs & reference material (docs/prp/*, TODOs, public gallery overview) and added a Playwright smoke test for the hero CTA while reconciling outstanding checklist items.
62 lines
2.1 KiB
PHP
62 lines
2.1 KiB
PHP
<?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 getCards(): 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'),
|
|
];
|
|
}
|
|
}
|
|
|