

<?php $__env->startSection('page_title', 'Leave Requests'); ?>

<?php $__env->startSection('content'); ?>
    <div class="card border-0 shadow-sm">
        <div class="card-header bg-white border-0 p-4 pb-0">
            <h5 class="fw-bold mb-0">Manage Leave Requests</h5>
        </div>
        <div class="card-body p-4">
            <div class="table-responsive">
                <table class="table datatable table-hover align-middle">
                    <thead class="bg-light">
                        <tr>
                            <th class="border-0">Employee</th>
                            <th class="border-0">Type</th>
                            <th class="border-0">Range</th>
                            <th class="border-0">Days</th>
                            <th class="border-0">Status</th>
                            <th class="border-0 text-end">Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__currentLoopData = $leaves; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $leave): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td class="fw-semibold"><?php echo e($leave->user->name); ?></td>
                                <td><?php echo e(ucfirst($leave->leave_type)); ?></td>
                                <td><?php echo e($leave->from_date->format('d M')); ?> - <?php echo e($leave->to_date->format('d M, Y')); ?></td>
                                <td><?php echo e($leave->total_days); ?></td>
                                <td>
                                    <span
                                        class="badge bg-<?php echo e($leave->status == 'approved' ? 'success' : ($leave->status == 'rejected' ? 'danger' : 'warning')); ?>-subtle text-<?php echo e($leave->status == 'approved' ? 'success' : ($leave->status == 'rejected' ? 'danger' : 'warning')); ?> px-3 rounded-pill">
                                        <?php echo e(ucfirst($leave->status)); ?>

                                    </span>
                                </td>
                                <td class="text-end">
                                    <?php if($leave->status == 'pending'): ?>
                                        <div class="d-flex justify-content-end gap-1">
                                            <form action="<?php echo e(route('admin.leaves.approve', $leave->id)); ?>" method="POST">
                                                <?php echo csrf_field(); ?>
                                                <button type="submit"
                                                    class="btn btn-sm btn-success rounded-pill px-3">Approve</button>
                                            </form>
                                            <form action="<?php echo e(route('admin.leaves.reject', $leave->id)); ?>" method="POST">
                                                <?php echo csrf_field(); ?>
                                                <button type="submit"
                                                    class="btn btn-sm btn-outline-danger rounded-pill px-3">Reject</button>
                                            </form>
                                        </div>
                                    <?php else: ?>
                                        <button class="btn btn-sm btn-light border rounded-pill px-3">Details</button>
                                    <?php endif; ?>
                                </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH G:\wamp64\www\projects\attendance\resources\views/admin/leaves/index.blade.php ENDPATH**/ ?>