<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="h-full">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
{{-- โโ Safe defaults for all ViewComposer-injected variables โโโโโโโโโโ --}}
{{-- Guards against undefined variable errors on error pages / routes --}}
{{-- that bypass the composer (e.g. Livewire component renders). --}}
@php
// Array settings โ always safe to access with []
$seoSettings = $seoSettings ?? [];
$footerSettings = $footerSettings ?? [];
$generalSettings = $generalSettings ?? [];
// Menu objects โ may be null when no menu is configured
$headerMenu = $headerMenu ?? null;
$footerMenu = $footerMenu ?? null;
$footerLegalMenu = $footerLegalMenu ?? null;
// Derived SEO values
$siteTitle = $seoSettings['meta_title'] ?? config('app.name');
$siteDesc = $seoSettings['meta_description'] ?? 'Your trusted online pharmacy โ medicines, wellness & healthcare products delivered fast.';
$siteKeywords = $seoSettings['meta_keywords'] ?? '';
$ogTitle = $seoSettings['og_title'] ?? $siteTitle;
$ogDesc = $seoSettings['og_description'] ?? $siteDesc;
$ogImage = !empty($seoSettings['og_image'])
? asset('storage/' . $seoSettings['og_image'])
: asset('images/og-default.jpg');
$twitterCard = $seoSettings['twitter_card_type'] ?? 'summary_large_image';
$gaId = $seoSettings['google_analytics_id'] ?? '';
$pixelId = $seoSettings['facebook_pixel_id'] ?? '';
$siteVerify = $seoSettings['google_site_verification'] ?? '';
$pageTitle = isset($title) ? $title . ' โ ' . $siteTitle : $siteTitle;
// Brand color: General Settings > Branding stores both the raw hex
// (for the color picker to redisplay) and a pre-computed 11-shade
// palette (see App\Support\BrandPalette) as JSON. Setting::group()
// returns raw values, so JSON columns need decoding here โ same
// pattern used for the homepage's JSON settings.
$brandColor = $generalSettings['brand_color'] ?? null;
$rawPalette = $generalSettings['brand_palette'] ?? null;
$brandPalette = is_string($rawPalette) ? (json_decode($rawPalette, true) ?? null) : $rawPalette;
// Pre-built as a plain string here (rather than a foreach loop nested
// inside a conditional block, inline in the style tag further down)
// for readability. Same output, just assembled in PHP instead of in
// the template.
//
// NOTE: never write the literal characters "at-sign-p-h-p" or
// "at-sign-e-n-d-p-h-p" as plain text anywhere in this file, even in
// a comment or outside a real PHP block. Blade's own compileString()
// extracts every "at-sign-php ... at-sign-endphp" span BEFORE it
// strips comments, using a plain text search with no awareness of
// comment boundaries. A stray mention outside a real block gets
// treated as an opener and silently swallows everything up to the
// next real closer as one raw block โ which is exactly what broke
// the header/footer here (see the incident notes in git history).
$brandPaletteCss = null;
if ($brandPalette) {
$brandPaletteCss = '';
foreach ($brandPalette as $shade => $rgb) {
$brandPaletteCss .= "--color-primary-{$shade}: {$rgb};\n ";
}
}
@endphp
<title>@yield('title', $pageTitle)</title>
@if(!empty($generalSettings['store_favicon']))
<link rel="icon" href="{{ asset('storage/' . $generalSettings['store_favicon']) }}">
@endif
<meta name="description" content="@yield('meta_description', $description ?? $siteDesc)">
@if($siteKeywords)<meta name="keywords" content="{{ $siteKeywords }}">@endif
@if($siteVerify)<meta name="google-site-verification" content="{{ $siteVerify }}">@endif
{{-- Open Graph --}}
<meta property="og:type" content="website">
<meta property="og:title" content="@yield('og_title', $ogTitle)">
<meta property="og:description" content="@yield('og_description', $ogDesc)">
<meta property="og:image" content="@yield('og_image', $ogImage)">
<meta property="og:url" content="{{ url()->current() }}">
{{-- Twitter Card --}}
<meta name="twitter:card" content="{{ $twitterCard }}">
<meta name="twitter:title" content="@yield('og_title', $ogTitle)">
<meta name="twitter:description" content="@yield('og_description', $ogDesc)">
<meta name="twitter:image" content="@yield('og_image', $ogImage)">
@stack('meta')
<link rel="manifest" href="/manifest.json">
<meta name="theme-color" content="{{ $brandColor ?? '#0d9488' }}">
@vite(['resources/css/app.css', 'resources/js/app.js'])
{{-- Brand color override โ see the PHP block near the top of this file
(before the title tag) and App\Support\BrandPalette. Printed as an
inline <style> so it
loads after (and therefore wins the cascade over) the compiled
stylesheet above; every bg-primary-*/text-primary-*/etc. class
repaints without needing a rebuild for this specific change.
Only prints when a custom color has actually been saved โ with
nothing set, app.css's own :root defaults (the original teal)
apply and this block is skipped entirely. --}}
@if($brandPaletteCss)
<style>
:root {
{!! $brandPaletteCss !!}
}
</style>
@endif
@livewireStyles
@stack('head')
{{-- โโ Google Analytics (GA4) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ --}}
@if($gaId)
<script async src="https://www.googletagmanager.com/gtag/js?id={{ $gaId }}"></script>
<script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js',new Date());gtag('config','{{ $gaId }}');</script>
@endif
{{-- โโ Facebook Pixel โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ --}}
@if($pixelId)
<script>!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,document,'script','https://connect.facebook.net/en_US/fbevents.js');fbq('init','{{ $pixelId }}');fbq('track','PageView');</script>
<noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id={{ $pixelId }}&ev=PageView&noscript=1"/></noscript>
@endif
</head>
<body class="h-full antialiased" x-data="{ mobileMenuOpen: false, searchOpen: false }">
@include('layouts.partials.header')
{{-- Main content โ supports both @extends/@section and <x-app-layout> component styles --}}
<main>
@hasSection('content')
@yield('content')
@else
{{ $slot ?? '' }}
@endif
</main>
{{-- โโ Footer โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ --}}
<footer class="bg-gray-900 text-gray-300 mt-16">
{{-- Trust strip --}}
<div class="bg-primary-700 text-white py-4">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
<div class="trust-item !text-white">
<svg class="w-5 h-5 !text-primary-200 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"/></svg>
<div><p class="font-semibold text-sm">100% Genuine</p><p class="text-xs text-primary-200">Licensed pharmacies only</p></div>
</div>
<div class="trust-item !text-white">
<svg class="w-5 h-5 !text-primary-200 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
<div><p class="font-semibold text-sm">Express Delivery</p><p class="text-xs text-primary-200">Same-day in Kathmandu</p></div>
</div>
<div class="trust-item !text-white">
<svg class="w-5 h-5 !text-primary-200 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 8h2a2 2 0 012 2v6a2 2 0 01-2 2h-2v4l-4-4H9a1.994 1.994 0 01-1.414-.586m0 0L11 14h4a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2v4l.586-.586z"/></svg>
<div><p class="font-semibold text-sm">Expert Pharmacists</p><p class="text-xs text-primary-200">Free medicine counselling</p></div>
</div>
<div class="trust-item !text-white">
<svg class="w-5 h-5 !text-primary-200 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4M7.835 4.697a3.42 3.42 0 001.946-.806 3.42 3.42 0 014.438 0 3.42 3.42 0 001.946.806 3.42 3.42 0 013.138 3.138 3.42 3.42 0 00.806 1.946 3.42 3.42 0 010 4.438 3.42 3.42 0 00-.806 1.946 3.42 3.42 0 01-3.138 3.138 3.42 3.42 0 00-1.946.806 3.42 3.42 0 01-4.438 0 3.42 3.42 0 00-1.946-.806 3.42 3.42 0 01-3.138-3.138 3.42 3.42 0 00-.806-1.946 3.42 3.42 0 010-4.438 3.42 3.42 0 00.806-1.946 3.42 3.42 0 013.138-3.138z"/></svg>
<div><p class="font-semibold text-sm">Secure Payments</p><p class="text-xs text-primary-200">eSewa ยท Khalti ยท COD</p></div>
</div>
</div>
</div>
</div>
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
@php
// $footerSettings / $generalSettings already guaranteed non-null from the PHP block near the top of this file
$footerTagline = $footerSettings['footer_tagline'] ?? 'Your trusted online pharmacy โ delivering genuine medicines and healthcare products across Nepal.';
$copyrightText = $footerSettings['copyright_text'] ?? ('ยฉ ' . date('Y') . ' ' . config('app.name') . '. All rights reserved.');
$footerMenuOn = (bool)($footerSettings['footer_menu_enabled'] ?? true);
// Social links
$fbUrl = $footerSettings['facebook_url'] ?? '';
$igUrl = $footerSettings['instagram_url'] ?? '';
$twUrl = $footerSettings['twitter_url'] ?? '';
$ytUrl = $footerSettings['youtube_url'] ?? '';
$ttUrl = $footerSettings['tiktok_url'] ?? '';
$liUrl = $footerSettings['linkedin_url'] ?? '';
$waNumber = $footerSettings['whatsapp_number'] ?? '';
$waUrl = $waNumber ? 'https://wa.me/' . preg_replace('/[^0-9]/', '', $waNumber) : '';
$storeName = $generalSettings['store_name'] ?? config('app.name');
// Pharmacy license / compliance (Admin โ Footer Settings)
$showLicense = (bool)($footerSettings['show_license_in_footer'] ?? true);
$licenseNumber = $footerSettings['license_number'] ?? '';
$licenseAuthority = $footerSettings['license_authority'] ?? 'Department of Drug Administration (DDA)';
$licenseHolder = $footerSettings['license_holder_name'] ?? '';
$licenseValidUntil = $footerSettings['license_valid_until'] ?? '';
@endphp
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
{{-- Column 1: Brand + tagline + social --}}
<div>
<div class="flex items-center gap-2 mb-3">
<svg class="w-7 h-7" viewBox="0 0 32 32" fill="none">
<rect width="32" height="32" rx="8" fill="#0d9488"/>
<path d="M10 16h12M16 10v12" stroke="white" stroke-width="3" stroke-linecap="round"/>
</svg>
<h3 class="text-white font-bold text-lg">{{ $storeName }}</h3>
</div>
<p class="text-sm text-gray-400 mb-4">{{ $footerTagline }}</p>
{{-- Social icons --}}
<div class="flex items-center flex-wrap gap-3">
@if($fbUrl)
<a href="{{ $fbUrl }}" target="_blank" rel="noopener" class="text-gray-400 hover:text-blue-400 transition-colors" aria-label="Facebook">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M18 2h-3a5 5 0 00-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 011-1h3z"/></svg>
</a>
@endif
@if($igUrl)
<a href="{{ $igUrl }}" target="_blank" rel="noopener" class="text-gray-400 hover:text-pink-400 transition-colors" aria-label="Instagram">
<svg class="w-5 h-5" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><rect x="2" y="2" width="20" height="20" rx="5" ry="5"/><path d="M16 11.37A4 4 0 1112.63 8 4 4 0 0116 11.37z"/><line x1="17.5" y1="6.5" x2="17.51" y2="6.5"/></svg>
</a>
@endif
@if($twUrl)
<a href="{{ $twUrl }}" target="_blank" rel="noopener" class="text-gray-400 hover:text-sky-400 transition-colors" aria-label="Twitter/X">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>
</a>
@endif
@if($ytUrl)
<a href="{{ $ytUrl }}" target="_blank" rel="noopener" class="text-gray-400 hover:text-red-500 transition-colors" aria-label="YouTube">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M22.54 6.42a2.78 2.78 0 00-1.95-1.96C18.88 4 12 4 12 4s-6.88 0-8.59.46a2.78 2.78 0 00-1.95 1.96A29 29 0 001 12a29 29 0 00.46 5.58A2.78 2.78 0 003.41 19.54C5.12 20 12 20 12 20s6.88 0 8.59-.46a2.78 2.78 0 001.95-1.96A29 29 0 0023 12a29 29 0 00-.46-5.58zM9.75 15.02V8.98L15.5 12l-5.75 3.02z"/></svg>
</a>
@endif
@if($ttUrl)
<a href="{{ $ttUrl }}" target="_blank" rel="noopener" class="text-gray-400 hover:text-white transition-colors" aria-label="TikTok">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M19.59 6.69a4.83 4.83 0 01-3.77-4.25V2h-3.45v13.67a2.89 2.89 0 01-2.88 2.5 2.89 2.89 0 01-2.89-2.89 2.89 2.89 0 012.89-2.89c.28 0 .54.04.79.1V9.01a6.32 6.32 0 00-.79-.05 6.34 6.34 0 00-6.34 6.34 6.34 6.34 0 006.34 6.34 6.34 6.34 0 006.33-6.34V8.98a8.17 8.17 0 004.78 1.52V7.06a4.85 4.85 0 01-1.01-.37z"/></svg>
</a>
@endif
@if($liUrl)
<a href="{{ $liUrl }}" target="_blank" rel="noopener" class="text-gray-400 hover:text-blue-500 transition-colors" aria-label="LinkedIn">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M16 8a6 6 0 016 6v7h-4v-7a2 2 0 00-2-2 2 2 0 00-2 2v7h-4v-7a6 6 0 016-6zM2 9h4v12H2z"/><circle cx="4" cy="4" r="2"/></svg>
</a>
@endif
@if($waUrl)
<a href="{{ $waUrl }}" target="_blank" rel="noopener" class="text-gray-400 hover:text-green-400 transition-colors" aria-label="WhatsApp">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"/></svg>
</a>
@endif
</div>
</div>
{{-- Column 2: Dynamic footer menu (Shop links) or hardcoded fallback --}}
<div>
@if($footerMenuOn && $footerMenu && $footerMenu->items()->count() > 0)
<h4 class="text-white font-semibold mb-3">{{ $footerMenu->name }}</h4>
<ul class="space-y-2 text-sm">
@foreach($footerMenu->items()->get() as $menuItem)
<li>
<a href="{{ $menuItem->url }}" class="hover:text-white"
@if($menuItem->target === '_blank') target="_blank" rel="noopener" @endif>
{{ $menuItem->label }}
</a>
</li>
@endforeach
</ul>
@else
<h4 class="text-white font-semibold mb-3">Shop</h4>
<ul class="space-y-2 text-sm">
<li><a href="{{ route('products.index') }}" class="hover:text-white">All Medicines</a></li>
<li><a href="{{ route('categories.index') }}" class="hover:text-white">Categories</a></li>
<li><a href="{{ route('flash-sales.index') }}" class="hover:text-white">Flash Sales</a></li>
<li><a href="{{ route('prescriptions.create') }}" class="hover:text-white">Upload Prescription</a></li>
<li><a href="{{ route('blog.index') }}" class="hover:text-white">Health Blog</a></li>
</ul>
@endif
</div>
{{-- Column 3: Account links (always hardcoded โ user-context) --}}
<div>
<h4 class="text-white font-semibold mb-3">Account</h4>
<ul class="space-y-2 text-sm">
<li><a href="{{ route('orders.track.form') }}" class="hover:text-white">Track Order</a></li>
@auth
<li><a href="{{ route('account.show') }}" class="hover:text-white">My Profile</a></li>
<li><a href="{{ route('orders.index') }}" class="hover:text-white">My Orders</a></li>
<li><a href="{{ route('prescriptions.index') }}" class="hover:text-white">My Prescriptions</a></li>
@else
<li><a href="{{ route('login') }}" class="hover:text-white">Login</a></li>
<li><a href="{{ route('register') }}" class="hover:text-white">Register</a></li>
@endauth
</ul>
</div>
{{-- Column 4: For Pharmacies --}}
<div>
<h4 class="text-white font-semibold mb-3">For Pharmacies</h4>
<ul class="space-y-2 text-sm">
@if(config('multivendor.enabled'))
<li><a href="{{ route('vendor.register') }}" class="hover:text-white">Register Your Pharmacy</a></li>
@endif
<li><a href="{{ route('orders.track.form') }}" class="hover:text-white">Track Shipment</a></li>
</ul>
@if($showLicense)
<div class="mt-4 p-3 bg-gray-800 rounded-lg text-xs text-gray-400">
<p class="font-medium text-gray-300 mb-1">Drug License</p>
@if($licenseNumber)
<p>License #: <span class="text-gray-300">{{ $licenseNumber }}</span></p>
@endif
@if($licenseHolder)
<p>Licensed to: <span class="text-gray-300">{{ $licenseHolder }}</span></p>
@endif
<p class="mt-1">Verified and licensed by {{ $licenseAuthority }}.</p>
@if($licenseValidUntil)
<p class="mt-1">Valid until {{ \Illuminate\Support\Carbon::parse($licenseValidUntil)->format('d M Y') }}.</p>
@endif
</div>
@endif
</div>
</div>
{{-- Bottom bar --}}
<div class="border-t border-gray-700 mt-8 pt-8 text-sm text-gray-500">
<div class="flex flex-col md:flex-row items-center justify-between gap-3">
<span>{{ $copyrightText }}</span>
{{-- Legal links from footer_legal menu or hardcoded --}}
@if($footerMenuOn && $footerLegalMenu && $footerLegalMenu->items()->count() > 0)
<nav class="flex items-center gap-4 flex-wrap">
@foreach($footerLegalMenu->items()->get() as $legalItem)
<a href="{{ $legalItem->url }}" class="hover:text-gray-300 transition-colors">{{ $legalItem->label }}</a>
@endforeach
</nav>
@else
<nav class="flex items-center gap-4 flex-wrap">
<a href="{{ route('about') }}" class="hover:text-gray-300">About Us</a>
<a href="{{ route('contact') }}" class="hover:text-gray-300">Contact Us</a>
<a href="{{ url('/page/privacy-policy') }}" class="hover:text-gray-300">Privacy Policy</a>
<a href="{{ url('/page/terms-of-service') }}" class="hover:text-gray-300">Terms of Service</a>
<a href="{{ url('/page/return-policy') }}" class="hover:text-gray-300">Return Policy</a>
</nav>
@endif
</div>
</div>
</div>
</footer>
@livewireScripts
@stack('scripts')
</body>
</html>