

<?php $__env->startSection('content'); ?>
<div class="container-fluid px-4 py-6">
    <div class="max-w-7xl mx-auto">
        <!-- Header -->
        <div class="d-flex justify-content-between align-items-center mb-4">
            <div>
                <h2 class="mb-1">Training Management</h2>
                <p class="text-muted mb-0">Manage and track all training programs</p>
            </div>
            <a href="<?php echo e(route('trainings.create')); ?>" class="btn btn-primary">
                <i class="bi bi-plus-lg"></i> Create Training
            </a>
        </div>

        <!-- Success Message -->
        <?php if(session('success')): ?>
            <div class="alert alert-success alert-dismissible fade show" role="alert">
                <?php echo e(session('success')); ?>

                <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
            </div>
        <?php endif; ?>

        <!-- Trainings List -->
        <?php $__empty_1 = true; $__currentLoopData = $trainings; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $training): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <div class="card shadow-sm mb-4">
                <div class="card-body">
                    <div class="d-flex justify-content-between align-items-start mb-3">
                        <div>
                            <h4 class="mb-2"><?php echo e($training->name); ?></h4>
                            <p class="text-muted mb-0"><?php echo e($training->summary); ?></p>
                        </div>
                        <span class="badge bg-success">Active</span>
                    </div>

                    <div class="row g-4 mb-3">
                        <div class="col-md-3">
                            <div class="d-flex gap-2">
                                <i class="bi bi-calendar3 text-muted"></i>
                                <div>
                                    <div class="text-muted small">Duration</div>
                                    <div class="fw-semibold"><?php echo e($training->duration); ?> day<?php echo e($training->duration !== 1 ? 's' : ''); ?></div>
                                    <div class="text-muted small"><?php echo e($training->start_date->format('M d, Y')); ?> - <?php echo e($training->end_date->format('M d, Y')); ?></div>
                                </div>
                            </div>
                        </div>

                        <div class="col-md-3">
                            <div class="d-flex gap-2">
                                <i class="bi bi-geo-alt text-muted"></i>
                                <div>
                                    <div class="text-muted small">Location</div>
                                    <div class="fw-semibold"><?php echo e($training->location); ?></div>
                                </div>
                            </div>
                        </div>

                        <div class="col-md-3">
                            <div class="d-flex gap-2">
                                <i class="bi bi-people text-muted"></i>
                                <div>
                                    <div class="text-muted small">Participants</div>
                                    <div class="fw-semibold"><?php echo e(count($training->participants ?? [])); ?> / <?php echo e($training->expected_participants); ?></div>
                                </div>
                            </div>
                        </div>

                        <div class="col-md-3">
                            <div class="d-flex gap-2">
                                <i class="bi bi-person text-muted"></i>
                                <div>
                                    <div class="text-muted small">Trainer</div>
                                    <div class="fw-semibold"><?php echo e($training->trainer_name); ?></div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- View Details Accordion -->
                    <div class="accordion" id="training<?php echo e($training->id); ?>">
                        <div class="accordion-item border-0">
                            <h2 class="accordion-header">
                                <button class="accordion-button collapsed bg-light" type="button" data-bs-toggle="collapse" data-bs-target="#details<?php echo e($training->id); ?>">
                                    <i class="bi bi-info-circle me-2"></i> View Details
                                </button>
                            </h2>
                            <div id="details<?php echo e($training->id); ?>" class="accordion-collapse collapse" data-bs-parent="#training<?php echo e($training->id); ?>">
                                <div class="accordion-body">
                                    <div class="row">
                                        <div class="col-md-6 mb-3">
                                            <h6 class="fw-semibold mb-2">Course Outline</h6>
                                            <p class="text-muted small" style="white-space: pre-wrap;"><?php echo e($training->course_outline); ?></p>
                                        </div>

                                        <div class="col-md-6 mb-3">
                                            <h6 class="fw-semibold mb-2">Training Details</h6>
                                            <div class="mb-2">
                                                <strong>Creation Date:</strong> <?php echo e($training->creation_date->format('M d, Y')); ?>

                                            </div>
                                            <div class="mb-2">
                                                <strong>Supervisor:</strong> <?php echo e($training->supervisor_name); ?>

                                            </div>
                                            <?php if($training->remarks): ?>
                                                <div class="mb-2">
                                                    <strong>Remarks:</strong> <?php echo e($training->remarks); ?>

                                                </div>
                                            <?php endif; ?>
                                        </div>

                                        <?php if($training->participant_officers && $training->participant_officers->count() > 0): ?>
                                            <div class="col-12 mb-3">
                                                <h6 class="fw-semibold mb-2">Participants (<?php echo e($training->participant_officers->count()); ?>)</h6>
                                                <div class="d-flex flex-wrap gap-2">
                                                    <?php $__currentLoopData = $training->participant_officers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $officer): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <span class="badge bg-primary"><?php echo e($officer->name); ?></span>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </div>
                                            </div>
                                        <?php endif; ?>
                                    </div>

                                    <!-- Action Buttons -->
                                    <div class="d-flex gap-2 pt-3 border-top">
                                        <a href="<?php echo e(route('trainings.show', $training)); ?>" class="btn btn-sm btn-outline-primary">
                                            <i class="bi bi-eye"></i> View Full Details
                                        </a>
                                        <a href="<?php echo e(route('trainings.edit', $training)); ?>" class="btn btn-sm btn-outline-secondary">
                                            <i class="bi bi-pencil"></i> Edit
                                        </a>
                                        <form action="<?php echo e(route('trainings.destroy', $training)); ?>" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this training?');">
                                            <?php echo csrf_field(); ?>
                                            <?php echo method_field('DELETE'); ?>
                                            <button type="submit" class="btn btn-sm btn-outline-danger">
                                                <i class="bi bi-trash"></i> Delete
                                            </button>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <div class="card shadow-sm text-center py-5">
                <div class="card-body">
                    <i class="bi bi-journal-text" style="font-size: 4rem; color: #ccc;"></i>
                    <h4 class="mt-3 mb-2">No trainings yet</h4>
                    <p class="text-muted mb-4">Get started by creating your first training program</p>
                    <a href="<?php echo e(route('trainings.create')); ?>" class="btn btn-primary">
                        <i class="bi bi-plus-lg"></i> Create Training
                    </a>
                </div>
            </div>
        <?php endif; ?>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\wamp64\www\ndrt-system\resources\views/trainings/index.blade.php ENDPATH**/ ?>