From 7eaa0ab23ad2d366036b6a7c2f717201c7916680 Mon Sep 17 00:00:00 2001 From: isaacclad Date: Sun, 7 Jun 2026 19:57:55 +0000 Subject: [PATCH] Fix payment QR preview rendering using inline data URIs. Match Events/QR Plus pattern so QR images render without a separate authenticated preview URL, and add a styled preview card on the show page. Co-authored-by: Cursor --- .../Controllers/Mini/PaymentQrController.php | 16 ++++++- .../views/mini/payment-qrs/create.blade.php | 13 +++++- .../views/mini/payment-qrs/index.blade.php | 2 +- .../partials/preview-card.blade.php | 35 +++++++++++++++ .../views/mini/payment-qrs/show.blade.php | 44 ++++++++++++------- 5 files changed, 90 insertions(+), 20 deletions(-) create mode 100644 resources/views/mini/payment-qrs/partials/preview-card.blade.php diff --git a/app/Http/Controllers/Mini/PaymentQrController.php b/app/Http/Controllers/Mini/PaymentQrController.php index caa569e..e472d6e 100644 --- a/app/Http/Controllers/Mini/PaymentQrController.php +++ b/app/Http/Controllers/Mini/PaymentQrController.php @@ -32,7 +32,14 @@ class PaymentQrController extends Controller ->latest() ->get(); - return view('mini.payment-qrs.index', ['qrCodes' => $qrCodes]); + $previewDataUris = $qrCodes->mapWithKeys(function (QrCode $qr) { + return [$qr->id => $this->imageGenerator->previewDataUri($qr)]; + }); + + return view('mini.payment-qrs.index', [ + 'qrCodes' => $qrCodes, + 'previewDataUris' => $previewDataUris, + ]); } public function create(): View @@ -67,7 +74,12 @@ class PaymentQrController extends Controller { $this->authorizePaymentQr($paymentQr); - return view('mini.payment-qrs.show', ['qrCode' => $paymentQr]); + $previewDataUri = $this->imageGenerator->previewDataUri($paymentQr); + + return view('mini.payment-qrs.show', [ + 'qrCode' => $paymentQr->fresh(), + 'previewDataUri' => $previewDataUri, + ]); } public function update(Request $request, QrCode $paymentQr): RedirectResponse diff --git a/resources/views/mini/payment-qrs/create.blade.php b/resources/views/mini/payment-qrs/create.blade.php index 454994c..8ba549f 100644 --- a/resources/views/mini/payment-qrs/create.blade.php +++ b/resources/views/mini/payment-qrs/create.blade.php @@ -1,7 +1,18 @@ Create Payment QR
-
+
+ + + + + + Ladill Mini + Create payment QR +
+ - +

{{ $qr->publicUrl() }}

diff --git a/resources/views/mini/payment-qrs/partials/preview-card.blade.php b/resources/views/mini/payment-qrs/partials/preview-card.blade.php new file mode 100644 index 0000000..36272ac --- /dev/null +++ b/resources/views/mini/payment-qrs/partials/preview-card.blade.php @@ -0,0 +1,35 @@ +@php + $showDownloads = $showDownloads ?? true; +@endphp + +
+
+
+
+ Payment QR code for {{ $qrCode->label }} +
+
+
+ + @if ($showDownloads) +
+

Download

+ +
+ @endif +
diff --git a/resources/views/mini/payment-qrs/show.blade.php b/resources/views/mini/payment-qrs/show.blade.php index f3d9c43..5eb5d5a 100644 --- a/resources/views/mini/payment-qrs/show.blade.php +++ b/resources/views/mini/payment-qrs/show.blade.php @@ -1,28 +1,40 @@ {{ $qrCode->label }} @php $c = $qrCode->content(); @endphp -
-
-
- ← All payment QRs -

{{ $qrCode->label }}

-

{{ $c['business_name'] ?? '' }}@if(!empty($c['branch_label'])) · {{ $c['branch_label'] }}@endif

-
-
- PNG - SVG - PDF -
+
+
+ + + + + + Ladill Mini + {{ $qrCode->label }}
+ + + @if(session('success'))
{{ session('success') }}
@endif -
-
- QR code + +
+
+ @include('mini.payment-qrs.partials.preview-card', [ + 'qrCode' => $qrCode, + 'previewDataUri' => $previewDataUri, + 'showDownloads' => true, + ])

{{ $qrCode->publicUrl() }}

-

Standard black-and-white QR — ready to print at your till or counter.

+

Standard black-and-white QR — ready to print at your till or counter.

+
@csrf @method('PATCH')