<?php $__env->startSection('title', 'Incidencias de Seguridad - Ojo de Águila'); ?>
<?php $__env->startSection('header_title', 'Reporte de Incidencias'); ?>

<?php $__env->startSection('content'); ?>
<div class="dashboard-grid">
    <!-- Formulario para Reportar -->
    <div class="card">
        <div class="card-header">
            <h3 class="card-title">🚨 Reportar Incidencia</h3>
        </div>
        <div class="card-body">
            <form action="<?php echo e(route('incidents.store')); ?>" method="POST">
                <?php echo csrf_field(); ?>
                <div class="form-group">
                    <label for="title" class="form-label required">Título / Suceso</label>
                    <input type="text" name="title" id="title" class="form-control" placeholder="Ej: Falla eléctrica portón, sospechoso en perímetro..." required>
                </div>

                <div class="form-group">
                    <label for="severity" class="form-label required">Severidad / Urgencia</label>
                    <select name="severity" id="severity" class="form-control" required>
                        <option value="low">Baja (Mantenimiento menor)</option>
                        <option value="medium">Media (Atención rutinaria)</option>
                        <option value="high">Alta (Requiere acción rápida)</option>
                        <option value="critical">Crítica (Emergencia de seguridad)</option>
                    </select>
                </div>

                <div class="form-group">
                    <label for="description" class="form-label required">Descripción detallada</label>
                    <textarea name="description" id="description" class="form-control" rows="5" placeholder="Ingresa detalles sobre lo ocurrido y acciones tomadas..." required></textarea>
                </div>

                <button type="submit" class="btn btn-primary btn-full" style="height: 44px; margin-top: 8px;">
                    🛡️ Registrar Incidencia
                </button>
            </form>
        </div>
    </div>

    <!-- Listado de Incidencias -->
    <div style="display: flex; flex-direction: column; gap: 20px;">
        <?php $__empty_1 = true; $__currentLoopData = $incidents; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $inc): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <?php
                $severityClass = $inc->severity === 'critical' || $inc->severity === 'high' ? 'badge-danger' : ($inc->severity === 'medium' ? 'badge-warning' : 'badge-success');
                $statusColor = $inc->status === 'open' ? 'var(--danger-color)' : 'var(--success-color)';
                $statusLabel = $inc->status === 'open' ? 'Abierto' : 'Resuelto';
            ?>
            <div class="card" style="margin-bottom: 0;">
                <div class="card-header" style="padding: 16px 20px; display: flex; align-items: center; justify-content: space-between;">
                    <div style="display: flex; align-items: center; gap: 10px;">
                        <span style="width: 8px; height: 8px; border-radius: 50%; background-color: <?php echo e($statusColor); ?>;"></span>
                        <span style="font-weight: 700; font-size: 14px; color: var(--text-primary);"><?php echo e($inc->title); ?></span>
                    </div>
                    <span class="badge <?php echo e($severityClass); ?>" style="font-size: 10px;">
                        <?php echo e($inc->severity); ?>

                    </span>
                </div>
                <div class="card-body" style="padding: 20px;">
                    <p style="font-size: 13px; color: var(--text-secondary); margin-bottom: 16px;">
                        <?php echo e($inc->description); ?>

                    </p>
                    <div style="display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--text-light); font-weight: 600;">
                        <span>👮 Reportado por: <strong><?php echo e($inc->reporter->name); ?></strong></span>
                        <span>⏱️ <?php echo e($inc->created_at instanceof \Carbon\Carbon ? $inc->created_at->diffForHumans() : \Carbon\Carbon::parse($inc->created_at)->diffForHumans()); ?></span>
                    </div>
                </div>
            </div>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <div class="card">
                <div class="card-body" style="text-align: center; color: var(--text-light); padding: 40px;">
                    No se registran incidencias hoy.
                </div>
            </div>
        <?php endif; ?>
    </div>
</div>
<?php $__env->stopSection(); ?>

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