<? $vis_ticket_id=(isset($vis_ticket_id) && $vis_ticket_id!="")?$vis_ticket_id : $ticket_details['ticket_id']; ?>
<label class="col-sm-1 control-label"><? echo $vis_language['TXTTAGS']; ?></label>
<div class="col-sm-11">
<? if($tag_details!=-1) for($i=0;$i<count($tag_details);$i++){?>
	<div class="btn-group pull-left<? if($i>0) echo ' m-l-sm m-b-xs'?>">
        <span class="btn btn-xs alert-success"><?= $tag_details[$i]['label_name']?></span>
		<button type="button" class="btn btn-xs alert-success" data-dismiss="alert" onclick="$('#vis_tags_<?= $vis_ticket_id ?>').visExecution('load_operations', {'vis_module':'ticket', 'vis_operation':'remove_ticket_label', 'vis_action':'remove_tags', 'vis_ticket_id':<?= $vis_ticket_id?>, 'vis_label_id':<?= $tag_details[$i]['label_id']?>,'vis_loading':'no'});"><span aria-hidden="true"><i class="vh vh-cross"></i></span><span class="sr-only">Close</span></button>
	</div>
	<? 
	} ?>
	<div class="m-b-none pull-left">
		<div class="row<? if($tag_details!=-1 && count($tag_details)>0) echo ' m-l-sm'; else echo ' m-l-none';?>">
			<form id="vis_ticket_tag_form_<?= $vis_ticket_id ?>" name="vis_ticket_tag_form_<?= $vis_ticket_id ?>" target="vis_hidden_frame" onsubmit="$('#vis_tags_<?= $vis_ticket_id?>').visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'add_live_tag', 'vis_action':'details', 'vis_form':'vis_ticket_tag_form_<?= $vis_ticket_id ?>', 'vis_ticket_id':<?= $vis_ticket_id?>,'vis_loading':'no'})">
				<input class="vis_live_td_input vis_ticket_new_recipients m-none" name="vis_newtag" id="vis_new_tag_name_<?= $vis_ticket_id?>" placeholder="<?= $vis_language['TXTTYPEHEREANDPRESSENTERTOSAVE']; ?>" data-resize="no" data-module="vis_tags" type="text" style="padding: 0px 5px;">
				<script type="text/javascript">
					/*$(document).ready(function() {
						$("#vis_new_tag_name_<?= $vis_ticket_id?>").tokenInput(
							"index.php?vis_module=ticket&vis_operation=get_tag",{
								theme: "facebook",
								searchDelay: 500,
								minChars: 3,
								queryParam: "vis_data",
								propertyToSearch: "label_name",
								tokenValue: "label_name",
								resultsFormatter: function(item){ return "<li>" + "<div style='display: inline-block;' class='m-xs'><div class='full_name'>" + item.label_name + "</div></div></li>" },
								tokenFormatter: function(item) { return "<li><p>" + item.label_name + "</p></li>" }
								
							}
						);
						$("div.token-input-dropdown-facebook").css('width',$(".token-input-list-facebook").width()+2+'px');
						$("#token-input-vis_new_tag_name_<?= $vis_ticket_id?>").parent().parent().css('border','0');
                        $('#token-input-vis_new_tag_name_<?= $vis_ticket_id?>').each(resize_input_rec_pe_tags).focusout(resize_input_rec_pe_tags);
						get_tags_count();	
				});*/ 
				function get_tags_count(){
					var data = {'vis_ticket_id':'<?= $vis_ticket_id?>'};   
						$.ajax({
							url: 'index.php?vis_module=ticket&vis_operation=get_ticket_tags_count',
							data: data,
							type: "POST",
							dataType: "json",
							success: function(data) {
									$('#tags_count').html(data);
							},
							error: function(xhr, ajaxOptions, thrownError) {$("#vis_global_msg_div").visInterface("load_global_message", "Error: "+xhr.status+" - "+thrownError);}
						});
				}
				</script>
			</form>
		</div>
	</div>
</div>