<script src="js/ajax.js" type="text/javascript"></script>
<script>
function showPassDiv(){
	var opt = document.getElementById('chk_pass');
	if(opt.checked){	    
	    $('#pass_div').show();
	} else {
		$('#pass_div').hide();
	}
}
</script>
<div class="page-content-wrapper">
                <div class="page-content">
                    <div class="page-bar">
                        <div class="page-title-breadcrumb">
                            <div class=" pull-left">
                                <div class="page-title">Add Admin</div>
                            </div>
                            <ol class="breadcrumb page-breadcrumb pull-right">
                                <li><i class="fa fa-home"></i>&nbsp;<a class="parent-item" href="index.php?page=home">Home</a>&nbsp;<i class="fa fa-angle-right"></i>
                                </li>
                                <li><a class="parent-item" href="index.php?page=manage_admin">Admin</a>&nbsp;<i class="fa fa-angle-right"></i></li><li class="active">Add Admin</li>
                            </ol>
                        </div>
                    </div>
<div class="row">
                        <div class="col-md-12 col-sm-12">
                            <div class="card card-box">
                                <div class="card-head">
                                    <header>Add Admin</header>                                    
                                </div>
                                <div class="card-body" id="bar-parent1">
                                	<?php if(isset($error)) { ?> 
                                	<div class="alert alert-danger"><?php echo $error; ?></div>
                                	<?php } else if(isset($success) && $success!=''){ ?>                                		
                                		<div class="alert alert-success"><?php echo $success; ?></div>
                                	<?php } else if(isset($_REQUEST['success'])){ ?>                                		
                                		<div class="alert alert-success"><?php echo $_REQUEST['success']; ?></div>
                                	<?php } ?>
                                	
                                	<form name="add_user_form" method="post" action="" class="form label-inline">
							              	<div class="form-body"> 
                                            	<div class="form-group row">
	                                                <label class="control-label col-md-3">Admin Type</label>
	                                                <div class="col-md-4">   
	                                                	<input name="type" type="text" id="type" class="form-control" value="<?php if(isset($_POST['type']) && $_POST['type']!=''){ echo $_POST['type'];} else if(isset($editRec['type']) && $editRec['type']!=''){ echo $editRec['type']; } ?>" />                                                 
	                                                    <!--<select class="form-control" name="role" id="role">
                                                        	<option value="" >Select Type</option>
                                                        	<option value="admin" <?php if(isset($_POST['role']) && $_POST['role']=='admin'){ echo 'selected'; } else if(isset($editRec['role']) && $editRec['role']=='admin'){ echo 'selected'; }?> >admin</option>
                                                            <option value="staff" <?php if(isset($_POST['role']) && $_POST['role']=='staff'){ echo 'selected'; } else if(isset($editRec['role']) && $editRec['role']=='staff'){ echo 'selected'; }?> >staff</option>
                                                     		</select>-->
	                                                </div>
	                                            </div>
							              		<div class="form-group row">
	                                                <label class="control-label col-md-3">User Name</label>
	                                                <div class="col-md-4">                                                    
	                                                    <input name="user_name" type="text" id="user_name" class="form-control" value="<?php if(isset($_POST['user_name']) && $_POST['user_name']!=''){ echo $_POST['user_name'];} else if(isset($editRec['ad_username']) && $editRec['ad_username']!=''){ echo $editRec['ad_username']; } ?>" />
	                                                </div>
	                                            </div>
	                                            <div class="form-group row">
	                                                <label class="control-label col-md-3">Email</label>
	                                                <div class="col-md-4">                                                    
	                                                    <input name="email" type="text" id="email" class="form-control" value="<?php if(isset($_POST['email']) && $_POST['email']!=''){ echo $_POST['email'];} else if(isset($editRec['email']) && $editRec['email']!=''){ echo $editRec['email']; } ?>" />
	                                                </div>
	                                            </div>
	                                            <?php if(isset($editId)){ ?>
	                                            <div style="padding-left:10px;" class="form-group row">
	                                                <div class="checkbox checkbox-aqua">
	                                                    <input name="change_pass" value="yes" id="chk_pass" onclick="showPassDiv()"  type="checkbox">
	                                                    <label for="chk_pass">
	                                                        Change Password?
	                                                    </label>
	                                                </div>
	                                            </div>
	                                            <?php } ?>
	                                            <div id="pass_div" <?php if(isset($_POST['change_pass']) && $_POST['change_pass']=='yes'){ echo 'style="display: block;"'; } else if(!isset($editId)){ echo 'style="display: block;"'; } else { echo 'style="display: none;"'; }  ?>>
		                                            <div class="form-group row">
		                                                <label class="control-label col-md-3">Password</label>
		                                                <div class="col-md-4">                                                    
		                                                    <input name="password" type="password" id="password" class="form-control" value="" />
		                                                </div>
		                                            </div>
		                                            <div class="form-group row">
		                                                <label class="control-label col-md-3">Re enter Password</label>
		                                                <div class="col-md-4">                                                    
		                                                    <input name="re_password" type="password" id="re_password" class="form-control" value="" />
		                                                </div>
		                                            </div>
		                                        </div>
	                                            <div class="offset-md-3 col-md-9">	     
	                                            	<?php if(isset($editId) && $editId!=''){ ?> 
	                                            		<button type="submit" name="update_user" class="btn btn-info">Update</button>
	                                            	<?php } else { ?>                                      	
	                                            		<button type="submit" name="add_user" class="btn btn-info">Add</button>	     
	                                            	<?php } ?>                                       		                                          	
	                                            </div>
							              	</div> 
							           </form>
							           
      
                                </div>
                            </div>
                        </div>
                        
                        
                        
                        
                        
                        
         </div>
	</div>
</div>
