From 30ec8943dc45df0f4e756bc140cc4a5f3f073fdf Mon Sep 17 00:00:00 2001 From: isaacclad Date: Sat, 4 Jul 2026 16:55:16 +0000 Subject: [PATCH] Add Events-style heroes to Storefronts and Products index pages. Surface wallet balance and key counts in gradient hero sections so Merchant list pages match the Events pattern. Co-authored-by: Cursor --- .../Merchant/ProductController.php | 11 +- .../Merchant/StorefrontController.php | 7 + .../views/merchant/products/index.blade.php | 169 +++++++++++------- .../merchant/storefronts/index.blade.php | 112 +++++++++--- 4 files changed, 204 insertions(+), 95 deletions(-) diff --git a/app/Http/Controllers/Merchant/ProductController.php b/app/Http/Controllers/Merchant/ProductController.php index 4c8f68a..378d3b1 100644 --- a/app/Http/Controllers/Merchant/ProductController.php +++ b/app/Http/Controllers/Merchant/ProductController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Merchant; use App\Http\Controllers\Controller; use App\Services\Crm\CrmClient; +use App\Services\Qr\QrCodeManagerService; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\View\View; @@ -14,6 +15,8 @@ use Illuminate\View\View; */ class ProductController extends Controller { + public function __construct(private QrCodeManagerService $manager) {} + private function crm(): CrmClient { return CrmClient::for((string) ladill_account()->public_id); @@ -29,9 +32,15 @@ class ProductController extends Controller 'search' => $search !== '' ? $search : null, ]); + $products = (array) ($response['data'] ?? []); + $wallet = $this->manager->walletFor(ladill_account()); + return view('merchant.products.index', [ - 'products' => (array) ($response['data'] ?? []), + 'products' => $products, 'search' => $search, + 'wallet' => $wallet, + 'productCount' => count($products), + 'activeCount' => collect($products)->filter(fn ($p) => ($p['active'] ?? true))->count(), ]); } diff --git a/app/Http/Controllers/Merchant/StorefrontController.php b/app/Http/Controllers/Merchant/StorefrontController.php index 4511f1c..b20af46 100644 --- a/app/Http/Controllers/Merchant/StorefrontController.php +++ b/app/Http/Controllers/Merchant/StorefrontController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Merchant; use App\Http\Controllers\Controller; use App\Models\QrCode; +use App\Models\QrWallet; use App\Services\Crm\CrmClient; use App\Services\Qr\QrCodeManagerService; use App\Services\Qr\QrImageGeneratorService; @@ -39,9 +40,15 @@ class StorefrontController extends Controller return [$qr->id => $this->imageGenerator->previewDataUri($qr)]; }); + $wallet = $this->manager->walletFor($account); + return view('merchant.storefronts.index', [ 'qrCodes' => $qrCodes, 'previewDataUris' => $previewDataUris, + 'wallet' => $wallet, + 'activeCount' => $qrCodes->where('is_active', true)->count(), + 'pricePerQr' => QrWallet::pricePerQr(), + 'topupUrl' => 'https://'.config('app.account_domain').'/wallet', ]); } diff --git a/resources/views/merchant/products/index.blade.php b/resources/views/merchant/products/index.blade.php index c8195bf..e34c7b7 100644 --- a/resources/views/merchant/products/index.blade.php +++ b/resources/views/merchant/products/index.blade.php @@ -1,75 +1,114 @@ Products +
-
-
-

Products

-

Your product catalog, synced with Ladill CRM. Use these on any storefront.

+ @foreach(['success', 'error'] as $flash) + @if(session($flash)) +
+

{{ session($flash) }}

+
+ @endif + @endforeach + +
+
+
+
+
+
+ Catalog · Pricing · Inventory-ready +
+

Your products

+

+ Manage your product catalog in Ladill CRM and use items across any storefront. +

+ +
+ +
+
+

GHS {{ number_format($wallet->spendableBalance(), 2) }}

+

Account balance

+
+
+

{{ number_format($productCount) }}

+

Products

+
+
+

{{ number_format($activeCount) }}

+

Active

+
+
+
- New product
- @if(session('success')) -
{{ session('success') }}
- @endif - -
- - -
- - @if(empty($products)) -
-

{{ $search !== '' ? 'No products match your search.' : 'No products yet.' }}

- Add your first product +
+
+

Your products

+
+ + +
- @else -
- - - - - - - - - - - - @foreach($products as $p) - - - - - - + + @if(empty($products)) +

+ {{ $search !== '' ? 'No products match your search.' : 'No products yet. Add your first product to get started.' }} +

+ @else +
+
ProductSKUPriceStatus
-

{{ $p['name'] ?? '—' }}

- @if(!empty($p['description'])) -

{{ \Illuminate\Support\Str::limit($p['description'], 60) }}

- @endif -
{{ $p['sku'] ?: '—' }} - {{ strtoupper($p['currency'] ?? 'GHS') }} {{ number_format(((int) ($p['unit_price_minor'] ?? 0)) / 100, 2) }} - - - {{ ($p['active'] ?? true) ? 'Active' : 'Inactive' }} - - -
- Edit -
- @csrf - @method('DELETE') - -
-
-
+ + + + + + + - @endforeach - -
ProductSKUPriceStatus
-
- @endif + + + @foreach($products as $p) + + +

{{ $p['name'] ?? '—' }}

+ @if(!empty($p['description'])) +

{{ \Illuminate\Support\Str::limit($p['description'], 60) }}

+ @endif + + {{ $p['sku'] ?: '—' }} + + {{ strtoupper($p['currency'] ?? 'GHS') }} {{ number_format(((int) ($p['unit_price_minor'] ?? 0)) / 100, 2) }} + + + + {{ ($p['active'] ?? true) ? 'Active' : 'Inactive' }} + + + +
+ Edit +
+ @csrf + @method('DELETE') + +
+
+ + + @endforeach + + +
+ @endif +
diff --git a/resources/views/merchant/storefronts/index.blade.php b/resources/views/merchant/storefronts/index.blade.php index acfb1cc..23e87b0 100644 --- a/resources/views/merchant/storefronts/index.blade.php +++ b/resources/views/merchant/storefronts/index.blade.php @@ -1,35 +1,89 @@ Storefronts -
-
-
-

Storefronts

-

Shop, menu & booking QR storefronts with online checkout.

-
- New storefront -
- @if($qrCodes->isEmpty()) -
-

No storefronts yet.

- Create your first storefront -
- @else -
- @foreach($qrCodes as $qr) - -
- @if(!empty($previewDataUris[$qr->id])) - - @endif -
-

{{ $qr->label }}

-

{{ $qr->content()['name'] ?? 'Organisation' }}

-

{{ $qr->is_active ? 'Active' : 'Inactive' }} · {{ $qr->publicUrl() }}

-
+ +
+ @foreach(['success', 'error'] as $flash) + @if(session($flash)) +
+

{{ session($flash) }}

+
+ @endif + @endforeach + +
+
+
+
+
+
+ Shop · Menu · Booking · Online checkout
-
- @endforeach +

Your storefronts

+

+ Create QR storefronts for shops, menus, and bookings. Share a Ladill Link and take orders online. +

+
+ +
+
+ +
+
+

GHS {{ number_format($wallet->spendableBalance(), 2) }}

+

Account balance

+
+
+

{{ $qrCodes->count() }}

+

Storefronts

+
+
+

{{ number_format($activeCount) }}

+

Active

+
+
+
- @endif +
+ +
+
+

Your storefronts

+
+ @if($qrCodes->isEmpty()) +

No storefronts yet. Create your first storefront to get started.

+ @else + + @endif +