<? global $vis_language; ?>
<script>
	$(document).ready(function(){
		function change_password_strength(strengthPercentage, is_valid){
			$("#password_strength_per").val(strengthPercentage);
			var show_password_result;
				if(strengthPercentage>=0 && strengthPercentage<50){show_password_result='<span class="label vh-yellow-bg"> <?=$vis_language['TXTWEAK'];?> </span>';}
				else if(strengthPercentage>=50 && strengthPercentage<70){show_password_result='<span class="label vh-green-bg"> <?=$vis_language['TXTMEDIUM'];?> </span>';}
				else if(strengthPercentage>=70 && strengthPercentage<90){show_password_result='<span class="label vh-orange-bg"> <?=$vis_language['TXTSTRONG'];?> </span>';}
				else if(strengthPercentage>=90 && strengthPercentage<=100){show_password_result='<span class="label vh-red-bg"> <?=$vis_language['TXTVERYSTRONG'];?> </span>';}
				if(is_valid=='not_allowed') $('#password_strenght_id').html('<? echo $vis_language['TXTPASSWORDSRENGTH']."&nbsp;&nbsp;"; ?> '+show_password_result+ '&nbsp;&nbsp; <?=$vis_language['TXTNOTALLOWED']?>');
				else if(is_valid=='allowed') $('#password_strenght_id').html('<? echo $vis_language['TXTPASSWORDSRENGTH']."&nbsp;&nbsp;"; ?> '+show_password_result+ '&nbsp;&nbsp; <?=$vis_language['TXTALLOWED']?>');
				return true;	
		}
		
		$('#vis_password').pStrength({
			'changeBackground'          : false,
			'onPasswordStrengthChanged' : function(passwordStrength, strengthPercentage) {
				if(passwordStrength!=0){change_password_strength(strengthPercentage,'not_allowed');}
			},
			'passwordValidFrom': '<?=$security_password_details[0]['content']?>',
			'onValidatePassword': function(strengthPercentage) {
				change_password_strength(strengthPercentage,'allowed');
			}
		});
	});
</script>
<section class="container m-t-md">
   <div class="row">
      <div class="col-md-12">
          <section class="panel shadow-none">
            <?php if(isset($request_data['incorrect']) && $request_data['incorrect']=='email') {?>
            <script> $("#vis_submit_err_div").show(); $("#vis_submit_err_div").html('<? echo $vis_language['MSGCLTEMAILEXIST']; ?>'); </script><? } ?>
            <?php if(isset($operation['reg_message']) && $operation['reg_message']!='') { ?>
            <script> $("#<?= ($operation['success']==1)?'vis_submit_msg_div':'vis_submit_err_div'; ?>").show(); $("#<?= ($operation['success']==1)?'vis_submit_msg_div':'vis_submit_err_div'; ?>").html('<? echo $operation['reg_message']; ?>'); </script><? } ?>
			
            <div class="panel-body">
				<form class="form-horizontal" id="vis_form_register" name="vis_form_register" method="post" enctype="multipart/form-data">
					<div class="col-md-12">
					  <div class="wrapper">
						  <div class="form-group">
							<label for="FirstName" class="col-sm-2 control-label"><? echo $vis_language['TXTFIRSTNAME']; ?></label>
                            <div class="col-sm-8"><input type="text" class="form-control input-sm" name="vis_firstname" id="vis_firstname" value="<?= $request_data['vis_firstname']; ?>"></div>
						  </div>
						  <div class="form-group">
							<label for="LastName" class="col-sm-2 control-label"><? echo $vis_language['TXTLASTNAME']; ?></label>
							<div class="col-sm-8"><input type="text" class="form-control input-sm" name="vis_lastname" id="vis_lastname" value="<?= $request_data['vis_lastname']; ?>"></div>
						  </div>
						  <div class="form-group">
							<label for="PersonalEmail" class="col-sm-2 control-label"><? echo $vis_language['TXTEMAIL']; ?></label>
							<div class="col-sm-8"><input type="email" class="form-control input-sm" name="vis_email" id="vis_email" value="<?= $request_data['vis_email']; ?>"></div>
						  </div>
						  <div class="form-group">
							<label for="UserName" class="col-sm-2 control-label"><? echo $vis_language['TXTUSERNAME']; ?></label>
							<div class="col-sm-8"><input type="text" class="form-control input-sm" name="vis_username" id="vis_username" value="<?= $request_data['vis_username']; ?>"></div>
						  </div>
                          <input type="hidden" name="vis_auto_pass" id="vis_auto_pass" value="1"/>
						  <input type="hidden" name="vis_group" id="vis_group" value="<?php echo $client_details[0]['group_id'];?>">
						  <div class="line line-dashed b-b line-lg pull-in"></div>
						<div class="form-group">
						  <label class="col-sm-2 control-label"><? echo $vis_language['TXTACCESS']; ?></label>
						  <div class="col-sm-10">
							<div class="checkbox i-checks">
							  <label><input type="checkbox" name="vis_openticket" id="vis_openticket" value="1" checked="checked">&nbsp;
							  <i></i><? echo $vis_language['TXTVIEWREPLYSELFTICKET']; ?>
							  </label>
							</div>
							<div class="checkbox i-checks">
							  <label>
								<input type="checkbox" name="vis_view_tickets" id="vis_view_tickets" value="1">&nbsp;
								<i></i><? echo $vis_language['TXTTKTPSTGRM']; ?>
							  </label>
							</div>
							<div class="checkbox i-checks">
							  <label>
								<input type="checkbox" name="vis_replyticket" id="vis_replyticket" value="1">&nbsp;
								<i></i><? echo $vis_language['TXTRTKTPSTGRM']; ?>
							  </label>
							</div>
							<div class="checkbox i-checks">
							  <label>
								<input type="checkbox" name="vis_rcv_cont_mail" id="vis_rcv_cont_mail" value="1">&nbsp;
								<i></i><? echo $vis_language['TXTRECEIVECONTACTMAIL']; ?>
							  </label>
							</div>
							<div class="checkbox i-checks">
							  <label>
								<input type="checkbox" name="vis_rcv_pc_cont_mail" id="vis_rcv_pc_cont_mail" value="1">&nbsp;
								<i></i><? echo $vis_language['TXTRECIEVEPCLIENTANDCONTACTSMAIL']; ?>
							  </label>
							</div>		
                            <? if(VIS_HEAD_MENU_BILLING==1 && VIS_MODULE_ACCESS_BILLING==1) { ?>
                            <div class="checkbox i-checks">
							  <label>
								<input type="checkbox" name="vis_billingacess" id="vis_billingacess" value="1">&nbsp;
								<i></i><? echo $vis_language['TXTBILLINGACCESS']; ?>
							  </label>
							</div>
                            <? } ?>
						  </div>
						</div>
						 <!--<div class="form-group">
							<label for="UserName" class="col-sm-2 control-label"><? echo $vis_language['TXTSTATUS']; ?></label>
							<div class="col-sm-8">
							<label class="switch" >							
							<input type="checkbox"  name="vis_is_approved"  id="vis_is_approved" value="1" checked="checked" >
							<span></span>		
							</label>
							</div>
						  </div>-->
					  <div class="line line-dashed b-b line-lg pull-in"></div>
					  </div> <!-- /.wrapper -->
					</div> <!-- /.col-md-12 -->
					<div class="col-lg-offset-2 col-lg-8 m-b-lg">
                          <button type="submit" class="btn btn-primary"><? echo $vis_language['TXTADD']; ?></button>
						  <input type="hidden" name="vis_operation" value="add_client" /><input type="hidden" name="vis_module" value="client" /><input type="hidden" name="vis_client_id" value="<? echo $parent_id; ?>" />
					</div>
				</form>    
            </div>
          </section>
      </div>
   </div>
</section>
<style>
.switch input:checked + span {
    background-color: #1aae88 !important;
}
</style>
<script>
	function handlefilename(id) {
		var filename = id.value;
		var lastIndex = filename.lastIndexOf("\\");
		if (lastIndex >= 0) filename = filename.substring(lastIndex + 1);
        $('#vis_filename').text(filename);
    }
</script>
<script src="<?= VIS_PATH_SCRIPT; ?>file-input/bootstrap-filestyle.min.js"></script>
