<?php $__env->startSection('title', 'Customers Directory'); ?>

<?php $__env->startSection('content'); ?>
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px;">
    <div>
        <h1 class="serif" style="font-size: 26px; margin: 0; color: #0f172a;">Registered Customer Directory</h1>
        <p style="color: var(--text-muted); font-size: 14px; margin-top: 4px;">View registered customer profiles and total purchase metrics.</p>
    </div>
</div>

<div class="admin-card" style="margin-bottom: 24px; padding: 14px 20px;">
    <form action="<?php echo e(route('admin.customers.index')); ?>" method="GET" style="display: flex; gap: 12px;">
        <input type="text" name="search" value="<?php echo e($search); ?>" placeholder="Search by customer name, email or phone..." class="form-control" style="flex: 1;">
        <button type="submit" class="btn-admin btn-secondary">Search</button>
    </form>
</div>

<div class="admin-card">
    <?php if($customers->isEmpty()): ?>
        <div style="padding: 40px; text-align: center; color: var(--text-muted);">
            No registered customers found.
        </div>
    <?php else: ?>
        <div style="overflow-x: auto;">
            <table class="admin-table">
                <thead>
                    <tr>
                        <th>Customer</th>
                        <th>Contact Information</th>
                        <th>Address</th>
                        <th>Total Orders</th>
                        <th>Lifetime Spend</th>
                        <th>Registered Date</th>
                        <th>Action</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__currentLoopData = $customers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <td>
                                <strong style="color: #0f172a; font-size: 15px;"><?php echo e($c->name); ?></strong>
                            </td>
                            <td>
                                <div><?php echo e($c->email); ?></div>
                                <div style="font-size: 12px; color: var(--text-muted);"><?php echo e($c->phone ?? 'No phone'); ?></div>
                            </td>
                            <td>
                                <div style="font-size: 12px; color: #334155;"><?php echo e($c->address ?? 'Not set'); ?></div>
                                <div style="font-size: 11px; color: var(--text-muted);"><?php echo e($c->city ? $c->city . ', ' . $c->state : ''); ?></div>
                            </td>
                            <td><strong><?php echo e($c->orders_count); ?></strong> orders</td>
                            <td><strong style="color: var(--primary);">₹<?php echo e(number_format($c->orders_sum_total_amount ?? 0, 2)); ?></strong></td>
                            <td><span style="font-size: 12px; color: var(--text-muted);"><?php echo e($c->created_at->format('M d, Y')); ?></span></td>
                            <td>
                                <a href="<?php echo e(route('admin.customers.show', $c)); ?>" class="btn-admin btn-secondary" style="padding: 6px 12px; font-size: 12px; background: #e0eff9; color: #186297; border-color: #b9dff3;">
                                    <i data-lucide="eye" style="width: 14px;"></i> View Profile
                                </a>
                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody>
            </table>
        </div>

        <div style="margin-top: 20px;">
            <?php echo e($customers->links()); ?>

        </div>
    <?php endif; ?>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /Users/koushikkona/Documents/Projects/divne/resources/views/admin/customers/index.blade.php ENDPATH**/ ?>