<script src="<?= VIS_PATH_SCRIPT; ?>file-input/bootstrap-filestyle.min.js"></script>
<? global $vis_language; ?>
<div class="wrapper-lg">
<section class="panel panel-default">
	<input type="hidden" name="vis_task_owner" value="<?echo $newly_added_task_details['staff_id'];?>" />
   <textarea id="vis_task_comment" name="vis_task_comment" class="form-control no-border" rows="2" placeholder="<? echo $vis_language['TXTPOSTYOURCOMMENTHERE']; ?>"></textarea>
   <footer class="panel-footer bg-light lt">
      <button type="button" class="btn vh-info-bg pull-right btn-sm" onclick="$('#vis_workpanel_div').visExecution('submit_form',{'vis_module':'home', 'vis_operation':'add_task_comment', 'vis_form':'vis_task_update_form' ,vis_task_comment_post:1})" ><? echo $vis_language['TXTPOST'];?></button>
      <ul class="nav nav-pills nav-sm">
         <input type="file" name="files[]" multiple="multiple" class="filestyle" data-icon="false" data-classButton="btn btn-link link" data-buttonText="<? echo $vis_language['TXTATTACHFILE']; ?>" data-input="false" onchange="$(this).visExecution('upload_file', {'vis_static_area':'#vis_task_attachments', 'vis_form':'vis_task_update_form', 'vis_form_attachment_area':'#vis_tasks_attachments'});" style="display:none">
         <input type="hidden" name="vis_location" value="<? echo VIS_DOMAIN; ?>" />
         <input type="hidden" name="vis_tasks_attachments" id="vis_tasks_attachments" value="" />
         <input type="hidden" id="vis_attachment_count" name="vis_attachment_count" value="0">
         <input type="hidden" name="vis_parent_type" value="4" />
      </ul>
      <div id="attachedMedia">
         <div class="form-group input-sm">
            <div class="col-sm-11">
               <div id="vis_task_attachments">
               </div>
            </div>
         </div>
      </div>
   </footer>
</section>
<section class="chat-list">
   <? if($get_task_comment!=-1) for($i=0 ; $i<count($get_task_comment); $i++){?>
   <article class="chat-item chat-item-comment left">
	   <?  if($newly_added_task_details['staff_id']==VIS_STAFF_ID || $get_task_comment[$i]['owner']==VIS_STAFF_ID){?>
	  <button type="button" title="Delete" class="close pull-right" data-toggle="ajaxModal" data-modal-arguments="vis_module=home&vis_operation=confirm_delete_task_comment&vis_comment_id=<? echo $get_task_comment[$i]['comment_id']; ?>&vis_task_id=<?= $get_task_comment[$i]['task_id'];?>&vis_static_area=vis_task_update_form"><i class="vh vh-cross text-sm"></i></button><? } else { ?>
		  <a class="close pull-right" id="vis_delete" href="javascript:void(0);" onclick ="delete_comment()" title="<? echo $vis_language['TXTDELETE']; ?>"><i class="vh vh-cross text-sm"></i></a><? } ?>
    <? if($get_task_comment[$i]['image_name']=='' || $get_task_comment[$i]['image_name']=='default.jpg'){ ?>
    <div class="l-avatar pull-left m-t-lg">
    <? if($get_task_comment[$i]['first_name']!=''){
					$firstname=preg_split('//u', $get_task_comment[$i]['first_name'], -1, PREG_SPLIT_NO_EMPTY);
$lastname=preg_split('//u', $get_task_comment[$i]['last_name'], -1, PREG_SPLIT_NO_EMPTY);
					?>
    <div class="sm"><? echo ucfirst($firstname[0]).ucfirst($lastname[0]);?></div>
    <? }else{ ?>
    <img class="sm" src="<?= VIS_PATH_PROFILE.'default.jpg';?>">
    <? }?>
				
		    </div>
      <? }else{?>
			<div class="l-avatar pull-left m-t-lg">
				<img src="<? echo VIS_PATH_PROFILE; echo $get_task_comment[$i]['image_name']; ?>" class="sm">
		    </div>
      <? }?>
      
      <!--<a href="#" class="pull-left m-t-lg thumb-sm avatar"><img src="<? //echo VIS_PATH_PROFILE; echo ($get_task_comment[$i]['image_name']=='')?'default.jpg':$get_task_comment[$i]['image_name']; ?>"></a>-->
      <span class="font-bold text-default m-l"><?= $get_task_comment[$i]['first_name'].' '.$get_task_comment[$i]['last_name'];?></span>
      <small class="text-muted m-l-sm"><?= format_datetime($get_task_comment[$i]['entry_date']);?></small>
      <section class="chat-body m-t-xs">
         <div class="panel bg-light dk text-sm m-b-none">
            <div class="panel-body">
               <span class="arrow left"></span>
               <p class="m-b-none"><?= $get_task_comment[$i]['content'];?></p>
               <? if($get_task_comment[$i]['attachment'] != -1){ ?>
               <?	for($j=0; $j<count($get_task_comment[$i]['attachment']); $j++){ ?>
               <div class="btn-group wrapper-xxs p-l-none">
                  <a href="?vis_module=export&vis_operation=get_attachment&vis_attachment=<?= $get_task_comment[$i]['attachment'][$j]['attachment_id'].'&'.VIS_STAFF_COOKIE.'='.$_COOKIE[VIS_STAFF_COOKIE]; ?>" ><span class="label label-default no-border"><? echo $get_task_comment[$i]['attachment'][$j]['file_name']; ?></span></a>
               </div>
               <? } }?>
            </div>
         </div>
      </section>
   </article>
   <? } ?>
</section>
<script>
	$(document).ready(function(){
   	$('#attachedMedia').hide(); });
 function delete_comment()
 {
	 $("#vis_global_msg_div").show();
	 document.getElementById("vis_global_msg_div").innerHTML = '<? echo $vis_language['MSGACCSSDND'];?>';
 }
</script>
