<? global $vis_language; echo $operation['vis_main_module']; ?>
<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>
<div class="modal-dialog modal-lg">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">&times;</button>
            <h4 class="modal-title"><?  echo (!isset($operation['vis_main_module']) )?((isset($operation['vis_static_area']) && $operation['vis_static_area']=='vis_client_add_modal')?$vis_language['TXTADDCONTACT']:$vis_language['TXTUPDATECONTACT']):$vis_language['TXTADDCLIENT']; ?></h4>
        </div>
        <div class="modal-body">
            <div class="row">
				<? if(isset($operation['vis_static_area']) && $operation['vis_static_area']=='vis_client_add_modal'){?>
                <div class="col-sm-12">
                    <? include(VIS_PATH_TEMPLATE.'client_new_form.php');?>
				</div><? } else {?>
				 <div class="col-sm-12">
                    <? include(VIS_PATH_TEMPLATE.'client_update.php');?>
				</div><?}?>
            </div>
        </div>
        <div class="modal-footer">	
            <a class="btn btn-default" data-dismiss="modal"><? echo $vis_language['TXTCANCEL']; ?></a>
			<? if(isset($operation['vis_static_area']) && $operation['vis_static_area'] === 'vis_client_add_modal'){?> 	
            <a class="btn btn-primary" onclick="$(this).visExecution('submit_form',{'vis_module':'client', 'vis_operation':'add_client', 'vis_form':'vis_new_client_form', 'vis_static_area':'vis_client_add_modal' ,'vis_parent_client_id':'<? echo $client_details[0]['client_id']; ?>', 'vis_org_operation':($('#short_summary').length)?'client_details':'open_new_ticket'});"><? echo $vis_language['TXTADD']; ?></a>
            <?} else { ?>
            <a class="btn btn-primary" onclick="$(this).visExecution('submit_form',{'vis_module':'client', 'vis_operation':'update_client', 'vis_form':'vis_update_client_form','vis_client_id':'<? echo $client_details[0]['client_id']; ?>','vis_parent_client_id':'<? echo $client_details[0]['parent_id']; ?>'})"><? echo $vis_language['TXTUPDATE']; ?></a><? } ?>
        </div>
    </div>
</div>
