<?php $__env->startSection('title', 'Configurar Campos'); ?>
<?php $__env->startSection('content'); ?>
<div class="row justify-content-center">
    <div class="col-md-10">
        <div class="card p-4">
            <div class="mb-4">
                <h3 class="fw-bold">Gestión de Campos Dinámicos</h3>
                <p class="text-muted small">Configure dónde desea que aparezcan los datos adicionales de cada estudiante.</p>
            </div>

            <div class="bg-light p-4 rounded-4 mb-5 border">
                <h6 class="fw-bold mb-3"><i class="bi bi-plus-circle me-2"></i>Nuevo Campo Personalizado</h6>
                <form action="<?php echo e(route('admin.custom_fields.store')); ?>" method="POST">
                    <?php echo csrf_field(); ?>
                    <div class="row g-3">
                        <div class="col-md-6">
                            <label class="form-label small fw-bold">Nombre de la Etiqueta</label>
                            <input type="text" name="label" class="form-control" placeholder="Ej: Promedio General" required>
                        </div>
                        <div class="col-md-4">
                            <label class="form-label small fw-bold">Ubicación (Sección)</label>
                            <select name="section" class="form-select" required>
                                <?php $__currentLoopData = $sections; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $val): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($key); ?>"><?php echo e($val); ?></option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                        </div>
                        <div class="col-md-2 d-flex align-items-end">
                            <button class="btn btn-primary w-100" type="submit">Agregar</button>
                        </div>
                    </div>
                </form>
            </div>

            <div class="row row-cols-1 row-cols-md-3 g-4">
                <?php $__currentLoopData = $sections; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $sectionName): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="col">
                        <div class="h-100 p-3 border rounded-4 bg-white">
                            <h6 class="fw-bold text-primary border-bottom pb-2 mb-3">
                                <i class="bi bi-layout-sidebar-inset me-2"></i><?php echo e($sectionName); ?>

                            </h6>
                            <div class="list-group list-group-flush">
                                <?php $__empty_1 = true; $__currentLoopData = $fields->where('section', $key); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $field): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <div class="list-group-item d-flex justify-content-between align-items-center px-0 py-2 border-0">
                                        <span class="small fw-medium"><?php echo e($field->label); ?></span>
                                        <form action="<?php echo e(route('admin.custom_fields.destroy', $field->id)); ?>" method="POST">
                                            <?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
                                            <button type="submit" class="btn btn-link text-danger btn-sm p-0">
                                                <i class="bi bi-x-circle"></i>
                                            </button>
                                        </form>
                                    </div>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <div class="text-center py-3 text-muted small italic">Sin campos extras</div>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/fichaacademicaup/public_html/ficha_academica/resources/views/admin/custom_fields/index.blade.php ENDPATH**/ ?>