<label class="col-sm-1 control-label"><? echo $vis_language['TXTRECIPIENTS']; ?></label>
<div class="col-sm-11">
	<? 
	if(trim($ticket_details['recipients'])!=""){
		$recepients=explode(',', $ticket_details['recipients']);						
		for($i=0;$i<count($recepients);$i++){?>
		<div class="btn-group pull-left<? if($i>0) echo ' m-l-sm m-b-xs'?>">
            <span class="btn btn-xs alert-info"><?= trim($recepients[$i])?></span>
			<button type="button" class="btn btn-xs alert-info" <? if(VIS_MODIFY_RECEPIENT_AND_PEOPLE_ACCESS==1){?>data-dismiss="alert"<?}?> onclick="check_remove_access1(<?= VIS_MODIFY_RECEPIENT_AND_PEOPLE_ACCESS;?>,'<?= trim($recepients[$i]);?>');"><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($ticket_details['recipients']!="") echo ' m-l-sm';?>">
			<form id="vis_ticket_recp_form_<?= $ticket_details['ticket_id'] ?>" name="vis_ticket_recp_form_<?= $ticket_details['ticket_id'] ?>" target="vis_hidden_frame" onsubmit="check_add_access1(<?= VIS_MODIFY_RECEPIENT_AND_PEOPLE_ACCESS;?>);">
				<input class="vis_live_td_input vis_ticket_new_recipients m-none" name="vis_newrcpt" id="vis_new_recpt_name_<?= $ticket_details['ticket_id'] ?>" placeholder="<?= $vis_language['TXTTYPEHEREANDPRESSENTERTOSAVE']; ?>" data-resize="no" data-module="vis_newrcpt" type="text" style="padding: 0px 5px;">
				<script type="text/javascript">
					$(document).ready(function() {
						$("#vis_new_recpt_name_<?= $ticket_details['ticket_id'] ?>").tokenInput(
							"index.php?vis_module=client&vis_operation=list_clients&vis_domain=<? echo $ticket_details['domain_id']; ?>",{
								theme: "facebook",
								searchDelay: 500,
								minChars: 3,
								queryParam: "vis_data",
								propertyToSearch: "email",
								tokenValue: "email",
								resultsFormatter: function(item){ return "<li>" + "<div style='display: inline-block;' class='m-xs'><div class='full_name'>" + item.full_name + " < " + item.email + " ></div></div></li>" },
								tokenFormatter: function(item) { return "<li><p>" + item.email + "</p></li>" }
							}
						);
						$("div.token-input-dropdown-facebook").css('width',$(".token-input-list-facebook").width()+2+'px');
						$("#token-input-vis_new_recpt_name_<?= $ticket_details['ticket_id']?>").parent().parent().css('border','0');
                        $('#token-input-vis_new_recpt_name_<?= $ticket_details['ticket_id'] ?>').each(resize_input_rec_pe_tags).focusout(resize_input_rec_pe_tags);
						get_participent_count();
					});
					function get_participent_count(){
						var data = {'vis_ticket_id':'<?= $ticket_details['ticket_id'];?>'};   
							$.ajax({
								url: 'index.php?vis_module=ticket&vis_operation=get_ticket_participent_count',
								data: data,
								type: "POST",
								dataType: "json",
								success: function(data) {
									$('#participient_count').html(data);
								},
								error: function(xhr, ajaxOptions, thrownError) {$("#vis_global_msg_div").visInterface("load_global_message", "Error: "+xhr.status+" - "+thrownError);}
							});
					}
					function check_remove_access1(access,recp)
					{
						if(access==1)
						$('#vis_recipients_<?= $ticket_details['ticket_id']?>').visExecution('load_operations', {'vis_module':'ticket', 'vis_operation':'remove_ticket_recp', 'vis_action':'remove_recipient', 'vis_ticket_id':<?= $ticket_details['ticket_id']?>, 'vis_email': <?= recp;?>,'vis_loading':'no'});
						else
						{
						   $("#vis_global_msg_div").visInterface("load_global_message", "<?php echo  $vis_language['MSGACCSSDND'] ;?>"); 
						   return false; 
						}
					}
					function check_add_access1(access)
					{
						if(access==1)
						$('#vis_recipients_<?= $ticket_details['ticket_id'] ?>').visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'add_live_recipient', 'vis_form':'vis_ticket_recp_form_<?= $ticket_details['ticket_id'] ?>', 'vis_action':'add_recipient', 'vis_ticket_id':<?= $ticket_details['ticket_id'] ?>,'vis_loading':'no'});
						else
						{
						   $("#vis_global_msg_div").visInterface("load_global_message", "<?php echo  $vis_language['MSGACCSSDND'] ;?>"); 
						   return false; 
						}
					}
				</script>
			</form>							
		</div>
	</div>
</div>
