Deploy Ladill Give / deploy (push) Successful in 34s
Co-authored-by: Cursor <cursoragent@cursor.com>
122 lines
7.3 KiB
PHP
122 lines
7.3 KiB
PHP
@php
|
|
$user = auth()->user();
|
|
$initials = collect(explode(' ', trim((string) $user?->name)))
|
|
->filter()
|
|
->take(2)
|
|
->map(fn ($part) => strtoupper(substr($part, 0, 1)))
|
|
->implode('');
|
|
|
|
$rcCartCount = 0;
|
|
$domainCartCount = 0;
|
|
$cartCount = 0;
|
|
$cartRoute = route('user.products.cart');
|
|
if ($user) {
|
|
$rcCartCount = \App\Models\RcServiceOrder::query()
|
|
->where('user_id', $user->id)
|
|
->whereIn('status', [
|
|
\App\Models\RcServiceOrder::STATUS_CART,
|
|
\App\Models\RcServiceOrder::STATUS_PENDING_PAYMENT,
|
|
])
|
|
->count();
|
|
|
|
$domainCartCount = \App\Models\DomainOrder::query()
|
|
->where('user_id', $user->id)
|
|
->whereIn('status', [
|
|
\App\Models\DomainOrder::STATUS_CART,
|
|
\App\Models\DomainOrder::STATUS_PENDING_PAYMENT,
|
|
])
|
|
->count();
|
|
|
|
$cartCount = $rcCartCount + $domainCartCount;
|
|
|
|
if ($rcCartCount === 0 && $domainCartCount > 0) {
|
|
$cartRoute = route('user.domains.cart');
|
|
}
|
|
}
|
|
@endphp
|
|
|
|
<header class="flex items-center justify-between h-16 border-b border-slate-200 bg-white px-6"
|
|
>
|
|
<div class="flex items-center gap-3 flex-1 min-w-0">
|
|
<button @click="sidebarOpen = !sidebarOpen" class="lg:hidden shrink-0 text-slate-500 hover:text-slate-700">
|
|
<svg class="w-6 h-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>
|
|
|
|
{{-- Search Bar --}}
|
|
<div class="relative hidden w-full max-w-md lg:block" x-data="topbarSearch()" @click.outside="open = false" @keydown.escape.window="open = false">
|
|
<div class="relative">
|
|
<svg class="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"/></svg>
|
|
<input data-ladill-search-input type="text"
|
|
x-model="query"
|
|
@focus="onFocus()"
|
|
@input.debounce.200ms="search()"
|
|
@keydown.arrow-down.prevent="moveDown()"
|
|
@keydown.arrow-up.prevent="moveUp()"
|
|
@keydown.enter.prevent="go()"
|
|
placeholder="Search domains, hosting, email, SMTP…"
|
|
class="w-full rounded-xl border border-slate-200 bg-slate-50 py-2 pl-9 pr-10 text-sm text-slate-700 placeholder-slate-400 transition focus:border-indigo-300 focus:bg-white focus:ring-2 focus:ring-indigo-100 focus:outline-none">
|
|
<kbd class="pointer-events-none absolute right-3 top-1/2 hidden -translate-y-1/2 rounded-md border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium text-slate-400 sm:inline-block">/</kbd>
|
|
</div>
|
|
|
|
{{-- Results dropdown --}}
|
|
<div x-show="open && (results.length > 0 || (query.length >= 2 && !loading))"
|
|
x-cloak
|
|
x-transition.opacity.duration.150ms
|
|
class="absolute left-0 top-full z-30 mt-1.5 w-full overflow-hidden rounded-xl border border-slate-200 bg-white shadow-lg">
|
|
<template x-if="loading">
|
|
<div class="px-4 py-3 text-center text-xs text-slate-400">Searching…</div>
|
|
</template>
|
|
<template x-if="!loading && results.length === 0 && query.length >= 2">
|
|
<div class="px-4 py-3 text-center text-xs text-slate-500">No results for "<span x-text="query" class="font-medium"></span>"</div>
|
|
</template>
|
|
<template x-if="!loading && results.length > 0">
|
|
<ul class="max-h-72 overflow-y-auto py-1">
|
|
<template x-for="(item, idx) in results" :key="item.url">
|
|
<li>
|
|
<a :href="item.url"
|
|
:class="idx === active ? 'bg-indigo-50 text-indigo-700' : 'text-slate-700'"
|
|
@mouseenter="active = idx"
|
|
class="flex items-center gap-3 px-4 py-2.5 text-sm transition hover:bg-indigo-50">
|
|
<span class="flex h-7 w-7 shrink-0 items-center justify-center rounded-lg"
|
|
:class="{
|
|
'bg-blue-100 text-blue-600': item.type === 'domain',
|
|
'bg-teal-100 text-teal-600': item.type === 'hosting',
|
|
'bg-sky-100 text-sky-600': item.type === 'email',
|
|
'bg-violet-100 text-violet-600': item.type === 'smtp',
|
|
'bg-amber-100 text-amber-600': item.type === 'ticket',
|
|
'bg-orange-100 text-orange-600': item.type === 'order',
|
|
'bg-slate-100 text-slate-600': !['domain','hosting','email','smtp','ticket','order'].includes(item.type),
|
|
}">
|
|
<template x-if="item.type === 'domain'">
|
|
<svg class="h-3.5 w-3.5" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M13.19 8.688a4.5 4.5 0 0 1 1.242 7.244l-4.5 4.5a4.5 4.5 0 0 1-6.364-6.364l1.757-1.757m13.35-.622 1.757-1.757a4.5 4.5 0 0 0-6.364-6.364l-4.5 4.5a4.5 4.5 0 0 0 1.242 7.244"/></svg>
|
|
</template>
|
|
<template x-if="item.type !== 'domain'">
|
|
<svg class="h-3.5 w-3.5" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"/></svg>
|
|
</template>
|
|
</span>
|
|
<span class="min-w-0 flex-1">
|
|
<span class="block truncate font-medium leading-tight" x-text="item.title"></span>
|
|
<span class="block truncate text-xs text-slate-400" x-text="item.subtitle"></span>
|
|
</span>
|
|
</a>
|
|
</li>
|
|
</template>
|
|
</ul>
|
|
</template>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex items-center gap-3">
|
|
@auth
|
|
@includeIf('partials.topbar-account-switcher')
|
|
@includeIf('partials.topbar-widgets-prepend')
|
|
@include('partials.topbar-desktop-widgets', ['user' => $user ?? $u ?? auth()->user(), 'showUser' => true])
|
|
@includeIf('partials.topbar-widgets-append')
|
|
@else
|
|
<a href="{{ route('login') }}" class="btn-primary">Sign in</a>
|
|
@include('partials.launcher')
|
|
@endauth
|
|
</div>
|
|
</header>
|