<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Hoja de vida empleado</title>
    <link rel="stylesheet" type="text/css" href="{{asset('assets/css/fontawesome.min.css')}}">
    <link rel="stylesheet" href="{{asset('assets/css/cv_employee_pdf.css')}}">
</head>
<body>
    <section>
        <table cellpadding="0" cellspacing="0" width="100%">
            <tr>
                <td width="35%">
                    <img src="{{ asset('storage/users/' .$user->imagen) }}" class="img-h-150" alt="{{ $user->first_name }} {{ $user->last_name }}" >
                </td>
                <td width="65%">
                    <h2 class="title">{{ $user->first_name }} {{ $user->last_name }}</h2>
                    <p class="p-header"><i class="fas fa-envelope"></i> <span>{{ $user->email }}</span></p>
                    <p class="p-header"><i class="fas fa-phone"></i> <span>{{ $user->phone }}</span></p>
                    <p class="p-header"><i class="fas fa-map-marker-alt"></i> <span>{{ $user->address }}</span></p>
                </td>
            </tr>
        </table>
    </section>
    <div class="separator"></div>
    <section class="data-employee">
        <table cellpadding="0" cellspacing="0" width="100%" class="table-cv data-personal">
            <thead>
                <tr>
                    <th class="th-header" width="50%">
                        <h3 class="text-left">Datos personales</h3>
                    </th>
                    <th class="th-header pl-10" width="50%">
                        <h3 class="text-left">Perfil profesional</h3>
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td class="td-body">
                        <p><b>Fecha de nacimiento:</b> <span>{{ \Carbon\Carbon::parse($user->birth_date)->monthName . ' ' . \Carbon\Carbon::parse($user->birth_date)->day . ', ' . \Carbon\Carbon::parse($user->birth_date)->year }}</span></p>
                        <p><b>Lugar de nacimiento:</b> <span>{{ $user->birth_place }}</span></p>
                        <p><b>{{ $user->document_type_name }}</b> <span>{{ $user->document }}</span></p>
                        <p><b>Género:</b> <span>{{ $user->gender_user }}</span></p>
                        <p><b>Estado civil:</b> <span>
                            {{ $user->civil_status_name }}
                        </span></p>
                        <p><b>Direción:</b> <span>{{ $user->address }} - {{ $user->city_residence_name }}, {{ $user->state_residence_name }}</span></p>
                        <p><b>Teléfono:</b> <span>{{ $user->phone }}</span></p>
                        <p><b>Correo electrónico:</b> <span>{{ $user->email }}</span></p>
                        @if ($languageuser->count() > 0)
                        <p><b>Idiomas:</b>
                            @foreach ($languageuser as $language)
                                <span>{{ $language->language_name }} ({{$language->level_name}})</span>
                            @endforeach
                        </p>
                        @endif
                    </td>
                    <td class="td-body pl-10">
                        <h3 style="padding: 0; margin:0;">{{ $user->title_position }}</h3>
                        @if (!empty($user->professional_license))
                            <p><b>Licencia profesional:</b> <span>{{ $user->professional_license }}</span></p>
                            <br>
                        @endif
                        <p>{{ $user->professional_profile }}</p>
                    </td>
                </tr>
            </tbody>
        </table>
        @if ($academic_formations->count() > 0)
            <div class="separator"></div>
            <table cellpadding="0" cellspacing="0" width="100%" class="table-cv data-academic">
                <thead>
                    <tr>
                        <th class="th-header" width="100%" colspan="2">
                            <hr class="hr-cv">
                            <h3 class="text-center">Formación académica</h3>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td class="td-body"  width="60%">
                            @foreach ($academic_formations as $academic_formation)
                                <p><b>Institución Educativa:</b> <span>{{ $academic_formation->institution_name }}</span></p>
                                <p><b>Nivel educativo:</b> <span>{{ $academic_formation->educational_level_name }}</span></p>
                                <p><b>Título obtenido:</b> <span>{{ $academic_formation->study_area }}</span></p>
                                <div class="separator"></div>
                            @endforeach
                        </td>
                        <td class="td-body"  width="40%">
                            @foreach ($academic_formations as $academic_formation)
                                <p><b>Modalidad:</b> <span>{{ $academic_formation->modality_name }}</span></p>
                                <p><b>Estado:</b> <span>{{ $academic_formation->status_name }}</span></p>
                                @if ($academic_formation->status == "1")
                                    <p><b>Finalizacion: </b> <span>{{ $academic_formation->final_date_month_name . ' ' . $academic_formation->final_date_year }}</span></p>
                                @endif
                                <div class="separator"></div>
                            @endforeach
                        </td>
                    </tr>
                </tbody>
            </table>
        @endif
        @if($skills->count() > 0)
            <div class="separator"></div>
            <table cellpadding="0" cellspacing="0" width="100%" class="table-cv data-skills">
                <thead>
                    <tr>
                        <th class="th-header">
                            <hr class="hr-cv">
                            <h3 class="text-center">Habilidades adicionales</h3>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td class="td-body">
                            <ul>
                            @foreach ($skills as $skill)
                                <li><span>{{ $skill->info }}</span></li>
                            @endforeach
                            </ul>
                        </td>
                    </tr>
                </tbody>
            </table>
        @endif
        @if ($work_experiences->count() > 0)
            <div class="separator"></div>
            <table cellpadding="0" cellspacing="0" width="100%" class="table-cv data-work">
                <thead>
                    <tr>
                        <th class="th-header" width="100%" colspan="2">
                            <hr class="hr-cv">
                            <h3 class="text-center">Experiencia laboral</h3>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td class="td-body"  width="60%">
                            @foreach ($work_experiences as $work_experience)
                                <p><b>Empresa:</b> <span>{{ $work_experience->company }}</span></p>
                                <p><b>Cargo:</b> <span>{{ $work_experience->title_position }}</span></p>
                                <p><b>Fecha de inicio:</b> <span>{{ \Carbon\Carbon::parse($work_experience->date_entry)->monthName . ' ' . \Carbon\Carbon::parse($work_experience->date_entry)->day . ', ' . \Carbon\Carbon::parse($work_experience->date_entry)->year }}</span></p>
                                @if ($work_experience->is_currently_working_here != "1")
                                    <p><b>Fecha de terminación:</b> <span>{{ \Carbon\Carbon::parse($work_experience->date_retirement)->monthName . ' ' . \Carbon\Carbon::parse($work_experience->date_retirement)->day . ', ' . \Carbon\Carbon::parse($work_experience->date_retirement)->year }}</span></p>
                                @else
                                    <p><b>Fecha de terminación:</b> <span>Actualmente trabaja en esta empresa</span></p>
                                @endif
                            @endforeach
                        </td>
                        <td class="td-body"  width="40%">
                            @foreach ($work_experiences as $work_experience)
                                <p><b>Sector:</b> <span>{{ $work_experience->type_company_name }}</span></p>
                                @if ($work_experience->is_currently_working_here != "1")
                                    <p><b>Duración:</b> <span>{{ $work_experience->duration }}</span></p>
                                @endif
                            @endforeach
                        </td>
                    </tr>
                    <tr>
                        <td class="td-body" width="100%" colspan="2">
                            @foreach ($work_experiences as $work_experience)
                                <p><b>Labores:</b> <span>{{ $work_experience->responsabilities }}</span></p>
                            @endforeach
                        </td>
                    </tr>
                </tbody>
            </table>
        @endif
        @if ($trainings->count() > 0)
            <div class="separator"></div>
            <table cellpadding="0" cellspacing="0" width="100%" class="table-cv data-training">
                <thead>
                    <tr>
                        <th class="th-header" width="100%">
                            <hr class="hr-cv">
                            <h3 class="text-center">Capacitaciones</h3>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    @foreach ($trainings as $training)
                    <tr>
                        <td class="td-body">
                            <p><b>{{ $training->name }}</b></p>
                            <p><span>{{ $training->company }} | {{ $training->place }}</span></p>
                            <p><b>Año:</b> <span>{{ $training->year }} | Duración:</b> <span>{{ $training->time }}</span></p>
                            <div class="separator-mini"></div>
                        </td>
                    </tr>
                    @endforeach
                </tbody>
            </table>
        @endif
        @if ($references->count() > 0)
            <div class="separator"></div>
            <table cellpadding="0" cellspacing="0" width="100%" class="table-cv data-references">
                <thead>
                    <tr>
                        <th class="th-header">
                            <hr class="hr-cv">
                            <h3 class="text-center">Referencias</h3>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    @foreach ($references as $reference)
                    <tr>
                        <td class="td-body">
                            <h3 style="padding-bottom: 0; margin-bottom:0;"><span>{{ $reference->name }}</span></h3>
                            <p><b>Empresa:</b> <span>{{ $reference->company }}</span></p>
                            <p><b>Puesto:</b> <span>{{ $reference->title_position }}</span></p>
                            <p><b>Teléfono:</b> <span>{{ $reference->phone }}</span></p>
                            <div class="separator-mini"></div>
                        </td>
                    </tr>
                    @endforeach
                </tbody>
            </table>
        @endif
    </section>
</body>
</html>
