<?php $__env->startSection('content'); ?>
    <div class="customer-list">
        <div class="customer-list-header">
            <div class="flex-align gap-3">
                <p class="fw-medium text--dark"><?php echo e(__($pageTitle)); ?></p>
            </div>

            <div class="flex-end gap-3 customer-list-header-action">
                <div class="flex-align gap-3 flex-1 justify-content-lg-end">
                    <div class="customer-search">
                        <span class="icon">
                            <i class="fa-solid fa-magnifying-glass"></i>
                        </span>
                        <input class="customer-search-input agentSearch" type="text" value="<?php echo e(request()->search); ?>" placeholder="<?php echo app('translator')->get('Search'); ?>">
                    </div>
                </div>
                <div class="flex-align gap-3">
                    <a href="<?php echo e(route('admin.agent.add')); ?>" class="btn btn--base btn--sm"><?php echo app('translator')->get('New Agent'); ?>
                        <span class="icon">
                            <i class="fa-solid fa-plus"></i>
                        </span>
                    </a>
                    <div class="layout-view-action-inner">
                        <button class="layout-view-action-btn list-view" data-key="agent">
                            <?php echo $__env->make('admin.partials.svg.list_view', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                        </button>
                        <button class="layout-view-action-btn grid-view" data-key="agent">
                            <?php echo $__env->make('admin.partials.svg.grid_view', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                        </button>
                    </div>
                </div>
            </div>
        </div>

        <div class="customer-card-wrapper">
            <?php $__empty_1 = true; $__currentLoopData = $admins; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $admin): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                <div class="customer-card agentDetails" data-key="agent" data-agent="<?php echo e($admin->id); ?>">
                    <div class="customer-card-thumb">
                        <img src="<?php echo e(getImage(getFilePath('adminProfile') . '/' . $admin->image, getFileSize('adminProfile'), true)); ?>" alt="customer">
                    </div>
                    <div class="customer-card-content">
                        <div class="customer-card-info">
                            <a href="<?php echo e(route('admin.agent.overview', $admin->id)); ?>" class="name"><?php echo e(__($admin->name)); ?></a>
                            <p class="email"><?php echo e($admin->email); ?></p>
                        </div>
                        <div class="flex-align gap-1 list-view-none">
                            <p class="fs-12"><?php echo app('translator')->get('Total Tickets'); ?>: <span class="text--dark"><?php echo e($admin->total_tickets); ?> </span></p>
                            <p class="fs-12"><?php echo app('translator')->get('Open Tickets'); ?>: <span class="text--dark"><?php echo e($admin->open_tickets); ?> </span></p>
                        </div>
                        <div class="customer-card-text grid-view-none">
                            <?php echo app('translator')->get('Total Tickets'); ?>: <span class="text--dark"><?php echo e($admin->total_tickets); ?></span>
                        </div>
                        <div class="customer-card-text grid-view-none">
                            <?php echo app('translator')->get('Open Tickets'); ?>: <span class="text--dark"><?php echo e($admin->open_tickets); ?></span>
                        </div>
                        <div class="customer-card-text grid-view-none">
                            <?php echo app('translator')->get('Created Date'); ?>: <span class="text--dark"><?php echo e(showDateTime($admin->created_at)); ?></span>
                        </div>
                        <div class="customer-card-action">
                            <a class="action-btn" href="<?php echo e(route('admin.department.list')); ?>?admin=<?php echo e($admin->id); ?>" data-bs-toggle="tooltip" data-bs-placement="top" title="<?php echo app('translator')->get('Department'); ?>">
                                <?php echo $__env->make('admin.partials.svg.department', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                            </a>

                            <?php if(auth('admin')->user()->super_admin): ?>
                                <a class="action-btn" href="<?php echo e(route('admin.agent.edit', $admin->id)); ?>" data-bs-toggle="tooltip" data-bs-placement="top" title="<?php echo app('translator')->get('Edit'); ?>">
                                    <?php echo $__env->make('admin.partials.svg.edit', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                                </a>
                            <?php endif; ?>
                        </div>
                    </div>
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                <?php if (isset($component)) { $__componentOriginal785b8965d65806a202a14875024d2012 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal785b8965d65806a202a14875024d2012 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.empty-message','data' => ['message' => 'No agent found']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('empty-message'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['message' => 'No agent found']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal785b8965d65806a202a14875024d2012)): ?>
<?php $attributes = $__attributesOriginal785b8965d65806a202a14875024d2012; ?>
<?php unset($__attributesOriginal785b8965d65806a202a14875024d2012); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal785b8965d65806a202a14875024d2012)): ?>
<?php $component = $__componentOriginal785b8965d65806a202a14875024d2012; ?>
<?php unset($__componentOriginal785b8965d65806a202a14875024d2012); ?>
<?php endif; ?>
            <?php endif; ?>
        </div>

        <?php if($admins->hasPages()): ?>
            <div class="pagination-wrapper">
                <?php echo e(paginateLinks($admins)); ?>

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

<?php $__env->startPush('style'); ?>
    <style>
        .agentDetails {
            cursor: pointer;
        }

        .pagination-wrapper {
            margin-top: auto;
        }
    </style>
<?php $__env->stopPush(); ?>

<?php $__env->startPush('script'); ?>
    <script>
        (function($) {
            "use strict";

            $('.agentSearch').on('keydown', function(e) {
                if (e.key === 'Enter') {
                    var query = $(this).val().trim();
                    window.location.href = "<?php echo e(route('admin.agent.list')); ?>" + '?search=' + encodeURIComponent(query);
                }
            });

            let route = `<?php echo e(route('admin.agent.overview', '')); ?>`;

            $('.agentDetails').on('click', function(e) {
                if ($(e.target).closest('.action-col').length) {
                    return;
                }
                let agent = $(this).data('agent');
                window.location.href = route + '/' + agent;
            });

        })(jQuery);
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('admin.layouts.master', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\projects\custom_viserdesk\Files\core\resources\views/admin/agent/list.blade.php ENDPATH**/ ?>