<? global $vis_language;?>
<section id="breadcrumb" class="row m-b m-l-none m-r-none">
    <div class="col-sm-6">
        <h3 class="m-b-xs text-black"><? echo $vis_language['TXTIMPORT']; ?></h3>
        <ul class="breadcrumb bg-empty no-border m-b-xxs no-padder">
            <li><a class="link" href="#/home/quick_view/<? echo $vis_language['TXTHOME']; ?>"><? echo $vis_language['TXTHOME']; ?></a></li>
         <li><a class="link" href="#/setting/setting_menu/<? echo $vis_language['TXTSETTINGS'];?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTSETTINGS'];?>',{'vis_module':'setting','vis_operation':'setting_menu'});"><? echo $vis_language['TXTSETTINGS']; ?></a></li>
         <li><a  class="link" href="#/setting/view_staff/<? echo $vis_language['TXTSTAFF'];?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTSTAFF'];?>',{'vis_module':'setting','vis_operation':'view_staff'});" class="link"><? echo $vis_language['TXTSTAFF']; ?></a> </li>
         <li class="active"><?echo $vis_language['TXTIMPORT'];?></li>
        </ul>
    </div>
</section>
<section class="padder">
    <section class="panel panel-default">
        <header class="panel-heading sub_header"><?=$vis_language['TXTIMPORT']?></header>
        <div class="panel-body">
            <form class="form-horizontal" role="form" id="vis_client_import_form" name="vis_client_import_form" method="post">
				<input type="hidden" name="vis_client_id" id="vis_client_id" value="<? echo $operation['vis_client_id']; ?>" />
				<div class="form-group">
                     <label class="col-sm-2 control-label p-d-sm"><?=$vis_language['TXTSENDLOGINDETAILS']?></label>
                     <div class="col-sm-10">
                        <select name="vis_send_email" class="form-control input-sm selectpicker" <? if(count($email_templates)>10) echo 'data-live-search="true"';?>>
                           <option value="0"><?=$vis_language['TXTDONOTSENDEMAIL']?></option>
                           <?php if($email_templates!=-1) for($i=0;$i<count($email_templates);$i++) echo '<option value="'.$email_templates[$i]['etemplate_id'].'">'.$email_templates[$i]['etemplate_name'].'</option>'; ?>
                        </select>
                     </div>
                  </div>

                  <div class="form-group">
                     <label class="col-sm-2 control-label p-d-sm"><? echo $vis_language['TXTASGNDEPT']; ?></label>
                     <div class="col-sm-10">
                         <div class="radio i-checks m-r-lg pull-left"><label>
                        <input type="radio" name="vis_access" checked="checked" id="vis_access_yes" value="0"/><i></i>
                        <? echo $vis_language['TXTYES']; ?></label></div>
                        <div class="radio i-checks m-r-lg pull-left"><label>
                        <input type="radio" name="vis_access" id="vis_access_no" value="1"/><i></i>
                        <? echo $vis_language['TXTNO']; ?>
                        </label></div>
                     </div>
                  </div>
                  <div id="department_access" >
					<div class="form-group">
						 <label class="col-sm-2 control-label p-d-sm"><? echo $vis_language['TXTDEPARTMENTACCESS']; ?></label>
						 <div class="col-sm-10">
							 <label class="checkbox-inline i-checks">
							<input type="checkbox"  value="0" id="vis_department_all" name="vis_department_all"  checked="checked" onchange="toggle_dept_list();" <? if($department_details['department_access']==0) echo ' checked="checked"'; ?> /><i></i> <? echo $vis_language['TXTALLDEPARTMENTS']; ?>
							</label>
						 </div>
					  </div>

						<div id="vis_dept_list_section" class="form-group" style="<?= ($department_details['department_access']==0)?'display:none':'';?>">
							<label class="col-sm-2 control-label"></label>
								<div class="col-sm-8">
									<div class="dept_access_list">
								   <? $dept_list=array();
									  for($i=0;$i<count($department_details);$i++) { ?>
								   <label class="checkbox-inline i-checks">
								   <input type="checkbox"  value="<? echo $department_details[$i]['department_id']; ?>" id="vis_department" name="vis_department[]" /> <i></i><? echo $department_details[$i]['domain_name'].' :: '.$department_details[$i]['department_name']; ?></label><br/>
								   <?
									  $dept_list[]=$department_details[$i]['department_id'];
									  } ?>
								</div>
							</div>
						 </div>
                   </div>
                      <div class="form-group">
               <label class="col-sm-2 control-label p-d-sm"><? echo $vis_language['TXTSTATUS']; ?></label>
               <div class="col-sm-1">
                  <label class="switch">
                  <input type="checkbox" checked="checked" name="vis_status"  id="vis_status">
                  <span ></span>
                  </label>
               </div>
            </div>

            <input type="hidden" name="vis_department_count" id="vis_department_count" value="<? echo count($department_details); ?>" />
            <input type="hidden" name="vis_group" id="vis_group" value="1" />
				<div class="form-group">
					<label for="vis_csvfile" class="col-sm-2 control-label"><? echo $vis_language['TXTSELECTCSV']; ?></label>
					<div class="col-sm-10">
						<input type="file" name="files[]" multiple="multiple" onchange="$(this).visExecution('upload_file', {'vis_static_area':'#vis_csv_attachments', 'vis_form':'vis_client_import_form', 'vis_form_attachment_area':'#vis_import_attachments'})" class="filestyle" data-input="false" data-icon="true" data-iconName="vh-chat" data-buttonText="<?=$vis_language['TXTCLICKHERE']?>" data-badge="true"/><input type="hidden" name="vis_location" value="<? echo VIS_DOMAIN; ?>" /><input type="hidden" name="vis_import_attachments" id="vis_import_attachments" value="" /><input type="hidden" name="vis_attachments" id="vis_attachments" value="" /><div id="vis_csv_attachments"></div>

                  <input type="hidden" name="vis_parent_type" value="4" />
					</div>
				</div>

            </form>

           <div class="b-2x b-t m-b-md"></div>
				<div class="col-sm col-sm-offset-2">
				<button type="button" class="btn btn-primary" onclick="$('#vis_global_msg_div').visExecution('submit_form', {'vis_module':'setting', 'vis_operation':'import_staff_list',
        'vis_form':'vis_client_import_form','view_title' : '<?php echo $vis_language['TXTCLIENTIMPORT']; ?>'});"><? echo $vis_language['TXTADD']; ?></button>
				</div> <br/>  </div>
    </section>
</section>

</section>
<style>
.wrapper-xxs {
    padding: 7px 5px 0 0!important;
}
</style>
<script src="<?= VIS_PATH_SCRIPT; ?>file-input/bootstrap-filestyle.min.js"></script>
<script language="javascript">
	if ($(vis_access_yes).is(":checked"))
   {
    $('#department_access').hide();
   }
    $(document).ready(function () {
     $('#vis_access_yes').click(function () {
     $('#department_access').hide();
     });
     $('#vis_access_no').click(function () {
     $('#department_access').show();
   });
  });
   function toggle_dept_list(){
       if($('#vis_department_all').is(":checked")) $('#vis_dept_list_section').hide();
       else $('#vis_dept_list_section').show();
   }
   function toggleType() {
    var obj = document.getElementById('vis_password');
    if (obj.type == 'text') {
        obj.type = 'password';
    } else {
        obj.type = 'text';
    }
}
    function vis_remove_attachment(ticket_id, attach_location){
        var loc = '';
        loc = (attach_location != "" && typeof(attach_location) != "undefined") ? attach_location : "vis_image_attachments";
        $("#" + loc).val( $("#" + loc).val().replace(ticket_id + ',', '') );
    }
     $(document).ready(function () {
		$(":file").filestyle({input: false});
	 });
</script>

