Use QR Plus layout chrome without monolith routes.
Deploy Ladill QR Plus / deploy (push) Successful in 26s
Deploy Ladill QR Plus / deploy (push) Successful in 26s
Fixes dashboard 500 from undefined cart, search, and notification routes. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,42 +1,9 @@
|
||||
@php
|
||||
$mobileFullScreenPage = request()->routeIs('user.search')
|
||||
|| request()->routeIs('user.products.cart')
|
||||
|| request()->routeIs('user.domains.cart')
|
||||
|| request()->routeIs('user.domains.checkout')
|
||||
|| request()->routeIs('user.products.checkout')
|
||||
|| request()->routeIs('user.products.order')
|
||||
|| request()->routeIs('profile.edit')
|
||||
|| request()->routeIs('account.settings')
|
||||
$mobileFullScreenPage = request()->routeIs('account.settings')
|
||||
|| request()->routeIs('user.qr-codes.create')
|
||||
|| request()->routeIs('user.qr-codes.show');
|
||||
|
||||
$qrMobilePage = request()->routeIs('user.qr-codes.create') || request()->routeIs('user.qr-codes.show');
|
||||
|
||||
$mobileCartCount = 0;
|
||||
$mobileCartRoute = route('user.products.cart');
|
||||
if (auth()->check()) {
|
||||
$mobileProductCartCount = \App\Models\RcServiceOrder::query()
|
||||
->where('user_id', auth()->id())
|
||||
->whereIn('status', [
|
||||
\App\Models\RcServiceOrder::STATUS_CART,
|
||||
\App\Models\RcServiceOrder::STATUS_PENDING_PAYMENT,
|
||||
])
|
||||
->count();
|
||||
|
||||
$mobileDomainCartCount = \App\Models\DomainOrder::query()
|
||||
->where('user_id', auth()->id())
|
||||
->whereIn('status', [
|
||||
\App\Models\DomainOrder::STATUS_CART,
|
||||
\App\Models\DomainOrder::STATUS_PENDING_PAYMENT,
|
||||
])
|
||||
->count();
|
||||
|
||||
$mobileCartCount = $mobileProductCartCount + $mobileDomainCartCount;
|
||||
|
||||
if ($mobileProductCartCount === 0 && $mobileDomainCartCount > 0) {
|
||||
$mobileCartRoute = route('user.domains.cart');
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" @class(['qr-mobile-page' => $qrMobilePage])>
|
||||
@@ -66,7 +33,7 @@
|
||||
{{-- Main content --}}
|
||||
<div class="flex min-h-screen flex-col min-w-0 lg:pl-64">
|
||||
<div class="{{ $mobileFullScreenPage ? 'hidden lg:block' : '' }}">
|
||||
@include('partials.topbar')
|
||||
@include('partials.topbar-qr')
|
||||
</div>
|
||||
|
||||
<div @class([
|
||||
@@ -74,7 +41,6 @@
|
||||
'hidden lg:block' => $mobileFullScreenPage,
|
||||
])>
|
||||
@include('partials.flash')
|
||||
@include('partials.mailbox-link-banner')
|
||||
</div>
|
||||
|
||||
<main @class([
|
||||
@@ -99,16 +65,15 @@
|
||||
@include('partials.mobile-bottom-nav', [
|
||||
'homeUrl' => route('qr.dashboard'),
|
||||
'homeActive' => request()->routeIs('qr.dashboard'),
|
||||
'searchUrl' => route('user.search'),
|
||||
'searchActive' => request()->routeIs('user.search'),
|
||||
'notificationsUrl' => route('user.notifications.index'),
|
||||
'notificationsActive' => request()->routeIs('user.notifications.*'),
|
||||
'unreadUrl' => route('user.notifications.unread'),
|
||||
'profileActive' => request()->routeIs('profile.edit') || request()->routeIs('account.settings'),
|
||||
'searchUrl' => route('user.qr-codes.index'),
|
||||
'searchActive' => request()->routeIs('user.qr-codes.*'),
|
||||
'notificationsUrl' => route('notifications.index'),
|
||||
'notificationsActive' => request()->routeIs('notifications.*'),
|
||||
'unreadUrl' => route('notifications.unread'),
|
||||
'profileActive' => request()->routeIs('account.settings'),
|
||||
'profileName' => $navUser?->name ?? '',
|
||||
'profileSubtitle' => $navUser?->email ?? '',
|
||||
'profileMenuItems' => [
|
||||
['type' => 'link', 'label' => 'Profile', 'href' => route('profile.edit')],
|
||||
['type' => 'link', 'label' => 'Account Settings', 'href' => route('account.settings')],
|
||||
['type' => 'link', 'label' => 'Overview', 'href' => route('qr.dashboard')],
|
||||
['type' => 'logout', 'label' => 'Logout', 'action' => route('logout')],
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
@php
|
||||
$user = auth()->user();
|
||||
$initials = collect(explode(' ', trim((string) $user?->name)))
|
||||
->filter()
|
||||
->take(2)
|
||||
->map(fn ($part) => strtoupper(substr($part, 0, 1)))
|
||||
->implode('');
|
||||
@endphp
|
||||
|
||||
<header class="flex h-16 items-center justify-between border-b border-slate-200 bg-white px-6">
|
||||
<div class="flex min-w-0 flex-1 items-center gap-3">
|
||||
<button @click="sidebarOpen = !sidebarOpen" class="shrink-0 text-slate-500 hover:text-slate-700 lg:hidden">
|
||||
<svg class="h-6 w-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"/></svg>
|
||||
</button>
|
||||
<p class="truncate text-sm font-medium text-slate-700 lg:hidden">Ladill QR Plus</p>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="relative hidden lg:block"
|
||||
x-data="notificationDropdown({
|
||||
unreadUrl: {{ \Illuminate\Support\Js::from(route('notifications.unread')) }},
|
||||
markReadUrl: {{ \Illuminate\Support\Js::from(route('notifications.mark-read', ['id' => '__ID__'])) }},
|
||||
markAllReadUrl: {{ \Illuminate\Support\Js::from(route('notifications.mark-all-read')) }},
|
||||
indexUrl: {{ \Illuminate\Support\Js::from(route('notifications.index')) }},
|
||||
csrfToken: {{ \Illuminate\Support\Js::from(csrf_token()) }},
|
||||
})"
|
||||
@click.outside="open = false">
|
||||
<button type="button"
|
||||
@click="toggle()"
|
||||
class="relative inline-flex items-center justify-center rounded-full border border-slate-200 p-2 text-slate-600 transition hover:bg-slate-50"
|
||||
aria-label="Notifications">
|
||||
<svg class="h-5 w-5" fill="none" stroke="currentColor" stroke-width="1.8" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M14.857 17.082a23.848 23.848 0 0 0 5.454-1.31A8.967 8.967 0 0 1 18 9.75V9a6 6 0 1 0-12 0v.75a8.967 8.967 0 0 1-2.312 6.022c1.733.64 3.56 1.08 5.455 1.31m5.714 0a24.255 24.255 0 0 1-5.714 0m5.714 0a3 3 0 1 1-5.714 0" />
|
||||
</svg>
|
||||
<span x-show="unreadCount > 0"
|
||||
x-cloak
|
||||
x-text="unreadCount > 9 ? '9+' : unreadCount"
|
||||
class="absolute -right-1 -top-1 inline-flex min-w-5 items-center justify-center rounded-full bg-rose-500 px-1.5 py-0.5 text-[10px] font-semibold text-white"></span>
|
||||
</button>
|
||||
|
||||
<div x-show="open"
|
||||
x-cloak
|
||||
x-transition
|
||||
class="absolute right-0 z-50 mt-2 w-80 origin-top-right rounded-xl border border-slate-200 bg-white shadow-lg">
|
||||
<div class="flex items-center justify-between border-b border-slate-100 px-4 py-3">
|
||||
<h3 class="text-sm font-semibold text-slate-900">Notifications</h3>
|
||||
<button type="button"
|
||||
x-show="unreadCount > 0"
|
||||
@click="markAllRead()"
|
||||
class="text-xs font-medium text-indigo-600 hover:text-indigo-700">
|
||||
Mark all read
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="max-h-80 overflow-y-auto">
|
||||
<template x-if="loading">
|
||||
<div class="px-4 py-6 text-center text-xs text-slate-400">Loading…</div>
|
||||
</template>
|
||||
<template x-if="!loading && notifications.length === 0">
|
||||
<div class="px-4 py-8 text-center text-sm text-slate-500">No notifications yet</div>
|
||||
</template>
|
||||
<template x-if="!loading && notifications.length > 0">
|
||||
<div class="divide-y divide-slate-100">
|
||||
<template x-for="notification in notifications" :key="notification.id">
|
||||
<a :href="notification.url || '#'"
|
||||
@click="markRead(notification.id)"
|
||||
class="flex items-start gap-3 px-4 py-3 transition hover:bg-slate-50">
|
||||
<div class="min-w-0 flex-1">
|
||||
<p class="truncate text-sm font-medium text-slate-900" x-text="notification.title"></p>
|
||||
<p class="line-clamp-2 text-xs text-slate-500" x-text="notification.message"></p>
|
||||
<p class="mt-1 text-[11px] text-slate-400" x-text="notification.created_at"></p>
|
||||
</div>
|
||||
</a>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div class="border-t border-slate-100 px-4 py-2.5">
|
||||
<a :href="indexUrl" class="block text-center text-xs font-medium text-slate-600 hover:text-slate-900">
|
||||
View all notifications
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="relative hidden lg:block" x-data="{ profileOpen: false }" @click.outside="profileOpen = false">
|
||||
<button type="button"
|
||||
@click="profileOpen = !profileOpen"
|
||||
class="inline-flex items-center gap-2 rounded-full border border-slate-200 px-2 py-1.5 text-slate-700 hover:bg-slate-50">
|
||||
@if ($user?->avatarUrl())
|
||||
<img src="{{ $user->avatarUrl() }}" alt="Avatar" class="h-8 w-8 rounded-full object-cover ring-1 ring-slate-200">
|
||||
@else
|
||||
<span class="inline-flex h-8 w-8 items-center justify-center rounded-full bg-slate-900 text-xs font-semibold text-white">
|
||||
{{ $initials !== '' ? $initials : 'U' }}
|
||||
</span>
|
||||
@endif
|
||||
<svg class="h-4 w-4 text-slate-500" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="m19 9-7 7-7-7" />
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<div x-show="profileOpen" x-cloak x-transition @click.outside="profileOpen = false"
|
||||
class="absolute right-0 z-20 mt-2 w-48 rounded-xl border border-slate-200 bg-white p-1 shadow-lg">
|
||||
<a href="{{ route('account.settings') }}" class="block rounded-lg px-3 py-2 text-sm text-slate-700 hover:bg-slate-100">Account Settings</a>
|
||||
<a href="{{ route('qr.dashboard') }}" class="block rounded-lg px-3 py-2 text-sm text-slate-700 hover:bg-slate-100">Dashboard</a>
|
||||
<form method="POST" action="{{ route('logout') }}">
|
||||
@csrf
|
||||
<button type="submit" class="w-full rounded-lg px-3 py-2 text-left text-sm text-rose-600 hover:bg-rose-50">Logout</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('partials.launcher')
|
||||
</div>
|
||||
</header>
|
||||
Reference in New Issue
Block a user