Nest Programmes under Events in sidebar and add programmes index hero.
Deploy Ladill Events / deploy (push) Successful in 44s
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>
This commit is contained in:
@@ -3,14 +3,16 @@
|
||||
namespace App\Http\Controllers\Events;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\QrCode;
|
||||
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', [
|
||||
@@ -21,12 +23,25 @@ class ProgrammeController extends Controller
|
||||
public function index(Request $request): View
|
||||
{
|
||||
$account = ladill_account();
|
||||
$wallet = $this->manager->walletFor($account);
|
||||
|
||||
$programmes = $account->qrCodes()
|
||||
->whereIn('type', QrTypeCatalog::programmeTypes())
|
||||
->latest()
|
||||
->get();
|
||||
|
||||
return view('events.programmes', compact('programmes'));
|
||||
$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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user