

<?php $__env->startSection('content'); ?>
    <div class="container">
        <h1>Task List</h1>

        <?php if(session('success')): ?>
            <div class="alert alert-success">
                <?php echo e(session('success')); ?>

            </div>
        <?php endif; ?>

        <!-- Create Task Button -->
        <a href="<?php echo e(route('tasks.create')); ?>" class="btn btn-success mb-3">Create Task</a>

        <table class="table table-striped">
            <thead>
                <tr>
                    <th>#</th>
                    <th>Title</th>
                    <th>Description</th>
                    <th>Creator</th>
                    <th>Assigned To</th>
                    <th>Farm</th>
                    <th>Section</th>
                    <th>Created At</th>
                    <th>Actions</th>
                </tr>
            </thead>
            <tbody>
                <?php $__empty_1 = true; $__currentLoopData = $tasks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $task): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <tr>
                        <td><?php echo e($loop->iteration); ?></td>
                        <td><?php echo e($task->title); ?></td>
                        <td><?php echo e(Str::limit($task->description, 50)); ?></td>
                        <td><?php echo e($task->creator->fullname ?? 'N/A'); ?></td>
                        <td><?php echo e($task->assignee->fullname ?? 'N/A'); ?></td>
                        <td><?php echo e($task->farm->registration_no ?? 'N/A'); ?></td>
                        <td><?php echo e($task->section->name ?? 'N/A'); ?></td>
                        <td><?php echo e($task->created_at->format('Y-m-d H:i')); ?></td>
                        <td>
                            <a href="<?php echo e(route('tasks.show', $task->id)); ?>" class="btn btn-primary btn-sm">View</a>
                            <a href="<?php echo e(route('tasks.edit', $task->id)); ?>" class="btn btn-warning btn-sm">Edit</a>
                            <form action="<?php echo e(route('tasks.destroy', $task->id)); ?>" method="POST" style="display: inline-block;">
                                <?php echo csrf_field(); ?>
                                <?php echo method_field('DELETE'); ?>
                                <button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want to delete this task?');">Delete</button>
                            </form>
                        </td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <tr>
                        <td colspan="9" class="text-center">No tasks found.</td>
                    </tr>
                <?php endif; ?>
            </tbody>
        </table>

        <div class="d-flex justify-content-center">
            <?php echo e($tasks->links()); ?>

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

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\laragon\www\VPS_changes\resources\views/tasks/tasks-index.blade.php ENDPATH**/ ?>