<?php if (isset($component)) { $__componentOriginale0f1cdd055772eb1d4a99981c240763e = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginale0f1cdd055772eb1d4a99981c240763e = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin-layout','data' => ['title' => 'Driver Shifts']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['title' => 'Driver Shifts']); ?>
    <div class="card">
        <div class="card-body">
            <h5 class="fw-bold mb-3">Driver Shifts</h5>

            <?php if($shifts->isEmpty()): ?>
                <div class="text-center text-muted py-5">
                    <i class="bi bi-clock-history fs-1 d-block mb-2"></i>
                    No shifts recorded yet.
                </div>
            <?php else: ?>
                <div class="table-responsive">
                    <table class="table align-middle datatable">
                        <thead>
                            <tr>
                                <th>Driver</th>
                                <th>Vehicle</th>
                                <th>Started</th>
                                <th>Ended</th>
                                <th>Availability</th>
                                <th>Status</th>
                                <th class="text-end">Actions</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__currentLoopData = $shifts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $shift): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td class="fw-semibold"><?php echo e($shift->driver->full_name ?? '—'); ?></td>
                                    <td><?php echo e($shift->vehicle->registration_number ?? '—'); ?></td>
                                    <td><?php echo e($shift->started_at->format('d M Y, H:i')); ?></td>
                                    <td><?php echo e($shift->ended_at?->format('d M Y, H:i') ?? '—'); ?></td>
                                    <td>
                                        <?php if(!$shift->ended_at): ?>
                                            <span class="badge <?php echo e($shift->is_available ? 'is-green' : 'is-amber'); ?>">
                                                <?php echo e($shift->is_available ? 'Available' : 'Busy'); ?>

                                            </span>
                                        <?php else: ?>
                                            <span class="text-muted">—</span>
                                        <?php endif; ?>
                                    </td>
                                    <td>
                                        <span class="badge <?php echo e($shift->ended_at ? 'is-rose' : 'is-blue'); ?>">
                                            <?php echo e($shift->ended_at ? 'Ended' : 'Active'); ?>

                                        </span>
                                    </td>
                                    <td class="text-end">
                                        <?php if(!$shift->ended_at && auth()->user()->hasPermission('shifts.manage')): ?>
                                            <form method="POST" action="<?php echo e(route('admin.shifts.force-end', $shift)); ?>" class="d-inline"
                                                  data-confirm-title="End shift for <?php echo e($shift->driver->full_name); ?>?"
                                                  data-confirm-text="Any of their in-progress bookings will be automatically cancelled."
                                                  data-confirm-button="End Shift"
                                                  data-confirm-input-label="Reason (optional)">
                                                <?php echo csrf_field(); ?>
                                                <?php echo method_field('PATCH'); ?>
                                                <input type="hidden" name="reason" class="confirm-input-target">
                                                <button type="submit" class="btn btn-sm btn-outline-danger">End Shift</button>
                                            </form>
                                        <?php endif; ?>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>
            <?php endif; ?>
        </div>
    </div>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginale0f1cdd055772eb1d4a99981c240763e)): ?>
<?php $attributes = $__attributesOriginale0f1cdd055772eb1d4a99981c240763e; ?>
<?php unset($__attributesOriginale0f1cdd055772eb1d4a99981c240763e); ?>
<?php endif; ?>
<?php if (isset($__componentOriginale0f1cdd055772eb1d4a99981c240763e)): ?>
<?php $component = $__componentOriginale0f1cdd055772eb1d4a99981c240763e; ?>
<?php unset($__componentOriginale0f1cdd055772eb1d4a99981c240763e); ?>
<?php endif; ?>
<?php /**PATH C:\xampp\htdocs\dispatch-v2\resources\views/admin/shifts/index.blade.php ENDPATH**/ ?>