

<?php $__env->startSection('title', 'Proyectos'); ?>
<?php $__env->startSection('page-title', 'Gestión de Proyectos'); ?>

<?php $__env->startSection('content'); ?>
<?php if (isset($component)) { $__componentOriginale19f62b34dfe0bfdf95075badcb45bc2 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginale19f62b34dfe0bfdf95075badcb45bc2 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.breadcrumb','data' => ['items' => [
    ['label' => 'Proyectos', 'icon' => 'folder', 'active' => true]
]]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('breadcrumb'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['items' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute([
    ['label' => 'Proyectos', 'icon' => 'folder', 'active' => true]
])]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginale19f62b34dfe0bfdf95075badcb45bc2)): ?>
<?php $attributes = $__attributesOriginale19f62b34dfe0bfdf95075badcb45bc2; ?>
<?php unset($__attributesOriginale19f62b34dfe0bfdf95075badcb45bc2); ?>
<?php endif; ?>
<?php if (isset($__componentOriginale19f62b34dfe0bfdf95075badcb45bc2)): ?>
<?php $component = $__componentOriginale19f62b34dfe0bfdf95075badcb45bc2; ?>
<?php unset($__componentOriginale19f62b34dfe0bfdf95075badcb45bc2); ?>
<?php endif; ?>

<div class="d-flex justify-content-between align-items-center mb-4">
    <div>
        <h4>Proyectos</h4>
        <p class="text-muted mb-0"><?php echo e($projects->count()); ?> proyecto(s) encontrado(s)</p>
    </div>
    <?php if(auth()->user()->hasRole(['administrador', 'supervisor'])): ?>
    <a href="<?php echo e(route('projects.create')); ?>" class="btn btn-primary">
        <i class="bi bi-plus-circle"></i> Nuevo Proyecto
    </a>
    <?php endif; ?>
</div>

<?php if(session('success')): ?>
<div class="alert alert-success alert-dismissible fade show" role="alert">
    <i class="bi bi-check-circle me-2"></i><?php echo e(session('success')); ?>

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

<?php if(session('error')): ?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
    <i class="bi bi-exclamation-triangle me-2"></i><?php echo e(session('error')); ?>

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

<div class="row">
    <?php $__empty_1 = true; $__currentLoopData = $projects; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $project): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
    <div class="col-md-6 col-lg-4 mb-4">
        <div class="card h-100">
            <div class="card-body">
                <div class="d-flex justify-content-between align-items-start mb-3">
                    <h5 class="card-title mb-0">
                        <a href="<?php echo e(route('projects.show', $project)); ?>" class="text-decoration-none">
                            <?php echo e($project->name); ?>

                        </a>
                    </h5>
                    <span class="badge bg-<?php echo e($project->status === 'activo' ? 'success' : ($project->status === 'completado' ? 'info' : 'secondary')); ?>">
                        <?php echo e(ucfirst($project->status)); ?>

                    </span>
                </div>
                
                <p class="card-text text-muted small">
                    <?php echo e(Str::limit($project->description, 100)); ?>

                </p>
                
                <div class="mb-3">
                    <div class="small text-muted mb-1">
                        <i class="bi bi-building me-1"></i>
                        <?php echo e($project->company->name ?? 'Sin empresa'); ?>

                    </div>
                    <?php if($project->start_date): ?>
                    <div class="small text-muted">
                        <i class="bi bi-calendar me-1"></i>
                        Inicio: <?php echo e($project->start_date->format('d/m/Y')); ?>

                    </div>
                    <?php endif; ?>
                    <?php if($project->end_date): ?>
                    <div class="small text-muted">
                        <i class="bi bi-calendar-check me-1"></i>
                        Fin: <?php echo e($project->end_date->format('d/m/Y')); ?>

                    </div>
                    <?php endif; ?>
                </div>
                
                <hr>
                
                <div class="row text-center">
                    <div class="col-6">
                        <div class="fs-5 fw-bold text-primary"><?php echo e($project->tickets->count() ?? 0); ?></div>
                        <div class="small text-muted">Tickets</div>
                    </div>
                    <div class="col-6">
                        <div class="fs-5 fw-bold text-info"><?php echo e($project->assignedUsers->count() ?? 0); ?></div>
                        <div class="small text-muted">Técnicos</div>
                    </div>
                </div>
            </div>
            <div class="card-footer bg-white">
                <div class="d-flex justify-content-between">
                    <a href="<?php echo e(route('projects.show', $project)); ?>" class="btn btn-sm btn-outline-primary">
                        <i class="bi bi-eye"></i> Ver
                    </a>
                    <?php if(auth()->user()->hasRole(['administrador', 'supervisor'])): ?>
                    <a href="<?php echo e(route('projects.edit', $project)); ?>" class="btn btn-sm btn-outline-secondary">
                        <i class="bi bi-pencil"></i> Editar
                    </a>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
    <div class="col-12">
        <div class="card">
            <div class="card-body text-center py-5">
                <i class="bi bi-folder2-open fs-1 text-muted"></i>
                <h5 class="mt-3">No hay proyectos disponibles</h5>
                <p class="text-muted">
                    <?php if(auth()->user()->hasRole(['administrador', 'supervisor'])): ?>
                        Comienza creando tu primer proyecto
                    <?php else: ?>
                        No tienes proyectos asignados todavía
                    <?php endif; ?>
                </p>
                <?php if(auth()->user()->hasRole(['administrador', 'supervisor'])): ?>
                <a href="<?php echo e(route('projects.create')); ?>" class="btn btn-primary mt-2">
                    <i class="bi bi-plus-circle"></i> Crear Primer Proyecto
                </a>
                <?php endif; ?>
            </div>
        </div>
    </div>
    <?php endif; ?>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('styles'); ?>
<style>
    .card {
        transition: transform 0.2s;
        box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
    }
    
    .card:hover {
        transform: translateY(-5px);
        box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
    }
</style>
<?php $__env->stopPush(); ?>

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