<?php
$edit = $_SESSION['id_user'];
$q=mysqli_query($connect, "select * from admin where ID ='$edit'") or die(mysqli_error($connect));
$b=mysqli_fetch_array($q);
?>
<div class="row clearfix">
  <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
    <div class="card">
      <div class="header">
        <h2>PROFILE</h2>
      </div>
      <div class="body">
        <form class="form_ajax">
        <input type="hidden" name="p" value="admin-login">
        <input type="hidden" name="t" value="update">
        <input type="hidden" name="token" value="<?php echo getToken();?>">
        <input type="hidden" name="status" value="1">
        <input type="hidden" name="id" value="<?php echo $b['ID'];?>">
        <input type="hidden" name="email" value="<?php echo $b['email'];?>">
          <div class="form-group">
            <label>Name</label>
            <div class="form-line">
              <input type="text" name="nama" class="form-control" required value="<?php echo $b['nama'];?>">
            </div>
          </div>
          <div class="form-group">
            <label>Email</label>
            <div class="form-line">
              <input type="email" disabled class="form-control" value="<?php echo $b['email'];?>">
            </div>
          </div>
		   <div class="form-group">
          	<label>No. HP</label>
            <div class="form-line">
            	<input type="tel" name="no_hp" class="form-control" required value="<?php echo $b['hp'];?>">
            </div>
          </div>
          <div class="form-group">
            <label>Password</label>
            <div class="form-line">
              <input type="password" id="password" name="password" minlength="6" placeholder="(empty if not change)" class="form-control">
            </div>
          </div>
		  <div class="form-group">
            <label>Confirm Password</label>
            <div class="form-line">
              <input type="password" name="password" equalTo="#password" placeholder="(empty if not change)" class="form-control">
            </div>
          </div>
           <div class="form-group">
            <label>Photo</label>
            <div class="form-line">
				<input name="foto" id="inputFile99" accept="image/*" onChange="validateImage(this);" type="file"/>
                <?php if($b['foto']){?>
                <p align="center" id="img-view99" class="img-view" style="text-align:center;"><img src="assets/images/placeholder.png" data-src="<?php echo getConfig($connect, 'base_url');?>image.php?t=admin&id=<?php echo $edit;?>&s=90" style="height:100px;" class="center">
                  <button type="button" class="btn bg-red waves-effect no-padding btn-xs" onClick="$('#img-view99').remove();$('#inputFile99').val('');"><i class="material-icons">delete</i></button>
                  <input type="hidden" name="old_img" value="1">
                </p>
                <?php } ?>
              </div>
          </div>
        <div class="form-group">
          <button type="submit" class="btn btn-sm bg-blue-grey waves-effect">Submit</button>
          <button type="reset" class="btn btn-sm bg-red waves-effect back">Cancel</button>
        <div class="preloader pl-size-xs pull-right" style="display:none;" id="loading">
            <div class="spinner-layer pl-deep-purple">
              <div class="circle-clipper left">
                <div class="circle"></div>
              </div>
              <div class="circle-clipper right">
                <div class="circle"></div>
              </div>
            </div>
          </div>
        </div>
      </form>
      </div>
    </div>
  </div>
</div>