<?php $__env->startSection('menu'); ?>
    <?php echo $__env->make('etudiants.menu', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<section class="profile-details bg-light py-5">
    <div class="container">
        <!-- Header -->
        <div class="header d-flex justify-content-between align-items-center mb-4">
            <h1 class="text-primary">Mon Profil</h1>
            <a href="<?php echo e(route('etudiants.offres.index')); ?>" class="btn btn-outline-primary">
                <i class="bi bi-arrow-left"></i> Retour à l'accueil
            </a>
        </div>

        <!-- User Profile Details -->
        <div class="card shadow-sm">
            <div class="card-body">
                <div class="d-flex align-items-center mb-4">
                    <img src="<?php echo e(asset('auth/images/img2.svg')); ?>" alt="User Avatar" class="rounded-circle me-3" width="80" height="80">
                    <div>
                        <h3 class="card-title"><?php echo e(auth()->user()->name); ?> <?php echo e(auth()->user()->surname); ?></h3>
                        <p class="text-muted"><?php echo e(auth()->user()->email); ?></p>
                    </div>
                </div>

                <hr>

                <div class="row">
                    <div class="col-md-6">
                        <h5>Date de naissance</h5>
                        <p><?php echo e(auth()->user()->birthday ? (new \DateTime(auth()->user()->birthday))->format('d/m/Y') : 'Non spécifiée'); ?></p>
                    </div>
                    <div class="col-md-6">
                        <h5>Lieu de naissance</h5>
                        <p><?php echo e(auth()->user()->birthplace ?: 'Non spécifié'); ?></p>
                    </div>
                    <div class="col-md-6">
                        <h5>Téléphone</h5>
                        <p><?php echo e(auth()->user()->phone ?: 'Non spécifié'); ?></p>
                    </div>
                    <div class="col-md-6">
                        <h5>Matricule</h5>
                        <p><?php echo e(auth()->user()->matricule ?: 'Non spécifié'); ?></p>
                    </div>
                    <div class="col-md-6">
                        <h5>Adresse</h5>
                        <p><?php echo e(auth()->user()->address ?: 'Non spécifiée'); ?></p>
                    </div>
                    <div class="col-md-6">
                    <?php if($user->cv): ?>
                                <!-- Affichage de l'image -->
                                <?php if(in_array(pathinfo($user->cv, PATHINFO_EXTENSION), ['jpg', 'jpeg', 'png', 'gif'])): ?>
                                <h5>Curiculum Vitae</h5>
                                    <a href="<?php echo e(Storage::url($user->cv)); ?>" download class="btn btn-primary btn-sm mt-2">
                                        <i class="fa fa-download"></i> Télécharger le cv
                                    </a>
                                <?php endif; ?>
                                
                                <!-- Affichage du PDF -->
                                <?php if(pathinfo($user->cv, PATHINFO_EXTENSION) == 'pdf'): ?>
                                <h5>Curiculum Vitae</h5>
                                    <a href="<?php echo e(Storage::url($user->cv)); ?>" download class="btn btn-primary btn-sm mt-2">
                                        <i class="fa fa-download"></i> Télécharger le cv
                                    </a>
                                <?php endif; ?>
                                
                                <!-- Message pour les autres types de fichiers -->
                                <?php if(in_array(pathinfo($user->cv, PATHINFO_EXTENSION), ['docx', 'xlsx', 'pptx'])): ?>
                                <h5>Curiculum Vitae</h5>
                                    <a href="<?php echo e(Storage::url($user->cv)); ?>" download class="btn btn-primary btn-sm mt-2">
                                        <i class="fa fa-download"></i> Télécharger le cv
                                    </a>
                                <?php endif; ?>
                            <?php else: ?>
                                <p>Aucune pièce jointe</p>
                            <?php endif; ?>
                            </div>
                </div>

                <hr>

                <!-- Actions -->
                <div class="d-flex justify-content-center mt-3">
                    <a href="<?php echo e(route('etudiants.editProfile')); ?>" class="btn btn-primary mx-2">
                        Modifier le profil
                    </a>
                    <a href="<?php echo e(route('alumnis.createDegree')); ?>" class="btn btn-primary mx-2">
                        Ajouter un diplôme/certificat
                    </a>
                    </a>
                    <a href="<?php echo e(route('alumnis.degree')); ?>" class="btn btn-primary mx-2">
                        Voir mes formations
                    </a>
                    <a href="<?php echo e(route('logout')); ?>" class="btn btn-outline-danger mx-2">
                        <i class="bi bi-box-arrow-right"></i> Déconnexion
                    </a>
                </div>
            </div>
        </div>
    </div>
</section>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.base', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/africawebstudent/public_html/alumnis/resources/views/etudiants/profile.blade.php ENDPATH**/ ?>