<?php
    $siteName = $siteName ?? \App\Models\Setting::get('site_name', config('app.name', 'فروشگاه'));
    $adminAsset = url('theme/admin');
    $faviconUrl = $siteFavicon ?? null;
    if (!$faviconUrl) {
        $faviconFile = \App\Models\Setting::get('site_favicon', '');
        $faviconUrl = $faviconFile
            ? asset('uploads/site/' . $faviconFile)
            : $adminAsset . '/img/favicon/favicon.ico';
    }
?>
<!DOCTYPE html>

<html
    lang="fa"
    class="light-style layout-navbar-fixed layout-menu-fixed layout-compact"
    dir="rtl"
    data-theme="theme-default"
    data-assets-path="<?php echo e($adminAsset); ?>/"
    data-template="vertical-menu-template-no-customizer">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />

    <title><?php echo e($siteName); ?> - پنل ادمین - <?php echo $__env->yieldContent('title'); ?></title>

    <meta name="description" content="" />

    <link rel="icon" href="<?php echo e($faviconUrl); ?>" />

    <!-- Fonts -->
    <link rel="preconnect" href="https://fonts.googleapis.com" />
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
    <link href="https://fonts.googleapis.com/css2?family=Public+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&amp;display=swap" rel="stylesheet" />

    <!-- Icons -->
    <link rel="stylesheet" href="<?php echo e($adminAsset); ?>/vendor/fonts/fontawesome.css" />
    <link rel="stylesheet" href="<?php echo e($adminAsset); ?>/vendor/fonts/tabler-icons.css" />
    <link rel="stylesheet" href="<?php echo e($adminAsset); ?>/vendor/fonts/flag-icons.css" />

    <!-- Core CSS -->
    <link rel="stylesheet" href="<?php echo e($adminAsset); ?>/vendor/css/rtl/core.css" />
    <link rel="stylesheet" href="<?php echo e($adminAsset); ?>/vendor/css/rtl/theme-default.css" />
    <link rel="stylesheet" href="<?php echo e($adminAsset); ?>/css/demo.css" />

    <!-- Vendors CSS -->
    <link rel="stylesheet" href="<?php echo e($adminAsset); ?>/vendor/libs/node-waves/node-waves.css" />
    <link rel="stylesheet" href="<?php echo e($adminAsset); ?>/vendor/libs/perfect-scrollbar/perfect-scrollbar.css" />
    <link rel="stylesheet" href="<?php echo e($adminAsset); ?>/vendor/libs/typeahead-js/typeahead.css" />
    <link rel="stylesheet" href="<?php echo e($adminAsset); ?>/vendor/libs/apex-charts/apex-charts.css" />
    <link rel="stylesheet" href="<?php echo e($adminAsset); ?>/vendor/libs/swiper/swiper.css" />
    <link rel="stylesheet" href="<?php echo e($adminAsset); ?>/vendor/libs/datatables-bs5/datatables.bootstrap5.css" />
    <link rel="stylesheet" href="<?php echo e($adminAsset); ?>/vendor/libs/datatables-responsive-bs5/responsive.bootstrap5.css" />
    <link rel="stylesheet" href="<?php echo e($adminAsset); ?>/vendor/libs/datatables-checkboxes-jquery/datatables.checkboxes.css" />
    <link rel="stylesheet" href="<?php echo e($adminAsset); ?>/vendor/css/pages/cards-advance.css" />
    <link rel="stylesheet" href="<?php echo e($adminAsset); ?>/vendor/libs/sweetalert2/sweetalert2.css" />
    <style>
        .swal2-popup, .swal2-popup * { font-family: inherit !important; }
    </style>

    <?php echo $__env->yieldContent('customhead'); ?>

    <script src="<?php echo e($adminAsset); ?>/vendor/js/helpers.js"></script>
    <script src="<?php echo e($adminAsset); ?>/js/config.js"></script>
</head>

<body>
<div class="layout-wrapper layout-content-navbar">
    <div class="layout-container">

        <!-- Menu -->
        <aside id="layout-menu" class="layout-menu menu-vertical menu bg-menu-theme">
            <div class="app-brand demo">
                <a href="<?php echo e(route('admin.index')); ?>" class="app-brand-link">
                    <img class="w-px-200" src="<?php echo e($siteLogo); ?>" alt="<?php echo e($siteName); ?>">
                </a>
                <a href="javascript:void(0);" class="layout-menu-toggle menu-link text-large ms-auto">
                    <i class="ti menu-toggle-icon d-none d-xl-block ti-sm align-middle"></i>
                    <i class="ti ti-x d-block d-xl-none ti-sm align-middle"></i>
                </a>
            </div>

            <div class="menu-inner-shadow"></div>

            <ul class="menu-inner py-1 mt-3">

                <?php
                    $pendingOrders = \App\Models\Order::where('status', 'paid')->count();
                    $pendingCancelRequests = \App\Models\OrderCancelRequest::where('status', 'pending')->count();
                    $pendingReviews = \App\Models\ProductReview::where('status', 'pending')->count();
                    $openTickets = \App\Models\Ticket::whereIn('status', ['opened', 'user_replied'])->count();
                    $settingsMenuOpen = request()->routeIs('admin.settings.*')
                        && !request()->routeIs('admin.settings.club.*')
                        && !request()->routeIs('admin.settings.contact-page*')
                        && !request()->routeIs('admin.settings.about-page*')
                        && !request()->routeIs('admin.settings.terms-page*')
                        && !request()->routeIs('admin.settings.backups*')
                        && !request()->routeIs('admin.settings.ai-models*')
                        && !request()->routeIs('admin.settings.biata-bot*')
                        && !request()->routeIs('admin.settings.content-generation*');
                    $aiMenuOpen = request()->routeIs('admin.settings.ai-models*')
                        || request()->routeIs('admin.settings.biata-bot*')
                        || request()->routeIs('admin.settings.content-generation*')
                        || request()->routeIs('admin.biata-bot.chats.*');
                ?>

                
                <li class="menu-header small text-uppercase">
                    <span class="menu-header-text">مدیریت</span>
                </li>

                <li class="menu-item <?php echo e(request()->routeIs('admin.index') ? 'active' : ''); ?>">
                    <a href="<?php echo e(route('admin.index')); ?>" class="menu-link">
                        <i class="menu-icon tf-icons ti ti-layout-dashboard"></i>
                        <div>داشبورد مدیر</div>
                    </a>
                </li>

                <li class="menu-item <?php echo e(request()->routeIs('admin.analytics.*') ? 'active' : ''); ?>">
                    <a href="<?php echo e(route('admin.analytics.index')); ?>" class="menu-link">
                        <i class="menu-icon tf-icons ti ti-chart-bar"></i>
                        <div>تجزیه و تحلیل</div>
                    </a>
                </li>

                <li class="menu-item <?php echo e(request()->routeIs('admin.products.*') || request()->routeIs('admin.brands.*') || request()->routeIs('admin.reviews.*') || request()->routeIs('admin.discount-codes.*') ? 'active open' : ''); ?>">
                    <a href="javascript:void(0);" class="menu-link menu-toggle">
                        <i class="menu-icon tf-icons ti ti-package"></i>
                        <div>مدیریت فروشگاه</div>
                        <?php if($pendingReviews > 0): ?>
                        <span class="badge bg-danger rounded-pill ms-auto"><?php echo e($pendingReviews); ?></span>
                        <?php endif; ?>
                    </a>
                    <ul class="menu-sub">
                        <li class="menu-item <?php echo e(request()->routeIs('admin.products.index', 'admin.products.edit') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.products.index')); ?>" class="menu-link">
                                <div>لیست محصولات</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.products.create', 'admin.products.store') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.products.create')); ?>" class="menu-link">
                                <div>محصول جدید</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.products.categories.*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.products.categories.index')); ?>" class="menu-link">
                                <div>دسته‌بندی‌ها</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.brands.*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.brands.index')); ?>" class="menu-link">
                                <div>برندها</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.reviews.index') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.reviews.index')); ?>" class="menu-link">
                                <div>لیست دیدگاه‌ها</div>
                                <?php if($pendingReviews > 0): ?>
                                <span class="badge bg-danger rounded-pill ms-auto"><?php echo e($pendingReviews); ?></span>
                                <?php endif; ?>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.reviews.create') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.reviews.create')); ?>" class="menu-link">
                                <div>دیدگاه جدید</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.discount-codes.index') || request()->routeIs('admin.discount-codes.edit') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.discount-codes.index')); ?>" class="menu-link">
                                <div>کدهای تخفیف</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.discount-codes.create', 'admin.discount-codes.store') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.discount-codes.create')); ?>" class="menu-link">
                                <div>کد تخفیف جدید</div>
                            </a>
                        </li>
                    </ul>
                </li>

                <li class="menu-item <?php echo e(request()->routeIs('admin.orders.*') ? 'active open' : ''); ?>">
                    <a href="javascript:void(0);" class="menu-link menu-toggle">
                        <i class="menu-icon tf-icons ti ti-shopping-cart"></i>
                        <div>مدیریت سفارشات</div>
                        <?php if($pendingOrders + $pendingCancelRequests > 0): ?>
                        <span class="badge bg-danger rounded-pill ms-auto"><?php echo e($pendingOrders + $pendingCancelRequests); ?></span>
                        <?php endif; ?>
                    </a>
                    <ul class="menu-sub">
                        <li class="menu-item <?php echo e(request()->routeIs('admin.orders.index') || request()->routeIs('admin.orders.show') || request()->routeIs('admin.orders.updateStatus') || request()->routeIs('admin.orders.saveTracking') || request()->routeIs('admin.orders.destroy') || request()->routeIs('admin.orders.amadast-sync') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.orders.index')); ?>" class="menu-link">
                                <div>همه سفارشات</div>
                                <?php if($pendingOrders > 0): ?>
                                <span class="badge bg-danger rounded-pill ms-auto"><?php echo e($pendingOrders); ?></span>
                                <?php endif; ?>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.orders.returns.*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.orders.returns.index')); ?>" class="menu-link">
                                <div>درخواست‌های لغو</div>
                                <?php if($pendingCancelRequests > 0): ?>
                                <span class="badge bg-danger rounded-pill ms-auto"><?php echo e($pendingCancelRequests); ?></span>
                                <?php endif; ?>
                            </a>
                        </li>
                    </ul>
                </li>

                <li class="menu-item <?php echo e(request()->routeIs('admin.settings.club.*') ? 'active open' : ''); ?>">
                    <a href="javascript:void(0);" class="menu-link menu-toggle">
                        <i class="menu-icon tf-icons ti ti-gift"></i>
                        <div>باشگاه مشتریان</div>
                    </a>
                    <ul class="menu-sub">
                        <li class="menu-item <?php echo e(request()->routeIs('admin.settings.club.wheel*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.settings.club.wheel')); ?>" class="menu-link">
                                <div>تنظیمات گردونه شانس</div>
                            </a>
                        </li>
                    </ul>
                </li>

                <li class="menu-item <?php echo e(request()->routeIs('admin.finance.*') || request()->routeIs('admin.wallets.*') ? 'active open' : ''); ?>">
                    <a href="javascript:void(0);" class="menu-link menu-toggle">
                        <i class="menu-icon tf-icons ti ti-wallet"></i>
                        <div>مالی</div>
                    </a>
                    <ul class="menu-sub">
                        <li class="menu-item <?php echo e(request()->routeIs('admin.wallets.*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.wallets.index')); ?>" class="menu-link">
                                <div>کیف پول کاربران</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.finance.transactions.*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.finance.transactions.index')); ?>" class="menu-link">
                                <div>تراکنش‌ها</div>
                            </a>
                        </li>
                    </ul>
                </li>

                <li class="menu-item <?php echo e(request()->routeIs('admin.users.*') ? 'active' : ''); ?>">
                    <a href="<?php echo e(route('admin.users.index')); ?>" class="menu-link">
                        <i class="menu-icon tf-icons ti ti-users"></i>
                        <div>لیست کاربران</div>
                    </a>
                </li>

                
                <li class="menu-header small text-uppercase">
                    <span class="menu-header-text">محتوا</span>
                </li>

                <li class="menu-item <?php echo e(request()->routeIs('admin.announcements.*') ? 'active' : ''); ?>">
                    <a href="<?php echo e(route('admin.announcements.index')); ?>" class="menu-link">
                        <i class="menu-icon tf-icons ti ti-bell"></i>
                        <div>اطلاعیه‌ها</div>
                    </a>
                </li>

                <li class="menu-item <?php echo e(request()->routeIs('admin.blog.*') ? 'active open' : ''); ?>">
                    <a href="javascript:void(0);" class="menu-link menu-toggle">
                        <i class="menu-icon tf-icons ti ti-news"></i>
                        <div>وبلاگ</div>
                    </a>
                    <ul class="menu-sub">
                        <li class="menu-item <?php echo e(request()->routeIs('admin.blog.posts.index', 'admin.blog.posts.edit') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.blog.posts.index')); ?>" class="menu-link">
                                <div>لیست مقالات</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.blog.posts.create') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.blog.posts.create')); ?>" class="menu-link">
                                <div>مقاله جدید</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.blog.categories.*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.blog.categories.index')); ?>" class="menu-link">
                                <div>دسته‌بندی‌ها</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.blog.tags.*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.blog.tags.index')); ?>" class="menu-link">
                                <div>تگ‌ها</div>
                            </a>
                        </li>
                    </ul>
                </li>

                <li class="menu-item <?php echo e(request()->routeIs('admin.settings.contact-page*') || request()->routeIs('admin.settings.about-page*') || request()->routeIs('admin.settings.terms-page*') ? 'active open' : ''); ?>">
                    <a href="javascript:void(0);" class="menu-link menu-toggle">
                        <i class="menu-icon tf-icons ti ti-file-text"></i>
                        <div>صفحات</div>
                    </a>
                    <ul class="menu-sub">
                        <li class="menu-item <?php echo e(request()->routeIs('admin.settings.contact-page*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.settings.contact-page')); ?>" class="menu-link">
                                <div>صفحه تماس با ما</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.settings.about-page*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.settings.about-page')); ?>" class="menu-link">
                                <div>صفحه درباره ما</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.settings.terms-page*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.settings.terms-page')); ?>" class="menu-link">
                                <div>صفحه قوانین و مقررات</div>
                            </a>
                        </li>
                    </ul>
                </li>

                
                <li class="menu-item <?php echo e(request()->routeIs('admin.tickets.*') ? 'active open' : ''); ?>">
                    <a href="javascript:void(0);" class="menu-link menu-toggle">
                        <i class="menu-icon tf-icons ti ti-headset"></i>
                        <div>پشتیبانی</div>
                        <?php if($openTickets > 0): ?>
                        <span class="badge bg-danger rounded-pill ms-auto"><?php echo e($openTickets); ?></span>
                        <?php endif; ?>
                    </a>
                    <ul class="menu-sub">
                        <li class="menu-item <?php echo e(request()->routeIs('admin.tickets.index', 'admin.tickets.show') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.tickets.index')); ?>" class="menu-link">
                                <div>درخواست‌های پشتیبانی</div>
                                <?php if($openTickets > 0): ?>
                                <span class="badge bg-danger rounded-pill ms-auto"><?php echo e($openTickets); ?></span>
                                <?php endif; ?>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.tickets.new', 'admin.tickets.store') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.tickets.new')); ?>" class="menu-link">
                                <div>درخواست پشتیبانی جدید</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.tickets.departments.index', 'admin.tickets.departments.edit') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.tickets.departments.index')); ?>" class="menu-link">
                                <div>دپارتمان‌های پشتیبانی</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.tickets.departments.new', 'admin.tickets.departments.store') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.tickets.departments.new')); ?>" class="menu-link">
                                <div>دپارتمان پشتیبانی جدید</div>
                            </a>
                        </li>
                    </ul>
                </li>

                <li class="menu-item <?php echo e(request()->routeIs('admin.settings.backups*') ? 'active' : ''); ?>">
                    <a href="<?php echo e(route('admin.settings.backups')); ?>" class="menu-link">
                        <i class="menu-icon tf-icons ti ti-database-export"></i>
                        <div>مدیریت بک‌آپ</div>
                    </a>
                </li>

                
                <li class="menu-item <?php echo e($aiMenuOpen ? 'active open' : ''); ?>">
                    <a href="javascript:void(0);" class="menu-link menu-toggle">
                        <i class="menu-icon tf-icons ti ti-brain"></i>
                        <div>مرکز هوش مصنوعی</div>
                    </a>
                    <ul class="menu-sub">
                        <li class="menu-item <?php echo e(request()->routeIs('admin.settings.ai-models*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.settings.ai-models')); ?>" class="menu-link">
                                <div>تنظیمات مدل‌ها</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.settings.biata-bot') || request()->routeIs('admin.settings.biata-bot.save') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.settings.biata-bot')); ?>" class="menu-link">
                                <div>تنظیمات بیاتو بات</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.biata-bot.chats.*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.biata-bot.chats.index')); ?>" class="menu-link">
                                <div>گزارشات گفتگو</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.settings.content-generation*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.settings.content-generation')); ?>" class="menu-link">
                                <div>تنظیمات تولید محتوا</div>
                            </a>
                        </li>
                    </ul>
                </li>

                
                <li class="menu-item <?php echo e($settingsMenuOpen ? 'active open' : ''); ?>">
                    <a href="javascript:void(0);" class="menu-link menu-toggle">
                        <i class="menu-icon tf-icons ti ti-settings"></i>
                        <div>تنظیمات</div>
                    </a>
                    <ul class="menu-sub">
                        <li class="menu-item <?php echo e(request()->routeIs('admin.settings.main*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.settings.main')); ?>" class="menu-link">
                                <div>تنظیمات اصلی</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.settings.appearance*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.settings.appearance')); ?>" class="menu-link">
                                <div>تنظیمات ظاهری</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.settings.seo*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.settings.seo')); ?>" class="menu-link">
                                <div>تنظیمات سئو</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.settings.torob-api*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.settings.torob-api')); ?>" class="menu-link">
                                <div>اتصال ترب</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.settings.payment-methods*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.settings.payment-methods')); ?>" class="menu-link">
                                <div>روش‌های پرداخت</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.settings.zibal*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.settings.zibal')); ?>" class="menu-link">
                                <div>درگاه پرداخت زیبال</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.settings.card-to-card*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.settings.card-to-card')); ?>" class="menu-link">
                                <div>پرداخت کارت به کارت</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.settings.torobpay*') ? 'active open' : ''); ?>">
                            <a href="javascript:void(0);" class="menu-link menu-toggle">
                                <div>درگاه پرداخت ترب‌پی</div>
                            </a>
                            <ul class="menu-sub">
                                <li class="menu-item <?php echo e(request()->routeIs('admin.settings.torobpay') || request()->routeIs('admin.settings.torobpay.save') || request()->routeIs('admin.settings.torobpay.campaign*') ? 'active' : ''); ?>">
                                    <a href="<?php echo e(route('admin.settings.torobpay')); ?>" class="menu-link">
                                        <div>تنظیمات درگاه</div>
                                    </a>
                                </li>
                                <li class="menu-item <?php echo e(request()->routeIs('admin.settings.torobpay.orders*') ? 'active' : ''); ?>">
                                    <a href="<?php echo e(route('admin.settings.torobpay.orders')); ?>" class="menu-link">
                                        <div>سفارش‌های ترب‌پی</div>
                                    </a>
                                </li>
                                <li class="menu-item <?php echo e(request()->routeIs('admin.settings.torobpay.support') ? 'active' : ''); ?>">
                                    <a href="<?php echo e(route('admin.settings.torobpay.support')); ?>" class="menu-link">
                                        <div>پشتیبانی</div>
                                    </a>
                                </li>
                            </ul>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.settings.digipay*') ? 'active open' : ''); ?>">
                            <a href="javascript:void(0);" class="menu-link menu-toggle">
                                <div>درگاه پرداخت دیجی‌پی</div>
                            </a>
                            <ul class="menu-sub">
                                <li class="menu-item <?php echo e(request()->routeIs('admin.settings.digipay') || request()->routeIs('admin.settings.digipay.save') ? 'active' : ''); ?>">
                                    <a href="<?php echo e(route('admin.settings.digipay')); ?>" class="menu-link">
                                        <div>تنظیمات درگاه</div>
                                    </a>
                                </li>
                                <li class="menu-item <?php echo e(request()->routeIs('admin.settings.digipay.orders*') ? 'active' : ''); ?>">
                                    <a href="<?php echo e(route('admin.settings.digipay.orders')); ?>" class="menu-link">
                                        <div>سفارش‌های دیجی‌پی</div>
                                    </a>
                                </li>
                                <li class="menu-item <?php echo e(request()->routeIs('admin.settings.digipay.support') ? 'active' : ''); ?>">
                                    <a href="<?php echo e(route('admin.settings.digipay.support')); ?>" class="menu-link">
                                        <div>راهنما</div>
                                    </a>
                                </li>
                            </ul>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.settings.shipping-methods*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.settings.shipping-methods.index')); ?>" class="menu-link">
                                <div>روش‌های ارسال</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.settings.amadast*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.settings.amadast')); ?>" class="menu-link">
                                <div>تنظیمات آمادست</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.settings.sms-sending*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.settings.sms-sending')); ?>" class="menu-link">
                                <div>تنظیمات ارسال پیامک</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.settings.sms') || request()->routeIs('admin.settings.sms.save') || request()->routeIs('admin.settings.sms.credit') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.settings.sms')); ?>" class="menu-link">
                                <div>تنظیمات پیام متنی</div>
                            </a>
                        </li>
                        <li class="menu-item <?php echo e(request()->routeIs('admin.settings.woo-import*') ? 'active' : ''); ?>">
                            <a href="<?php echo e(route('admin.settings.woo-import')); ?>" class="menu-link">
                                <div>انتقال از ووکامرس</div>
                            </a>
                        </li>
                    </ul>
                </li>

            </ul>
        </aside>
        <!-- / Menu -->

        <div class="layout-page">
            <!-- Navbar -->
            <nav class="layout-navbar container-xxl navbar navbar-expand-xl navbar-detached align-items-center bg-navbar-theme" id="layout-navbar">
                <div class="layout-menu-toggle navbar-nav align-items-xl-center me-3 me-xl-0 d-xl-none">
                    <a class="nav-item nav-link px-0 me-xl-4" href="javascript:void(0)">
                        <i class="ti ti-menu-2 ti-sm"></i>
                    </a>
                </div>

                <div class="navbar-nav-right d-flex align-items-center" id="navbar-collapse">
                    <div class="navbar-nav align-items-center">
                        <div class="nav-item navbar-search-wrapper mb-0 admin-inline-search">
                            <a class="nav-item nav-link admin-search-toggler d-flex align-items-center px-0" href="javascript:void(0);">
                                <i class="ti ti-search ti-md me-2"></i>
                                <span class="d-none d-md-inline-block text-muted">جستجو...</span>
                            </a>
                            <div class="admin-search-panel d-none" id="admin-search-panel">
                                <div class="admin-search-shell">
                                    <div class="admin-search-input-row">
                                        <i class="ti ti-search text-muted flex-shrink-0"></i>
                                        <input type="text" class="form-control admin-search-field border-0 shadow-none" placeholder="جستجوی محصولات، سفارش‌ها، کاربران..." aria-label="جستجو در پنل ادمین" autocomplete="off" />
                                        <button type="button" class="btn btn-sm btn-icon admin-search-close flex-shrink-0" aria-label="بستن">
                                            <i class="ti ti-x"></i>
                                        </button>
                                    </div>
                                    <div class="admin-search-menu d-none" id="admin-search-menu"></div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <ul class="navbar-nav flex-row align-items-center ms-auto">
                        <?php
                            $navInitial = mb_substr(Auth::user()->first_name ?? 'A', 0, 1);
                        ?>
                        <li class="nav-item navbar-dropdown dropdown-user dropdown">
                            <a class="nav-link dropdown-toggle hide-arrow" href="javascript:void(0);" data-bs-toggle="dropdown">
                                <div class="avatar avatar-online">
                                    <span class="avatar-initial rounded-circle bg-label-danger" style="font-size:0.85rem;"><?php echo e($navInitial); ?></span>
                                </div>
                            </a>
                            <ul class="dropdown-menu dropdown-menu-end">
                                <li>
                                    <a class="dropdown-item" href="<?php echo e(route('admin.profile.edit')); ?>">
                                        <div class="d-flex">
                                            <div class="flex-shrink-0 me-3">
                                                <div class="avatar avatar-online">
                                                    <span class="avatar-initial rounded-circle bg-label-danger" style="font-size:0.85rem;"><?php echo e($navInitial); ?></span>
                                                </div>
                                            </div>
                                            <div class="flex-grow-1">
                                                <span class="fw-medium d-block"><?php echo e(Auth::user()->first_name); ?> <?php echo e(Auth::user()->last_name); ?></span>
                                                <small class="text-muted">مدیر سیستم</small>
                                            </div>
                                        </div>
                                    </a>
                                </li>
                                <li><div class="dropdown-divider"></div></li>
                                <li>
                                    <a class="dropdown-item" href="<?php echo e(route('admin.profile.edit')); ?>">
                                        <i class="ti ti-user-edit me-2 ti-sm"></i>
                                        <span class="align-middle">ویرایش پروفایل</span>
                                    </a>
                                </li>
                                <li><div class="dropdown-divider"></div></li>
                                <li>
                                    <form method="POST" action="<?php echo e(route('logout')); ?>">
                                        <?php echo csrf_field(); ?>
                                        <button type="submit" class="dropdown-item">
                                            <i class="ti ti-logout me-2 ti-sm"></i>
                                            <span class="align-middle">خروج</span>
                                        </button>
                                    </form>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </div>

            </nav>
            <!-- / Navbar -->

            <!-- Content wrapper -->
            <div class="content-wrapper">
                <?php echo $__env->yieldContent('content'); ?>

                <footer class="content-footer footer bg-footer-theme">
                    <div class="container-xxl">
                        <div class="footer-container d-flex align-items-center justify-content-between py-2 flex-md-row flex-column">
                            <div>
                                &copy; <script>document.write(new Date().getFullYear())</script>
                                <?php echo e($siteName); ?>

                            </div>
                        </div>
                    </div>
                </footer>

                <div class="content-backdrop fade"></div>
            </div>
            <!-- / Content wrapper -->
        </div>
    </div>

    <div class="layout-overlay layout-menu-toggle"></div>
    <div class="drag-target"></div>
</div>

<script src="<?php echo e($adminAsset); ?>/vendor/libs/jquery/jquery.js"></script>
<script src="<?php echo e($adminAsset); ?>/vendor/libs/popper/popper.js"></script>
<script src="<?php echo e($adminAsset); ?>/vendor/js/bootstrap.js"></script>
<script src="<?php echo e($adminAsset); ?>/vendor/libs/node-waves/node-waves.js"></script>
<script src="<?php echo e($adminAsset); ?>/vendor/libs/perfect-scrollbar/perfect-scrollbar.js"></script>
<script src="<?php echo e($adminAsset); ?>/vendor/libs/hammer/hammer.js"></script>
<script src="<?php echo e($adminAsset); ?>/vendor/libs/i18n/i18n.js"></script>
<script src="<?php echo e($adminAsset); ?>/vendor/libs/typeahead-js/typeahead.js"></script>
<script src="<?php echo e($adminAsset); ?>/vendor/js/menu.js"></script>
<script src="<?php echo e($adminAsset); ?>/vendor/libs/apex-charts/apexcharts.js"></script>
<script src="<?php echo e($adminAsset); ?>/vendor/libs/swiper/swiper.js"></script>
<script src="<?php echo e($adminAsset); ?>/vendor/libs/datatables-bs5/datatables-bootstrap5.js"></script>
<script src="<?php echo e($adminAsset); ?>/js/main.js"></script>
<script src="<?php echo e($adminAsset); ?>/vendor/libs/sweetalert2/sweetalert2.js"></script>
<script src="<?php echo e(asset('theme/assets/js/persian-numbers.js')); ?>"></script>
<style>
  #layout-navbar,
  #layout-navbar .navbar-nav-right,
  #layout-navbar #navbar-collapse {
    overflow: visible !important;
  }
  .admin-inline-search {
    position: relative;
    min-height: 2.5rem;
    display: flex;
    align-items: center;
  }
  .admin-inline-search.is-open {
    z-index: 1095;
    width: min(720px, calc(100vw - 2rem));
    height: 2.5rem;
    align-self: center;
  }
  .admin-inline-search.is-open .admin-search-toggler {
    display: none !important;
  }
  .admin-search-panel {
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    width: 100%;
  }
  .admin-search-shell {
    width: 100%;
    background: var(--bs-paper-bg, #fff);
    border: 1px solid rgba(47, 43, 61, .1);
    border-radius: .55rem;
    box-shadow: 0 .45rem 1.25rem rgba(47, 43, 61, .12);
    overflow: hidden;
  }
  .admin-search-input-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-height: 2.5rem;
    padding: 0 .35rem 0 .65rem;
    background: transparent;
    border: 0;
  }
  .admin-search-shell.has-results .admin-search-input-row {
    border-bottom: 1px solid rgba(47, 43, 61, .08);
  }
  .admin-search-input-row .admin-search-field {
    flex: 1 1 auto;
    min-width: 0;
    background: transparent;
    padding-inline: .25rem;
  }
  .admin-search-input-row .admin-search-field:focus {
    box-shadow: none;
  }
  .admin-search-close {
    color: #6f6b7d;
    margin-inline-start: auto; /* می‌چسباند به انتهای چپ در RTL */
  }
  /* مخفی کردن منوی استاتیک typeahead قالب */
  .layout-navbar .twitter-typeahead,
  .layout-navbar .tt-menu,
  .layout-navbar .navbar-search-suggestion:not(#admin-search-menu) {
    display: none !important;
  }
  #admin-search-menu {
    max-height: min(70vh, 560px);
    overflow-y: auto;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
  #admin-search-menu .suggestion {
    display: block;
    color: inherit;
    text-decoration: none;
  }
  #admin-search-menu .suggestion:hover,
  #admin-search-menu .suggestion.active {
    background: rgba(115, 103, 240, .08);
  }
  @media (max-width: 767.98px) {
    .admin-inline-search.is-open {
      width: auto;
    }
    .admin-search-panel {
      position: fixed;
      top: .75rem;
      inset-inline: .75rem;
      width: auto;
      z-index: 1095;
    }
  }
</style>
<script>
(function ($) {
  'use strict';

  $(function () {
    var searchUrl = <?php echo json_encode(route('admin.search'), 15, 512) ?>;
    var $input = $('.admin-inline-search .admin-search-field');
    var $panel = $('#admin-search-panel');
    var $menu = $('#admin-search-menu');
    var $root = $('.admin-inline-search');
    var xhr = null;
    var timer = null;
    var cache = Object.create(null);
    var reqId = 0;

    if (!$input.length || !$menu.length || !$panel.length) {
      return;
    }

    // جلوگیری از typeahead استاتیک قالب روی اینپوت جستجوی ادمین
    try {
      if (typeof $.fn.typeahead === 'function') {
        $('.layout-navbar .search-input').typeahead('destroy');
      }
    } catch (e) {}
    $('.layout-navbar .tt-menu, .layout-navbar .twitter-typeahead').remove();

    function esc(text) {
      return $('<div>').text(text == null ? '' : String(text)).html();
    }

    function isOpen() {
      return $root.hasClass('is-open');
    }

    function openSearch() {
      $root.addClass('is-open');
      $panel.removeClass('d-none');
      $input.trigger('focus');
    }

    function closeSearch() {
      clearTimeout(timer);
      if (xhr && xhr.readyState !== 4) {
        xhr.abort();
      }
      xhr = null;
      $input.val('');
      hideMenu();
      $panel.addClass('d-none');
      $root.removeClass('is-open');
    }

    function showMenu() {
      $menu.removeClass('d-none');
      $panel.find('.admin-search-shell').addClass('has-results');
    }

    function hideMenu() {
      $menu.addClass('d-none').empty();
      $panel.find('.admin-search-shell').removeClass('has-results');
    }

    function renderPending() {
      $menu.html(
        '<div class="px-3 py-3 text-muted">' +
          '<i class="ti ti-loader ti-xs me-1"></i> در حال جستجو...' +
        '</div>'
      );
      showMenu();
    }

    function renderResults(data) {
      var groups = (data && data.groups) || [];
      if (!groups.length) {
        $menu.html(
          '<div class="not-found px-3 py-2">' +
            '<p class="py-2 mb-0"><i class="ti ti-alert-circle ti-xs me-2"></i> نتیجه‌ای یافت نشد</p>' +
          '</div>'
        );
        showMenu();
        return;
      }

      var html = '';
      groups.forEach(function (group) {
        html += '<h6 class="suggestions-header text-primary mb-0 mx-3 mt-3 pb-2">' + esc(group.title) + '</h6>';
        (group.items || []).forEach(function (item) {
          var subtitle = item.subtitle
            ? '<small class="text-muted d-block">' + esc(item.subtitle) + '</small>'
            : '';
          html +=
            '<a class="suggestion d-flex justify-content-between px-3 py-2 w-100" href="' + esc(item.url) + '">' +
              '<div>' +
                '<i class="ti ' + esc(item.icon || 'ti-search') + ' me-2"></i>' +
                '<span class="align-middle">' + esc(item.name) + '</span>' +
                subtitle +
              '</div>' +
            '</a>';
        });
      });
      $menu.html(html);
      showMenu();
    }

    function runSearch(q) {
      if (Object.prototype.hasOwnProperty.call(cache, q)) {
        renderResults(cache[q]);
        return;
      }

      if (xhr && xhr.readyState !== 4) {
        xhr.abort();
      }

      var current = ++reqId;
      renderPending();

      xhr = $.ajax({
        url: searchUrl,
        data: { q: q },
        dataType: 'json',
        cache: true
      })
        .done(function (data) {
          if (current !== reqId) {
            return;
          }
          cache[q] = data;
          renderResults(data);
        })
        .fail(function (_, status) {
          if (status === 'abort' || current !== reqId) {
            return;
          }
          $menu.html(
            '<div class="not-found px-3 py-2">' +
              '<p class="py-2 mb-0 text-danger"><i class="ti ti-alert-circle ti-xs me-2"></i> خطا در جستجو</p>' +
            '</div>'
          );
          showMenu();
        })
        .always(function () {
          if (current === reqId) {
            xhr = null;
          }
        });
    }

    $('.admin-search-toggler').on('click', function (e) {
      e.preventDefault();
      if (isOpen()) {
        closeSearch();
      } else {
        openSearch();
      }
    });

    $('.admin-search-close').on('click', function (e) {
      e.preventDefault();
      closeSearch();
    });

    $input.on('input', function () {
      var q = $.trim($input.val());
      clearTimeout(timer);

      if (!q.length) {
        hideMenu();
        return;
      }

      timer = setTimeout(function () {
        runSearch(q);
      }, 180);
    });

    $input.on('keydown', function (e) {
      if (e.key === 'Escape') {
        closeSearch();
        return;
      }

      var $items = $menu.find('.suggestion');
      if (!$items.length || (e.key !== 'ArrowDown' && e.key !== 'ArrowUp' && e.key !== 'Enter')) {
        return;
      }

      var $active = $items.filter('.active');
      var index = $items.index($active);

      if (e.key === 'ArrowDown') {
        e.preventDefault();
        index = index < $items.length - 1 ? index + 1 : 0;
        $items.removeClass('active').eq(index).addClass('active');
      } else if (e.key === 'ArrowUp') {
        e.preventDefault();
        index = index > 0 ? index - 1 : $items.length - 1;
        $items.removeClass('active').eq(index).addClass('active');
      } else if (e.key === 'Enter' && $active.length) {
        e.preventDefault();
        window.location = $active.attr('href');
      }
    });

    $(document).on('keydown.adminSearch', function (e) {
      if ((e.ctrlKey || e.metaKey) && e.key === '/') {
        e.preventDefault();
        openSearch();
      }
      if (e.key === 'Escape' && isOpen()) {
        closeSearch();
      }
    });

    $(document).on('mousedown.adminSearch', function (e) {
      if (!isOpen()) return;
      if (!$root.is(e.target) && $root.has(e.target).length === 0) {
        closeSearch();
      }
    });
  });
})(jQuery);
</script>

<?php echo $__env->yieldContent('customjs'); ?>
</body>
</html>
<?php /**PATH /home/louishop/public_html/engine/resources/views/admin/layouts/layout.blade.php ENDPATH**/ ?>