<? global $vis_language; ?>
  <ul class="list-unstyled padder m-b-none" id="vis_task_list">
   <? $status=array(1 => $vis_language['TXTINPROGRESS'],2 => $vis_language['TXTOVERDUE'],3 => $vis_language['TXTCOMPLETED'],4 => $vis_language['TXTCANCELED'],5 =>$vis_language['TXTNOTSTARTED']);
   $priority=array(1 => $vis_language['TXTLOW'],2 => $vis_language['TXTMEDIUM'],3 => $vis_language['TXTHIGH']); 
for($i=0; $i<$task_info['task_count']; $i++){ $flag=0; ?>
<li class="m-b-xs">
  <div class="r bg-white b-l b-4x b-light wrapper">                         
	<div class="row">
	  <div class="m-r m-t-xs pull-right"> 
		  <span class="text-muted m-l-xs m-r-lg" data-toggle="tooltip" data-placement="top" title="Target_date"><? echo format_datetime($task_details[$i]['enddate']); ?></span>
		 <?  
		   if($task_details[$i]['enddate_diff']<=0){ if($task_details[$i]['task_status']!=3 && $task_details[$i]['task_status']!=4){?>
				 <label id="vis_task_status" class="btn-xs wrapper-xxs vh-danger-bg" ><? echo $vis_language['TXTOVERDUE']; ?></label>
				<?} else 
				{ if($task_details[$i]['task_status']==1) {?>
				<label id="vis_task_status" class="btn-xs wrapper-xxs vh-success-bg"><? echo $status[$task_details[$i]['task_status']]; ?></label>
				 <?}else if($task_details[$i]['task_status']==3){?>
				  <label id="vis_task_status" class="btn-xs wrapper-xxs vh-info-bg"><? echo $status[$task_details[$i]['task_status']]; ?></label>
				  <?}else if($task_details[$i]['task_status']==4){ ?>
				  <label id="vis_task_status" class="btn-xs wrapper-xxs vh-grey-bg"><? echo $status[$task_details[$i]['task_status']]; ?></label><? }} ?>
				<?}else { if($task_details[$i]['task_status']==1) {?>
				<label id="vis_task_status" class="btn-xs wrapper-xxs vh-success-bg"><? echo $status[$task_details[$i]['task_status']]; ?></label>
				 <?}else if($task_details[$i]['task_status']==3){?>
				  <label id="vis_task_status" class="btn-xs wrapper-xxs vh-info-bg"><? echo $status[$task_details[$i]['task_status']]; ?></label>
				  <?}else if($task_details[$i]['task_status']==4){ ?>
				  <label id="vis_task_status" class="btn-xs wrapper-xxs vh-grey-bg"><? echo $status[$task_details[$i]['task_status']]; ?></label>
				  <?}else if($task_details[$i]['task_status']==5){ ?>
				  <label id="vis_task_status" class="btn-xs wrapper-xs label label-default"><? echo $status[$task_details[$i]['task_status']]; ?></label><? }} ?>
		<label class="btn-xs wrapper-xxs vh-warning-bg" data-toggle="tooltip" data-placement="top" title="comments"><?= $task_details[$i]['comment_count'];?></label>	
		
			  <? if($task_details[$i]['parent_id']==0 && ($task_details[$i]['task_repeat_schedule']==0 || $task_details[$i]['task_repeat_schedule']==NULL)){ ?>
		  <label class="vh vh-folder-add vh-lg wrapper-sm vis-pointer" data-toggle="ajaxModal" data-modal-arguments="vis_module=home&vis_operation=add_subtask&vis_static_area=vis_subtask_area&vis_task_id=<? echo $task_details[$i]['task_id']; ?>" data-placement="top" title="Create subtask"></label><? } else {?>
		  <label class="vh vh-folder-add vh-lg wrapper-sm text-muted vis-not-allowed" disabled="disabled"></label><? } ?>
	  </div>
		<div class="pull-left">
			<div class="btn-group m-l-xs m-r-n-sm">
			  <a href="javascript:void(0);" class="btn btn-xs btn-link">
				 <? if($task_details[$i]['priority']==3){?>
				<span  data-toggle="tooltip" data-placement="top" title="Priority: High">
					<i class="vh vh-arrow-up text-success"></i>
				 </span>
				 <?} else if($task_details[$i]['priority']==1){?>
					 <span  data-toggle="tooltip" data-placement="top" title="Priority: Low">
					<i class="vh vh-arrow-down text-success"></i>
				 </span><? } else {?>
					  <span  data-toggle="tooltip" data-placement="top" title="Priority: Medium">
					<i class="vh vh-arrow-right text-success"></i>
				 </span><? } ?>
			  </a>
			  <a href="javascript:void(0);" class="btn btn-xs btn-link" data-toggle="button">
				<? $owner_favourite = explode(',',$task_details[$i]['owner_favourite']); 
					if(($key = array_search(VIS_STAFF_ID, $owner_favourite)) !== false){?>
					<span data-toggle="tooltip" data-placement="top" title="Click to remove from your favourite" onclick="$(this).visExecution('load_area',{'vis_module':'home', 'vis_operation':'set_task_asfavourites','vis_task_id':'<? echo $task_details[$i]['task_id'];?>','vis_favourite':0,'vis_filter_id':'<? echo $operation['filter_id'];?>'});"><i class="vh vh-star vh-yellow"></i></span>
				<? } else {?>
					<span data-toggle="tooltip" data-placement="top" title="Click to mark as your favourite" onclick="$(this).visExecution('load_area',{'vis_module':'home', 'vis_operation':'set_task_asfavourites','vis_task_id':'<? echo $task_details[$i]['task_id'];?>','vis_favourite':1,'vis_filter_id':'<? echo $operation['filter_id'];?>'});"><i class="vh vh-star-empty"></i></span>
				<? } ?>
			  </a>
			</div>

			  <a href="javascript:void(0);" onmouseover="javascript:show_user_details(0,<?= $task_details[$i]['staff_id']?>,null,<?= $task_details[$i]['task_id']?>);" id="user<?= $task_details[$i]['task_id'];?>_<?= $task_details[$i]['staff_id'];?>"  onmouseout="hide_user_details(this);">
     
     <? if($task_details[$i]['image']=='' || $task_details[$i]['image']=='default.jpg'){?>
<div class="l-avatar m-l">
<? if($task_details[$i]['name']!=''){
	$namearr=explode(' ',$task_details[$i]['name']);
$fullname='';
if($task_details[$i]['first_name']!=''){ 
$lastname=preg_split('//u', $task_details[$i]['last_name'], -1, PREG_SPLIT_NO_EMPTY); 
$firstname=preg_split('//u', $task_details[$i]['first_name'], -1, PREG_SPLIT_NO_EMPTY);
$fullname=ucfirst($firstname[0]).ucfirst($lastname[0]);
}else{
	$firstname=preg_split('//u', $namearr[0], -1, PREG_SPLIT_NO_EMPTY);
	$fullname=ucfirst($firstname[0]);
}
	?>
   <div class="sm"><? echo $fullname; ?></div>
    <? }else{ ?>
    <img class="sm" src="<?= VIS_PATH_PROFILE.'default.jpg';?>">
    <? }?>

</div>
<? }else{ ?>
<div class="l-avatar m-l">
<img src="<? echo VIS_PATH_PROFILE; echo $task_details[$i]['image']; ?>" class="sm">
</div>
<? }?>

     <!--<div class="avatar thumb-sm m-l"><img src="<? //echo VIS_PATH_PROFILE; echo ($task_details[$i]['image']=='')?'default.jpg':$task_details[$i]['image']; ?>" alt=""></div>-->
     
     </a>
			 <? for($j=0; $j<$total_task_info['total']; $j++){
				 if($task_details[$i]['task_id']==$total_task_details[$j]['parent_id'] && $total_task_details[$j]['is_repeat']!=1) {
					 if($flag!=1){ $flag=1;?> 
				 <span class="badge bg-gradient  font-normal text-xs m-l-sm " id="vis_task_level">M</span>
				 <? } } }if($task_details[$i]['parent_id']>0 && $task_details[$i]['is_repeat']!=1){?>
					  <span class="badge bg-gradient  font-normal text-xs m-l-sm " id="vis_task_level">S</span>
				<? } if( $task_details[$i]['is_repeat']==1){?>
					  <span class="badge bg-gradient  font-normal text-xs m-l-sm " id="vis_task_level">R</span>
				<? } ?>
		</div>
		<div class="col-sm-3 m-t-xs">
			<a  href="javascript:void(0);" onclick="$('#vis_workpanel_div').visExecution('load_module','<?= rawurlencode(str_replace('/', ' ', $task_details[$i]['task_title'])).'/'.$task_details[$i]['task_id']?>',{'vis_module':'home', 'vis_operation':'view_update_tasks', 'vis_form':'vis_task_form'  ,'vis_filter_id':'<? echo $operation['filter_id'];?>','vis_task_id':'<? echo $task_details[$i]['task_id'];?>'})" class="text-ellipsis" ><?= $task_details[$i]['task_title']?></a>
		</div>
	</div>
  </div>
</li><? } ?>
</ul>
<input type="hidden" id="vis_task_filter_id" name="vis_task_filter_id" value="<?echo $operation['filter_id'];?>"/>
