<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo e($user->name); ?> - User Details</title>
    
    <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=Instrument+Sans:ital,wght@0,400..700;1,400..700&display=swap" rel="stylesheet">
    
    <script>
        // Clear filter on page refresh instantly to prevent flicker
        if (window.location.search) {
            const navEntries = performance.getEntriesByType("navigation");
            if ((navEntries.length > 0 && navEntries[0].type === "reload") || (performance.navigation && performance.navigation.type === 1)) {
                window.location.replace(window.location.pathname);
            }
        }
    </script>
    
    <style>
        :root {
            --primary: #3b46f1;
            --primary-hover: #2a35d8;
            --primary-light: #eff6ff;
            --bg-main: #f8fafc;
            --bg-card: #ffffff;
            
            --text-main: #0f172a;
            --text-muted: #64748b;
            --text-label: #334155;
            --border-color: #e2e8f0;
            --font-family: 'Instrument Sans', sans-serif;

            --sidebar-width: 260px;
            --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
            --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
            --border-radius: 12px;
        }

        * { margin: 0; padding: 0; box-sizing: border-box; }

        body {
            font-family: var(--font-family);
            background-color: var(--bg-main);
            color: var(--text-main);
            min-height: 100vh;
            -webkit-font-smoothing: antialiased;
        }

        .dashboard-layout { display: flex; position: relative; min-height: 100vh; }

        .main-content {
            margin-left: var(--sidebar-width);
            flex-grow: 1;
            padding: 2rem;
            display: flex;
            flex-direction: column;
            gap: 2rem;
            min-width: 0;
            transition: margin-left 0.3s ease;
        }

        .card {
            background-color: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: var(--border-radius);
            padding: 1.5rem;
            box-shadow: var(--shadow-sm);
        }

        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 1.5rem;
            margin-bottom: 2rem;
        }

        .stat-card-link {
            text-decoration: none;
            color: inherit;
            display: block;
            transition: transform 0.2s;
        }

        .stat-card-link:hover {
            transform: translateY(-2px);
        }

        .stat-card {
            background-color: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: var(--border-radius);
            padding: 1.5rem;
            display: flex;
            align-items: center;
            gap: 1rem;
            box-shadow: var(--shadow-sm);
        }

        .total-card:hover .stat-card {
        border-color: var(--primary);
        box-shadow: 0 4px 12px rgba(59,70,241,0.15);
        }
           
        .pending-card:hover .stat-card {
        border-color: #d97706;
        box-shadow: 0 4px 12px rgba(217,119,6,0.15);
        }
        
        .stat-icon {
            width: 48px;
            height: 48px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: var(--primary-light);
            color: var(--primary);
        }

        .stat-icon svg { width: 24px; height: 24px; }

        .stat-content { display: flex; flex-direction: column; }

        .stat-label {
            font-size: 0.875rem;
            color: var(--text-muted);
            font-weight: 600;
        }

        .stat-value {
            font-size: 1.5rem;
            font-weight: 800;
            color: var(--text-main);
        }

        .table-responsive {
            width: 100%;
            overflow-x: auto;
        }

        .tasks-table {
            width: 100%;
            border-collapse: collapse;
            text-align: left;
        }

        .tasks-table th {
            font-size: 0.725rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--text-muted);
            font-weight: 700;
            padding: 1rem;
            border-bottom: 1px solid #f1f5f9;
            background-color: #fdfdfd;
            white-space: nowrap;
        }

        .tasks-table td {
            padding: 1.15rem 1rem;
            border-bottom: 1px solid #f1f5f9;
            font-size: 0.875rem;
            color: var(--text-label);
            white-space: nowrap;
        }

        .tasks-table th:nth-child(2),
        .tasks-table td:nth-child(2) {
            white-space: normal;
            word-break: break-word;
            min-width: 250px;
        }

        .status-badge {
            display: inline-flex;
            align-items: center;
            padding: 0.25rem 0.75rem;
            border-radius: 50px;
            font-size: 0.75rem;
            font-weight: 700;
            background-color: #fef3c7;
            color: #d97706;
        }
        
        .user-assigned-card {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        
        .user-name-mini {
            font-weight: 600;
            color: var(--text-label);
            font-size: 0.85rem;
        }
        
        @media (max-width: 1024px) {
            .main-content { margin-left: 0; padding: 1.5rem; }
        }
    </style>
    <!-- Favicon -->
    <link rel="icon" type="image/png" href="<?php echo e(asset('images/faviocntaskpannel.png')); ?>">
</head>
<body>

    <div class="dashboard-layout">
        <?php echo $__env->make('admin.sidebar.sidebar', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

        <main class="main-content">
            <?php echo $__env->make('admin.sidebar.topbar', ['title' => 'User: ' . $user->name, 'backUrl' => route('users.index')], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

            <div class="stats-grid">
                <a href="<?php echo e(route('users.viewusers', ['id' => $user->id, 'tab' => 'total', 'project_id' => $projectId])); ?>" class="stat-card-link total-card">
                    <div class="stat-card" >
                        <div class="stat-icon">
                            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01"></path></svg>
                        </div>
                        <div class="stat-content">
                            <span class="stat-label">Total Tasks</span>
                            <span class="stat-value"><?php echo e($totalTasksCount); ?></span>
                        </div>
                    </div>
                </a>

                <a href="<?php echo e(route('users.viewusers', ['id' => $user->id, 'tab' => 'pending', 'project_id' => $projectId])); ?>" class="stat-card-link pending-card">
                    <div class="stat-card">
                        <div class="stat-icon" style="background-color: #fef3c7; color: #d97706;">
                            <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
                        </div>
                        <div class="stat-content">
                            <span class="stat-label">Pending Tasks</span>
                            <span class="stat-value"><?php echo e($pendingTasksCount); ?></span>
                        </div>
                    </div>
                </a>
                
                <div class="stat-card">
                    <div class="stat-icon" style="background-color: #f0fdf4; color: #16a34a;">
                        <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path></svg>
                    </div>
                    <div class="stat-content">
                        <span class="stat-label">User Role</span>
                        <span class="stat-value" style="font-size: 1.25rem;"><?php echo e($user->role); ?></span>
                    </div>
                </div>
            </div>

            <div class="card">
                <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem;">
                    <h3 style="color: var(--text-main); margin: 0;"><?php echo e($tableTitle); ?></h3>
                    <form method="GET" action="<?php echo e(route('users.viewusers', $user->id)); ?>" style="margin: 0;">
                        <input type="hidden" name="tab" value="<?php echo e($tab); ?>">
                        <select name="project_id" onchange="this.form.submit()" style="padding: 0.5rem 1rem; border-radius: 8px; border: 1px solid var(--border-color); background-color: var(--bg-main); color: var(--text-main); font-family: var(--font-family); font-size: 0.875rem; outline: none; cursor: pointer; min-width: 150px;">
                            <option value="">All Projects</option>
                            <?php $__currentLoopData = $projects; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $projectOption): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <!--<option value="<?php echo e($projectOption->id); ?>" <?php echo e($projectId == $projectOption->id ? 'selected' : ''); ?>><?php echo e($projectOption->name); ?></option>-->
                                <option value="<?php echo e($projectOption->id); ?>" <?php echo e($projectId == $projectOption->id ? 'selected' : ''); ?>><?php echo e($projectOption->name); ?> - (<?php echo e($projectOption->type); ?>)</option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                    </form>
                </div>
                <div class="table-responsive">
                    <table class="tasks-table">
                        <thead>
                            <tr>
                                <th>S.No</th>
                                <th>Task Name</th>
                                <th>Status</th>
                                <th>Project</th>
                                <th>Start Date</th>
                                <th>End Date</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__empty_1 = true; $__currentLoopData = $tasks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $task): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                <tr>
                                    <td><?php echo e(($tasks->currentPage() - 1) * $tasks->perPage() + $loop->iteration); ?></td>
                                    <td><strong><?php echo e($task->name); ?></strong></td>
                                    <td>
                                        <?php
                                            $badgeBg = '#fef3c7'; $badgeColor = '#d97706';
                                            if ($task->status === 'Completed') { $badgeBg = '#ecfdf5'; $badgeColor = '#10b981'; }
                                            elseif ($task->status === 'In Progress') { $badgeBg = '#eff6ff'; $badgeColor = '#3b82f6'; }
                                            elseif ($task->status === 'Hold' || $task->status === 'On Hold') { $badgeBg = '#fef2f2'; $badgeColor = '#ef4444'; }
                                        ?>
                                        <span class="status-badge" style="background-color: <?php echo e($badgeBg); ?>; color: <?php echo e($badgeColor); ?>;"><?php echo e($task->status); ?></span>
                                    </td>
                                    <td>
                                        <?php if($task->project): ?>
                                            <div class="user-assigned-card">
                                                <!--<span class="user-name-mini"><?php echo e($task->project->name); ?></span>-->
                                                 <span class="user-name-mini"><?php echo e($task->project->name); ?> - (<?php echo e($task->project->type); ?>)</span>
                                            </div>
                                        <?php else: ?>
                                            <span style="color: var(--text-muted); font-style: italic;">No Project</span>
                                        <?php endif; ?>
                                    </td>
                                    <td><?php echo e($task->start_date ? \Carbon\Carbon::parse($task->start_date)->format('d/m/Y') : '-'); ?></td>
                                    <td><?php echo e($task->end_date ? \Carbon\Carbon::parse($task->end_date)->format('d/m/Y') : '-'); ?></td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                <tr>
                                    <td colspan="6" style="text-align: center; padding: 3rem; color: var(--text-muted);">
                                        No tasks found in this category.
                                    </td>
                                </tr>
                            <?php endif; ?>
                        </tbody>
                    </table>
                </div>
                 <!-- Footer Pagination -->
                <?php echo $__env->make('common.pagination', ['paginator' => $tasks, 'resourceName' => 'tasks'], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
            </div>
        </main>
    </div>
</body>
</html>
<?php /**PATH /home/sainikcanteen/public_html/task.sainikcanteen.co.in/resources/views/admin/users/viewusers.blade.php ENDPATH**/ ?>