

<?php $__env->startSection('content'); ?>
<div class="flex justify-between items-center mb-6">
    <h2 class="text-2xl font-bold text-gold">إدارة الرواتب</h2>
    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('create_payrolls')): ?>
    <a href="<?php echo e(route('admin.payrolls.create')); ?>" class="btn-gold">إنشاء دورة رواتب جديدة</a>
    <?php endif; ?>
</div>

<div class="bg-black/20 border border-gray-800 rounded-2xl p-6 mb-8">
    <form action="<?php echo e(route('admin.payrolls.index')); ?>" method="GET" class="flex gap-4">
        <div class="flex-1">
            <select name="branch_id" class="w-full bg-black border-gray-800 rounded-lg px-4 py-2 text-white outline-none">
                <option value="">جميع الفروع</option>
                <?php $__currentLoopData = $branches; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $branch): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <option value="<?php echo e($branch->id); ?>" <?php echo e(request('branch_id') == $branch->id ? 'selected' : ''); ?>><?php echo e($branch->name); ?></option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </select>
        </div>
        <button type="submit" class="px-6 py-2 bg-gray-800 text-white rounded-lg">تصفية</button>
    </form>
</div>

<div class="bg-black/20 border border-gray-800 rounded-2xl overflow-hidden">
    <table class="w-full text-right">
        <thead>
            <tr class="bg-black/40 border-b border-gray-800">
                <th class="px-6 py-4 text-gray-400">الشهر</th>
                <th class="px-6 py-4 text-gray-400">الفرع</th>
                <th class="px-6 py-4 text-gray-400">الحالة</th>
                <th class="px-6 py-4 text-gray-400">أنشئ بواسطة</th>
                <th class="px-6 py-4 text-gray-400">العمليات</th>
            </tr>
        </thead>
        <tbody class="divide-y divide-gray-800">
            <?php $__currentLoopData = $cycles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cycle): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <tr class="hover:bg-white/5 transition-colors">
                <td class="px-6 py-4 font-bold"><?php echo e($cycle->month); ?></td>
                <td class="px-6 py-4"><?php echo e($cycle->branch->name); ?></td>
                <td class="px-6 py-4">
                    <?php if($cycle->status === 'approved'): ?>
                    <span class="px-3 py-1 rounded-full text-xs font-bold bg-green-500/20 text-green-400">معتمدة</span>
                    <?php else: ?>
                    <span class="px-3 py-1 rounded-full text-xs font-bold bg-yellow-500/20 text-yellow-400">مسودة</span>
                    <?php endif; ?>
                </td>
                <td class="px-6 py-4 text-gray-400"><?php echo e($cycle->creator->name); ?></td>
                <td class="px-6 py-4">
                    <a href="<?php echo e(route('admin.payrolls.show', $cycle->id)); ?>" class="text-gold hover:underline">عرض التفاصيل</a>
                </td>
            </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </tbody>
    </table>
</div>

<div class="mt-6">
    <?php echo e($cycles->links()); ?>

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

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\tq cars\resources\views/admin/payrolls/index.blade.php ENDPATH**/ ?>