<!DOCTYPE html>
<html lang="<?php echo e(app()->getLocale()); ?>" dir="<?php echo e(app()->getLocale() === 'ar' ? 'rtl' : 'ltr'); ?>">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="csrf-token" content="<?php echo e(csrf_token()); ?>">
    <title><?php echo $__env->yieldContent('title', 'Dashboard'); ?> · MUTLAQ SALEH SATI ERP</title>
    <?php if(app()->getLocale() === 'ar'): ?>
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.rtl.min.css">
    <?php else: ?>
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
    <?php endif; ?>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link href="https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
    <style>
        :root{--accent:#0f766e;--accent-soft:#e7f5f3;--ink:#17212b;--muted:#667085;--line:#e7e9ee;--canvas:#f3f5f7;--sidebar:268px;--top:64px}
        *{box-sizing:border-box} body{margin:0;background:var(--canvas);color:var(--ink);font:13px/1.45 <?php echo e(app()->getLocale()==='ar' ? "'Cairo',sans-serif" : "'Inter',sans-serif"); ?>;overflow-x:hidden}
        a{color:inherit}.erp-sidebar{position:fixed;z-index:1040;top:12px;bottom:12px;<?php echo e(app()->getLocale()==='ar'?'right':'left'); ?>:12px;width:var(--sidebar);background:#fff;border:1px solid rgba(16,24,40,.06);border-radius:18px;box-shadow:0 12px 35px rgba(16,24,40,.08);display:flex;flex-direction:column;transition:.2s}
        .brand{height:68px;padding:13px 16px;display:flex;align-items:center;border-bottom:1px solid var(--line)}.brand strong{display:block;font-size:12.5px;letter-spacing:.01em}.brand small{color:var(--muted);font-size:10px}
        .side-scroll{overflow:auto;padding:9px 8px;scrollbar-width:thin}.nav-section{padding:11px 10px 4px;color:#98a2b3;font-size:9px;font-weight:700;letter-spacing:.09em;text-transform:uppercase}.side-link{display:flex;align-items:center;gap:10px;padding:7px 10px;margin:1px 0;border-radius:9px;text-decoration:none;color:#475467;font-weight:500;white-space:nowrap}.side-link i{font-size:15px;width:18px;text-align:center}.side-link:hover{background:#f7f8fa;color:var(--ink)}.side-link.active{background:var(--accent-soft);color:var(--accent);font-weight:700}.side-link .count{margin-inline-start:auto;font-size:9px;background:#eef1f4;border-radius:20px;padding:1px 6px}
        .side-user{margin-top:auto;padding:10px;border-top:1px solid var(--line)}.user-box{display:flex;align-items:center;gap:9px;padding:8px;border-radius:11px;background:#f8fafb}.avatar{width:32px;height:32px;border-radius:50%;display:grid;place-items:center;background:#17212b;color:#fff;font-weight:700}.user-box small{display:block;color:var(--muted);font-size:10px}.logout{border:0;background:transparent;margin-inline-start:auto;color:#98a2b3}
        .erp-topbar{position:fixed;z-index:1030;top:0;<?php echo e(app()->getLocale()==='ar'?'right':'left'); ?>:calc(var(--sidebar) + 24px);<?php echo e(app()->getLocale()==='ar'?'left':'right'); ?>:0;height:var(--top);display:flex;align-items:center;gap:12px;padding:0 22px;background:rgba(243,245,247,.92);backdrop-filter:blur(9px)}.menu-toggle{border:0;background:#fff;border-radius:10px;width:36px;height:36px;box-shadow:0 1px 3px rgba(16,24,40,.08)}
        .global-search{position:relative;width:min(430px,42vw)}.global-search input{height:38px;padding-inline-start:38px;border:1px solid var(--line);border-radius:11px;background:#fff;font-size:12px;box-shadow:0 1px 2px rgba(16,24,40,.03)}.global-search>.bi-search{position:absolute;z-index:2;top:10px;inset-inline-start:13px;color:#98a2b3}.search-key{position:absolute;top:8px;inset-inline-end:9px;border:1px solid var(--line);border-radius:5px;padding:2px 6px;color:#98a2b3;background:#fafafa;font-size:9px}.search-results{display:none;position:absolute;top:43px;inset-inline:0;background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:0 18px 45px rgba(16,24,40,.14);max-height:420px;overflow:auto;padding:7px}.search-results.show{display:block}.search-group{font-size:9px;font-weight:700;text-transform:uppercase;color:#98a2b3;padding:7px 8px 3px}.search-item{display:block;text-decoration:none;padding:7px 8px;border-radius:7px}.search-item:hover{background:#f5f7f8}.search-item small{display:block;color:var(--muted)}
        .top-actions{margin-inline-start:auto;display:flex;align-items:center;gap:8px}.top-btn{height:36px;border:1px solid var(--line);background:#fff;border-radius:10px;padding:0 11px;color:#475467;font-size:11px;font-weight:600}.top-btn.primary{background:var(--accent);color:#fff;border-color:var(--accent)}
        .erp-main{margin-<?php echo e(app()->getLocale()==='ar'?'right':'left'); ?>:calc(var(--sidebar) + 24px);padding:calc(var(--top) + 10px) 22px 28px;min-height:100vh;transition:.2s}.page-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:14px}.page-head h1{font-size:20px;margin:0 0 2px;font-weight:700;letter-spacing:-.02em}.page-head p{margin:0;color:var(--muted);font-size:11px}
        .card-erp{background:#fff;border:1px solid var(--line);border-radius:13px;box-shadow:0 1px 2px rgba(16,24,40,.02);margin-bottom:14px}.card-erp-header{min-height:44px;padding:10px 13px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;font-weight:700}.card-erp-body{padding:13px}.table-responsive{border-radius:0 0 13px 13px}.table-dense{font-size:11px;margin:0}.table-dense thead th{background:#f8f9fb;color:#667085;text-transform:uppercase;letter-spacing:.025em;font-size:9px;font-weight:700;border-bottom:1px solid var(--line);padding:8px 9px;white-space:nowrap}.table-dense td{padding:7px 9px;border-color:#eef0f2;vertical-align:middle}.table-dense tbody tr:hover{background:#fbfcfc}.form-label{font-size:10px;color:#667085;font-weight:700;margin-bottom:4px}.form-control,.form-select{border-color:#dfe3e8;border-radius:8px;font-size:12px;min-height:34px;padding:6px 9px}.form-control:focus,.form-select:focus{border-color:#69aaa4;box-shadow:0 0 0 3px rgba(15,118,110,.09)}.btn{border-radius:8px;font-size:11px;font-weight:600}.btn-primary{background:var(--accent);border-color:var(--accent)}.btn-primary:hover{background:#0b625c;border-color:#0b625c}.btn-dense{padding:5px 9px}.badge{font-size:9px;font-weight:700}.status-finalized,.status-posted,.status-approved,.status-received,.status-active,.status-open{background:#e8f7ee!important;color:#16794b!important}.status-draft,.status-requested,.status-in_transit{background:#fff5dd!important;color:#9a6700!important}.status-cancelled,.status-inactive,.status-closed{background:#f1f2f4!important;color:#667085!important}
        .stat-card{padding:13px}.stat-card .label{color:var(--muted);font-size:10px;font-weight:600}.stat-card .value{font-size:19px;font-weight:700;margin-top:4px;letter-spacing:-.02em}.stat-card .icon{width:34px;height:34px;border-radius:10px;background:var(--accent-soft);color:var(--accent);display:grid;place-items:center;font-size:15px}.text-accent{color:var(--accent)!important}.bg-accent-soft{background:var(--accent-soft)!important}.sticky-actions{position:sticky;bottom:10px;z-index:1000;background:rgba(255,255,255,.94);backdrop-filter:blur(8px);border:1px solid var(--line);border-radius:12px;padding:9px 11px;box-shadow:0 12px 30px rgba(16,24,40,.12)}
        body.sidebar-collapsed .erp-sidebar{transform:translateX(<?php echo e(app()->getLocale()==='ar'?'290px':'-290px'); ?>)} body.sidebar-collapsed .erp-topbar{ <?php echo e(app()->getLocale()==='ar'?'right':'left'); ?>:0} body.sidebar-collapsed .erp-main{margin-<?php echo e(app()->getLocale()==='ar'?'right':'left'); ?>:0}
        @media(max-width:991px){.erp-sidebar{transform:translateX(<?php echo e(app()->getLocale()==='ar'?'290px':'-290px'); ?>)}.erp-sidebar.mobile-open{transform:none}.erp-topbar{inset-inline:0}.erp-main{margin-inline:0;padding-inline:12px}.global-search{width:min(360px,48vw)}.branch-label{display:none}}
        @media(max-width:600px){.global-search{width:auto;flex:1}.search-key,.quick-label,.language-label{display:none}.erp-topbar{padding:0 10px}.top-btn{padding:0 9px}.page-head{align-items:center}.page-head h1{font-size:17px}}
        @media print{.erp-sidebar,.erp-topbar,.no-print,.alert{display:none!important}.erp-main{margin:0!important;padding:0!important}.card-erp{box-shadow:none}}
    </style>
    <?php echo $__env->yieldContent('styles'); ?>
</head>
<body>
<?php $ar=app()->getLocale()==='ar'; $active=fn($pattern)=>request()->routeIs($pattern)?'active':''; $can=fn($permission)=>auth()->user()?->hasPermission($permission); ?>
<aside class="erp-sidebar" id="sidebar">
    <div class="brand"><div><strong>MUTLAQ SALEH SATI</strong><small><?php echo e($ar?'نظام المحاسبة والمخزون':'Accounting & Inventory ERP'); ?></small></div></div>
    <nav class="side-scroll">
        <a class="side-link <?php echo e($active('dashboard')); ?>" href="<?php echo e(route('dashboard')); ?>"><i class="bi bi-speedometer2"></i><?php echo e($ar?'لوحة التحكم':'Dashboard'); ?></a>
        <div class="nav-section"><?php echo e($ar?'المبيعات':'Sales'); ?></div>
        <?php if($can('sales.create')): ?><a class="side-link <?php echo e($active('sales.create')); ?>" href="<?php echo e(route('sales.create')); ?>"><i class="bi bi-receipt-cutoff"></i><?php echo e($ar?'فاتورة جديدة':'New Invoice'); ?><span class="count">F9</span></a><?php endif; ?>
        <?php if($can('sales.view')): ?><a class="side-link <?php echo e($active('sales.index')||$active('sales.show')?'active':''); ?>" href="<?php echo e(route('sales.index')); ?>"><i class="bi bi-files"></i><?php echo e($ar?'فواتير المبيعات':'Sales Invoices'); ?></a><?php endif; ?>
        <?php if($can('sales-return.view')): ?><a class="side-link <?php echo e($active('sales-returns.*')); ?>" href="<?php echo e(route('sales-returns.index')); ?>"><i class="bi bi-arrow-return-left"></i><?php echo e($ar?'مرتجع المبيعات':'Sales Returns'); ?></a><?php endif; ?>
        <?php if($can('customers.view')): ?><a class="side-link <?php echo e($active('customers.*')); ?>" href="<?php echo e(route('customers.index')); ?>"><i class="bi bi-people"></i><?php echo e($ar?'العملاء':'Customers'); ?></a><?php endif; ?>
        <div class="nav-section"><?php echo e($ar?'مبيعات الفان':'Van Sales'); ?></div>
        <?php if($can('van-sales.view')): ?><a class="side-link <?php echo e($active('van.*')); ?>" href="<?php echo e(route('van.index')); ?>"><i class="bi bi-truck-front"></i><?php echo e($ar?'تشغيل الفانات':'Van Operations'); ?></a><?php endif; ?>
        <div class="nav-section"><?php echo e($ar?'المشتريات':'Purchase'); ?></div>
        <?php if($can('purchases.create')): ?><a class="side-link <?php echo e($active('purchases.create')); ?>" href="<?php echo e(route('purchases.create')); ?>"><i class="bi bi-bag-plus"></i><?php echo e($ar?'شراء جديد':'New Purchase'); ?></a><?php endif; ?>
        <?php if($can('purchases.view')): ?><a class="side-link <?php echo e($active('purchases.index')||$active('purchases.show')?'active':''); ?>" href="<?php echo e(route('purchases.index')); ?>"><i class="bi bi-bag-check"></i><?php echo e($ar?'فواتير الشراء':'Purchase Invoices'); ?></a><?php endif; ?>
        <?php if($can('purchase-return.view')): ?><a class="side-link <?php echo e($active('purchase-returns.*')); ?>" href="<?php echo e(route('purchase-returns.index')); ?>"><i class="bi bi-arrow-return-right"></i><?php echo e($ar?'مرتجع الشراء':'Purchase Returns'); ?></a><?php endif; ?>
        <?php if($can('suppliers.view')): ?><a class="side-link <?php echo e($active('suppliers.*')); ?>" href="<?php echo e(route('suppliers.index')); ?>"><i class="bi bi-buildings"></i><?php echo e($ar?'الموردون':'Suppliers'); ?></a><?php endif; ?>
        <div class="nav-section"><?php echo e($ar?'المخزون':'Inventory'); ?></div>
        <?php if($can('products.view')): ?><a class="side-link <?php echo e($active('products.*')); ?>" href="<?php echo e(route('products.index')); ?>"><i class="bi bi-box-seam"></i><?php echo e($ar?'المنتجات':'Products'); ?></a><?php endif; ?>
        <?php if($can('inventory.view')): ?><a class="side-link <?php echo e($active('current-stock.*')); ?>" href="<?php echo e(route('current-stock.index')); ?>"><i class="bi bi-boxes"></i><?php echo e($ar?'المخزون الحالي':'Current Stock'); ?></a><?php endif; ?>
        <?php if($can('inventory.view')): ?><a class="side-link <?php echo e($active('opening-stock.*')); ?>" href="<?php echo e(route('opening-stock.index')); ?>"><i class="bi bi-archive"></i><?php echo e($ar?'المخزون الافتتاحي':'Opening Stock'); ?></a><?php endif; ?>
        <?php if($can('stock-transfer.view')): ?><a class="side-link <?php echo e($active('stock-transfers.*')); ?>" href="<?php echo e(route('stock-transfers.index')); ?>"><i class="bi bi-arrow-left-right"></i><?php echo e($ar?'تحويل المخزون':'Stock Transfer'); ?></a><?php endif; ?>
        <?php if($can('stock-adjustment.view')): ?><a class="side-link <?php echo e($active('stock-adjustments.*')); ?>" href="<?php echo e(route('stock-adjustments.index')); ?>"><i class="bi bi-sliders"></i><?php echo e($ar?'تسوية المخزون':'Stock Adjustment'); ?></a><?php endif; ?>
        <?php if($can('inventory.view')): ?><a class="side-link <?php echo e($active('stock-ledger.*')); ?>" href="<?php echo e(route('stock-ledger.index')); ?>"><i class="bi bi-journal-text"></i><?php echo e($ar?'دفتر المخزون':'Stock Ledger'); ?></a><?php endif; ?>
        <div class="nav-section"><?php echo e($ar?'الحسابات':'Accounts'); ?></div>
        <?php if($can('accounts.view')): ?><a class="side-link <?php echo e($active('accounts.chart')); ?>" href="<?php echo e(route('accounts.chart')); ?>"><i class="bi bi-diagram-3"></i><?php echo e($ar?'دليل الحسابات':'Chart of Accounts'); ?></a><?php endif; ?>
        <?php if($can('journal.view')): ?><a class="side-link <?php echo e($active('accounts.journals*')); ?>" href="<?php echo e(route('accounts.journals')); ?>"><i class="bi bi-journal-plus"></i><?php echo e($ar?'القيود اليومية':'Journal Entries'); ?></a><?php endif; ?>
        <?php if($can('accounts.view')): ?><a class="side-link <?php echo e($active('accounts.ledger')); ?>" href="<?php echo e(route('accounts.ledger')); ?>"><i class="bi bi-book"></i><?php echo e($ar?'الأستاذ العام':'General Ledger'); ?></a><?php endif; ?>
        <?php if($can('receipts.view')): ?><a class="side-link <?php echo e(request('type')==='receipts'?'active':''); ?>" href="<?php echo e(route('treasury.index','receipts')); ?>"><i class="bi bi-cash-coin"></i><?php echo e($ar?'المقبوضات':'Receipts'); ?></a><?php endif; ?>
        <?php if($can('payments.view')): ?><a class="side-link <?php echo e(request('type')==='payments'?'active':''); ?>" href="<?php echo e(route('treasury.index','payments')); ?>"><i class="bi bi-credit-card"></i><?php echo e($ar?'المدفوعات':'Payments'); ?></a><?php endif; ?>
        <?php if($can('expenses.view')): ?><a class="side-link <?php echo e(request('type')==='expenses'?'active':''); ?>" href="<?php echo e(route('treasury.index','expenses')); ?>"><i class="bi bi-wallet2"></i><?php echo e($ar?'المصروفات':'Expenses'); ?></a><?php endif; ?>
        <div class="nav-section"><?php echo e($ar?'التقارير والإعدادات':'Reports & Settings'); ?></div>
        <?php if($can('reports.view')): ?><a class="side-link <?php echo e($active('reports.*')); ?>" href="<?php echo e(route('reports.index')); ?>"><i class="bi bi-bar-chart-line"></i><?php echo e($ar?'التقارير والضريبة':'Reports & VAT'); ?></a><?php endif; ?>
        <?php if($can('settings.access_settings')): ?><a class="side-link <?php echo e($active('settings.*')||$active('branches.*')||$active('warehouses.*')?'active':''); ?>" href="<?php echo e(route('settings.company')); ?>"><i class="bi bi-gear"></i><?php echo e($ar?'الإعدادات':'Settings'); ?></a><?php endif; ?>
        <?php if($can('users.view')||$can('roles.view')): ?><a class="side-link <?php echo e($active('users.*')||$active('roles.*')?'active':''); ?>" href="<?php echo e($can('users.view')?route('users.index'):route('roles.index')); ?>"><i class="bi bi-shield-check"></i><?php echo e($ar?'المستخدمون والصلاحيات':'Users & Permissions'); ?></a><?php endif; ?>
        <?php if($can('backups.view')): ?><a class="side-link <?php echo e($active('backups.*')); ?>" href="<?php echo e(route('backups.index')); ?>"><i class="bi bi-database-check"></i><?php echo e($ar?'النسخ الاحتياطي':'Backup'); ?></a><?php endif; ?>
    </nav>
    <div class="side-user"><div class="user-box"><div class="avatar"><?php echo e(mb_strtoupper(mb_substr(auth()->user()->name??'U',0,1))); ?></div><div class="text-truncate"><strong class="d-block text-truncate" style="max-width:145px"><?php echo e(auth()->user()->name??'User'); ?></strong><small><?php echo e(auth()->user()?->roles->first()?->name??'Administrator'); ?></small></div><form class="ms-auto" method="POST" action="<?php echo e(route('logout')); ?>"><?php echo csrf_field(); ?><button class="logout" title="Logout"><i class="bi bi-box-arrow-right"></i></button></form></div></div>
</aside>
<header class="erp-topbar">
    <button class="menu-toggle" id="menuToggle" aria-label="Toggle navigation"><i class="bi bi-list"></i></button>
    <div class="global-search"><i class="bi bi-search"></i><input id="globalSearch" class="form-control" autocomplete="off" placeholder="<?php echo e($ar?'ابحث عن فاتورة، منتج، عميل، باركود...':'Search invoices, products, customers, barcodes…'); ?>"><span class="search-key">Ctrl K</span><div id="searchResults" class="search-results"></div></div>
    <div class="top-actions">
        <div class="dropdown"><button class="top-btn primary" data-bs-toggle="dropdown"><i class="bi bi-plus-lg"></i> <span class="quick-label"><?php echo e($ar?'إضافة سريعة':'Quick add'); ?></span></button><div class="dropdown-menu dropdown-menu-end shadow-sm border-0"><?php if($can('sales.create')): ?><a class="dropdown-item small" href="<?php echo e(route('sales.create')); ?>">New sales invoice</a><?php endif; ?> <?php if($can('purchases.create')): ?><a class="dropdown-item small" href="<?php echo e(route('purchases.create')); ?>">New purchase</a><?php endif; ?> <?php if($can('receipts.create')): ?><a class="dropdown-item small" href="<?php echo e(route('treasury.create','receipts')); ?>">New receipt</a><?php endif; ?> <?php if($can('products.create')): ?><a class="dropdown-item small" href="<?php echo e(route('products.create')); ?>">New product</a><?php endif; ?></div></div>
        <div class="dropdown"><button class="top-btn" data-bs-toggle="dropdown"><i class="bi bi-building"></i> <span class="branch-label"><?php echo e(auth()->user()?->branches->first()?->code??'JED'); ?></span></button><div class="dropdown-menu dropdown-menu-end shadow-sm border-0"><?php $__empty_1 = true; $__currentLoopData = auth()->user()?->branches??[]; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $branch): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><span class="dropdown-item small"><?php echo e($branch->code); ?> · <?php echo e($branch->name_en); ?></span><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><span class="dropdown-item small">JED · Jeddah Main</span><?php endif; ?></div></div>
        <a class="top-btn text-decoration-none d-flex align-items-center" href="<?php echo e(route('language.switch',$ar?'en':'ar')); ?>"><i class="bi bi-translate"></i> <span class="language-label"><?php echo e($ar?'EN':'العربية'); ?></span></a>
    </div>
</header>
<main class="erp-main">
    <?php if(session('success')): ?><div class="alert alert-success alert-dismissible fade show py-2 px-3 border-0 shadow-sm small"><i class="bi bi-check-circle me-1"></i><?php echo e(session('success')); ?><button class="btn-close" data-bs-dismiss="alert"></button></div><?php endif; ?>
    <?php if(session('error')): ?><div class="alert alert-danger alert-dismissible fade show py-2 px-3 border-0 shadow-sm small"><i class="bi bi-exclamation-triangle me-1"></i><?php echo e(session('error')); ?><button class="btn-close" data-bs-dismiss="alert"></button></div><?php endif; ?>
    <?php if($errors->any()): ?><div class="alert alert-danger py-2 px-3 border-0 shadow-sm small"><strong>Please correct the highlighted fields.</strong><ul class="mb-0 mt-1"><?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><li><?php echo e($error); ?></li><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></ul></div><?php endif; ?>
    <?php echo $__env->yieldContent('content'); ?>
</main>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script>
const body=document.body,sidebar=document.getElementById('sidebar');document.getElementById('menuToggle').addEventListener('click',()=>{if(innerWidth<992)sidebar.classList.toggle('mobile-open');else{body.classList.toggle('sidebar-collapsed');localStorage.setItem('erp-sidebar',body.classList.contains('sidebar-collapsed')?'1':'0')}});if(innerWidth>=992&&localStorage.getItem('erp-sidebar')==='1')body.classList.add('sidebar-collapsed');
const gs=document.getElementById('globalSearch'),sr=document.getElementById('searchResults');let searchTimer;function esc(s){const d=document.createElement('div');d.textContent=s??'';return d.innerHTML}gs.addEventListener('input',()=>{clearTimeout(searchTimer);const q=gs.value.trim();if(q.length<2){sr.classList.remove('show');return}searchTimer=setTimeout(async()=>{const r=await fetch(`<?php echo e(route('global-search')); ?>?q=${encodeURIComponent(q)}`,{headers:{Accept:'application/json'}});const groups=await r.json();let html='';Object.entries(groups).forEach(([name,items])=>{if(items.length){html+=`<div class="search-group">${esc(name)}</div>`;items.forEach(i=>html+=`<a class="search-item" href="${esc(i.url)}"><strong>${esc(i.label)}</strong><small>${esc(i.meta)}</small></a>`)}});sr.innerHTML=html||'<div class="p-3 text-muted">No matching records</div>';sr.classList.add('show')},180)});document.addEventListener('click',e=>{if(!e.target.closest('.global-search'))sr.classList.remove('show')});document.addEventListener('keydown',e=>{if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()==='k'){e.preventDefault();gs.focus()}if(e.key==='Escape'){sr.classList.remove('show');gs.blur()}});
</script>
<?php echo $__env->yieldContent('scripts'); ?>
</body>
</html>
<?php /**PATH C:\xampp\htdocs\saudi\resources\views\layouts\app.blade.php ENDPATH**/ ?>