

<?php $__env->startSection('title', 'Candidate Dashboard'); ?>

<?php $__env->startSection('content'); ?>
<div class="min-h-screen bg-gray-50 p-4 sm:p-6">
    <div class="max-w-6xl mx-auto">

        
        <div class="mb-6 flex items-start justify-between gap-3 flex-wrap">
            <div>
                <h1 class="text-2xl font-bold text-gray-900">Candidate Dashboard</h1>
                <p class="text-sm text-gray-600 mt-1">
                    স্বাগতম <?php echo e(auth()->user()->name); ?> 👋 — আপনার প্রোফাইল, প্রার্থী তালিকা এবং টিম পরিচালনা করুন
                </p>
            </div>
            

            <div class="flex gap-2">
                <a href="<?php echo e(route('candidates.create')); ?>"
                   class="px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700">
                    নতুন প্রার্থী যোগ করুন
                </a>
                <a href="<?php echo e(route('teams.create')); ?>"
                   class="px-4 py-2 border rounded-lg hover:bg-gray-50">
                    নতুন টিম তৈরি
                </a>
            </div>
        </div>

        
        <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-8">
            <div class="bg-white rounded-xl border p-4">
                <div class="text-xs text-gray-500">মোট প্রার্থী</div>
                <div class="text-2xl font-bold text-gray-900 mt-1">
                    <?php echo e(\App\Models\Candidate::count()); ?>

                </div>
            </div>

            <div class="bg-white rounded-xl border p-4">
                <div class="text-xs text-gray-500">আমার টিম</div>
                <div class="text-2xl font-bold text-gray-900 mt-1">
                    <?php echo e(\App\Models\Team::where('manager_user_id', auth()->id())->count()); ?>

                </div>
            </div>

            <div class="bg-white rounded-xl border p-4">
                <div class="text-xs text-gray-500">আমার Candidate Profile</div>
                <div class="text-base font-semibold text-gray-900 mt-1">
                    <?php if(auth()->user()->candidate): ?>
                        তৈরি আছে ✅
                    <?php else: ?>
                        এখনো নেই
                    <?php endif; ?>
                </div>
            </div>

            <div class="bg-white rounded-xl border p-4">
                <div class="text-xs text-gray-500">দ্রুত লিংক</div>
                <div class="mt-2 flex flex-wrap gap-2">
                    <a href="<?php echo e(route('candidates.index')); ?>"
                       class="px-3 py-1.5 rounded-lg border text-xs hover:bg-gray-50">Candidates</a>
                    <a href="<?php echo e(route('teams.index')); ?>"
                       class="px-3 py-1.5 rounded-lg border text-xs hover:bg-gray-50">Teams</a>
                </div>
            </div>
        </div>

        
        <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">

            
            <div class="bg-white rounded-xl border p-6">
                <div class="flex items-center justify-between gap-3 flex-wrap mb-4">
                    <h2 class="text-lg font-semibold text-gray-900">Candidates Management</h2>
                    <a href="<?php echo e(route('candidates.index')); ?>"
                       class="text-sm font-semibold text-emerald-700 hover:underline">
                        সব দেখুন →
                    </a>
                </div>

                <div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
                    <a href="<?php echo e(route('candidates.create')); ?>"
                       class="p-4 rounded-xl border hover:bg-gray-50 transition">
                        <div class="font-semibold text-gray-900">নতুন প্রার্থী যোগ</div>
                        <div class="text-sm text-gray-500 mt-1">Create Candidate</div>
                    </a>

                    <a href="<?php echo e(route('candidates.index')); ?>"
                       class="p-4 rounded-xl border hover:bg-gray-50 transition">
                        <div class="font-semibold text-gray-900">প্রার্থী তালিকা</div>
                        <div class="text-sm text-gray-500 mt-1">List / Filter / Edit</div>
                    </a>
                </div>

                <div class="mt-5 pt-5 border-t">
                    <div class="text-sm text-gray-600">
                        নোট: আপনি Candidate role হিসেবে Candidates CRUD করতে পারবেন।
                    </div>
                </div>
            </div>

            
            <div class="bg-white rounded-xl border p-6">
                <div class="flex items-center justify-between gap-3 flex-wrap mb-4">
                    <h2 class="text-lg font-semibold text-gray-900">My Team Management</h2>
                    <a href="<?php echo e(route('teams.index')); ?>"
                       class="text-sm font-semibold text-emerald-700 hover:underline">
                        সব দেখুন →
                    </a>
                </div>

                <div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
                    <a href="<?php echo e(route('teams.create')); ?>"
                       class="p-4 rounded-xl border hover:bg-gray-50 transition">
                        <div class="font-semibold text-gray-900">নতুন টিম তৈরি</div>
                        <div class="text-sm text-gray-500 mt-1">Create Team</div>
                    </a>

                    <a href="<?php echo e(route('teams.index')); ?>"
                       class="p-4 rounded-xl border hover:bg-gray-50 transition">
                        <div class="font-semibold text-gray-900">আমার টিম তালিকা</div>
                        <div class="text-sm text-gray-500 mt-1">Edit / Members</div>
                    </a>
                </div>

                <div class="mt-5 pt-5 border-t">
                    <div class="text-sm text-gray-600">
                        নোট: টিম ম্যানেজার হিসেবে আপনি আপনার টিমের CRUD এবং সদস্য নিয়ন্ত্রণ করতে পারবেন।
                    </div>
                </div>
            </div>

        </div>

        
        <?php
            $myTeams = \App\Models\Team::where('manager_user_id', auth()->id())
                ->latest('id')
                ->take(5)
                ->get();
        ?>

        <div class="mt-6 bg-white rounded-xl border p-6">
            <div class="flex items-center justify-between gap-3 flex-wrap mb-4">
                <h2 class="text-lg font-semibold text-gray-900">আমার টিম (সর্বশেষ ৫টি)</h2>
                <a href="<?php echo e(route('teams.index')); ?>" class="text-sm font-semibold text-emerald-700 hover:underline">সব টিম →</a>
            </div>

            <?php if($myTeams->count()): ?>
                <div class="overflow-x-auto">
                    <table class="w-full text-sm">
                        <thead class="bg-gray-50 border-b">
                            <tr class="text-left">
                                <th class="p-3">টিম</th>
                                <th class="p-3">অ্যাকশন</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__currentLoopData = $myTeams; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $t): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr class="border-b last:border-b-0 hover:bg-gray-50">
                                    <td class="p-3 font-medium text-gray-900">
                                        <?php echo e($t->name ?? ('Team #' . $t->id)); ?>

                                    </td>
                                    <td class="p-3">
                                        <div class="flex flex-wrap gap-2">
                                            <a href="<?php echo e(route('teams.show', $t)); ?>"
                                               class="px-3 py-1.5 rounded-lg border hover:bg-gray-50 text-xs">
                                                View
                                            </a>
                                            <a href="<?php echo e(route('teams.edit', $t)); ?>"
                                               class="px-3 py-1.5 rounded-lg border hover:bg-gray-50 text-xs">
                                                Edit
                                            </a>
                                            <a href="<?php echo e(route('teams.members.index', $t)); ?>"
                                               class="px-3 py-1.5 rounded-lg border hover:bg-gray-50 text-xs">
                                                Members
                                            </a>
                                            <a href="<?php echo e(route('teams.members.create', $t)); ?>"
                                               class="px-3 py-1.5 rounded-lg border hover:bg-gray-50 text-xs">
                                                Add Member
                                            </a>
                                        </div>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>
            <?php else: ?>
                <div class="p-4 rounded-xl bg-gray-50 border text-sm text-gray-600">
                    আপনি এখনো কোনো টিম তৈরি করেননি।
                </div>
            <?php endif; ?>
        </div>

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

<?php echo $__env->make('layout.main', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Projects\election\resources\views/candidate/dashboard.blade.php ENDPATH**/ ?>