

<?php $__env->startSection('title', 'User Activity Report'); ?>

<?php $__env->startSection('content'); ?>
<div class="content-wrapper">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <div>
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb mb-1">
                    <li class="breadcrumb-item"><a href="<?php echo e(route('dashboard.reports')); ?>">Reports</a></li>
                    <li class="breadcrumb-item active">User Activity</li>
                </ol>
            </nav>
            <h4 class="mb-0">User Activity Report</h4>
        </div>
        <?php if($canExport): ?>
        <a href="<?php echo e(route('dashboard.reports.user-activity.export', request()->query())); ?>" class="btn btn-success">
            <i class="bi bi-file-earmark-excel me-1"></i> Export to Excel
        </a>
        <?php endif; ?>
    </div>

    <!-- Filters -->
    <div class="card border-0 shadow-sm mb-4">
        <div class="card-body">
            <form method="GET" action="<?php echo e(route('dashboard.reports.user-activity')); ?>" class="row g-3">
                <div class="col-md-3">
                    <label class="form-label">Date From</label>
                    <input type="date" name="date_from" class="form-control" value="<?php echo e($dateFrom); ?>">
                </div>
                <div class="col-md-3">
                    <label class="form-label">Date To</label>
                    <input type="date" name="date_to" class="form-control" value="<?php echo e($dateTo); ?>">
                </div>
                <div class="col-md-4">
                    <label class="form-label">User</label>
                    <select name="user_id" class="form-select">
                        <option value="">All Users</option>
                        <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($user->id); ?>" <?php echo e($userId == $user->id ? 'selected' : ''); ?>>
                            <?php echo e($user->name); ?> (<?php echo e($user->email); ?>)
                        </option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>
                <div class="col-md-2 d-flex align-items-end">
                    <button type="submit" class="btn btn-primary w-100">
                        <i class="bi bi-funnel me-1"></i> Filter
                    </button>
                </div>
            </form>
        </div>
    </div>

    <!-- Summary Stats -->
    <div class="row g-3 mb-4">
        <div class="col-md-3">
            <div class="card border-0 shadow-sm bg-primary bg-opacity-10">
                <div class="card-body text-center">
                    <h3 class="text-primary mb-0"><?php echo e(number_format($summary['total_users'])); ?></h3>
                    <small class="text-muted">New Users</small>
                </div>
            </div>
        </div>
        <div class="col-md-3">
            <div class="card border-0 shadow-sm bg-info bg-opacity-10">
                <div class="card-body text-center">
                    <h3 class="text-info mb-0"><?php echo e(number_format($summary['total_calls'])); ?></h3>
                    <small class="text-muted">Total Calls</small>
                </div>
            </div>
        </div>
        <div class="col-md-3">
            <div class="card border-0 shadow-sm bg-success bg-opacity-10">
                <div class="card-body text-center">
                    <h3 class="text-success mb-0"><?php echo e(number_format($summary['total_sms'])); ?></h3>
                    <small class="text-muted">Total SMS</small>
                </div>
            </div>
        </div>
        <div class="col-md-3">
            <div class="card border-0 shadow-sm bg-warning bg-opacity-10">
                <div class="card-body text-center">
                    <h3 class="text-warning mb-0"><?php echo e(number_format($summary['total_sessions'])); ?></h3>
                    <small class="text-muted">Total Sessions</small>
                </div>
            </div>
        </div>
    </div>

    <!-- Report Table -->
    <div class="card border-0 shadow-sm">
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>name</th>
                            <th>Email</th>
                            <th>Status</th>
                            <th class="text-center">Calls</th>
                            <th class="text-center">SMS</th>
                            <th class="text-center">Sessions</th>
                            <th>Registered</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__empty_1 = true; $__currentLoopData = $report; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr>
                            <td><?php echo e($user->id); ?></td>
                            <td>
                                <a href="<?php echo e(route('dashboard.user-details', $user->id)); ?>">
                                    <?php echo e($user->name); ?>

                                </a>
                            </td>
                            <td><span class="masked-data"><?php echo e($user->email); ?></span></td>
                            <td>
                                <?php if($user->is_active): ?>
                                <span class="badge bg-success">Active</span>
                                <?php else: ?>
                                <span class="badge bg-danger">Inactive</span>
                                <?php endif; ?>
                            </td>
                            <td class="text-center">
                                <span class="badge bg-info"><?php echo e(number_format($user->calls_count)); ?></span>
                            </td>
                            <td class="text-center">
                                <span class="badge bg-success"><?php echo e(number_format($user->sms_count)); ?></span>
                            </td>
                            <td class="text-center">
                                <span class="badge bg-warning text-dark"><?php echo e(number_format($user->sessions_count)); ?></span>
                            </td>
                            <td><?php echo e($user->created_at->format('Y-m-d H:i')); ?></td>
                        </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr>
                            <td colspan="8" class="text-center text-muted py-4">No data found for the selected criteria.</td>
                        </tr>
                        <?php endif; ?>
                    </tbody>
                </table>
            </div>

            <div class="d-flex justify-content-center mt-4">
                <?php echo e($report->appends(request()->query())->links()); ?>

            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.dashboard', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH D:\xampp82\htdocs\AutoPromix\backend\resources\views\dashboard\reports\user-activity.blade.php ENDPATH**/ ?>