<? global $vis_language, $request_data;
$tp=0;
if(!isset($module_setting1['vis_show_priority']) || $module_setting1['vis_show_priority']==1 || $module_setting1['vis_show_priority']==2){
	$module_setting1['vis_priority']='';
}
if(!isset($module_setting1['vis_show_location']) || $module_setting1['vis_show_location']==1 || $module_setting1['vis_show_location']==2){
	$module_setting1['vis_assets_location']='';
}
if(!isset($module_setting1['vis_show_tickettype']) || $module_setting1['vis_show_tickettype']==1 || $module_setting1['vis_show_tickettype']==2){
	$module_setting1['vis_tickettype']='';
}
if(isset($module_setting1['vis_show_level']) && ($module_setting1['vis_show_level']==1 || $module_setting1['vis_show_level']==2)){
	$tp++;
	$module_setting1['vis_level']='';
}
if(isset($module_setting1['vis_show_category']) && ($module_setting1['vis_show_category']==1 || $module_setting1['vis_show_category']==2)){
	$tp++;
	$module_setting1['vis_category']='';
	if(isset($module_setting1['vis_show_subcategory']) && ($module_setting1['vis_show_subcategory']==1 || $module_setting1['vis_show_subcategory']==2)){
		$tp++;
		$module_setting1['vis_subcategory']='';
		if(isset($module_setting1['vis_show_item']) && ($module_setting1['vis_show_item']==1 || $module_setting1['vis_show_item']==2)){
			$tp++;
			$module_setting1['vis_item']='';
		}
	}
}
if($itil_enabled==1)$tp++;
if($tp<5){$divorspan="span";$class_properties='class="col-sm-3"';
}else{
	$divorspan="div";$class_properties='class="col-sm-2"';
}
$show_pause=0;
$due_flag =($ticket_details['pause_dtime']!='')? $ticket_details['pause_dtime']:'';
$resolution_flag = ($ticket_details['pause_rtime']!='') ? $ticket_details['pause_rtime']:'';
?>
<section id="breadcrumb" class="row m-b m-l-none m-r-none">
    <div class="col-sm-5 col-xs-5">
        <h3 class="m-b-xs text-black">
			<? if($ticket_details['channel_id']<=23 && strstr($ticket_details['icon_path'], "vh vh-"))
				{
					echo '<i class="'.$ticket_details['icon_path'].' vh-lg"></i>';
				}
				else
				{
					if(file_exists(VIS_PATH_PROFILE.$ticket_details['icon_path']))
						echo '<img src="'.VIS_PATH_PROFILE.$ticket_details['icon_path'].'" class="thumb-xs">';
					else
						echo '<i class="vh vh-channel vh-lg"></i>';
				}
			?>
<span> <?php echo($ticket_details['ticket_hash']); ?></span>
		<span class="vh-yellow m-l-xs">
		<? for($cn=0;$cn<5;$cn++){ 
			echo '<i class="vh '.($cn<$ticket_details['rating']?'vh-star':'vh-star-empty').'"></i>';
		}?>
		</span>
        </h3>
        <ul class="breadcrumb bg-empty no-border m-b-xxs no-padder">
            <li><a class="link" href="#/home/quick_view/<?= $vis_language['TXTHOME'];?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<?= $vis_language['TXTHOME'];?>',{'vis_module':'home','vis_operation':'quick_view', 'vis_action':'#/home/quick_view/<?= $vis_language['TXTHOME'];?>'});"><?= $vis_language['TXTHOME'];?></a></li>
            <li><a class="link" href="#/ticket/filter_ticket/<?php echo ($ticket_details['is_deleted'] == 1)?$vis_language['TXTTRASH'].'/5':(($ticket_details['is_ticket_spam'] == 1)?$vis_language['TXTSPAM'].'/6':$vis_language['TXTINBOX'].'/1'); ?>"><?php echo ($ticket_details['is_deleted'] == 1)?$vis_language['TXTTRASH']:(($ticket_details['is_ticket_spam'] == 1)?$vis_language['TXTSPAM']:$vis_language['TXTINBOX']); ?></a></li>
            <li class="active"><?php echo($ticket_details['ticket_hash']); ?></li>
        </ul>
    </div>
    <div class="clearfix col-sm-7 text-right text-left-xs m-t-lg">
        <div class="row">
			<div class="col-sm-12">
				<div class="pull-right">
					
             
					<div class="btn-group ">
					
						<button class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown"  ><? echo $vis_language['TXTREPLY']; ?><span class="caret"></span></button>
					
						<ul class="dropdown-menu dropdown-menu-right text-left">
	                          
							<li><a href="javascript:void(0);"  onclick="<? if($autoticketlockflag==1){?>$('#vis_ticket_reply_<?= $ticket_details['ticket_id']; ?>').visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'lock_onreplyticket', 'vis_action':'lock', 'vis_ticket_id':<? echo $ticket_details['ticket_id']; ?>}) <? }?>;  $('#vis_ticket_reply_<? echo $ticket_details['ticket_id']; ?>').visExecution('reply_forward', {'vis_ticket_id':<? echo $ticket_details['ticket_id']; ?>, 'vis_department_id':<? echo $ticket_details['department_id']; ?>, 'vis_domain_id':<? echo $ticket_details['domain_id']; ?>, 'vis_action':'reply'});"><i class="vh vh-mail-reply text-muted"></i> <? echo $vis_language['TXTREPLY']; ?></a></li>
							<li><a href="javascript:void(0);" onclick="<? if($autoticketlockflag==1){?>$('#vis_ticket_reply_<?= $ticket_details['ticket_id']; ?>').visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'lock_onreplyticket', 'vis_action':'lock', 'vis_ticket_id':<? echo $ticket_details['ticket_id']; ?>}) <? }?>; $('#vis_ticket_reply_<? echo $ticket_details['ticket_id']; ?>').visExecution('reply_forward', {'vis_ticket_id':<? echo $ticket_details['ticket_id']; ?>, 'vis_department_id':<? echo $ticket_details['department_id']; ?>, 'vis_domain_id':<? echo $ticket_details['domain_id']; ?>, 'vis_action':'replyall'});"><i class="vh vh-mail-reply-all text-muted"></i> <? echo $vis_language['TXTREPLYALL']; ?></a></li>
							<li><a href="javascript:void(0);" onclick="<? if($autoticketlockflag==1){?>$('#vis_ticket_reply_<?= $ticket_details['ticket_id']; ?>').visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'lock_onreplyticket', 'vis_action':'lock', 'vis_ticket_id':<? echo $ticket_details['ticket_id']; ?>}) <? }?>; $('#vis_ticket_reply_<? echo $ticket_details['ticket_id']; ?>').visExecution('reply_forward', {'vis_ticket_id':<? echo $ticket_details['ticket_id']; ?>, 'vis_department_id':<? echo $ticket_details['department_id']; ?>, 'vis_domain_id':<? echo $ticket_details['domain_id']; ?>, 'vis_action':'forward'});"><i class="vh vh-mail-forward text-muted"></i> <? echo $vis_language['TXTFORWARD']; ?></a></li>
					 </ul> 
					</div>			
					<div class="btn-group">
						<button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><? echo $vis_language['TXTLABELS']; ?> <b class="caret"></b></button>
							<ul class="dropdown-menu dropdown-menu-right text-left" id="vis_ticket_labels_list">
								<? include(VIS_PATH_TEMPLATE.'ticket_label_list.php');?>
							</ul>                              
					</div>

					<div class="btn-group">
						<button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><i class="vh vh-action text-muted"></i> <b class="caret"></b></button>
						  <ul class="dropdown-menu dropdown-menu-right text-left">
								<li><a href="javascript:void(0);" onclick="$('#vis_global_msg_div').visExecution('load_operations', {'vis_module':'ticket', 'vis_operation':'add_pinup', 'vis_ticket_id':<? echo $ticket_details['ticket_id']; ?>});"><? echo $vis_language['TXTADDTOPIN']; ?></a></li>
								<li><a href="javascript:void(0);" data-toggle="ajaxModal" data-modal-arguments="vis_module=ticket&vis_operation=new_time_track&vis_static_area=vis_time_track_form&vis_ticket_id=<? echo $ticket_details['ticket_id']; ?>&vis_department_id=<? echo $ticket_details['department_id']; ?>&vis_domain_id=<? echo $ticket_details['domain_id']; ?>&vis_client_id=<? echo $ticket_details['client_id']; ?>" onclick="clearInterval(vis_ticket_timer[<?php echo $ticket_details['ticket_id']; ?>]);vis_ticket_timer_flag_[<?php echo $ticket_details['ticket_id']; ?>]=false;"><? echo $vis_language['TXTADDTIMETRACK']; ?></a></li>
								<li><a href="javascript:void(0);" data-toggle="ajaxModal" data-modal-arguments="vis_module=ticket&vis_operation=get_sla_plan&vis_ticket_id=<?= $ticket_details['ticket_id']; ?>&vis_form=vis_sla_form&vis_static_area=vis_set_sla_form"><?= $vis_language['TXTCHANGESLA'] ?></a></li>
								<li><a href="javascript:void(0);" data-toggle="ajaxModal" data-modal-arguments="vis_module=ticket&vis_operation=get_ticket_properties&vis_static_area=vis_ticket_property_form&vis_ticket_id=<? echo $ticket_details['ticket_id']; ?>&vis_client_id=<? echo $ticket_details['client_id']; ?>&vis_domain_id=<? echo $ticket_details['domain_id']; ?>"><? echo $vis_language['TXTPROPERTIES']; ?></a></li>
								<li class="divider"></li>
								<li><a href="javascript:void(0);" data-toggle="ajaxModal" data-modal-arguments="vis_module=ticket&vis_operation=new_note&vis_static_area=vis_ticket_note_form&vis_ticket_id=<? echo $ticket_details['ticket_id']; ?>&vis_client_id=<? echo $ticket_details['client_id']; ?>&vis_domain_id=<? echo $ticket_details['domain_id']; ?>&vis_department_id=<? echo $ticket_details['department_id']; ?>"><? echo $vis_language['TXTNOTEADD']; ?></a></li>
								<li><a href="javascript:void(0);" data-toggle="ajaxModal" data-modal-arguments="vis_module=ticket&vis_operation=new_comment&vis_ticket_id=<? echo $ticket_details['ticket_id']; ?>"><? echo $vis_language['TXTADDCOMMENT']; ?></a></li>
								<? if(VIS_MODULE_ACCESS_BILLING==1 && $ticket_details['client_id']!=0) { ?>
								<li><a href="javascript:void(0);" data-toggle="ajaxModal" data-modal-arguments="vis_module=billing&vis_operation=add_invoice&vis_static_area=vis_ticket_invoice_form&vis_ticket_id=<? echo $ticket_details['ticket_id']; ?>&vis_client_id=<? echo $ticket_details['client_id']; ?>" onclick="change_ticket_flag('<?= $ticket_details['ticket_id'];?>');"><? echo $vis_language['TXTADDINVOICE']; ?></a></li>
								<? } ?>
								<? $link=(VIS_EXPORT_TO_PDF_ACCESS==1)?"href='index.php?vis_module=ticket&vis_operation=export_ticket&vis_type=pdf&vis_ticket_id=".$ticket_details['ticket_id']."&pdf_set=1' target='_blank'":'onclick="show_access()" class="vis-pointer"';?>
								<li><a <?= $link;?>><? echo $vis_language['TXTEXPORTTOPDF']; ?></a></li>
								<li class="divider"></li>
								<li><a href="javascript:void(0);" data-toggle="ajaxModal" data-modal-arguments="vis_module=ticket&vis_operation=get_link_tickets&vis_static_area=vis_ticket_link_form&vis_ticket_id=<? echo $ticket_details['ticket_id']; ?>"><? echo $vis_language['TXTLINKTICKET']; ?></a></li>
								<li><a href="javascript:void(0);" data-toggle="ajaxModal" data-modal-arguments="vis_module=ticket&vis_operation=get_merge_tickets&vis_static_area=vis_ticket_merge_form&vis_ticket_id=<? echo $ticket_details['ticket_id']; ?>&vis_client_id=<? echo $ticket_details['client_id']; ?>"><? echo $vis_language['TXTMERGETICKET']; ?></a></li>
								<? if($ticket_details['client_id'] > 0) {
									if($ticket_details['is_deleted']==1) {
										echo '<li><a href="javascript:void(0);" onclick="$(this).visExecution(\'load_operations\', {\'vis_module\':\'ticket\', \'vis_operation\':\'update_properties\', \'vis_action\':\'delete\', \'vis_ticket_id\':'.$ticket_details['ticket_id'].', \'vis_update_id\':0})">'.$vis_language['TXTMOVETOINBOX'].'</a></li>';
									}
									else {
										echo '<li><a href="javascript:void(0);" onclick="$(this).visExecution(\'load_operations\', {\'vis_module\':\'ticket\', \'vis_operation\':\'update_properties\', \'vis_action\':\'delete\', \'vis_ticket_id\':'.$ticket_details['ticket_id'].', \'vis_update_id\':1})">'.$vis_language['TXTMOVETOTRASH'].'</a></li>';
									}
									if($ticket_details['is_ticket_spam']==1) {
										echo '<li><a href="javascript:void(0);" onclick="$(this).visExecution(\'load_operations\', {\'vis_module\':\'ticket\', \'vis_operation\':\'update_properties\', \'vis_action\':\'spam\', \'vis_ticket_id\':'.$ticket_details['ticket_id'].', \'vis_update_id\':0})">'.$vis_language['TXTREMOVESPAM'].'</a></li>';
									} else {
										echo '<li><a href="javascript:void(0);" onclick="$(this).visExecution(\'load_operations\', {\'vis_module\':\'ticket\', \'vis_operation\':\'update_properties\', \'vis_action\':\'spam\', \'vis_ticket_id\':'.$ticket_details['ticket_id'].', \'vis_update_id\':1})">'.$vis_language['TXTMARKSPAM'].'</a></li>';
									}
									?>
								<li id="ban_status"><a href="javascript:void(0);" onclick="$('#ban_status').visExecution('submit_form',{'vis_module':'client', 'vis_operation':'ban_client', 'vis_action':'ban', 'vis_ticket_id':'<? echo $ticket_details['ticket_id']; ?>', 'vis_remove_ban': <?= $ticket_details['is_banned']?>, 'vis_client_id':<? echo $ticket_details['client_id']; ?>});"><?= $ticket_details['is_banned']?$vis_language['TXTREMOVEBAN']:$vis_language['TXTBAN']; ?></a></li>
								<? } ?>
							</ul>                            
					</div>
                      <? if(VIS_TIMETRACK_ACCESS!=0){ ?>
					<div class="btn-group">
					  <div class="btn btn-default btn-sm" id="vis_timer_text_<?php echo $ticket_details['ticket_id']; ?>" onclick="vis_toggle_timer('<?php echo $ticket_details['ticket_id']; ?>');"><i class="vh vh-stopwatch" title="<?= $vis_language['TXTTIMETRCK'];?>"></i> <span class="" id="vis_ticket_<?= $ticket_details['ticket_id']?>"></span></div>
					</div>
					
					  <?} 
					  
					  if(($self_ticket_lock || $ticket_lock == -1) && $autoticketlockflag!=1){ ?>
                    <div class="btn-group" id="vis_lock_ticket_<?= $ticket_details['ticket_id']; ?>">
                        <div title="<?= ($self_ticket_lock) ? $vis_language['TXTLOCKED']: $vis_language['TXTUNLOCKED'];?>" class="btn btn-default btn-sm" onclick="$('#vis_lock_ticket_<?= $ticket_details['ticket_id']; ?>').visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'lock_ticket', 'vis_action':'<?= ($self_ticket_lock) ? 'unlock' : 'lock'?>', 'vis_ticket_id':<? echo $ticket_details['ticket_id']; ?>});"><i class="vh vh-<?= ($self_ticket_lock) ? 'lock' : 'unlock'?> vh-lg"></i></div>
					</div>
                    <? } ?>
					
				<?php if($integration_list[1]!=-1){?>
				
					<div class="btn-group">
						<button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><i class="vh vh-integration text-muted"></i> <b class="caret"></b></button>
					   <ul class="dropdown-menu dropdown-menu-right text-left">
						<?php 
						for($i=0;$i<$integration_list[0]['total'];$i++){
							if($integration_list[1][$i]['integration_type']==1){
								$integration_link = 'vis_module=ticket&amp;vis_operation=get_whmcs_details&amp;vis_static_area=vis_whmcs_details_form&vis_email='.$ticket_details['email'].'&vis_ticketid='.$ticket_details['ticket_id'].'&vis_domain='.$ticket_details['domain_id'];
								$integration_name = $vis_language['TXTWHMCS'];
								$integration_icon = '<i class="vh vh-whmcs vh-lg vh-whmcs-color"></i>';
							}elseif($integration_list[1][$i]['integration_type']==28){
								$integration_link = 'vis_module=ticket&amp;vis_operation=get_mailchimp_details&amp;vis_static_area=vis_mailchimp_details_form&vis_email='.$ticket_details['email'].'&vis_ticketid='.$ticket_details['ticket_id'].'&vis_domain='.$ticket_details['domain_id'];
								$integration_name = $vis_language['TXTMAILCHIMP'];
								$integration_icon = '<i class="vh vh-mailchimp vh-lg vh-mailchimp-color"></i>';
							}elseif($integration_list[1][$i]['integration_type']==29){
								$integration_link = 'vis_module=ticket&amp;vis_operation=get_freshbooks_details&amp;vis_static_area=vis_freshbooks_details_form&vis_email='.$ticket_details['email'].'&vis_ticketid='.$ticket_details['ticket_id'].'&vis_domain='.$ticket_details['domain_id'];
								$integration_name = $vis_language['TXTFRESHBOOKS'];
								$integration_icon = '<i class="vh vh-freshbooks vh-lg vh-freshbooks-color"></i>';
							}elseif($integration_list[1][$i]['integration_type']==31){
								$integration_link = 'vis_module=ticket&amp;vis_operation=get_magento_details&amp;vis_static_area=vis_mailchimp_details_form&vis_email='.$ticket_details['email'].'&vis_ticketid='.$ticket_details['ticket_id'].'&vis_domain='.$ticket_details['domain_id'];
								$integration_name = $vis_language['TXTMAGENTO'];
								$integration_icon = '<i class="vh vh-magento vh-lg vh-magento-color"></i>';
							}elseif($integration_list[1][$i]['integration_type']==33){
								$integration_link = 'vis_module=ticket&amp;vis_operation=get_insightly_details&amp;vis_static_area=vis_mailchimp_details_form&vis_email='.$ticket_details['email'].'&vis_ticketid='.$ticket_details['ticket_id'].'&vis_domain='.$ticket_details['domain_id'];
								$integration_name = $vis_language['TXTINSIGHTLY'];
								$integration_icon = '<i class="vh vh-insightly vh-lg vh-insightly-color"></i>';
							}elseif($integration_list[1][$i]['integration_type']==34){
								$integration_link = 'vis_module=ticket&amp;vis_operation=get_bigcommerce_details&amp;vis_email='.$ticket_details['email'].'&vis_ticketid='.$ticket_details['ticket_id'].'&vis_domain='.$ticket_details['domain_id'];
								$integration_name = $vis_language['TXTBIGCOMMERCE'];
								$integration_icon = '<i class="vh vh-bigcommerce vh-lg vh-bigcommerce-color"></i>';
							}elseif($integration_list[1][$i]['integration_type']==35){
								$integration_link = 'vis_module=ticket&amp;vis_operation=get_jira_details&amp;vis_static_area=vis_whmcs_details_form&vis_email='.$ticket_details['email'].'&vis_ticketid='.$ticket_details['ticket_id'].'&vis_domain='.$ticket_details['domain_id'];
								$integration_name = $vis_language['TXTJIRA'];
								$integration_icon = '<i class="vh vh-atlassian-jira vh-lg vh-atlassian-color"></i>';
							}elseif($integration_list[1][$i]['integration_type']==36){
								$integration_link = 'vis_module=ticket&amp;vis_operation=get_blesta_details&amp;vis_email='.$ticket_details['email'].'&vis_ticketid='.$ticket_details['ticket_id'].'&vis_domain='.$ticket_details['domain_id'];
								$integration_name = $vis_language['TXTBLESTA'];
								$integration_icon = '<i class="vh vh-blesta vh-lg vh-blesta-color"></i>';
							}elseif($integration_list[1][$i]['integration_type']==37 && $check_redmine_status != -1){
								$integration_link = 'vis_module=ticket&amp;vis_operation=get_readmine_details&amp;vis_ticketid='.$ticket_details['ticket_id'].'&vis_domain='.$ticket_details['domain_id'];
								$integration_name = $vis_language['TXTREADMINE'];
								$integration_icon = '<i class="vh vh-redmine vh-lg vh-redmine-color"></i>';
							}elseif($integration_list[1][$i]['integration_type']==41){
								$integration_link = 'vis_module=ticket&amp;vis_operation=get_capsulecrm_details&amp;vis_ticketid='.$ticket_details['ticket_id'].'&vis_domain='.$ticket_details['domain_id'].'&vis_client_email='.$ticket_details['email'];
								$integration_name = $vis_language['TXTCAPSULECRM'];
								$integration_icon = '<i class="vh vh-capsulecrm vh-lg vh-capsulecrm-color"></i>';
							}elseif($integration_list[1][$i]['integration_type']==43){
								
								$integration_link = 'vis_module=ticket&amp;vis_operation=get_harvest_details&amp;vis_ticketid='.$ticket_details['ticket_id'].'&vis_domain='.$ticket_details['domain_id'].'&vis_client_email='.$ticket_details['email'];
								$integration_name = $vis_language['TXTHARVEST'];
								$integration_icon = '<i class="vh vh-harvest vh-lg vh-harvest-color"></i>';
							}elseif($integration_list[1][$i]['integration_type']==48){
								
								$integration_link = 'vis_module=ticket&amp;vis_operation=get_vtiger_details&amp;vis_ticketid='.$ticket_details['ticket_id'].'&vis_domain='.$ticket_details['domain_id'].'&vis_client_email='.$ticket_details['email'];
								$integration_name = $vis_language['TXTVTIGER'];
								$integration_icon = '<i class="vh vh-vtiger vh-lg vh-vtiger-color"></i>';
							}
							elseif($integration_list[1][$i]['integration_type']==56){
								
								$integration_link = 'vis_module=ticket&amp;vis_operation=get_xero_details&amp;vis_ticketid='.$ticket_details['ticket_id'].'&vis_domain='.$ticket_details['domain_id'].'&vis_client_email='.$ticket_details['email'];
								$integration_name = $vis_language['TXTXERO'];
								$integration_icon = '<i class="vh vh-vtiger vh-lg vh-vtiger-color"></i>';
							}
						if(($integration_list[1][$i]['integration_type']==43 &&$harvest !=1)|| ($integration_list[1][$i]['integration_type']==1 && $whmcs !=1)||($integration_list[1][$i]['integration_type']==48 && $vtiger !=1) || ($integration_list[1][$i]['integration_type']!=43 && $integration_list[1][$i]['integration_type']!=1 && $integration_list[1][$i]['integration_type']!=48)){ ?>
						
						<li>
							<a data-modal-arguments="<?php echo $integration_link;?>" class="m-l-xs" data-toggle="ajaxModal" href="javascript:void(0);"> <?= $integration_icon.' '.$integration_name; ?></a>			
						</li>
						<?php }
						if($integration_list[1][$i]['integration_type']==43){ $harvest = 1; }
						if($integration_list[1][$i]['integration_type']==1){  $whmcs = 1; }
						if($integration_list[1][$i]['integration_type']==48){ $vtiger = 1; }
						}	
													
						?>
						</ul>
					</div>
				<?php }?>
				</div>
				</div>
			</div>
    </div>
    <div class="m-l-md clr">
    </div>
</section>
<div class="col-lg-12 b-t b-light" id="ticket_details_view">
	<div class="form-group m-l-n clear m-b-xs m-t-xs">
		<div class="padder h4 font-bold">
			<span id="vis_ticket_subject">
				<span><? echo $vis_language['TXTSUBJECT']; ?></span>
				<span class="text-lt h4 l-h font-bold">: <? if($ticket_details['schedule_id']!=0){?><i class="vh vh-clock vh-green" title="<?= $vis_language['TXTSCHEDULETICKET']?>"></i><? echo "&nbsp;";} ?><? if($ticket_details['client_id']==0){?><i class="vh vh-information-round vh-blue" title="<?= $vis_language['TXTINTERNALTICKET']?>"></i><? echo "&nbsp;";} ?><? echo $ticket_details['subject']; ?></span>
			</span>
			<span id="vis_ticket_labels">
			<? 	if($label_details!=-1){
					for($i=0;$i<count($label_details);$i++){ ?>
			<span id="vis_ticket_label_<?= $label_details[$i]['label_id']?>">	
				<div class="btn-group m-l-xs">
                    <span class="btn btn-xs l-h-1x text-xs" style="background-color: <?= $label_details[$i]['label_color']?>; color: #fff; font-weight: normal"><?= $label_details[$i]['label_name'];?></span>
					<button style="background-color: <?= $label_details[$i]['label_color']?>; color: #fff;" type="button" class="btn btn-xs l-h-1x text-xs p-l-none" onclick="remove_label(<?= $label_details[$i]['label_id'].','.$ticket_details['ticket_id'];?>);"><span aria-hidden="true"><i class="vh vh-cross"></i></span><span class="sr-only">Close</span></button>
				</div>
			</span>
			<? 		}
				}?>
			</span>
		</div>
	</div>
    <?php if(isset($ticket_lock) && $ticket_lock != -1 && $lock_msg != "") { ?>
    <div id="vis_ticket_lock" class="l-h-2x clear m-b-xs">        
        <i class="vh vh-lock vh-2x vis_fl"></i>&nbsp;<span class="vh-red"><?= $lock_msg;?></span>       
    </div>
        <? } ?>
	<div>
		<ul class="navSeprator no-padder m-b-n">
			<li><label><? echo $vis_language['TXTCREATEDBY']?></label>
			<? if(VIS_INTERNAL_TICKET==1){ ?>				
				<a href="#/home/profile_view/Profile/<?= $ticket_first_post['submitter_id']?>" class="link m-l-xs" onmouseover="javascript:show_user_details(0,<?= $ticket_first_post['submitter_id']?>);" id="user_<?= $ticket_first_post['submitter_id'];?>" onmouseout="hide_user_details(this);"> <?= $ticket_first_post['submitter_name']." &lt;".$ticket_first_post['submitter_email']."&gt;"; ?></a>
			<? } else { 
				?>				
				<a href="#/client/client_details/<?= $ticket_details['first_name'].' '.$ticket_details['last_name'] ?>/<?= $ticket_details['client_id']?>" class="link m-l-xs" onmouseover="javascript:show_user_details(1,<?= $ticket_details['client_id']?>,null,null,null,1);" id="user_<?= $ticket_details['client_id'];?>" onmouseout="hide_user_details(this);"> <?= $ticket_details['first_name'].' '.$ticket_details['last_name'];echo ($ticket_details['email']!='')?" &lt;".$ticket_details['email']."&gt;":( (is_numeric($ticket_details['contact_number']))?" &lt;".$ticket_details['contact_number']."&gt;":(($ticket_details['user_name']!='')?" &lt;".$ticket_details['user_name']."&gt;":" &lt;".$ticket_details['mobile_number']."&gt;")); ?></a>
			<? } ?>
			</li>
			<li><label><? echo $vis_language['TXTCREATIONDATE']; ?></label><span class="text-muted m-l-xs"><? echo format_datetime($ticket_details['receive_date']); ?></span></li>
			<li><label><? echo $vis_language['TXTMODIFICATIONDATE']; ?></label><span class="text-muted m-l-xs" id="ticket_modified_date"><?php echo format_datetime($ticket_details['modify_date']); ?></span></li>
		</ul>
		
		<!--<ul class="navSeprator no-padder m-b-n">
			<?php if(($whmcs[1]!=-1 || $mailchimp[1]!=-1 || $freshbooks[1]!=-1 || $insightly[1]!=-1 || $magento[1]!=-1 || $bigcommerce[1]!=-1 || $jira[1]!=-1 || $blesta[1]!=-1 || $capsule_crm[1]!=-1) && $ticket_details['client_id']!=0) { ?><label><? echo $vis_language['TXTINTEGRATIONS']?></label><? } ?>
        <?php if(($whmcs[1]!=-1) && $ticket_details['client_id']!=0) { ?>
			<li>
			<a data-modal-arguments="vis_module=ticket&amp;vis_operation=get_whmcs_details&amp;vis_static_area=vis_whmcs_details_form&vis_email=<?php echo $ticket_details['email']; ?>&vis_ticketid=<?php echo $ticket_details['ticket_id']; ?>&vis_domain=<?=$ticket_details['domain_id'];?>" class="link m-l-xs" data-toggle="ajaxModal" href="javascript:void(0);"><?= $vis_language['TXTWHMCS']; ?></a>			
			</li>
        <?php } ?>
        <?php if($mailchimp[1]!=-1 && $ticket_details['client_id']!=0) { ?>
            <li>
			<a data-modal-arguments="vis_module=ticket&amp;vis_operation=get_mailchimp_details&amp;vis_static_area=vis_mailchimp_details_form&vis_email=<?php echo $ticket_details['email']; ?>&vis_ticketid=<?php echo $ticket_details['ticket_id']; ?>&vis_domain=<?=$ticket_details['domain_id'];?>" class="link <?= ($whmcs[1]==-1)?'m-l-xs':''; ?>" data-toggle="ajaxModal" href="javascript:void(0);"><?= $vis_language['TXTMAILCHIMP']; ?></a>			
			</li>
        <?php } ?>    
        <?php if($freshbooks[1]!=-1 && $ticket_details['client_id']!=0) { ?>
            <li>
			<a data-modal-arguments="vis_module=ticket&amp;vis_operation=get_freshbooks_details&amp;vis_static_area=vis_freshbooks_details_form&vis_email=<?php echo $ticket_details['email']; ?>&vis_ticketid=<?php echo $ticket_details['ticket_id']; ?>&vis_domain=<?=$ticket_details['domain_id'];?>" class="link <?= ($whmcs[1]==-1 || $mailchimp[1]==-1)?'m-l-xs':''; ?>" data-toggle="ajaxModal" href="javascript:void(0);"><?= $vis_language['TXTFRESHBOOKS']; ?></a>			
			</li>
        <?php } ?>
		<?php if($magento[1]!=-1 && $ticket_details['client_id']!=0) { ?>
            <li>
			<a data-modal-arguments="vis_module=ticket&amp;vis_operation=get_magento_details&amp;vis_static_area=vis_mailchimp_details_form&vis_email=<?php echo $ticket_details['email']; ?>&vis_ticketid=<?php echo $ticket_details['ticket_id']; ?>&vis_domain=<?=$ticket_details['domain_id'];?>" class="link" data-toggle="ajaxModal" href="javascript:void(0);"><?= $vis_language['TXTMAGENTO']; ?></a>			
			</li>
        <?php } ?>  
		<?php if($insightly[1]!=-1 && $ticket_details['client_id']!=0) { ?>
            <li>
			<a data-modal-arguments="vis_module=ticket&amp;vis_operation=get_insightly_details&amp;vis_static_area=vis_mailchimp_details_form&vis_email=<?php echo $ticket_details['email']; ?>&vis_ticketid=<?php echo $ticket_details['ticket_id']; ?>&vis_domain=<?=$ticket_details['domain_id'];?>" class="link <?= ($insightly[1]==-1)?'m-l-xs':''; ?>" data-toggle="ajaxModal" href="javascript:void(0);"><?= $vis_language['TXTINSIGHTLY']; ?></a>			
			</li>
        <?php } ?> 
        <?php if($bigcommerce[1]!=-1 && $ticket_details['client_id']!=0) { ?>
            <li>
<a data-modal-arguments="vis_module=ticket&amp;vis_operation=get_bigcommerce_details&amp;vis_email=<?php echo $ticket_details['email']; ?>&vis_ticketid=<?php echo $ticket_details['ticket_id']; ?>&vis_domain=<?=$ticket_details['domain_id'];?>" class="link" data-toggle="ajaxModal" href="javascript:void(0);"><?= $vis_language['TXTBIGCOMMERCE']; ?></a> 
</li>
        <?php } ?>
        <?php if(($jira[1]!=-1) && $ticket_details['client_id']!=0) { ?>
			<li>
			<a data-modal-arguments="vis_module=ticket&amp;vis_operation=get_jira_details&amp;vis_static_area=vis_whmcs_details_form&vis_email=<?php echo $ticket_details['email']; ?>&vis_ticketid=<?php echo $ticket_details['ticket_id']; ?>&vis_domain=<?=$ticket_details['domain_id'];?>" class="link m-l-xs" data-toggle="ajaxModal" href="javascript:void(0);"><?= $vis_language['TXTJIRA']; ?></a>			
			</li>
        <?php } ?>
        <?php if($blesta[1]!=-1 && $ticket_details['client_id']!=0) { ?>
            <li>
			<a data-modal-arguments="vis_module=ticket&amp;vis_operation=get_blesta_details&amp;vis_email=<?php echo $ticket_details['email']; ?>&vis_ticketid=<?php echo $ticket_details['ticket_id']; ?>&vis_domain=<?=$ticket_details['domain_id'];?>" class="link" data-toggle="ajaxModal" href="javascript:void(0);"><?= $vis_language['TXTBLESTA']; ?></a>			
			</li>
        <?php } 
	      if($check_redmine_status != -1) { ?> 
			<li>
				<a id="redmine" data-modal-arguments="vis_module=ticket&amp;vis_operation=get_readmine_details&amp;vis_ticketid=<?php echo $ticket_details['ticket_id']; ?>&vis_domain=<?=$ticket_details['domain_id'];?>" class="link m-l-xs <?php //if($redmine_link_result[0]['count(*)']==1){ echo 'font-bold'; } ?>" data-toggle="ajaxModal" href="javascript:void(0);" ><?= $vis_language['TXTREADMINE']; ?></a>			
			</li>
        <?php }
              if($capsule_crm[1] != -1 && $ticket_details['client_id']!=0) { ?> 
			<li>
				<a id="capsule_crm" data-modal-arguments="vis_module=ticket&amp;vis_operation=get_capsulecrm_details&amp;vis_ticketid=<?php echo $ticket_details['ticket_id']; ?>&vis_domain=<?=$ticket_details['domain_id'];?>&vis_client_email=<?php echo $ticket_details['email']; ?>" class="link m-l-xs <?php //if($redmine_link_result[0]['count(*)']==1){ echo 'font-bold'; } ?>" data-toggle="ajaxModal" href="javascript:void(0);" ><?= $vis_language['TXTCAPSULECRM']; ?></a>			
			</li>
        <?php } ?>
            </ul>-->
	</div>
	<div id="vis_ticket_reply_<? echo $ticket_details['ticket_id']; ?>" style="display:none"></div>
	<div id="vis_ticket_forward_<? echo $ticket_details['ticket_id']; ?>" style="display:none"></div>
	<section class="panel panel-default m-t-xs">
		<header class="panel-heading text-right bg-light clearfix">
			<ul class="nav nav-tabs pull-left no-borders" id="tabs"> 
				<li id="ticket_details" class="active"><a href="#vis_details_list_<? echo $ticket_details['ticket_id']; ?>" data-toggle="tab" onclick="$('#vis_details_list_<? echo $ticket_details['ticket_id']; ?>').visExecution('load_area',{'vis_module':'ticket', 'vis_operation':'get_details', 'vis_action':'details', 'vis_ticket_id':<? echo $ticket_details['ticket_id']; ?>, 'vis_department_id':<? echo $ticket_details['department_id']; ?>, 'vis_readonly':1});set_active_tab('ticket_details');"><? echo $vis_language['TXTTICKETDETAILS']; ?></a></li>
				<li id="audit_log"><a href="#vis_details_list_<? echo $ticket_details['ticket_id']; ?>" data-toggle="tab" onclick="$('#vis_details_list_<? echo $ticket_details['ticket_id']; ?>').visExecution('load_area',{'vis_module':'ticket', 'vis_operation':'get_details', 'vis_action':'audit_log', 'vis_ticket_id':<? echo $ticket_details['ticket_id']; ?>});set_active_tab('audit_log');"><? echo $vis_language['TXTAUDITLOG']; ?></a></li>
				<? if($ticket_details['client_id'] > 0) { ?>
				<li id="history"><a href="#vis_details_list_<? echo $ticket_details['ticket_id']; ?>" data-toggle="tab" onclick="$('#vis_details_list_<? echo $ticket_details['ticket_id']; ?>').visExecution('load_area',{'vis_module':'ticket', 'vis_operation':'get_details', 'vis_action':'history', 'vis_chk_hide':true, 'vis_client_id':<? echo $ticket_details['client_id']; ?>, 'vis_ticket_id':<? echo $ticket_details['ticket_id']; ?>});set_active_tab('history');"><? echo $vis_language['TXTHISTORY']; ?></a></li>
				<? } ?>
                <li id="link"<? if($link_arr['count']<=0) echo ' style="display:none;"'; ?>><a href="#vis_details_list_<? echo $ticket_details['ticket_id']; ?>" data-toggle="tab" onclick="$('#vis_details_list_<? echo $ticket_details['ticket_id']; ?>').visExecution('load_area',{'vis_module':'ticket', 'vis_operation':'get_details', 'vis_action':'link', 'vis_ticket_id':<? echo $ticket_details['ticket_id']; ?>});set_active_tab('link');"><? echo $vis_language['TXTLINK']; ?></a></li>
				<li id="notes" <? if($module_setting['vis_show_note']==1) { echo 'style="display:none;"'; } else { if(count($note_details)==0) { echo 'style="display:none;"'; } else { echo 'style="display:block;"'; } } ?>><a href="#vis_details_list_<? echo $ticket_details['ticket_id']; ?>" data-toggle="tab" onclick="$('#vis_details_list_<? echo $ticket_details['ticket_id']; ?>').visExecution('load_area',{'vis_module':'ticket', 'vis_operation':'get_details', 'vis_action':'notes', 'vis_domain_id':<? echo $ticket_details['domain_id']; ?>, 'vis_client_id':<? echo $ticket_details['client_id']; ?>, 'vis_ticket_id':<? echo $ticket_details['ticket_id']; ?>});set_active_tab('notes');"><? echo $vis_language['TXTNOTES']; ?></a></li>
				<li id="time_track"<? if($time_track_count==0) echo 'style="display:none;"'; ?>><a href="#vis_details_list_<? echo $ticket_details['ticket_id']; ?>" data-toggle="tab" onclick="$('#vis_details_list_<? echo $ticket_details['ticket_id']; ?>').visExecution('load_area',{'vis_module':'ticket', 'vis_operation':'time_track_details', 'vis_ticket_id':<? echo $ticket_details['ticket_id']; ?>, 'vis_department_id':<? echo $ticket_details['department_id']; ?>});set_active_tab('time_track');"><? echo $vis_language['TXTTIMETRACK']; ?></a></li>
				<? 	if(VIS_MODULE_ACCESS_BILLING==1){ ?>
                <li id="invoices"<? if($total_invoice_cnt['cnt']==0) echo 'style="display:none;"'; ?>><a href="#vis_details_list_<? echo $ticket_details['ticket_id']; ?>" data-toggle="tab" onclick="$('#vis_details_list_<? echo $ticket_details['ticket_id']; ?>').visExecution('load_area',{'vis_module':'billing', 'vis_operation':'get_invoices', 'vis_ticket_id':<? echo $ticket_details['ticket_id']; ?>, 'vis_client_id':<? echo $ticket_details['client_id']; ?>, 'vis_org_operation': 'ticket_details'});set_active_tab('invoices');"><? echo $vis_language['TXTINVOICES']; ?> <? if($unpaid_invoice_cnt['cnt']>0){ ?> <span style="display: inline-block;" class="badge badge-sm up vh-danger-bg count" id="vis_unpaid_invoice_count"><?= $unpaid_invoice_cnt['cnt']; ?></span><? } ?></a></li>
				<? } 
				if($custom_group!=-1 && $custom_fields_details != -1) { ?>
				<li id="custom_fields"<?if($module_setting['vis_show_custom_field']==1) echo 'style="display:none;"'; else echo 'style="display:block;"';?>><a href="#vis_details_list_<? echo $ticket_details['ticket_id']; ?>" data-toggle="tab" onclick="$('#vis_details_list_<? echo $ticket_details['ticket_id']; ?>').visExecution('load_area',{'vis_module':'ticket', 'vis_operation':'custom_field_details', 'vis_ticket_id':<? echo $ticket_details['ticket_id']; ?>, 'vis_department_id':<? echo $ticket_details['department_id']; ?>, 'vis_readonly':1});set_active_tab('custom_fields');"><? echo $vis_language['TXTCUSTOMFIELDS']; ?></a></li>
				<? } 
				if($custIds!=-1) {
				?>
				<li id="feedback_fields" <?if($module_setting['vis_show_custom_field']==1) echo 'style="display:none;"'; else echo 'style="display:block;"';?>><a href="#vis_details_list_<? echo $ticket_details['ticket_id']; ?>" data-toggle="tab" onclick="$('#vis_details_list_<? echo $ticket_details['ticket_id']; ?>').visExecution('load_area',{'vis_module':'ticket', 'vis_operation':'get_ticket_feedback', 'vis_ticket_id':<? echo $ticket_details['ticket_id']; ?>, 'vis_department_id':<? echo $ticket_details['department_id']; ?>, 'vis_readonly':1});set_active_tab('feedback_fields');"><? echo $vis_language['TXTUSERFEEDBACK']; ?></a></li>
				<? } if($ticket_details['attachment_count']!=0){?>
		<li id="ticket_attachment"><a href="#vis_details_list_<? echo $ticket_details['ticket_id']; ?>" data-toggle="tab" onclick="$('#vis_details_list_<? echo $ticket_details['ticket_id']; ?>').visExecution('load_area',{'vis_module':'ticket', 'vis_operation':'get_details', 'vis_action':'attachments','vis_ticket_id':<? echo $ticket_details['ticket_id']; ?>});set_active_tab('ticket_attachment');"><? echo $vis_language['TXTATTACHMENT']; ?></a></li>
		<?php }?>
			</ul>
		</header>
		<div class="panel-body">
			<div class="tab-content">
				<div class="tab-pane active" id="vis_details_list_<? echo $ticket_details['ticket_id']; ?>">
					<div class="row">
						<div class="form-group m-b-none">
							<div class="col-sm-2">
								<label class="control-label m-l-sm font-bold"><? echo $vis_language['TXTDEPARTMENT']; ?></label>
								<div id="department">
									<button data-toggle="dropdown" class="btn bg-empty btn-sm dropdown-toggle action_btn bg-white" type="button" onclick="<? if(VIS_DEPARTMENT_ACCESS!=0){ ?>$('#department').visExecution('load_area', {'vis_module': 'ticket', 'vis_operation': 'load_lists', 'vis_action': 'department', 'vis_ticket_id': <?= $ticket_details['ticket_id']?>, 'vis_selected_id': <?= $ticket_details['department_id']; ?>, 'vis_domain_id': <?= $ticket_details['domain_id']; ?>});<? } else{ ?>$('#vis_global_msg_div').visInterface('load_global_message', '<?= $vis_language['MSGACCSSDND']; ?>');<? } ?>"><span class="filter-option pull-left"><?= $ticket_details['domain_name'].' : '.$ticket_details['department_name']; ?>&nbsp;</span><span class="caret"></span></button>
								</div>
							</div>
							<div class="col-sm-2">
								<label class="control-label m-l-sm font-bold"><? echo $vis_language['TXTSTATUS']; ?></label>
								<div id="status">
									<button data-toggle="dropdown" class="btn bg-empty btn-sm dropdown-toggle action_btn bg-white" type="button" onclick="<? if(VIS_STATUS_ACCESS!=0){ ?>$('#status').visExecution('load_area', {'vis_module': 'ticket', 'vis_operation': 'load_lists', 'vis_action': 'status', 'vis_ticket_id': <?= $ticket_details['ticket_id']?>, 'vis_selected_id': <?= $ticket_details['status_id']; ?>, 'vis_domain_id': <?= $ticket_details['domain_id']; ?>, 'vis_dept_id': <?= $ticket_details['department_id']; ?>});<? } else{ ?>$('#vis_global_msg_div').visInterface('load_global_message', '<?= $vis_language['MSGACCSSDND']; ?>');<? } ?>"><span class="filter-option pull-left" style="color:<?= $ticket_details['status_color']; ?>" ><?= $t_status=wordwrap($ticket_details['ticket_status'],20,"<br />\n"); ?>&nbsp;</span><span class="caret"></span></button>
								</div>
							</div>
							<?php if(isset($module_setting1['vis_priority'])){?>
								<div class="col-sm-2">
									<label class="control-label m-l-sm font-bold"><? echo $vis_language['TXTPRIORITY']; ?></label>
									<div id="priority">
										<button data-toggle="dropdown" class="btn bg-empty btn-sm dropdown-toggle action_btn bg-white" type="button" onclick="<? if(VIS_PRIORITY_ACCESS!=0){ ?>$('#priority').visExecution('load_area', {'vis_module': 'ticket', 'vis_operation': 'load_lists', 'vis_action': 'priority', 'vis_ticket_id': <?= $ticket_details['ticket_id']?>, 'vis_selected_id': <?= $ticket_details['priority_id']; ?>, 'vis_domain_id': <?= $ticket_details['domain_id']; ?>, 'vis_dept_id': <?= $ticket_details['department_id']; ?>});<? } else{?>$('#vis_global_msg_div').visInterface('load_global_message', '<?= $vis_language['MSGACCSSDND']; ?>');<? } ?>"><span class="filter-option pull-left"  style="color:<?= $ticket_details['priority_color']; ?>" ><?= $t_priority=wordwrap($ticket_details['ticket_priority'],20,"<br />\n"); ?>&nbsp;</span><span class="caret"></span></button>
									</div>
								</div>
							<?php }
							if(isset($module_setting1['vis_tickettype'])){?>
								<div class="col-sm-2">
									<label class="control-label m-l-sm font-bold"><? echo $vis_language['TXTTYPE']; ?></label>
									<div id="type">
										<button data-toggle="dropdown" class="btn bg-empty btn-sm dropdown-toggle action_btn bg-white" type="button" onclick="<? if(VIS_TYPE_ACCESS!=0){ ?>$('#type').visExecution('load_area', {'vis_module': 'ticket', 'vis_operation': 'load_lists', 'vis_action': 'type', 'vis_ticket_id': <?= $ticket_details['ticket_id']?>, 'vis_selected_id': <?= $ticket_details['type_id']; ?>, 'vis_domain_id': <?= $ticket_details['domain_id']; ?>, 'vis_dept_id': <?= $ticket_details['department_id']; ?>});<? } else{?>$('#vis_global_msg_div').visInterface('load_global_message', '<?= $vis_language['MSGACCSSDND']; ?>');<? } ?>"><span class="filter-option pull-left"><?= $t_priority=wordwrap($ticket_details['ticket_type'],20,"<br />\n"); ?>&nbsp;</span><span class="caret"></span></button>
									</div>
								</div>
							<?php }?>
							<div class="col-sm-2">
								<label class="control-label m-l-sm font-bold"><? echo $vis_language['TXTFLAG']; ?></label>
								<div id="flag">	
									<button data-toggle="dropdown" class="btn bg-empty btn-sm dropdown-toggle action_btn bg-white" type="button" onclick="<? if(VIS_FLAG_ACCESS!=0){ ?>$('#flag').visExecution('load_area', {'vis_module': 'ticket', 'vis_operation': 'load_lists', 'vis_action': 'flag', 'vis_ticket_id': <?= $ticket_details['ticket_id']?>, 'vis_selected_id': <?= $ticket_details['flag_id']; ?>, 'vis_domain_id': <?= $ticket_details['domain_id']; ?>, 'vis_dept_id': <?= $ticket_details['department_id']; ?>});<? } else{?>$('#vis_global_msg_div').visInterface('load_global_message', '<?= $vis_language['MSGACCSSDND']; ?>');<? } ?>"><span class="filter-option pull-left"><span class="vh-stack pull-right"><i class="vh vh-flag-inner vh-stack-lg" style="color:<?= $ticket_details['flag_color'];?>"></i><i class="vh vh-flag-empty vh-stack-lg"></i></span></span><span class="caret"></span></button>
								</div>
							</div>
							<div class="col-sm-2">
								<div id="owner">
									<button data-toggle="dropdown" class="btn bg-empty btn-sm dropdown-toggle action_btn bg-white" type="button" onclick="<? if(VIS_STAFF_ACCESS!=0){ ?>$('#owner').visExecution('load_area', {'vis_module': 'ticket', 'vis_operation': 'load_lists', 'vis_action': 'owner', 'vis_ticket_id': <?= $ticket_details['ticket_id']?>,  'vis_domain_id': <?= $ticket_details['domain_id']; ?>, 'vis_department_id': <?= $ticket_details['department_id']; ?>});<? } else{?>$('#vis_global_msg_div').visInterface('load_global_message', '<?= $vis_language['MSGACCSSDND']; ?>');<? } ?>"><span class="filter-option pull-left"><?= $vis_language['TXTASSIGNEDTO']; ?>&nbsp;</span><span class="caret"></span></button>
								</div>
									<?  $owner1 = $vis_language['TXTUNASSIGNED'];
										$owner_cnt = (!empty($owner_details) && $owner_details != -1) ? count($owner_details) : 0;
											if ($owner_details != -1 ) {
												foreach ($owner_details as $owner) {
												if ($owner1 == $vis_language['TXTUNASSIGNED']) {
													$owner1 = $owner['first_name'] . ' ' . $owner['last_name'];
												}
											}
											} ?>
								</select>
								<div><? if ($owner_cnt > 1) { ?>
									<span class="m-l-sm text-sm"><? echo $vis_language['TXTMULTIPLEOWNERS'];?></span>
									<? } else { ?>
									<span class="m-l-sm text-sm"><? echo $owner1;?></span>
									<? } ?>
								</div>
							</div>
							
						</div>
					</div>
					<? if ($owner_cnt > 1) { ?>
					<div class="wrapper-sm m-b-none m-t-xs" id="vis_assigned_to_<?= $ticket_details['ticket_id'];?>">		
						<div class="row">			
							<div class="form-group clear m-b-xs m-t-xs">
								<? include(VIS_PATH_TEMPLATE."assigned_owner_list.php");?>
							</div>
						</div>
					</div>
					<? } ?>
					<div class="wrapper-sm<? if(isset($owner_cnt) && $owner_cnt <= 1) { echo ' m-t'; }?> b m-b-none vis_new m-b">
						<div class="row">
							<div class="col-sm-3 m-t-xs">
								<label><? echo $vis_language['TXTSLAPLAN']?></label>
								<span class="label vh-green-bg m-l-xs"><? echo ($ticket_details['slaplan_id'] > 0) ? $ticket_details['sla_name'] : (($ticket_details['slaplan_id'] == 0 && $ticket_details['rdue_time'] > 0 || $ticket_details['sdue_time'] > 0) ? $vis_language['TXTCUSTDUETIME'] : $vis_language['TXTNONE']);?></span>
							</div>
							<div class="col-sm-3 m-t-xs">
								<label><? echo $vis_language['TXTDUETIME']?></label>
								<? if($due_flag!='')echo (is_numeric($due_flag))?'<span class="vh-green m-l-sm"><i class="vh vh-clock"></i> '.count_remain_time($due_flag) : '<span class="m-l-sm"><i class="vh vh-clock"></i> '.$due_flag;
								elseif($ticket_details['due_time']<=0 && $ticket_details['user_replied']==1 && $ticket_details['status_id']!=3 && $ticket_details['sdue_time']!=0) echo '<span class="m-l-sm vh-danger"><i class="vh vh-clock"></i> '.$vis_language['TXTOVERDUE']; elseif($ticket_details['due_time']>0 && $ticket_details['user_replied']==1 && $ticket_details['status_id']!=3) {$show_pause=1;echo '<span class="vh-green m-l-sm"><i class="vh vh-clock"></i> '.count_remain_time($ticket_details['due_time']);} else echo '<span class="m-l-sm"><i class="vh vh-clock"></i> '.$vis_language['TXTUNDUE']; ?> </span>
							</div>
							<div class="col-sm-3 m-t-xs">
								<label><? echo $vis_language['TXTRESOLUTIONTIME']; ?></label>
								 <? if($resolution_flag!='')echo (is_numeric($resolution_flag))?'<span class="vh-green m-l-sm"><i class="vh vh-clock"></i> '.count_remain_time($resolution_flag) : '<span class="m-l-sm"><i class="vh vh-clock"></i> '.$resolution_flag;
								elseif($ticket_details['resolution_time']<=0 && $ticket_details['status_id']!=3 && $ticket_details['rdue_time']!=0) echo '<span class=" m-l-sm vh-danger"><i class="vh vh-clock"></i> '.$vis_language['TXTOVERDUE']; elseif($ticket_details['resolution_time']>0 && $ticket_details['status_id']!=3) {$show_pause=1;echo '<span class="vh-green m-l-sm"><i class="vh vh-clock"></i> '.count_remain_time(($ticket_details['resolution_time']));} else echo '<span class="m-l-sm"><i class="vh vh-clock"></i> '.$vis_language['TXTUNDUE']; ?></span>
							</div>
							<?php if($resolution_flag!='' || $due_flag!=''){?>
								<div class="col-sm-3 m-t-xs">
									<a class="link pull-right" href="javascript:void(0)" onclick="$('#vis_global_msg_div').visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'resume_ticket_sla','vis_ticket_id':'<?= $ticket_details['ticket_id']?>'});"><i class="vh vh-stopwatch"></i> <? echo $vis_language['TXTRESUMESLA']; ?></a>
								</div>
							<?php }else if($show_pause==1) {?>
								<div class="col-sm-3 m-t-xs">
									<a class="link pull-right" href="javascript:void(0)" onclick="$('#vis_global_msg_div').visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'pause_ticket_sla','vis_ticket_id':'<?= $ticket_details['ticket_id']?>'});"><i class="vh vh-stopwatch"></i> <? echo $vis_language['TXTPAUSESLA']; ?></a>
								</div>
							<?php }?>
							<!--<div class="col-sm-3 m-t-xs">
								<ul class="navSeprator no-padder m-n">
									<li><a id="toggle_recipients_people" href="javascript:void(0);" onclick="toggle_recipients_people();" class="link m-l-xs"><?= $vis_language['TXTSHOWRECIPIENTNPEOPLE']?></a></li>
									<li id="show_vis_ticket_tags"<? if($tag_details!=-1) echo ' style="display:none";'?>><a href="javascript:void(0);" onclick="$('#vis_ticket_tags').show();" class="link"><?= $vis_language['TXTADDTAG']?></a></li>
								</ul>
							</div>-->
						</div>
					</div>
     	<?php  if($total_approvals>0){ ?>
     <div class="wrapper-sm<? if(isset($owner_cnt) && $owner_cnt <= 1) { echo ' m-t'; }?> b m-b-none vis_new m-b">

					<div class="row">
					

					<? //THIS ONE FOR SEND APPROVAL LABLE STRATS?>

					<div class="col-sm-4 m-t-xs">
					<label><?php echo $vis_language['TXTAPPROVALSTATUS'];?>     </label>
					</div>

					<? //THIS ONE FOR SEND APPROVAL LABLE ENDS ?>

					<div class="col-sm-4 m-t-xs">
					<label></label>
					<span class="m-l-xs" id="">
					<?php if($single_details[0]['approvals_status']==0 && $single_details!=-1){ 
					if($single_details[0]['staff_id']==VIS_STAFF_ID){?>
					<a class="link"  href="javascript:void(0);" onclick="change_status(<? echo $single_details[0]['approvals_id'].', 1, '.$single_details[0]['staff_id'];?>);" title="<? echo $vis_language['TXTAPPROVE']; ?>"><?= $vis_language['TXTAPPROVE'];?></a> / 

					<a class="link"  href="javascript:void(0);" data-toggle="ajaxModal" data-modal-arguments="vis_module=ticket&vis_operation=reject_approvals&from=ticket&vis_ticket_id=<? echo $ticket_details['ticket_id'];?>&vis_approvals_id=<? echo $single_details[0]['approvals_id'];?>" title="<? echo $vis_language['TXTITILREJECT']; ?>"><?= $vis_language['TXTITILREJECT'];?></a>
					<?php }
					}?></span>
					</div>



					<div class="col-sm-4 m-t-xs">
					<label><? echo $vis_language['TXTAPPROVALSTATUS'].'  ';?>  </label>
					<? if($approvals_status==-1) echo '<span class="label m-l-xs label-default">'.$vis_language['TXTNOTREQUESTED'].'</span>';
					if($approvals_status==0) echo '<span class="label m-l-xs label-default">'.$vis_language['TXTREQUESTED'].'</span>';
					if($approvals_status==1)echo '<span class="label m-l-xs vh-green-bg">'.$vis_language['TXTAPPROVED'].'</span>';
					if($approvals_status==2) echo '<span class="label m-l-xs label-default">'.$vis_language['TXTCANCELED'].'</span>';
					if($approvals_status==3) echo '<span class="label m-l-xs vh-red-bg">'.$vis_language['TXTREJECTED'].'</span>';
					?>
					</div>

					
					</div>
	</div>
 <? }?>
					<?php if($tp>0){?>
					<div class="row">
						<div class="form-group m-b-none">
							<?php if(isset($module_setting1['vis_level'])){?>
								<div <?=$class_properties?>>
									
									<label class="control-label m-l-sm font-bold"><? echo $vis_language['TXTTICKETLEVEL']; ?></label>
									<<?=$divorspan?> id="level">
										<button data-toggle="dropdown" class="btn bg-empty btn-sm dropdown-toggle action_btn bg-white" type="button" onclick="<? if(VIS_TICKET_LEVEL_ACCESS!=0){ ?>$('#level').visExecution('load_area', {'vis_module': 'ticket', 'vis_operation': 'load_lists', 'vis_action': 'level', 'vis_ticket_id': <?= $ticket_details['ticket_id']?>, 'vis_selected_id': <?= ($ticket_details['ticket_level']=='')?0:$ticket_details['level_id']; ?>, 'vis_domain_id': <?= $ticket_details['domain_id']; ?>, 'vis_dept_id': <?= $ticket_details['department_id']; ?>});<? } else{?>$('#vis_global_msg_div').visInterface('load_global_message', '<?= $vis_language['MSGACCSSDND']; ?>');<? } ?>"><span class="filter-option pull-left"><?= ($ticket_details['ticket_level']=='')?$vis_language['TXTSELECT']:$ticket_details['ticket_level']; ?>&nbsp;</span><span class="caret"></span></button>
									</<?=$divorspan?>>
								</div>
							<?php }
							if(isset($module_setting1['vis_category'])){?>
								<div <?=$class_properties?>>
									<label class="control-label m-l-sm font-bold"><? echo $vis_language['TXTTICKETCATEGORY']; ?></label>
									<<?=$divorspan?> id="ticket_category">
										<button data-toggle="dropdown" class="btn bg-empty btn-sm dropdown-toggle action_btn bg-white" type="button" onclick="<? if(VIS_TICKET_CATEGORY_ACCESS!=0){ ?>$('#ticket_category').visExecution('load_area', {'vis_module': 'ticket', 'vis_operation': 'load_lists', 'vis_action': 'ticket_category', 'vis_ticket_id': <?= $ticket_details['ticket_id']?>, 'vis_selected_id': <?= ($ticket_details['ticket_category']=='')?0:$ticket_details['category_id']; ?>, 'vis_domain_id': <?= $ticket_details['domain_id']; ?>, 'vis_dept_id': <?= $ticket_details['department_id']; ?>});<? } else{ ?>$('#vis_global_msg_div').visInterface('load_global_message', '<?= $vis_language['MSGACCSSDND']; ?>');<? } ?>"><span class="filter-option pull-left"><?= ($ticket_details['ticket_category']=='')?$vis_language['TXTSELECT']:$ticket_details['ticket_category']; ?>&nbsp;</span><span class="caret"></span></button>
									</<?=$divorspan?>>
								</div>
							<?php }
							if(isset($module_setting1['vis_subcategory'])){?>
								<div <?=$class_properties?>>
									<label class="control-label m-l-sm font-bold"><? echo $vis_language['TXTTICKETSUBCATEGORY']; ?></label>
									<<?=$divorspan?> id="ticket_subcateogy">
										<button data-toggle="dropdown" class="btn bg-empty btn-sm dropdown-toggle action_btn bg-white" type="button" onclick="<? if(VIS_TICKET_CATEGORY_ACCESS!=0){ ?>$('#ticket_subcateogy').visExecution('load_area', {'vis_module': 'ticket', 'vis_operation': 'load_lists', 'vis_action': 'ticket_subcateogy', 'vis_ticket_id': <?= $ticket_details['ticket_id']?>, 'vis_selected_id': <?= ($ticket_details['ticket_sub_cateogy']=='')?0:$ticket_details['subcategory_id']; ?>, 'vis_category_id': <?= $ticket_details['category_id']; ?>, 'vis_domain_id': <?= $ticket_details['domain_id']; ?>, 'vis_dept_id': <?= $ticket_details['department_id']; ?>});<? } else{?>$('#vis_global_msg_div').visInterface('load_global_message', '<?= $vis_language['MSGACCSSDND']; ?>');<? } ?>"><span class="filter-option pull-left"><?= ($ticket_details['ticket_sub_cateogy']=='')?$vis_language['TXTSELECT']:$ticket_details['ticket_sub_cateogy']; ?>&nbsp;</span><span class="caret"></span></button>
									</<?=$divorspan?>>
								</div>
							<?php }
							if(isset($module_setting1['vis_item'])){?>
								<div <?=$class_properties?>>
									<label class="control-label m-l-sm font-bold"><? echo $vis_language['TXTTICKETITEM']; ?></label>
									<<?=$divorspan?> id="ticket_item">
										<button data-toggle="dropdown" class="btn bg-empty btn-sm dropdown-toggle action_btn bg-white" type="button" onclick="<? if(VIS_TICKET_CATEGORY_ACCESS!=0){ ?>$('#ticket_item').visExecution('load_area', {'vis_module': 'ticket', 'vis_operation': 'load_lists', 'vis_action': 'ticket_item', 'vis_ticket_id': <?= $ticket_details['ticket_id']?>, 'vis_selected_id': <?= ($ticket_details['ticket_item']=='')?0:$ticket_details['item_id']; ?>, 'vis_subcategory_id': <?= $ticket_details['subcategory_id']; ?>, 'vis_domain_id': <?= $ticket_details['domain_id']; ?>, 'vis_dept_id': <?= $ticket_details['department_id']; ?>});<? } else{?>$('#vis_global_msg_div').visInterface('load_global_message', '<?= $vis_language['MSGACCSSDND']; ?>');<? } ?>"><span class="filter-option pull-left"><?= ($ticket_details['ticket_item']=='')?$vis_language['TXTSELECT']:$ticket_details['ticket_item']; ?>&nbsp;</span><span class="caret"></span></button>
									</<?=$divorspan?>>
								</div>
							<?php }
							if($itil_enabled==1){if(isset($module_setting1['vis_assets_location'])){ ?>
							<div <?=$class_properties?>>
								<label class="control-label m-l-sm font-bold"><? echo $vis_language['TXTLOCATION']; ?></label>
								<<?=$divorspan?> id="assets_location">	
									<button data-toggle="dropdown" class="btn bg-empty btn-sm dropdown-toggle action_btn bg-white" type="button" onclick="<? if(VIS_TICKET_LOCATION_ACCESS!=0){ ?>$('#assets_location').visExecution('load_area', {'vis_module': 'ticket', 'vis_operation': 'load_lists', 'vis_action': 'assets_location', 'vis_ticket_id': <?= $ticket_details['ticket_id']?>, 'vis_selected_id': <?= $ticket_details['location_id']; ?>, 'vis_domain_id': <?= $ticket_details['domain_id']; ?>, 'vis_dept_id': <?= $ticket_details['department_id']; ?>});<? } else{?>$('#vis_global_msg_div').visInterface('load_global_message', '<?= $vis_language['MSGACCSSDND']; ?>');<? } ?>"><span class="filter-option pull-left"><?= ($ticket_details['assets_location']=='')?$vis_language['TXTSELECT']:$ticket_details['assets_location']; ?>&nbsp;</span><span class="caret"></span></button>
								</<?=$divorspan?>>
							</div>
							<?php }}?>
						</div>
					</div><br>
					<?php }?>
					<?php if($itil_enabled==1){
					if($service_ticket_details!=-1){?>
						<div class="btn-group">
							<button class="btn btn-default btn-xs btn-rounded" onclick="show_services(<?= $service_ticket_details[0]['service_item_id'];?>);"><? echo $vis_language['TXTITILSERVICEREQUEST']; ?></button>
						</div>
					<? }?>
					<div class="btn-group">    
						<button class="btn btn-default btn-xs btn-rounded" onclick="show_ci_cmdb(<? if($attach_ci_details!=-1) echo $attach_ci_details[0]['child_id']; else echo '0';?>);"><? echo $vis_language['TXTCI']; ?> (<? if(isset($attach_ci_details) && $attach_ci_details!=-1) echo count($attach_ci_details); else echo '0';?>)</button>
					</div>
					<div class="btn-group">    
						<button class="btn btn-default btn-xs btn-rounded" onclick="show_problem_cmdb(<? if($attach_problem_details!=-1) echo $attach_problem_details[0]['child_id']; else echo '0';?>);"><?= $vis_language['TXTPROBLEMS']; ?> (<? if(isset($attach_problem_details) && $attach_problem_details!=-1) echo '1'; else echo '0'; ?>)</button>
					</div>
					<div class="btn-group">
						<button class="btn btn-default btn-xs btn-rounded" onclick="show_changes_cmdb(<? if($attach_changes_details!=-1) echo $attach_changes_details[0]['child_id']; else echo '0';?>);"><? echo $vis_language['TXTCHANGES']; ?> (<? if(isset($attach_changes_details) && $attach_changes_details!=-1) echo '1'; else echo '0'; ?>)</button>
					</div>
					<?php } if(VIS_MODULE_ACCESS_TASK==1){?>
					<div class="btn-group">
						<button class="btn btn-default btn-xs btn-rounded" onclick="show_ticket_task();"><? echo $vis_language['TXTTASKS'];?> (<? if(isset($attach_task_details) && $attach_task_details!=-1) echo count($attach_task_details); else echo '0'; ?>)</button>
					</div><? } ?>
					<? if($ticket_details['client_id'] > 0) {
							$recepients=explode(',', $ticket_details['recipients']); 
							$people=explode(',', $ticket_details['people']);  
							if($people[0]=='')$people=0; else $people=count($people); 
							if($recepients[0]=='')$recepients=''; else $recepients=count($recepients);?>
					<div class="btn-group">    
						<button class="btn btn-default btn-xs btn-rounded" onclick="show_recipients();"><? echo $vis_language['TXTRECIPIENTNPEOPLE']; ?> (<span id="participient_count"><?= $recepients+$people;?></span>)</button>
					</div>
					<? }
					if($tag_details!=-1) $tag_count=count($tag_details); else $tag_count=0;?>
					<div class="btn-group">    
						<button class="btn btn-default btn-xs btn-rounded" onclick="show_tags();"><? echo $vis_language['TXTTAGS']; ?> (<span id="tags_count"><?= $tag_count;?></span>)</button>
					</div>
     
     <div class="btn-group">    
						<button class="btn btn-default btn-xs btn-rounded" onclick="show_approvals();"><? echo $vis_language['TXTAPPROVALS']; ?> (<span id="approval_count"><? echo $total_approvals;?></span>)</button>
					</div>
     
					<div id="vis_ticket_task" class="wrapper-sm m-b-none" style="display:none;">	
					</div>
					<?php if($itil_enabled==1){
					if(isset($service_ticket_details) && $service_ticket_details!=-1){?>
					<div id="services_detail" class="wrapper-sm m-b-none m-t" style="display:none;">	
					</div>
					<?php }?>
					<div id="vis_ci_cmdb" class="wrapper-sm m-b-none m-t" style="display:none;">
						<div class="row">
							<div class="col-sm-12 m-t-xs">
								<label><? echo  $vis_language['TXTITILNOCIASSOCIATED'];?></label>
								<span class="m-l-sm"><a class="link"  href="javascript:void(0);" data-toggle="ajaxModal" data-modal-arguments="vis_module=cmdb&vis_operation=attach_ci_cmdb&vis_ticket_id=<? echo $ticket_details['ticket_id'];?>&vis_domain_id=<? echo $ticket_details['domain_id'];?>&vis_dept_id=<? echo $ticket_details['department_id'];?>" title="<? echo $vis_language['TXTATTACHCI']; ?>"><?= $vis_language['TXTATTACHCI'];?></a></span>
						</div>	
						</div>
					</div>
					<div id="vis_problem_cmdb" class="wrapper-sm m-b-none m-t" style="display:none;">
						<div class="row">
							<div class="col-sm-12 m-t-xs">
								<label><? echo  $vis_language['TXTITILNOPROBLEMLINKED'];?></label>
								<span class="m-l-sm"><a class="link"  href="javascript:void(0);" data-toggle="ajaxModal" data-modal-arguments="vis_module=setting&vis_operation=attach_problem_cmdb&vis_ticket_id=<? echo $ticket_details['ticket_id'];?>&vis_domain_id=<? echo $ticket_details['domain_id'];?>&vis_dept_id=<? echo $ticket_details['department_id'];?>" title="<? echo $vis_language['TXTITILLINKPROBLEM']; ?>"><?= $vis_language['TXTITILLINKPROBLEM'];?></a></span>
							</div>
						</div>
					</div>
					<div id="vis_changes_cmdb" class="wrapper-sm m-b-none m-t" style="display:none;">
						<div class="row">
							<div class="col-sm-12 m-t-xs">
								<label><? echo  $vis_language['TXTITILNOCHANGESLINKED'];?></label>
								<span class="m-l-sm"><a class="link"  href="javascript:void(0);" data-toggle="ajaxModal" data-modal-arguments="vis_module=changes&vis_operation=attach_changes_cmdb&vis_ticket_id=<? echo $ticket_details['ticket_id'];?>&vis_domain_id=<? echo $ticket_details['domain_id'];?>&vis_dept_id=<? echo $ticket_details['department_id'];?>" title="<? echo $vis_language['TXTITILLINKCHANGES']; ?>"><?= $vis_language['TXTITILLINKCHANGES'];?></a></span>
							</div>
						</div>
					</div>
					<?php }?>
					<div class="wrapper-sm m-b-none m-t-xs" style="display:none;" id="vis_recipients_people">		
						<div class="row">			
							<div class="form-group clear m-b-xs m-t-xs" id="vis_recipients_<?= $ticket_details['ticket_id'] ?>">
								<? include(VIS_PATH_TEMPLATE."recipients_list.php");?>
							</div>
							<div class="form-group clear m-b-none m-t-sm" id="vis_peoples_<?= $ticket_details['ticket_id'] ?>">
								<? $is_people_set=1; include(VIS_PATH_TEMPLATE."peoples_list.php");?>
							</div>
						</div>
					</div>
					<div class="wrapper-sm m-b-none" style="display:none;" id="vis_ticket_tags">
						<div class="row">
							<div class="form-group clear m-b-none m-t-xs" id="vis_tags_<?= $ticket_details['ticket_id'] ?>">
								<? include(VIS_PATH_TEMPLATE."ticket_tags_list.php");?>
							</div>		
						</div>
					</div>
     
     <div class="wrapper-sm m-b-none" style="display:none;" id="vis_ticket_approvals">
						<div class="row">
							<div class="form-group clear m-b-none m-t-xs" id="vis_approvals_<?= $ticket_details['ticket_id'] ?>">
								<? include(VIS_PATH_TEMPLATE."ticket_approval_list.php");?>
							</div>		
						</div>
					</div>
     
					<? if($note_details != -1 && $module_setting['vis_show_note']){echo "<br><br>";
						include(VIS_PATH_TEMPLATE."ticket_note_details.php");
					   } 
					   if($custom_field_var!=-1){ ?>
						   <section class="panel panel-default pos-rlt clearfix m-b-none m-t-sm" id="ticket_customfields">
								<div class="panel-heading b-b b-light" style="background-color:#eee;">
									<div class="clear">
										<div class="row">
											<div class="m-l pull-left">
												<label class="pull-left"><? echo $vis_language['TXTCUSTOMFIELDS']; ?></label>
											</div>
											<div class="pull-right m-r-lg">
												<?  if($readonly==1 &&  $nodata !=1) { ?><a class="link" onclick="load_customfields_details();" href="javascript:void(0);"><?= $vis_language['TXTEDIT']; ?></a><? } ?>
											</div>
										</div>
									</div>
								</div>
								<div class="panel-collapse wrapper">
									<form class="form-horizontal" name="frm_edit_custom" id="frm_edit_custom" method="post"><?= $custom_field_var; ?></form>
								</div>			
							</section>
					<? } ?>
					<? ///////////////  
					if($custom_field_varfeedback!=-1 && $custIds!=-1){ ?>
					   <section class="panel panel-default pos-rlt clearfix m-b-none m-t-sm" id="ticket_customfields">
								<div class="panel-heading b-b b-light" style="background-color:#eee;">
									<div class="clear">
										<div class="row">
											<div class="m-l pull-left">
												<label class="pull-left"><? echo $vis_language['TXTUSERFEEDBACK']; ?></label>
											</div>
											<div class="pull-right m-r-lg">
												
											</div>
										</div>
									</div>
								</div>
								<div class="panel-collapse wrapper">
									<form class="form-horizontal" name="frm_edit_custom" id="frm_edit_custom" method="post"><?= $custom_field_varfeedback; ?></form>
								</div>			
							</section>
					<? } ////////////// ?>
				</div>
			</div>
		</div>
	</section>
	<section id="vis_ticket_post_forms">
		<!--<section class="panel panel-default pos-rlt clearfix m-b-md" >
			<div style="text-align:center"><br><b><I>Loading....</I></b><br><br></div>
		</section>-->
		<script language="javascript">
			$('#vis_ticket_post_forms').visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'get_ticket_post', 'vis_ticket_id':<? echo $ticket_details['ticket_id']; ?>});
		</script>
	</section>
</div>
<?php
if(isset($operation['ticket_reply_call']) && $operation['ticket_reply_call']=='reply'){
	echo '<script> $("#ticket_modified_date").html("'.format_datetime($ticket_details['modify_date']).'"); </script>';
}
?>
<script>
$("#vis_workpanel_div").removeClass("scrollable");
    $("#ticket_details_view").css({"overflow-x":"hidden", "min-height":($( window ).height()-132-10)+"px", "max-height":($( window ).height()-132-10)+"px", "overflow-y":"auto"});
    $(window).resize(function() {	//resize just happened, pixels changed 
        $("#ticket_details_view").css({"overflow-x":"hidden", "min-height":($( window ).height()-132-10)+"px", "max-height":($( window ).height()-132-10)+"px", "overflow-y":"auto"});
    });
function change_ticket_flag(ticket_id){
	clearInterval(vis_ticket_timer[ticket_id]);
	$('#vis_ticket_'+ticket_id).text(vis_time_string(elapsed_seconds_[ticket_id]));
	vis_ticket_timer_flag_[ticket_id]=false;
}
if("undefined" == typeof vis_ticket_timer_flag_){
	var vis_ticket_timer_flag_ = new Array();
	var elapsed_seconds_ = new Array();
	var vis_ticket_timer = new Array();
}
if((vis_ticket_timer_flag_[<?php echo $ticket_details['ticket_id']; ?>]!=false && vis_ticket_timer_flag_[<?php echo $ticket_details['ticket_id']; ?>]!=null) && typeof vis_ticket_timer[<?php echo $ticket_details['ticket_id']; ?>]!="undefined") {
	vis_ticket_timer_flag_[<?php echo $ticket_details['ticket_id']; ?>]=true;
}
else {
	vis_ticket_timer_flag_[<?php echo $ticket_details['ticket_id']; ?>]=false;
	vis_ticket_timer[<?php echo $ticket_details['ticket_id']; ?>] = '';
}
function vis_time_string(total_seconds,ticket_id) {
    var new_time=total_seconds;
    function pretty_time_string(num) {return (num<10?"0":"")+num;}
    var hours = Math.floor(total_seconds / 3600);
    total_seconds = total_seconds % 3600;
    var minutes = Math.floor(total_seconds / 60);
    total_seconds = total_seconds % 60;
    var seconds = Math.floor(total_seconds);

    hours = pretty_time_string(hours);
    minutes = pretty_time_string(minutes);
    seconds = pretty_time_string(seconds);

    var currentTimeString = hours + ":" + minutes + ":" + seconds;
    vis_set_ticket_time(new_time,ticket_id);
    return currentTimeString;
}
function vis_set_ticket_time(value,ticket_id) {
    <? if($ticket_details['ticket_status'] != 3){  ?>
    if(document.getElementById('vis_ticket_'+ticket_id)!=null) {
        var exdate=new Date();
        exdate.setDate(exdate.getDate()+10);
        var c_value=escape(value) + "; expires="+exdate.toUTCString();
        document.cookie="vis_ticket_time_["+ticket_id+"]="+c_value;
        <? } ?>
    }
    else if(typeof vis_ticket_timer[ticket_id]!="undefined") {
		clearInterval(vis_ticket_timer[ticket_id]);
		vis_ticket_timer_flag_[ticket_id]=false;
	}
}
function vis_toggle_timer(ticket_id) {
    if(vis_ticket_timer_flag_[ticket_id] && typeof vis_ticket_timer[ticket_id]!="undefined") {
		$(".modal-backdrop").remove();
		$(".modal").remove();
		$.ajax({
			url: "index.php?vis_tmpst=new Date().getTime()&vis_module=ticket&vis_operation=new_time_track&vis_static_area=vis_time_track_form&vis_domain_id=<? echo $ticket_details['domain_id']; ?>&vis_ticket_id=<? echo $ticket_details['ticket_id']; ?>&vis_department_id=<? echo $ticket_details['department_id']; ?>&vis_client_id=<? echo $ticket_details['client_id']; ?>",
			dataType: 'html',
			type: 'POST',
			success: function(data) {				
					var $modal = $(data);
					$modal.filter('.modal').modal();
			}
		});
        clearInterval(vis_ticket_timer[ticket_id]);
        $('#vis_ticket_'+ticket_id).text(vis_time_string(elapsed_seconds_[ticket_id]));
        vis_ticket_timer_flag_[ticket_id]=false;
    }
    else if(!vis_ticket_timer_flag_[ticket_id]) {
        if(typeof vis_ticket_timer[ticket_id]!="undefined") clearInterval(vis_ticket_timer[ticket_id]);
        vis_ticket_timer[ticket_id]=setInterval(function() {            
            $("#vis_timer_text_"+ticket_id).removeClass("btn-default").addClass("vh-green-bg");
            elapsed_seconds_[ticket_id]=elapsed_seconds_[ticket_id]+1;
            $('#vis_ticket_'+ticket_id).text(vis_time_string(elapsed_seconds_[ticket_id],ticket_id));
        }, 1000);
        vis_ticket_timer_flag_[ticket_id]=true;
    }
}
elapsed_seconds_[<?php echo $ticket_details['ticket_id'].']='; echo (isset($request_data['vis_ticket_time_'][$ticket_details['ticket_id']]) && is_numeric($request_data['vis_ticket_time_'][$ticket_details['ticket_id']]))?$request_data['vis_ticket_time_'][$ticket_details['ticket_id']]:0; ?>; 
if(elapsed_seconds_[<?php echo $ticket_details['ticket_id']; ?>]!=0 ) { 
	$('#vis_ticket_<?php echo $ticket_details['ticket_id']; ?>').text(vis_time_string(elapsed_seconds_[<?php echo $ticket_details['ticket_id']; ?>]));
    $("#vis_timer_text_<?php echo $ticket_details['ticket_id']; ?>").removeClass("btn-default").addClass("vh-green-bg");
}
$(".selectpicker").selectpicker();
function set_active_tab(tab_id){
	var active = $("#tabs .active").attr("id");
	$("#"+active).removeClass("active");
	$("#"+tab_id).addClass("active").show();
	var parent_div = $("#vis_details_list_<?= $ticket_details['ticket_id'];?>").parent().parent();
	if(parent_div.hasClass("p-l-none") && parent_div.hasClass("p-r-none"))
		parent_div.removeClass("p-l-none").removeClass("p-r-none");
	else if(parent_div.hasClass("no-padder"))
		parent_div.removeClass("no-padder");
		
	if($("#ticket_details_view #tabs #invoices.active").length
	|| $("#ticket_details_view #tabs #history.active").length
	|| $("#ticket_details_view #tabs #link.active").length) 
		parent_div.addClass("no-padder");
	else if($("#ticket_details_view #tabs #time_track.active").length || $("#ticket_details_view #tabs #history.active").length || $("#ticket_details_view #tabs #audit_log.active").length)
		parent_div.addClass("p-l-none").addClass("p-r-none");	
}
function remove_label(label_id, ticket_id){
	$('#vis_ticket_labels_list').visExecution('load_operations', {'vis_module':'ticket', 'vis_operation':'remove_ticket_label', 'vis_action':'remove_label', 'vis_ticket_id':ticket_id, 'vis_label_id':label_id, 'department_id':<?= $ticket_details['department_id']; ?>});
}
function lock_ticket(ticket_id, lock_flag){
    var lock_flag = (lock_flag) ? 'lock' : 'unlock';
    $('#vis_lock_ticket_'+ticket_id).visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'lock_ticket', 'vis_action':lock_flag, 'vis_ticket_id':ticket_id});
}
function reset_timer_<?= $ticket_details['ticket_id'];?>(){
    elapsed_seconds_[<?= $ticket_details['ticket_id']; ?>]=0;
    $('#vis_ticket_<?= $ticket_details['ticket_id']; ?>').text('');
    document.cookie='vis_ticket_time_[<?= $ticket_details['ticket_id'];?>]=0';
    $('#vis_timer_text_<?= $ticket_details['ticket_id']; ?>').addClass('btn-default').removeClass('vh vh-green-bg');
}
function load_edit_customfields(){
    $('#vis_details_list_<? echo $ticket_details['ticket_id']; ?>').visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'custom_field_details', 'vis_ticket_id':<? echo $ticket_details['ticket_id']; ?>, 'vis_department_id':<? echo $ticket_details['department_id']; ?>});
    set_active_tab('custom_fields');
}
function load_customfields_details(){
    $('#vis_details_list_<? echo $ticket_details['ticket_id']; ?>').visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'get_details', 'vis_action':'details', 'vis_ticket_id':<? echo $ticket_details['ticket_id']; ?>, 'vis_department_id':<? echo $ticket_details['department_id']; ?>});set_active_tab('ticket_details');
 }
function show_access()
{
       $("#vis_global_msg_div").visInterface("load_global_message", "<?php echo  $vis_language['MSGACCSSDND'] ;?>"); 
         return false; 
}
function update_owner(staff_id, update_owner) { // update owner properties i.e. assign new/remove 
        $('#vis_global_msg_div').visExecution('load_operations', {'vis_module': 'ticket', 'vis_operation': 'update_properties', 'vis_action': 'staff', 'vis_ticket_id': <?= $ticket_details['ticket_id']?>, 'vis_update_id': staff_id, 'vis_sub_action': update_owner});
}
function toggle_assigned_owner() { // show/hide assigned to (owner)
	$("#vis_assigned_to_<?= $ticket_details['ticket_id'];?>").toggle();
	if($("#vis_assigned_to_<?= $ticket_details['ticket_id'];?>").is(":visible")) {
		$("#vis_assigned_to_<?= $ticket_details['ticket_id'];?>").next().removeClass('m-t');
	} else {
		$("#vis_assigned_to_<?= $ticket_details['ticket_id'];?>").next().addClass('m-t');
	}
}
function update_properties(updateid,serialid){
	if(serialid==1) $('#vis_global_msg_div').visExecution('load_operations', {'vis_module': 'ticket', 'vis_operation': 'update_properties', 'vis_action': 'department', 'vis_ticket_id': <?= $ticket_details['ticket_id']; ?>, 'vis_update_id': updateid});
	else if(serialid==2) $('#vis_global_msg_div').visExecution('load_operations', {'vis_module': 'ticket', 'vis_operation': 'update_properties', 'vis_action': 'status', 'vis_ticket_id': <?= $ticket_details['ticket_id']; ?>,  'vis_update_id': updateid});
	else if(serialid==3) $('#vis_global_msg_div').visExecution('load_operations', {'vis_module': 'ticket', 'vis_operation': 'update_properties', 'vis_action': 'priority', 'vis_ticket_id': <?= $ticket_details['ticket_id']; ?>,  'vis_update_id': updateid});
	else if(serialid==4) $('#vis_global_msg_div').visExecution('load_operations', {'vis_module': 'ticket', 'vis_operation': 'update_properties', 'vis_action': 'type', 'vis_ticket_id': <?= $ticket_details['ticket_id']; ?>,  'vis_update_id': updateid});
	else if(serialid==5) $('#vis_global_msg_div').visExecution('load_operations', {'vis_module': 'ticket', 'vis_operation': 'update_properties', 'vis_action': 'flag', 'vis_ticket_id': <?= $ticket_details['ticket_id']; ?>,  'vis_update_id': updateid});
	else if(serialid==6) $('#vis_global_msg_div').visExecution('load_operations', {'vis_module': 'ticket', 'vis_operation': 'update_properties', 'vis_action': 'level', 'vis_ticket_id': <?= $ticket_details['ticket_id']; ?>,  'vis_update_id': updateid});
	else if(serialid==7) $('#vis_global_msg_div').visExecution('load_operations', {'vis_module': 'ticket', 'vis_operation': 'update_properties', 'vis_action': 'ticket_category', 'vis_ticket_id': <?= $ticket_details['ticket_id']; ?>,  'vis_update_id': updateid});
	else if(serialid==8) $('#vis_global_msg_div').visExecution('load_operations', {'vis_module': 'ticket', 'vis_operation': 'update_properties', 'vis_action': 'ticket_subcateogy', 'vis_ticket_id': <?= $ticket_details['ticket_id']; ?>,  'vis_update_id': updateid});
	else if(serialid==9) $('#vis_global_msg_div').visExecution('load_operations', {'vis_module': 'ticket', 'vis_operation': 'update_properties', 'vis_action': 'ticket_item', 'vis_ticket_id': <?= $ticket_details['ticket_id']; ?>,  'vis_update_id': updateid});
	else if(serialid==10) $('#vis_global_msg_div').visExecution('load_operations', {'vis_module': 'ticket', 'vis_operation': 'update_properties', 'vis_action': 'assets_location', 'vis_ticket_id': <?= $ticket_details['ticket_id']; ?>,  'vis_update_id': updateid});
}
function show_services(service_item_id){
	$('#services_detail').visExecution('load_operations', {'vis_module':'ticket', 'vis_operation':'get_service_details', 'vis_service_item_id':service_item_id,'vis_total_cost':'<?= $service_ticket_details[0]['total_cost'];?>','vis_quantity':'<?= $service_ticket_details[0]['quantity'];?>','vis_total_cost':'<?= $service_ticket_details[0]['total_cost'];?>','vis_service_id':'<? echo $service_ticket_details[0]['service_id'];?>','vis_ticket_id':'<? echo $ticket_details['ticket_id'];?>','vis_dept_id':'<?= $ticket_details['department_id'];?>'});
	$('#services_detail').toggle();
	$('#vis_recipients_people').hide();
	$('#vis_ticket_tags').hide();
	$('#vis_ci_cmdb').hide();
	$('#vis_problem_cmdb').hide();
	$('#vis_changes_cmdb').hide();
	$('#vis_ticket_task').hide();	
	$('#vis_ticket_approvals').hide();	
}
function show_recipients(){
	$('#vis_recipients_people').toggle();
	$('#services_detail').hide();
	$('#vis_ticket_tags').hide();
	$('#vis_ci_cmdb').hide();
	$('#vis_problem_cmdb').hide();
	$('#vis_changes_cmdb').hide();
	$('#vis_ticket_task').hide();
	$('#vis_ticket_approvals').hide();
}
function show_tags(){
	$('#vis_ticket_tags').toggle();
	$('#services_detail').hide();
	$('#vis_recipients_people').hide();
	$('#vis_ci_cmdb').hide();
	$('#vis_problem_cmdb').hide();
	$('#vis_changes_cmdb').hide();
	$('#vis_ticket_task').hide();
	$('#vis_ticket_approvals').hide();
}
function show_ci_cmdb(asset_id){
	if(asset_id!='0'){
		$('#vis_ci_cmdb').html('');
		$('#vis_ci_cmdb').visExecution('load_operations', {'vis_module':'ticket', 'vis_operation':'get_ci_details', 'vis_asset_id':''+asset_id+'','vis_ticket_id':'<? echo $ticket_details['ticket_id'];?>','vis_dept_id':'<?= $ticket_details['department_id'];?>','vis_attach_id':'<?= $attach_ci_details[0]['attach_id'];?>'});
	}
	$('#vis_ci_cmdb').toggle();
	$('#vis_ticket_tags').hide();
	$('#services_detail').hide();
	$('#vis_recipients_people').hide();
	$('#vis_problem_cmdb').hide();
	$('#vis_changes_cmdb').hide();
	$('#vis_ticket_task').hide();
	$('#vis_ticket_approvals').hide();
}
function show_problem_cmdb(problem_id){
	if(problem_id!='0'){
		$('#vis_problem_cmdb').html('');
		$('#vis_problem_cmdb').visExecution('load_operations', {'vis_module':'ticket', 'vis_operation':'get_problem_details', 'vis_problem_id':''+problem_id+'','vis_ticket_id':'<? echo $ticket_details['ticket_id'];?>','vis_dept_id':'<?= $ticket_details['department_id'];?>','vis_attach_id':'<?= $attach_problem_details[0]['attach_id'];?>'});
	}
	$('#vis_problem_cmdb').toggle();
	$('#vis_ci_cmdb').hide();
	$('#vis_ticket_tags').hide();
	$('#services_detail').hide();
	$('#vis_recipients_people').hide();
	$('#vis_changes_cmdb').hide();
	$('#vis_ticket_task').hide();
	$('#vis_ticket_approvals').hide();
}
function show_changes_cmdb(changes_id){
	if(changes_id!='0'){
		$('#vis_changes_cmdb').html('');
		$('#vis_changes_cmdb').visExecution('load_operations', {'vis_module':'ticket', 'vis_operation':'get_changes_details', 'vis_changes_id':''+changes_id+'','vis_ticket_id':'<? echo $ticket_details['ticket_id'];?>','vis_dept_id':'<?= $ticket_details['department_id'];?>','vis_attach_id':'<?= $attach_changes_details[0]['attach_id'];?>'});
	}
	$('#vis_changes_cmdb').toggle();
	$('#vis_problem_cmdb').hide();
	$('#vis_ci_cmdb').hide();
	$('#vis_ticket_tags').hide();
	$('#services_detail').hide();
	$('#vis_recipients_people').hide();
	$('#vis_ticket_task').hide();
	$('#vis_ticket_approvals').hide();
}
function show_ticket_task(){
	$('#vis_ticket_task').html('');
	$('#vis_ticket_task').visExecution('load_operations', {'vis_module':'ticket', 'vis_operation':'get_task_details','vis_ticket_id':'<? echo $ticket_details['ticket_id'];?>','vis_dept_id':'<?= $ticket_details['department_id'];?>'});
	$('#vis_ticket_task').toggle();
	$('#vis_changes_cmdb').hide();
	$('#vis_problem_cmdb').hide();
	$('#vis_ci_cmdb').hide();
	$('#vis_ticket_tags').hide();
	$('#services_detail').hide();
	$('#vis_recipients_people').hide();
	$('#vis_ticket_approvals').hide();
}

 function show_approvals(){
	$('#vis_ticket_approvals').toggle();
	$('#vis_recipients_people').hide();
	$('#services_detail').hide();
	$('#vis_ticket_tags').hide();
	$('#vis_ci_cmdb').hide();
	$('#vis_problem_cmdb').hide();
	$('#vis_changes_cmdb').hide();
	$('#vis_ticket_task').hide();
 }
	
		function change_status(id, status, staff_id) {
	
		var data = { vis_ticket_id:"<?=$ticket_details['ticket_id'];?>", approve_id:id, status:status, staff_id:staff_id};
		$.ajax({
			url: 'index.php?vis_module=<?=$operation['vis_module'];?>&vis_operation=change_approve_status',
			data: data,
			type: "POST",
			success: function(data) {
				
				$('#vis_global_msg_div').visInterface('load_global_message', '<?php echo $vis_language['MSGSUCCOPRT'];?>');$('#vis_details_list_<? echo $ticket_details['ticket_id']; ?>').visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'get_details', 'vis_action':'details', 'vis_ticket_id':'<? echo $ticket_details['ticket_id']; ?>', 'open_approvals':'yes'});
			},
			error: function(xhr, ajaxOptions, thrownError) {$("#vis_global_msg_div").visInterface("load_global_message", "Error: "+xhr.status+" - "+thrownError);}
		});
		
	}
</script>
