<? global $vis_language; ?>
<div class="modal-dialog">
  <div class="modal-content">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal">&times;</button>
      <h4 class="modal-title"><? echo $title;?></h4>
    </div>
    <div class="modal-body">
     <div class="row">
                <div class="col-sm-12">
                    <form role="form"  target="vis_hidden_frame" class="form-horizontal" name="vis_client_merge_form" id="vis_client_merge_form">
                        <div class="form-group">
                            <label class="col-sm-3 control-label txt_nowrap"><? echo $vis_language['TXTCLIENT']; ?></label>
                            <div class="col-sm-9">
                                <input class="form-control input-sm" type="text" name="vis_email" id="vis_email" value=""/>
                                <input class="form-control input-sm" type="hidden" name="vis_tempemail" id="vis_tempemail" value=""/>
                                <script type="text/javascript">
                                    $(document).ready(function() {
                                        $("#vis_email").tokenInput(
                                            "index.php?vis_module=client&vis_operation=list_clients&vis_parent_id=0&vis_notmatch_id=<? echo $operation['vis_client_id']; ?>&vis_domain=<? echo $operation['vis_domain_id']; ?>",
                                            {
                                                theme: "facebook",
                                                searchDelay: 300,
                                                minChars: 3,
                                                queryParam: "vis_data",
                                                propertyToSearch: "id",
                                                tokenValue: "id",
                                                tokenLimit: 1,
                                                preventDuplicates: true,
                                                resultsFormatter: function(item) {
													var contact= ( item.contact_number!='' && item.email!='')? item.email+' - '+item.contact_number : ((item.contact_number!='' && item.email=='')? item.contact_number:item.email );
                                                    return "<li>" + "<div style='display: inline-block; padding-left: 10px;'><div class='full_name'>" + item.full_name + " < " + contact + " ></div></div></li>";
                                                },
                                                tokenFormatter: function(item) {
													var contact= (item.email!='')? item.email:item.contact_number;
                                                    return "<li><p>" + contact + "</p></li>";
                                                }
                                            }
                                        );
                                        $("div.token-input-dropdown-facebook").css('width', $(".token-input-list-facebook").width() + 2 + 'px');
                                        $("#token-input-vis_email").parent().css('width','100%');
                                    });
                                </script>
                            </div>
                        </div>
                        <? if($action=='merge_clients'){ ?>
                        <div class="b-t m-b-md"></div>
                        <div class="col-md-12">
                            <div class="form-group">
                                <label class="col-sm-3 control-label"><? echo $vis_language['TXTINVOICES']; ?></label>
                                <div class="col-sm-9">
                                   <label class="checkbox-inline i-checks">
                                   <input type="checkbox" value="1" id="vis_invoice" name="vis_invoice" checked="checked"><i></i>
                                   </label>
                                </div>
                             </div>
                             <div class="form-group">
                                <label class="col-sm-3 control-label"><? echo $vis_language['TXTTICKET']; ?></label>
                                <div class="col-sm-9">
                                   <label class="checkbox-inline i-checks">
                                   <input type="checkbox" value="1" id="vis_ticket" name="vis_ticket" checked="checked"><i></i>
                                   </label>
                                </div>
                             </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label"><? echo $vis_language['TXTNOTE']; ?></label>
                                <div class="col-sm-9">
                                   <label class="checkbox-inline i-checks">
                                   <input type="checkbox" value="1" id="vis_note" name="vis_note" checked="checked"><i></i>
                                   </label>
                                </div>
                             </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label"><? echo $vis_language['TXTCREDIT']; ?></label>
                                <div class="col-sm-9">
                                   <label class="checkbox-inline i-checks">
                                   <input type="checkbox" value="1" id="vis_credit" name="vis_credit" checked="checked"><i></i>
                                   </label>
                                </div>
                             </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label"><? echo $vis_language['TXTCONTACTS']; ?></label>
                                <div class="col-sm-9">
                                   <label class="checkbox-inline i-checks">
                                   <input type="checkbox" value="1" id="vis_contacts" name="vis_contacts" checked="checked"><i></i>
                                   </label>
                                </div>
                             </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label"><? echo $vis_language['TXTDEPARTMENTACCESS']; ?></label>
                                <div class="col-sm-9">
                                   <label class="checkbox-inline i-checks">
                                   <input type="checkbox" value="1" id="vis_dept_access" name="vis_dept_access" checked="checked"><i></i>
                                   </label>
                                </div>
                             </div>
                       </div>
                        <? } ?>
                        <input type="hidden" name="vis_client_id" value="<? echo $operation['vis_client_id']; ?>" />
                        <input type="hidden" name="vis_client_email" value="<? echo $operation['vis_client_email']; ?>" />
                        
						<input type="hidden" name="vis_domain_id" value="<? echo $operation['vis_domain_id']; ?>" />
                    </form>
                </div>
            </div>
         </div>
    <div class="modal-footer">
	  <a class="btn btn-primary" onclick="$(this).visExecution('submit_form',{'vis_module':'client', 'vis_operation':'<?= $action ?>', 'vis_form':'vis_client_merge_form'});"><? echo $vis_language['TXTUPDATE']; ?></a>
    </div>
  </div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
