<?PHP if($capsulecrm_info['parties']['@size']!=0 && $operation['type']=='profile'){ 	?>
		<div class="popover-content">
		   <div class="col-sm-12 line b-b line-lg pull-in"></div>
		   <br>
		   <div class="row m-b-sm">
			  <div class="col-sm-6">
				 <label class="font-bold m-r-sm"><?php echo $vis_language['TXTFIRSTNAME'];?></label>:
				 <label class="m-l-sm">
					<?php echo $capsulecrm_info['parties']['person']['firstName']; ?></span>
			  </div>
			 <div class="col-sm-6"><label class="font-bold m-r-sm"><?php echo $vis_language['TXTLASTNAME'];?></label>:<label class="m-l-sm"><?php echo $capsulecrm_info['parties']['person']['lastName']; ?></span></div>
		   </div>
		   <div class="row m-b-sm">
			   <div class="col-sm-6"><label class="font-bold m-r-sm"><?php echo $vis_language['TXTEMAIL'];?></label>:<label class="m-l-sm"><?php echo $capsulecrm_info['parties']['person']['contacts']['email']['emailAddress']; ?></span></div>
		   </div>
		</div>
	<? 
	}elseif($capsulecrm_info['kases']['@size']!=0 && $operation['type']=='cases'){ 
	if(isset($capsulecrm_info['kases']['kase'][0])){
	for($i=0;$i<count($capsulecrm_info['kases']['kase']);$i++) {
		?>
		<section id="vis_ticket_post_forms">
			<section id="vis_ticket_post_2">
				<section id="vis_ticket_post_area_2" class="panel panel-default pos-rlt clearfix m-b-md">
					<div class="panel-heading b-b b-light padder-v">
						<div class="btn-group pull-right">
							<div class="pull-left m-r-sm m-t-xs">
								<label>Created on</label>
								<span class="text-muted m-l-xs"><?php echo format_datetime(strtotime($capsulecrm_info['kases']['kase'][$i]['createdOn'])); ?> </span>
							</div>
							<div class="clear"></div>
						</div>
						<div>
							<a href="javascript:void(0);" class="link m-l-xs" title=""><?php echo $capsulecrm_info['kases']['kase'][$i]['name']; ?> </a>
						</div>			
						<div class="m-r-sm m-b-xs">
							<span class="text-muted m-l-xs"><? echo '('.$capsulecrm_info['kases']['kase'][$i]['owner'].')';?></span>
						</div>	
						<div class="clear"></div>
					</div>
					<div class="panel-body wrapper">			
						<div id="vis_ticket_post_content_div_2">
							<div id="vis_ticket_post_content_text_2" class="vis_max_img_size"><?php echo $capsulecrm_info['kases']['kase'][$i]['description']; ?></div>
							<div id="vis_ticket_post_content_edit_2"></div>
						</div>        
					</div>
				</section>
			</section>
		</section>
	<?  } }else{
		foreach($capsulecrm_info as $capsulecrm_info) { ?>
		<section id="vis_ticket_post_forms">
			<section id="vis_ticket_post_2">
				<section id="vis_ticket_post_area_2" class="panel panel-default pos-rlt clearfix m-b-md">
					<div class="panel-heading b-b b-light padder-v">
						<div class="btn-group pull-right">
							<div class="pull-left m-r-sm m-t-xs">
								<label>Created on</label>
								<span class="text-muted m-l-xs"><?php echo format_datetime(strtotime($capsulecrm_info['kase']['createdOn'])); ?> </span>
							</div>
							<div class="clear"></div>
						</div>
						<div>
							<a href="javascript:void(0);" class="link m-l-xs" title=""><?php echo $capsulecrm_info['kase']['name']; ?> </a>
						</div>			
						<div class="m-r-sm m-b-xs">
							<span class="text-muted m-l-xs"><? echo '('.$capsulecrm_info['kase']['owner'].')';?></span>
						</div>	
						<div class="clear"></div>
					</div>
					<div class="panel-body wrapper">			
						<div id="vis_ticket_post_content_div_2">
							<div id="vis_ticket_post_content_text_2" class="vis_max_img_size"><?php echo $capsulecrm_info['kase']['description']; ?></div>
							<div id="vis_ticket_post_content_edit_2"></div>
						</div>        
					</div>
				</section>
			</section>
		</section>
	<?  }
	}
	}else if($capsulecrm_info['tasks']['@size']!=0 && $operation['type']=='tasks'){ ?>
						<div class="form-group">
                            <label class="col-sm-2 control-label"><? echo $vis_language['TXTSTASUS']; ?> </label>
                            <div class="col-sm-8">
                              <select name="vis_department" id="vis_department" class="form-control input-sm" onchange="onchange_status(this.value)">
								<option <?php if($operation['status']=='OPEN') echo 'selected="selected"';?>  value="OPEN" >OPEN</option>
								<option <?php if($operation['status']=='COMPLETED') echo 'selected="selected"';?> value="COMPLETED">COMPLETED</option>
							 </select>
                            </div>                            
                        </div>
	<a href="#vis_details_list" class="pull-right link m-b" onclick="$('#vis_details_list').visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'get_capsulecrm_cases_details','vis_domain':'<?php echo $operation['vis_domain']; ?>', 'type':'addtask'});"><?php echo $vis_language['TXTADD']; ?></a><br> <br> 
		<?php for($i=0;$i<count($capsulecrm_info['tasks']['task']);$i++) {?>
						 
		<section id="vis_ticket_post_forms">
			<section id="vis_ticket_post_2">
				<section id="vis_ticket_post_area_2" class="panel panel-default pos-rlt clearfix m-b-md">
					<div class="panel-heading b-b b-light padder-v">
						<div class="btn-group pull-right">
							<div class="pull-left m-r-sm m-t-xs">
								<label>Created on</label>
								<span class="text-muted m-l-xs"><?php echo format_datetime(strtotime($capsulecrm_info['tasks']['task'][$i]['createdOn'])); ?> </span>
							</div>
							<div class="clear"></div>
						</div>
						<div>
							<a href="javascript:void(0);" class="link m-l-xs" title=""><?php echo $capsulecrm_info['tasks']['task'][$i]['category']; ?> </a>
						</div>			
						<div class="m-r-sm m-b-xs">
							<span class="text-muted m-l-xs"><? echo '('.$capsulecrm_info['tasks']['task'][$i]['owner'].')';?></span>
						</div>	
						<div class="clear"></div>
					</div>
					<div class="panel-body wrapper">			
						<div id="vis_ticket_post_content_div_2">
							<div id="vis_ticket_post_content_text_2" class="vis_max_img_size"><?php echo $capsulecrm_info['tasks']['task'][$i]['description']; ?></div>
							<div id="vis_ticket_post_content_edit_2"></div>
						</div>        
					</div>
				</section>
			</section>
		</section>
		<script  type="application/javascript">
		function onchange_status(status){
				$('#vis_details_list').visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'get_capsulecrm_cases_details','vis_domain':'<?php echo $operation['vis_domain']; ?>','status':status, 'type':'tasks'});
		}
		</script>
  <?php }
	}else if($operation['type']=='addtask'){ ?>
		<section id="vis_ticket_post_forms">
			<section id="vis_ticket_post_2">
			<div style="color:red;" class="text-center" id="capsulecrm_error"></div>
	<form method="post" role="form" class="form-horizontal" name="vis_capsule_form" id="vis_capsule_form">
         <div class="form-group">
              <label class="col-sm-2 control-label"><? echo $vis_language['TXTDESCRIPTION']; ?></label>
              <div class="col-sm-10">
                  <input type="text" class="form-control input-sm" name="description" id="description" value="" />
              </div>
         </div>
		 <div class="form-group">
			<label class="col-sm-2 control-label m-t-xs"><?= $vis_language['TXTDUEDATE'];?></label>
			<div class="col-sm-10">
			 <span class="input-group-addon no-padder no-borders date">
				<input id="due_date" name="due_date" class="form-control input-sm" type="text" value="<?= $vis_expiry_date;?>">
			</span>
			</div>
		</div>
         <div class="line b-b line-lg pull-in"></div><br />
         <div class="form-group">
           <div class="col-sm-12 text-right">
			<a class="btn btn-default" data-dismiss="modal"><? echo $vis_language['TXTCANCEL']; ?></a>
            <a class="btn btn-primary" onclick="add_capsulecrm_task();"><? echo $vis_language['TXTCREATE']; ?></a>
            </div>
         </div>        
</form>
			</section>
		</section>
		<script  type="application/javascript">
		function add_capsulecrm_task(){
			if($('#description').val()==''){
				$('#capsulecrm_error').html('<?php echo $vis_language['MSGINFOMISS'];?>');
			}else{
				$('#vis_details_list').visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'get_capsulecrm_cases_details','vis_domain':'<?php echo $operation['vis_domain']; ?>','description':$('#description').val(),'due_date':$('#due_date').val(), 'type':'addtasks'});
			}
		}
		var d = new Date();
		var curr_time = d.getHours()+":"+d.getMinutes();
		var curr_date= '<? echo date("M-d, Y")?> '+curr_time+'';
		$('.date').datetimepicker({ format: "MMM-D, YYYY HH:mm",defaultDate: curr_date});
		</script>
  <?php  
	}else{?>
		<a href="#vis_details_list" class="pull-right link m-b" onclick="$('#vis_details_list').visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'get_capsulecrm_cases_details','vis_domain':'<?php echo $operation['vis_domain']; ?>', 'type':'addtask'});"><?php echo $vis_language['TXTADD']; ?></a><br> <br> 
	<?php	include(VIS_PATH_TEMPLATE.'no_record_yet.php');
	}