<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\AppLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
    <div class="portal-container dashboard-page">
        <?php if(session('status')): ?>
            <div class="alert alert-success"><?php echo e(session('status')); ?></div>
        <?php endif; ?>
        <?php if(session('error')): ?>
            <div class="alert alert-error"><?php echo e(session('error')); ?></div>
        <?php endif; ?>

        <?php
            $invoiceStatusLabel = function ($status) {
                $key = strtolower(str_replace(' ', '_', trim((string) $status)));
                return [
                    'payment_pending_whmcs' => 'Payment Processing',
                    'payment_received' => 'Payment Received',
                    'whmcs_sync_failed' => 'Processing',
                    'sync_failed' => 'Processing',
                    'manual_review' => 'Under Review',
                ][$key] ?? ucwords(str_replace('_', ' ', $key ?: 'pending'));
            };
            $invoiceMoney = fn ($invoice) => strtoupper((string) $invoice->currency) === 'USD'
                ? '$'.number_format((float) $invoice->total, 2).' USD'
                : strtoupper((string) $invoice->currency).' '.number_format((float) $invoice->total, 2);
        ?>

        <header class="dashboard-welcome dashboard-welcome-refined">
            <div>
                <span class="service-eyebrow">Account Overview</span>
                <h1>Welcome back, <?php echo e(Auth::user()->first_name ?: Auth::user()->displayName()); ?></h1>
                <p>Manage your hosting services, domains, invoices, and support requests.</p>
            </div>
            <a class="dashboard-primary-action" href="<?php echo e(route('store.index')); ?>">Order New Service</a>
        </header>

        <section class="dashboard-metrics" aria-label="Account statistics">
            <a href="<?php echo e(route('client.services')); ?>" class="dashboard-metric-card">
                <span class="dashboard-metric-icon">S</span>
                <div><strong><?php echo e($servicesCount); ?></strong><span>Active Services</span></div>
            </a>
            <a href="<?php echo e(route('client.domains')); ?>" class="dashboard-metric-card">
                <span class="dashboard-metric-icon">D</span>
                <div><strong><?php echo e($domainsCount); ?></strong><span>Domains</span></div>
            </a>
            <a href="<?php echo e(route('client.support')); ?>" class="dashboard-metric-card">
                <span class="dashboard-metric-icon">T</span>
                <div><strong>0</strong><span>Support Tickets</span></div>
            </a>
            <a href="<?php echo e(route('client.invoices')); ?>" class="dashboard-metric-card warning">
                <span class="dashboard-metric-icon">I</span>
                <div><strong><?php echo e($unpaidInvoicesCount); ?></strong><span>Unpaid Invoices</span></div>
            </a>
        </section>

        <section class="dashboard-content-grid">
            <div class="dashboard-content-main">
                <article class="dashboard-feature-card">
                    <div class="dashboard-card-copy">
                        <span class="service-eyebrow">Products & Services</span>
                        <h2>Your Active Products/Services</h2>
                        <p><?php echo e($servicesCount > 0 ? 'You currently have '.$servicesCount.' active service(s).' : 'You do not have any active services yet.'); ?></p>
                    </div>
                    <a class="dashboard-card-link" href="<?php echo e(route('client.services')); ?>">View Services</a>
                </article>

                <div class="dashboard-card-grid">
                    <article class="dashboard-action-card">
                        <div>
                            <span class="service-eyebrow">Billing</span>
                            <h2>Unpaid Invoices</h2>
                            <p>You have <?php echo e($unpaidInvoicesCount); ?> invoice(s) awaiting payment.</p>
                        </div>
                        <a class="dashboard-card-link" href="<?php echo e(route('client.invoices')); ?>">View Invoices</a>
                    </article>

                    <article class="dashboard-action-card">
                        <div>
                            <span class="service-eyebrow">Support</span>
                            <h2>Recent Support Tickets</h2>
                            <p>No recent tickets found. Open a ticket whenever you need assistance.</p>
                        </div>
                        <a class="dashboard-card-link" href="<?php echo e(route('client.support')); ?>">Open New Ticket</a>
                    </article>
                </div>

                <article class="dashboard-domain-card">
                    <div>
                        <span class="service-eyebrow">Domains</span>
                        <h2>Register a New Domain</h2>
                        <p>Search and register a domain directly from your account.</p>
                    </div>
                    <form method="POST" action="<?php echo e(route('domains.search')); ?>" class="dashboard-domain-form">
                        <?php echo csrf_field(); ?>
                        <input type="hidden" name="operation" value="register">
                        <input class="input" name="domain_name" placeholder="example.com" aria-label="Domain name">
                        <button class="primary-btn" type="submit">Search Domain</button>
                    </form>
                </article>
            </div>

            <aside class="dashboard-invoice-panel">
                <div class="dashboard-section-head">
                    <div>
                        <span class="service-eyebrow">Billing Activity</span>
                        <h2>Recent Invoices</h2>
                    </div>
                    <a href="<?php echo e(route('client.invoices')); ?>">View All</a>
                </div>

                <div class="dashboard-invoice-list">
                    <?php $__empty_1 = true; $__currentLoopData = $recentInvoices; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $invoice): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <?php $displayNumber = $invoice->whmcs_invoice_id ?: preg_replace('/\D+/', '', $invoice->invoice_number); ?>
                        <a href="<?php echo e(route('client.invoices.show', $invoice)); ?>" class="dashboard-invoice-row">
                            <div>
                                <strong>#<?php echo e($displayNumber); ?></strong>
                                <span><?php echo e($invoiceMoney($invoice)); ?></span>
                            </div>
                            <span class="status-pill <?php echo e(strtolower(str_replace(' ', '_', (string) $invoice->status))); ?>"><?php echo e($invoiceStatusLabel($invoice->status)); ?></span>
                        </a>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <div class="dashboard-empty-state">No invoices are available yet.</div>
                    <?php endif; ?>
                </div>
            </aside>
        </section>
    </div>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $attributes = $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php /**PATH /home/ovbopdha/public_html/ztcart.eagale.xyz/resources/views/client/dashboard.blade.php ENDPATH**/ ?>