Deploy Ladill Events / deploy (push) Successful in 44s
Match the Events list layout with balance, programme, and session stats so programme management feels consistent with the rest of the app. Co-authored-by: Cursor <cursoragent@cursor.com>
48 lines
1.3 KiB
PHP
48 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Events;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\QrWallet;
|
|
use App\Services\Qr\QrCodeManagerService;
|
|
use App\Support\Qr\QrTypeCatalog;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\View\View;
|
|
|
|
class ProgrammeController extends Controller
|
|
{
|
|
public function __construct(private QrCodeManagerService $manager) {}
|
|
|
|
public function create(): View
|
|
{
|
|
return view('events.programme-create', [
|
|
'pricePerQr' => QrWallet::pricePerQr(),
|
|
]);
|
|
}
|
|
|
|
public function index(Request $request): View
|
|
{
|
|
$account = ladill_account();
|
|
$wallet = $this->manager->walletFor($account);
|
|
|
|
$programmes = $account->qrCodes()
|
|
->whereIn('type', QrTypeCatalog::programmeTypes())
|
|
->latest()
|
|
->get();
|
|
|
|
$totalSessions = $programmes->sum(function ($programme) {
|
|
$days = (array) ($programme->content()['days'] ?? []);
|
|
|
|
return collect($days)->sum(fn ($day) => count((array) ($day['items'] ?? [])));
|
|
});
|
|
|
|
return view('events.programmes', [
|
|
'programmes' => $programmes,
|
|
'wallet' => $wallet,
|
|
'totalSessions' => $totalSessions,
|
|
'pricePerQr' => QrWallet::pricePerQr(),
|
|
'topupUrl' => 'https://'.config('app.account_domain').'/wallet',
|
|
]);
|
|
}
|
|
}
|