From 93272f968a5f9f8c6c0e22c5aab6112571ca2c56 Mon Sep 17 00:00:00 2001 From: isaacclad Date: Thu, 2 Jul 2026 00:10:58 +0000 Subject: [PATCH] Fix programme attachment dropdown always appearing disabled on events. Load itinerary options in the event show controller and link to programme creation when none exist yet. Co-authored-by: Cursor --- app/Http/Controllers/Qr/QrCodeController.php | 8 ++ .../partials/type-fields-edit.blade.php | 7 +- .../Feature/EventProgrammeAttachmentTest.php | 73 +++++++++++++++++++ 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 tests/Feature/EventProgrammeAttachmentTest.php diff --git a/app/Http/Controllers/Qr/QrCodeController.php b/app/Http/Controllers/Qr/QrCodeController.php index 9170f63..a17ed6a 100644 --- a/app/Http/Controllers/Qr/QrCodeController.php +++ b/app/Http/Controllers/Qr/QrCodeController.php @@ -206,6 +206,13 @@ class QrCodeController extends Controller ]); } + $itineraryOptions = $qrCode->type === QrCode::TYPE_EVENT + ? $account->qrCodes() + ->where('type', QrCode::TYPE_ITINERARY) + ->orderBy('label') + ->get(['id', 'label']) + : collect(); + return view('qr-codes.show', [ 'qrCode' => $qrCode, 'previewDataUri' => $previewDataUri, @@ -229,6 +236,7 @@ class QrCodeController extends Controller 'customDomains' => \App\Models\CustomDomain::where('qr_code_id', $qrCode->id)->get(), 'customDomainsEnabled' => app(\App\Services\CustomDomain\CustomDomainService::class)->enabled(), 'customDomainServerIp' => config('customdomain.server_ip'), + 'itineraryOptions' => $itineraryOptions, ]); } diff --git a/resources/views/qr-codes/partials/type-fields-edit.blade.php b/resources/views/qr-codes/partials/type-fields-edit.blade.php index 2ce4371..2ba9990 100644 --- a/resources/views/qr-codes/partials/type-fields-edit.blade.php +++ b/resources/views/qr-codes/partials/type-fields-edit.blade.php @@ -629,7 +629,12 @@ @if($itineraryOptions->isEmpty())

- Create an Itinerary QR code first to attach it here as the event programme. + @if(Route::has('programmes.create')) + Create a programme + first to attach it here as the event outline. + @else + Create a programme first to attach it here as the event outline. + @endif

@else