@extends('layouts.app-hr')
<?php Fun::lang()?>
@section('content')
    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-offset-1 col-sm-10">
                <div class="col-sm-9">
                    <fieldset style="line-height: 30px">
                        <legend>{{__('administrator.info_detail')}}</legend>
                        <div class="col-sm-4">{{__('administrator.code')}}</div>
                        <div class="col-sm-8">: {{$emp->code}}</div>

                        <div class="col-sm-4">{{__('administrator.name')}}</div>
                        <div class="col-sm-8">: {{$emp->name}}</div>

                        <div class="col-sm-4">{{__('administrator.nationality')}}</div>
                        <div class="col-sm-8">: {{$emp->nationality}}</div>

                        <div class="col-sm-4">{{__('administrator.dob')}}</div>
                        <div class="col-sm-8">: {{date('d-m-Y',strtotime($emp->date_of_birth))}}</div>

                        <div class="col-sm-4">{{__('administrator.gender')}}</div>
                        <div class="col-sm-8">: {{__('administrator.'.$emp->gender)}}</div>

                        <div class="col-sm-4">{{__('administrator.marital_status')}}</div>
                        <div class="col-sm-8">: {{__('administrator.'.$emp->marital_status)}}</div>

                        <div class="col-sm-4">{{__('administrator.id_card')}}</div>
                        <div class="col-sm-8">: {{$emp->id_card}}</div>

                        <div class="col-sm-4">{{__('administrator.employment_status')}}</div>
                        <div class="col-sm-8">: {{optional($emp->employment)->name}}</div>

                        <div class="col-sm-4">{{__('administrator.job')}}</div>
                        <div class="col-sm-8">: {{optional($emp->job)->job_title}}</div>

                        <div class="col-sm-4">{{__('administrator.contact')}}</div>
                        <div class="col-sm-8">: {{$emp->phone}}</div>

                        <div class="col-sm-4">{{__('administrator.email')}}</div>
                        <div class="col-sm-8">: {{$emp->email}}</div>

                        <div class="col-sm-4">{{__('administrator.joined_date')}}</div>
                        <div class="col-sm-8">: {{date('d-m-Y',strtotime($emp->joined_date))}}</div>

                        <div class="col-sm-4">{{__('administrator.pob')}}</div>
                        <div class="col-sm-8">: {{$emp->place_of_birth}} </div>

                        <div class="col-sm-4">{{__('administrator.address')}}</div>
                        <div class="col-sm-8">: {{$emp->address}} </div>

                        <div class="col-sm-4"> {{__('administrator.note')}}</div>
                        <div class="col-sm-8">: {{$emp->note}} </div>
                    </fieldset>
                    <div class="br"><br>&nbsp;</div>
                    <fieldset>
                        <legend>{{__('administrator.educate')}}</legend>
                        <div class="col-sm-12">
                            @php
                                $education = $emp->educate;
                            @endphp
                            @if(is_object($education) || is_array($education))
                                @if(count($education)>0)
                                    <div style="width: 100%; height: auto; float: left;">
                                        <table class="table table-bordered" style="width: 100%;border-collapse: collapse;"
                                               border="1">
                                            <thead>
                                            <tr>
                                                <th>{{__('administrator.no.')}}</th>
                                                <th>{{__('administrator.certificate')}}</th>
                                                <th>{{__('administrator.major')}}</th>
                                                <th>{{__('administrator.from_date')}}</th>
                                                <th>{{__('administrator.to_date')}}</th>
                                                <th>{{__('administrator.description')}}</th>
                                                <th>{{__('administrator.foreign')}}</th>
                                                <th>{{__('administrator.hobbies')}}</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            @php $if = 0; @endphp
                                            @if(count($education)>0)
                                                @foreach ($education as $p)
                                                    @php

                                                        $if++;
                                                            $certificate = isset($p['certificate'])?$p['certificate']:'';
                                                            $major = isset($p['major'])?$p['major']:'';
                                                            $from_date = isset($p['from_date'])?$p['from_date']:'';
                                                            $to_date = isset($p['to_date'])?$p['to_date']:'';
                                                            $description = isset($p['description'])?$p['description']:'';
                                                            $foreign_language_ability = isset($p['foreign_language_ability'])?$p['foreign_language_ability']:'';
                                                            $hobbies = isset($p['hobbies'])?$p['hobbies']:'';
                                                    @endphp
                                                    <tr>
                                                        <td>{{$if}}</td>
                                                        <td>{{$certificate}}</td>
                                                        <td>{{$major}}</td>
                                                        <td>{{$from_date}}</td>
                                                        <td>{{$to_date}}</td>
                                                        <td>{{$description}}</td>
                                                        <td>{{$foreign_language_ability}}</td>
                                                        <td>{{$hobbies}}</td>
                                                    </tr>
                                                @endforeach
                                            @endif
                                            </tbody>
                                        </table>
                                    </div>
                                @endif
                            @endif
                        </div>
                    </fieldset>
                    <div class="br"><br>&nbsp;</div>
                    <fieldset>
                        <legend>{{__('administrator.language')}}</legend>
                        <div class="col-sm-12">
                            @php
                                $language = $emp->language;
                            @endphp
                            @if(is_array($language) || is_object($language))
                                @if(count($language)>0)
                                    <div style="width: 100%; height: auto; float: left;">
                                        <table class="table table-bordered" style="width: 100%;border-collapse: collapse;" border="1">
                                            <thead>
                                            <tr>
                                                <th>{{__('administrator.no.')}}</th>
                                                <th>{{__('administrator.language')}}</th>
                                                <th>{{__('administrator.level')}}</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            @php $if = 0; @endphp
                                            @if(count($language)>0)
                                                @foreach ($language as $p)
                                                    @php
                                                        $if++;
                                                            $lang = isset($p['name'])?$p['name']:'';
                                                            $level =isset($p['type'])? $p['type']:'';
                                                    @endphp
                                                    <tr>
                                                        <td>{{$if}}</td>
                                                        <td>{{$lang}}</td>
                                                        <td>{{$level}}</td>
                                                    </tr>
                                                @endforeach
                                            @endif
                                            </tbody>
                                        </table>
                                    </div>
                                @endif
                            @endif
                        </div>
                    </fieldset>
                    <div class="br"><br>&nbsp;</div>
                    <fieldset>
                        <legend>{{__('administrator.work_experience')}}</legend>
                        <div class="col-sm-12">
                            @php
                                $work_experience = $emp->work_experience;
                            @endphp
                            @if(is_array($work_experience) || is_object($work_experience))
                                @if(count($work_experience)>0)
                                    <div style="width: 100%; height: auto; float: left;">
                                        <table class="table table-bordered" style="width: 100%;border-collapse: collapse;" border="1">
                                            <thead>
                                            <tr>
                                                <th>{{__('administrator.no.')}}</th>
                                                <th>{{__('administrator.company_name')}}</th>
                                                <th>{{__('administrator.position')}}</th>
                                                <th>{{__('administrator.location')}}</th>
                                                <th>{{__('administrator.join_date_work')}}</th>
                                                <th>{{__('administrator.end_date_work')}}</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            @php $if = 0; @endphp
                                            @if(count($work_experience)>0)
                                                @foreach ($work_experience as $p)
                                                    @php
                                                        $if++;
                                                            $company_name = isset($p['company_name'])?$p['company_name']:'';
                                                            $position = isset($p['position'])? $p['position']:'';
                                                            $location = isset($p['location'])? $p['location']:'';
                                                            $join_date_w = isset($p['join_date_w'])? $p['join_date_w']:'';
                                                            $end_date_w = isset($p['end_date_w'])? $p['end_date_w']:'';
                                                    @endphp
                                                    <tr>
                                                        <td>{{$if}}</td>
                                                        <td>{{$company_name}}</td>
                                                        <td>{{$position}}</td>
                                                        <td>{{$location}}</td>
                                                        <td>{{$join_date_w}}</td>
                                                        <td>{{$end_date_w}}</td>
                                                    </tr>
                                                @endforeach
                                            @endif
                                            </tbody>
                                        </table>
                                    </div>
                                @endif
                            @endif
                        </div>
                    </fieldset>

                    <div class="br"><br>&nbsp;</div>
                    <fieldset>
                        <legend>{{__('administrator.emergency_contact')}}</legend>
                        <div class="col-sm-12">
                            @php
                                $emergency = $emp->emergency_contact;
                            @endphp
                            @if(is_array($emergency) || is_object($emergency))
                                @if(count($emergency)>0)
                                    <div style="width: 100%; height: auto; float: left;">
                                        <table class="table table-bordered" style="width: 100%;border-collapse: collapse;" border="1">
                                            <thead>
                                            <tr>
                                                <th>{{__('administrator.no.')}}</th>
                                                <th>{{__('administrator.name')}}</th>
                                                <th>{{__('administrator.description')}}</th>
                                                <th>{{__('administrator.relationship')}}</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            @php $if = 0; @endphp
                                            @if(count($emergency)>0)
                                                @foreach ($emergency as $p)
                                                    @php
                                                        $if++;
                                                            $name = isset($p['name'])?$p['name']:'';
                                                            $desc = isset($p['desc'])? $p['desc']:'';
                                                            $relationship = isset($p['relationship'])? $p['relationship']:'';
                                                    @endphp
                                                    <tr>
                                                        <td>{{$if}}</td>
                                                        <td>{{$name}}</td>
                                                        <td>{{$desc}}</td>
                                                        <td>{{$relationship}}</td>
                                                    </tr>
                                                @endforeach
                                            @endif
                                            </tbody>
                                        </table>
                                    </div>
                                @endif
                            @endif
                        </div>
                    </fieldset>
                    <div class="br"><br>&nbsp;</div>
                    <fieldset>
                        <legend>{{__('administrator.family(only)')}}</legend>
                        <div class="col-sm-12">
                            @php
                                $family_full = $emp->family_full;
                            @endphp
                            @if(is_array($family_full) || is_object($family_full))
                                @if(count($family_full)>0)
                                    <div style="width: 100%; height: auto; float: left;">
                                        <table class="table table-bordered" style="width: 100%;border-collapse: collapse;" border="1">
                                            <thead>
                                            <tr>
                                                <th>{{__('administrator.no.')}}</th>
                                                <th>{{__('administrator.relation')}}</th>
                                                <th>{{__('administrator.name')}}</th>
                                                <th>{{__('administrator.sex')}}</th>
                                                <th>{{__('administrator.dob')}}</th>
                                                <th>{{__('administrator.job')}}</th>
                                                <th>{{__('administrator.type')}}</th>
                                                <th>{{__('administrator.alive')}}</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            @php $if = 0; @endphp
                                            @if(count($family_full)>0)
                                                @foreach ($family_full as $p)
                                                    @php
                                                        $if++;
                                                            $relation = isset($p['relation'])?$p['relation']:'';
                                                            $name =isset( $p['name'])? $p['name']:'';
                                                            $sex = isset($p['sex'])?$p['sex']:'';
                                                            $dob = isset($p['dob'])?$p['dob']:'';
                                                            $job = isset($p['job'])?$p['job']:'';
                                                            $type =isset( $p['type'])? $p['type']:'';
                                                            $alive = isset($p['alive'])?$p['alive']:'';
                                                    @endphp
                                                    <tr>
                                                        <td>{{$if}}</td>
                                                        <td>{{$relation}}</td>
                                                        <td>{{$name}}</td>
                                                        <td>{{$sex}}</td>
                                                        <td>{{$dob}}</td>
                                                        <td>{{$job}}</td>
                                                        <td>{{$type}}</td>
                                                        <td>{{$alive}}</td>
                                                    </tr>
                                                @endforeach
                                            @endif
                                            </tbody>
                                        </table>
                                    </div>
                                @endif
                            @endif
                        </div>
                    </fieldset>
                    <fieldset>
                        <legend>{{__('administrator.family')}}</legend>
                        <div class="col-sm-12">
                            @php
                                $family = $emp->family;
                            @endphp
                            @if(is_array($family) || is_object($family))
                                @if(count($family)>0)
                                    <div style="width: 100%; height: auto; float: left;">
                                        <table class="table table-bordered" style="width: 100%;border-collapse: collapse;" border="1">
                                            <thead>
                                            <tr>
                                                <th>{{__('administrator.no.')}}</th>
                                                <th>{{__('administrator.relation')}}</th>
                                                <th>{{__('administrator.name')}}</th>
                                                <th>{{__('administrator.sex')}}</th>
                                                <th>{{__('administrator.dob')}}</th>
                                                <th>{{__('administrator.job')}}</th>
                                                <th>{{__('administrator.type')}}</th>
                                                <th>{{__('administrator.alive')}}</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            @php $if = 0; @endphp
                                            @if(count($family)>0)
                                                @foreach ($family as $p)
                                                    @php
                                                        $if++;
                                                            $relation = isset($p['relation'])?$p['relation']:'';
                                                            $name =isset( $p['name'])? $p['name']:'';
                                                            $sex = isset($p['sex'])?$p['sex']:'';
                                                            $dob = isset($p['dob'])?$p['dob']:'';
                                                            $job = isset($p['job'])?$p['job']:'';
                                                            $type =isset( $p['type'])? $p['type']:'';
                                                            $alive = isset($p['alive'])?$p['alive']:'';
                                                    @endphp
                                                    <tr>
                                                        <td>{{$if}}</td>
                                                        <td>{{$relation}}</td>
                                                        <td>{{$name}}</td>
                                                        <td>{{$sex}}</td>
                                                        <td>{{$dob}}</td>
                                                        <td>{{$job}}</td>
                                                        <td>{{$type}}</td>
                                                        <td>{{$alive}}</td>
                                                    </tr>
                                                @endforeach
                                            @endif
                                            </tbody>
                                        </table>
                                    </div>
                                @endif
                            @endif
                        </div>
                    </fieldset>
                    <div class="br"><br>&nbsp;</div>
                    @if(!$file->isEmpty())
                        <fieldset>
                            <legend>{{__('administrator.document')}}</legend>
                            @foreach($file as $key => $re)
                                <div class="col-sm-4">{{$re->name}}</div>
                                <div class="col-sm-8">: {{$re->file}}
                                    <a href="/assets/attachment_file/{{$re->file}}" target="_blank">
                                        <span class="fa fa-download"></span>
                                    </a>
                                </div>
                                <div class="col-sm-4">{{__('administrator.description')}}</div>
                                <div class="col-sm-8">: {{$re->note}}</div>
                                <div class="hr">
                                    <br>&nbsp;
                                </div>
                            @endforeach
                        </fieldset>
                    @endif
                </div>
                <div class="col-sm-3">
                    <img src="{{$emp->avartar?asset('images/upload/'.$emp->avartar):asset('images/upload/profile.png')}}"
                         alt="" width="100%">
                </div>
            </div>
        </div>
    </div>
@endsection
