<? /* if($msg==1){ ?>
<div id="link_div">
    <div class="col-sm-12 text-center"><a class="link"><?php echo $vis_language['MSGISSUELIKED']; ?></a> </div>  
</div>
<?php }*/
if($operation['redmine']=='createissue'){ ?>
<div id="link_div">
    <div class="col-sm-12 text-center"><a class="link" href="javascript:void(0);" onclick="get_redmine_issue();"><?php echo $vis_language['TXTLINKISSUE'];?></a> <?php echo $vis_language['TXTOR']; ?> <a class="link" href="javascript:void(0);" onclick="get_create_issue();"><?php echo $vis_language['TXTCREATEISSUE']; ?></a></div>  
</div>
<div class="row m-b"></div>
<form method="post" role="form" class="form-horizontal" name="vis_redmine_form" id="vis_redmine_form">
	<?php if($vis_hide!=1) { ?>
	 <div class="form-group m-b">          
		<div class="col-sm-5" >
         <label for="taskPriority"><? echo $vis_language['TXTPROJECTS'];?></label>
			<select class="form-control input-sm selectpicker" id="vis_project" name="vis_project" onchange="get_togale_create(this.value);"<?php if(count($projectAll['projects']) > 5) $src= 'data-live-search="true"' ; ?>>
			<option value="0" ><?php echo $vis_language['TXTSELCTPROJECT'];?></option>
			<?
			   for($i=0;$i<count($projectAll['projects']);$i++) {			  
			   echo '<option value="'.$projectAll['projects'][$i]['id'].'" >'.$projectAll['projects'][$i]['name'].'</option>'; } ?>
			</select><br/><br/>
		</div>			
		<div class="col-sm-7" >
         <label for="taskPriority"><? echo $vis_language['TXTSUBJECT'];?></label>
			<div class="">
				<input type="text" class="form-control input-sm" name="vis_subject" id="vis_subject" value="<?=$ticket_details['subject'];?>" />
             </div>
		</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 id="btn_create" class="btn btn-primary" onclick="$(this).visExecution('submit_form',{'vis_module':'ticket', 'vis_operation':'create_redmine_issue', 'vis_form':'vis_redmine_form'});$(this).button('loading');"><? echo $vis_language['TXTCREATE']; ?></a>
            </div>
         </div>
         <input type="hidden" name="vis_ticketid" id="vis_ticketid" value="<?=$ticket_details['ticket_id'];?>" />  
         <input type="hidden" name="vis_domain" id="vis_domain" value="<?=$operation['vis_domain'];?>" />
	<?php } ?> 
</form>
<div class="text-center" id="issue_id_error" style="display:none;"></div>
<script>
$('#btn_create').hide();
function get_togale_create(pid){ 
	if(pid!=0) { $('#btn_create').show(); }else{$('#btn_create').hide();}
}
</script>
<?php }

if($operation['redmine']=='linkissue'){  
	 if($redmine_link_details !=-1 || $msg ==1){  ?>
	<form method="post" role="form" class="form-horizontal" name="vis_redmine_form" id="vis_redmine_form">
	<div class="col-sm-6" id="link_button">
         <a class="link" target="_blank" href="<?=$check_redmine_status[0]['billing_url'].'/issues/'.$issue_details['issue']['id']; ?>"><?= $vis_language['TXTVIEWISSUEINREDMINE'];?></a>
    </div>
    <div class="col-sm-6 text-right m-b" id="unlink_button">
         <a class="btn btn-primary" onclick="$('#vis_details_list').visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'unlink_redmine_issue','vis_domain':'<?=$operation['vis_domain'];?>','vis_ticketid':'<?=$operation['vis_ticketid'];?>'});$(this).button('loading');"><?= $vis_language['TXTUNLINKISSUE'];?></a>  <br/>
       </div>
</form>
<table class="table table-hover b-t b-light m-b">
   <thead class="table_head">
      <tr>
         <th class="txt_nowrap"><?= $vis_language['TXTISSUEID'];?></th>
		 <th class="txt_nowrap"><?= $vis_language['TXTSUBJECT'];?></th>         
         <th class="txt_nowrap"><?= $vis_language['TXTPROJECTNAME'];?></th>
		 <th class="txt_nowrap"><?= $vis_language['TXTSTATUS'];?></th>
		 <th class="txt_nowrap"><?= $vis_language['TXTPRIORITY'];?></th>
      </tr>
   </thead>
   <tbody><tr>
<?   echo '<td>'.$issue_details['issue']['id'].'</td>';
	 echo '<td>'.$issue_details['issue']['subject'].'</td>';
	 echo '<td>'.$issue_details['issue']['project']['name'].'</td>';	 
     echo '<td>'.$issue_details['issue']['status']['name'].'</td>';
	 echo '<td>'.$issue_details['issue']['priority']['name'].'</td>';
	 ?>     
     </tr>     
   </tbody>
</table>
<? }else{ ?>
<div id="link_div">
    <div class="col-sm-12 text-center"><a class="link" href="javascript:void(0);" onclick="get_redmine_issue();"><?php echo $vis_language['TXTLINKISSUE'];?></a> <?php echo $vis_language['TXTOR']; ?> <a class="link" href="javascript:void(0);" onclick="get_create_issue();"><?php echo $vis_language['TXTCREATEISSUE']; ?></a> </div>  
</div>
<div class="row m-b"></div>
<form method="post" role="form" class="form-horizontal" name="vis_redmine_form" id="vis_redmine_form">
	<?php if($vis_hide!=1) { ?>
	 <div class="form-group m-b">          
		<div class="col-sm-5" >
         <label for="taskPriority"><? echo $vis_language['TXTPROJECTS'];?></label>
			<select class="form-control input-sm selectpicker" id="vis_project" name="vis_project" onchange="get_issue_list(this.value);"<?php if(count($projectAll['projects']) > 5) $src= 'data-live-search="true"' ; ?>>
			<option value="0" ><?php echo $vis_language['TXTSELCTPROJECT'];?></option>
			<?
			   for($i=0;$i<count($projectAll['projects']);$i++) {			  
			   echo '<option value="'.$projectAll['projects'][$i]['id'].'" >'.$projectAll['projects'][$i]['name'].'</option>'; } ?>
			</select><br/><br/>
		</div>			
		<div class="col-sm-5" >
         <label for="taskPriority"><? echo $vis_language['TXTISSUE'];?></label>
			<div id="select_issue">
				<select class="form-control input-sm selectpicker" id="vis_issue" name="vis_issue" >
				<option value="0" ><? echo $vis_language['TXTSELECTISSUE'];?></option>
				</select>
			</div>
		</div>                
        
      </div>  
	  <div class="col-sm-12 text-right m-b" id="link_button">
         <a class="btn btn-primary" id="btnlink" onclick="vis_link_issue();$(this).button('loading');"><?php echo $vis_language['TXTLINKISSUE'];?></a><br/><br/>
      </div>
	<?php } ?> 
		<div style="height:100px;"></div>
</form>
<div class="text-center" id="issue_id_error" style="display:none;"></div>
<script>
$('#link_button').hide();
/*$('#disp_jira_issue').visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'get_jira_link_issue','vis_domain':'<?=$operation['vis_domain'];?>','vis_ticketid':'<?=$operation['vis_ticketid'];?>'});*/
function vis_link_issue(){
	var issue_hash=$('#vis_issue').val(); 
	var visproject=$('#vis_project').val();
	if(issue_hash==0){
		$("#vis_global_msg_div").visInterface("load_global_message", "<? echo $vis_language['TXTSELECTISSUE'];?>"); 
		$("#btnlink").button(reset);
		return false;
	}else{	
		$('#vis_details_list').visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'link_redmine_issue','vis_project':''+visproject+'','vis_issue':''+issue_hash+'','vis_domain':'<?=$operation['vis_domain'];?>','vis_ticket_id':'<?=$operation['vis_ticketid'];?>'});
		//$('#redmine' ).addClass('txt-red');
		//$('#redmine').removeClass('link');
	}
	
}

function get_issue_list(pid){ 
	if(pid!=0) { $('#link_button').show(); }else{$('#link_button').hide();}
	$('#select_issue').visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'get_issue','vis_project': pid });
}
</script> 
<? } 
} ?>
<!--<div id="vis_details_list"></div>-->
