<?php
$IMG = $this -> Profile_Default;
if ($this -> Profile["Avatar"] != "" || !empty($this -> Profile["Avatar"])) {
    $IMG = $this -> Profile["Avatar"];
}

$gender = 'fa-female';
if ($this -> Profile["Sex"] == "Male") {
    $gender = 'fa-male';
}

	function age($birthday)
	{
		if(!empty($birthday)){
			
		
	     list($year,$month,$day) = explode("-",$birthday);
	     $year_diff  = date("Y") - $year;
	     $month_diff = date("m") - $month;
	     $day_diff   = date("d") - $day;
	     if ($day_diff < 0 && $month_diff==0){$year_diff--;}
	     if ($day_diff < 0 && $month_diff < 0){$year_diff--;}
	     return $year_diff. ' ' . 'years old';
		}else{
			return "";
		}
	}
?>
<div class="panel panel-default">
   <div class="panel-body">
      <h3><span class="fa fa-user"></span> <?=$this->Profile["LastName"]?>, <?=$this->Profile["FirstName"]?></h3>
      <h3><span class="fa <?=$gender?> pull-right gender-icon"></span></h3>
      <p><?=$this->Profile["Job"]?></p>
      <div id="user_image" class="text-center">
         <img class="img-thumbnail" src=<?=$IMG?>>
      </div>
      
   </div>
   <div class="panel-body list-group <!--list-group-contacts-->">
   	
      <div  class="list-group-item site-border-top">                                 
         <a href="#" data-toggle="modal" data-target="#modal_edit"><span  class="btn btn-default pull-right">Edit</span></a>
         <a href="/union/members/profile/id/<?=$this->Profile["UserID"] ?>"><span  class="btn btn-default ">Profile</span></a>
      </div>
      <div class="list-group-item site-border-top">
         <div class="fa fa-users"></div>
         <span class="">Current Squad</span>
      </div>
      <div class="list-group-item site-border-top">
         <div class="fa fa-sitemap"></div>
         <span class=""><?=$this->Profile["city"]?></span>
      </div>
      <div class="list-group-item site-border-top">
         <div class="fa fa-user"></div>
         <span class=""><?=$this->Profile["Ethnicity"]?>, <?=$this->Profile["Sex"]?>, <?=age($this->Profile["DateOfBirth"] )?></span>
      </div>
      <div class="list-group-item site-border-top">
          <?php 
          
          if($this->Profile["JobType"]==2){
              
              ?>
         <div class="fa fa-map-marker"></div>
         <span class=""><?=$this->Profile["POS"]?></span>
          <?php } ?>
      </div>
   </div>
</div>

