<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title></title>

<!-- Content Header (Page header) -->
<div class="content-header ">
  <div class="container-fluid">
    <div class="row mb-2">
      <div class="col-sm-12">
        <!-- <h1 class="m-0 text-dark">Judul Atas</h1> -->
      </div><!-- /.col -->
    </div><!-- /.row -->
  </div><!-- /.container-fluid -->
</div>
<!-- /.content-header -->

<!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-12">
            <!-- Default box -->
            <div class="card">
              <div class="card-header bg-info">
                <h3 class="card-title ">Realisasi Gadai</h3>
                <div class="card-tools">
                  <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                    <i class="fas fa-minus"></i>
                  </button>
                  <button type="button" class="btn btn-tool" data-card-widget="remove" title="Remove">
                    <i class="fas fa-times"></i>
                  </button>
                </div>
              </div>
              <!-- /.card-header -->
        <div class="card-body">

          <!-- Croping Photo -->

<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.min.css">
 -->  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/croppie/2.6.2/croppie.min.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/croppie/2.6.2/croppie.js"></script>

<script language="javascript" type="text/javascript">
/*https://www.diskusiweb.com/discussion/31709/entry-pake-key-enter-kok-gak-berhasil*/
var fromEnter = false ;
function changeFocus (event,nextFocus)
{
if (event.keyCode==13)
{
var obj = document.getElementsByName( nextFocus )[ 0 ] ;
if (obj)
obj.focus() ;
}
fromEnter = true ;
}
function checkSubmit ()
{
fromEnter = !fromEnter ;
return fromEnter ;
}
</script>  
    
<!-- <link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet"> -->
<style>
* {
  box-sizing: border-box;
}
/*body {
  background-color: #f1f1f1;
}*/
#regForm {
  background-color: #ffffff;
  /*margin: 100px auto;*/
  /*font-family: Calibri;*/
  padding: 40px;
  /*width: 70%;*/
  /*min-width: 300px;*/
}
h1 {
  text-align: center;  
}
/*input {
  padding: 8px;
  width: 70%;
  font-size: 17px;
  font-family: Calibri;
  border: 1px solid #aaaaaa;
}*/
/* Mark input boxes that gets an error on validation: */
input.invalid {
  background-color: #ffdddd;
}

/* Hide all steps by default: */
.tab {
  display: none;
}

button {
  background-color: #04AA6D;
  color: #ffffff;
  border: none;
  padding: 10px 20px;
  font-size: 17px;
/*  font-family: Raleway;*/
  cursor: pointer;
}

button:hover {
  opacity: 0.8;
}

#prevBtn {
  background-color: #bbbbbb;
}

/* Make circles that indicate the steps of the form: */
.step {
  height: 15px;
  /*width: 15px;*/
  margin: 0 2px;
  background-color: #bbbbbb;
  border: none;  
  border-radius: 50%;
  display: inline-block;
  opacity: 0.5;
}

.step.active {
  opacity: 1;
}

/* Mark the steps that are finished and valid: */
.step.finish {
  background-color: #04AA6D;
}

/*.form-control,.label,.select{
  height:25px;
  margin-top: 1px;

  width: 284px;
}*/
input[type=text] {

  border: 2px solid #ccc;
  /*border-radius: 3px;
  font-size: 12px;
  background-color: white;*/
  /*height: 25px;*/
  width: 284px;
  }
</style>

       <?php
                  error_reporting(E_ALL^(E_NOTICE|E_WARNING));
                  ini_set('display_errors',1);
                  error_reporting(0);
                 include 'koneksi.php'; 
                      if(isset($_POST['r_register'])){                  
                      $id=$_POST["r_register"];
                   
                        $query4 = "SELECT register, COUNT(register) as jml FROM pinjaman where register='".$id."' ";
                         
                        $hasil1 = mysqli_query($koneksi, $query4);
                        $reg = mysqli_fetch_assoc($hasil1);       
                         }
                         ?>

              

            <form action="" method="POST">
          <div class="tab"> 
          <div class="row">

            <div class="col-sm-6">
               
             <div class="form-group row ">
              <label for="nama" class=" col-sm-4">No Register </label>
        
              <input type="text" name="r_register" id="r_register" placeholder="Ketik Register" class="form-control col-sm-6" value="<?php if(isset($_POST['r_register'])){ echo  $_POST['r_register'].".".sprintf("%02d",$reg['jml']+1);}?>" onchange="this.form.submit();" onKeyDown="changeFocus(event,'tgl')"/>
              
                    
                <button type="submit" class="  btn btn-info"  ><i class="fas fa-search"></i></button>
               </div>
            </form>
                    <?php
                    if(isset($_POST['r_register'])){                  
                      $id=$_POST["r_register"];  
                    ?>   
          <form name="form-simpanpencairan" action=".../../simpan/simpan_pinjaman.php" method="POST" class="form-simpanpencairan" id="form-simpanpencairan" >
              <input type="hidden" name="register" id="register"class="form-control col-sm-6" value="<?php echo $_POST['r_register'];?>">
              
              <input type="hidden" name="rekening" id="rekening" class="form-control col-sm-7" value="<?php echo  $_POST['r_register'].".".sprintf("%02d",$reg['jml']+1) ?>" readonly="rekening"/>
              

              <div class="form-group row">
                <label for="nama" class="col-sm-4">Tanggal</label>
                <input type="date"oninput="this.className = ''" name="tgl" id="tgl" class="form-control col-sm-7" value="<?php echo date('Y-m-d');?>" max="<?=date('Y-m-d')?>" onKeyDown="changeFocus(event,'plafond')"autofocus/>
              </div>

              <div class="form-group row">
                <label for="nama" class="col-sm-4">Plafond</label>
                <input type="text"oninput="this.className = ''" name="plafond" id="plafond" required="plafond" class="form-control col-sm-7" onKeyDown="changeFocus(event,'jcair')"/> 
              </div>

              <div class="form-group row">
                <label for="nama" class="col-sm-4">Jenis Cair</label>
                <div class="custom-control custom-radio col-sm-3 ">
                          <input type="radio"oninput="this.className = ''" class="custom-control-input"  id="customRadio1" name="jcair" value="B" onKeyDown="changeFocus(event,'pbarang')" required="" /> <!-- checked -->
                          <label for="customRadio1" class="custom-control-label">Baru </label>
                </div>
                <div class="custom-control custom-radio col-sm-3">
                          <input class="custom-control-input " type="radio"oninput="this.className = ''" id="customRadio2" name="jcair" value="P" onKeyDown="changeFocus(event,'pbarang')" required=""/>
                          <label for="customRadio2" class="custom-control-label">Perpanjangan</label>
                 </div>
              </div>
               

            <div class="form-group row">
                <label for="nama" class="col-sm-4">Pengajuan Barang</label>
                <input type="text"oninput="this.className = ''" name="pbarang" id="pbarang"required="Pengajuan" class="form-control col-sm-7" onkeyup="this.value = this.value.toUpperCase()" onKeyDown="changeFocus(event,'jbarang')"/>

            </div>
            
            <div class="form-group row">
                <label for="nama" class="col-sm-4">Jenis Barang</label>
                <div class="custom-control custom-radio col-sm-3 ">
                          <input class="custom-control-input " type="radio"oninput="this.className = ''" id="customRadio3" name="jbarang" value="Elektronik" onKeyDown="changeFocus(event,'kelengkapan')" required=""/>
                          <label for="customRadio3" class="custom-control-label">Elektronik </label>
                        </div>
                        <div class="custom-control custom-radio col-sm-3">
                          <input class="custom-control-input " type="radio"oninput="this.className = ''" id="customRadio4" name="jbarang" value="Kendaraan" onKeyDown="changeFocus(event,'kelengkapan')"required="" />
                          <label for="customRadio4" class="custom-control-label">Kendaraan</label>
                 </div>
              </div>
 
            <div class="form-group row">
                <label for="nama" class="col-sm-4">Kelengkapan</label>
                <select id="kelengkapan" name="kelengkapan"oninput="this.className = ''" class="form-control col-sm-7 select2" onKeyDown="changeFocus(event,'jaminan')"required="jaminan" >
                    <!--<option selected="selected">UNIT CHAS KOTAK</option>
                       -->
                    <option value="" >PILIH----</option>
                    <option value="UNIT KOTAK">UNIT KOTAK</option>
                    <option value="UNIT CHAS">UNIT CHAS</option>
                    <option value="UNIT CHAS KOTAK">UNIT CHAS KOTAK</option>
                    <option value="UNIT CHAS TAS">UNIT CHAS TAS</option>
                    <option value="UNIT KOTAK REMOT">UNIT KOTAK REMOT</option>
                    <option value="UNIT REMOT">UNIT REMOT</option>
                    <option value="UNIT BPKB STNK">UNIT BPKB STNK</option>
                    <option value="STNK KTP">STNK KTP</option>
                  </select>
            </div>
            <div class="form-group row">
                <label for="nama" class="col-sm-4">Jaminan</label>
                <select id="jaminan" name="jaminan"oninput="this.className = ''" class="form-control col-sm-7 select2" onKeyDown="changeFocus(event,'jwaktu')" required="jaminan">
                    <!-- <option selected="selected">TV</option> -->
                    <option value="">PILIH---</option>
                    <option value="TV">TV</option>
                    <option value="HP">HP</option>
                    <option value="LAPTOP">LAPTOP</option>
                    <option value="SPEKER AKTOR">SPEKER AKTOR</option>
                    <option value="DRON">DRON</option>
                    <option value="PROYEKTOR">PROYEKTOR</option>
                    <option value="SEPEDA YAMAHA">SEPEDA YAMAHA</option>
                    <option value="SEPEDA HONDA">SEPEDA HONDA</option>
                    <option value="SEPEDA SUZUKI">SEPEDA SUZUKI</option>
                    <option value="SEPEDA KAWASAKI">SEPEDA KAWASAKI</option>
                    <option value="MOBIL TOYOTA">MOBIL TOYOTA</option>
                    <option value="MOBIL DAIHATSU">MOBIL DAIHATSU</option>
                    <option value="MOBIL SUZUKI">MOBIL SUZUKI</option>
                    <option value="MOBIL MITSUBISHI">MOBIL MITSUBISHI</option>
                    
                  </select>

            </div>

             </div>
        

          
            <?php 
                        $query1 = "SELECT * FROM registrasi where id='".$id."' ";
                        $hasil2 = mysqli_query($koneksi, $query1);
                        $row = mysqli_fetch_assoc($hasil2);                        
                       ?>

               

              <div class="col-sm-6">

              <div class="form-group row">
                <label for="nama" class="col-sm-4">Nilai Taksiran</label>
                <input type="text"oninput="this.className = ''" name="taksasi" id="taksasi" class="form-control col-sm-7" onkeyup="validAngka(this)" onkeypress="return  hanyaAngka(event)" onKeyDown="changeFocus(event,'margin')" onfocus="use_number(this)" onblur="use_text(this)"/>    
              </div>

              <div class="form-group row">
                <label for="nama" class="col-sm-4">Jangka Waktu</label>
                <input type="text"oninput="this.className = ''" name="jwaktu" id="jwaktu" class="form-control col-sm-7" value="45" readonly="jwaktu" onkeyup="validAngka(this)" onkeypress="return  hanyaAngka(event)" minlength="1" maxlength="2" onKeyDown="changeFocus(event,'margin')"/>    
              </div>
              

              <div class="form-group row">
                <label for="nama" class="col-sm-4">Biaya Titip</label>
                <div class="custom-control custom-radio col-sm-3 ">
                          <input type="radio" class="custom-control-input"  id="customRadio11" name="margin" value="5.00" onKeyDown="changeFocus(event,'noseri')" required="margin" /> <!-- checked -->
                          <label for="customRadio11" class="custom-control-label">5% </label>
                </div>
                <div class="custom-control custom-radio col-sm-3">
                          <input class="custom-control-input " type="radio" id="customRadio12" name="margin" value="7.50" onKeyDown="changeFocus(event,'noseri')" required="margin"/>
                          <label for="customRadio12" class="custom-control-label">7.5%</label>
                 </div>
              </div>
                            
              <div class="form-group row">
                <label for="nama"  class="col-sm-4">SN/Plat</label>
                <input type="text"oninput="this.className = ''" name="noseri" id="noseri" required="noseri" class="form-control col-sm-7" onKeyDown="changeFocus(event,'kondisi')"/>    
              </div>
              
               <div class="form-group row">
                <label for="nama"  class="col-sm-4">Kondisi</label>
                <input type="text"oninput="this.className = ''" name="kondisi" id="kondisi" required="kondisi" class="form-control col-sm-7" onKeyDown="changeFocus(event,'keterangan')"/>    
              </div>

              <div class="form-group row">
                <label for="nama"  class="col-sm-4">Keterangan</label>
               <input type="text"oninput="this.className = ''" value="Pencairan <?php echo $_POST['r_register'].".".sprintf("%02d",$reg['jml']+1)."[".$row['nama']."]";?>" name="keterangan" id="keterangan"required="keterangan" class="form-control col-sm-7" onKeyDown="changeFocus(event,'simpanpencairan')"/>
                
              </div>

              <div class="form-group row">
                <label for="nama" class="col-sm-4">Nama</label>  
                <input type="text" class="form-control col-sm-7"required="" readonly="nama" value="<?php echo $row['nama']; ?>"/>  
              </div>

              <div class="form-group row">
                <label for="nama" class="col-sm-4">Alamat</label>  
                <input type="text" class="form-control col-sm-7" required="" value="<?php echo $row['alamat']; ?>" readonly="alamat"/>
                  
              </div>

         
                  
            </div>
            </div>
          </div>

        
      
      <!-- Kedua -->
         
          <div class="tab">
          
            <div class="col-sm-6" style="width: 100%;"> 
              
            <div class="form-group row">
                <label for="nama" class="col-sm-4">Jaminan-II</label>
                <select id="jaminan2" name="jaminan2"oninput="this.className = ''" class="form-control col-sm-7 select2" onKeyDown="changeFocus(event,'jwaktu')">
                    <option selected="selected">TV</option>
                    <option>TV</option>
                    <option>HP</option>
                    <option>LAPTOP</option>
                    <option>SPEKER AKTOR</option>
                    <option>DRON</option>
                    <option>PROYEKTOR</option>
                    <option>SEPEDA YAMAHA</option>
                    <option>SEPEDA HONDA</option>
                    <option>SEPEDA SUZUKI</option>
                    <option>SEPEDA KAWASAKI</option>
                    <option>MOBIL TOYOTA</option>
                    <option>MOBIL DAIHATSU</option>
                    <option>MOBIL SUZUKI</option>
                    <option>MOBIL MITSUBISHI</option>
                    
                  </select>

            </div>  

              <div class="form-group row">
                <label for="nama" class="col-sm-5">Jenis Barang</label>
                <div class="custom-control custom-radio col-sm-3 ">
                          <input class="custom-control-input " type="radio" id="customRadio21" name="jbarang2" value="Elektronik" onKeyDown="changeFocus(event,'kelengkapan2')" checked/>
                          <label for="customRadio21" class="custom-control-label">Elektronik </label>
                        </div>
                        <div class="custom-control custom-radio col-sm-3">
                          <input class="custom-control-input " type="radio"oninput="this.className = ''" id="customRadio22" name="jbarang2" value="Kendaraan" onKeyDown="changeFocus(event,'kelengkapan2')" />
                          <label for="customRadio22" class="custom-control-label">Kendaraan</label>
                 </div>
              </div>
              <div class="form-group row">
                <label for="nama"  class="col-sm-4">SN/Plat</label>
                <input type="text"oninput="this.className = ''" name="noseri2" id="noseri2" class="form-control col-sm-7" onKeyDown="changeFocus(event,'keterangan')"/>    
              </div>
            
            <div class="form-group row">
                <label for="nama" class="col-sm-4">Kelengkapan</label>
                <select id="kelengkapan2" name="kelengkapan2"oninput="this.className = ''" class="form-control col-sm-7 select2" onKeyDown="changeFocus(event,'jaminan')" >
                    <!--<option selected="selected">UNIT CHAS KOTAK</option>
                       -->
                    <option >UNIT KOTAK</option>
                    <option >UNIT CHAS</option>
                    <option >UNIT CHAS TAS</option>
                    <option >UNIT KOTAK REMOT</option>
                    <option >UNIT REMOT</option>
                    <option >UNIT BPKB STNK</option>
                    <option >STNK KTP</option>
                  </select>
            </div>
          </div>
        
          <div class="col-sm-6" style="width: 100%;">
             <div class="form-group row">
                <label for="nama" class="col-sm-4">Jaminan-III</label>
                <select id="jaminan3" name="jaminan3"oninput="this.className = ''" class="form-control col-sm-7 select2" onKeyDown="changeFocus(event,'jwaktu')">
                    <option selected="selected">TV</option>
                    <option>TV</option>
                    <option>HP</option>
                    <option>LAPTOP</option>
                    <option>SPEKER AKTOR</option>
                    <option>DRON</option>
                    <option>PROYEKTOR</option>
                    <option>SEPEDA YAMAHA</option>
                    <option>SEPEDA HONDA</option>
                    <option>SEPEDA SUZUKI</option>
                    <option>SEPEDA KAWASAKI</option>
                    <option>MOBIL TOYOTA</option>
                    <option>MOBIL DAIHATSU</option>
                    <option>MOBIL SUZUKI</option>
                    <option>MOBIL MITSUBISHI</option>
                    
                  </select>

            </div> 

              <div class="form-group row">
                <label for="nama" class="col-sm-5">Jenis Barang</label>
                <div class="custom-control custom-radio col-sm-3 ">
                          <input class="custom-control-input " type="radio" id="customRadio23" name="jbarang3" value="Elektronik" onKeyDown="changeFocus(event,'kelengkapan3')" checked/>
                          <label for="customRadio23" class="custom-control-label">Elektronik </label>
                        </div>
                        <div class="custom-control custom-radio col-sm-3">
                          <input class="custom-control-input " type="radio"oninput="this.className = ''" id="customRadio24" name="jbarang3" value="Kendaraan" onKeyDown="changeFocus(event,'kelengkapan3')" />
                          <label for="customRadio24" class="custom-control-label">Kendaraan</label>
                 </div>
              </div>
              <div class="form-group row">
                <label for="nama"  class="col-sm-4">SN/Plat</label>
                <input type="text"oninput="this.className = ''" name="noseri3" id="noseri3" class="form-control col-sm-7" onKeyDown="changeFocus(event,'keterangan')"/>    
              </div>
            
            <div class="form-group row">
                <label for="nama" class="col-sm-4">Kelengkapan</label>
                <select id="kelengkapan3" name="kelengkapan3"oninput="this.className = ''" class="form-control col-sm-7 select2" onKeyDown="changeFocus(event,'jaminan')" >
                    <!--<option selected="selected">UNIT CHAS KOTAK</option>
                       -->
                    <option >UNIT KOTAK</option>
                    <option >UNIT CHAS KOTAK</option>
                    <option >UNIT CHAS</option>
                    <option >UNIT CHAS TAS</option>
                    <option >UNIT KOTAK REMOT</option>
                    <option >UNIT REMOT</option>
                    <option >UNIT BPKB STNK</option>
                    <option >STNK KTP</option>
                  </select>
            </div>
          </div>
          </div>

        
      </div>

    <div style="overflow:auto;">
    <div style="float:right;">
      <button type="button" id="prevBtn" onclick="nextPrev(-1)">Back</button>
      <button type="button" id="nextBtn" onclick="nextPrev(1)">Next</button>
    </div>
  </div>
  <!-- Circles which indicates the steps of the form: -->
  <div style="text-align:center;margin-top:1px;">
    <span class="step"></span>
    <span class="step"></span>
    <span class="step"></span>
    <span class="step"></span>
  </div>

          
              
           
              
            <!-- /.card-body -->
            <div class="card-footer bg-info">
              <input type="submit" name="simpanpencairan" id="simpanpencairan" 
              class="btn btn-primary" value="Simpan" onclick='document.geElementById("form-simpanpencairan").submit()'  >
              <!-- <a href="" class="btn btn-secondary">
                Batal
              </a> -->
              <a href="home.php?home=<?php echo md5("pencairan");?>" class="btn btn-success">
                Tambah
              </a>
              <a href="home.php?home=<?php echo md5("edit_pencairan");?>" class="btn btn-warning">
                Edit
              </a>
              <a href="" class="btn btn-danger">
                Hapus
              </a>
              <a class="btn btn-secondary" type="button" href="faktur/cetak_faktur_pinjaman.php" target="_bank">Print</a>
            </div>  
          </form>
        <?php } ?>
          

          </div>
        </div>
        <!-- /.card -->
      </div>
      <!--/.col (left) -->
    </div>
    <!-- /.row -->
  </div><!-- /.container-fluid -->
</section>
<!-- /.content -->


<script>
var currentTab = 0; // Current tab is set to be the first tab (0)
showTab(currentTab); // Display the current tab

function showTab(n) {
  // This function will display the specified tab of the form...
  var x = document.getElementsByClassName("tab");
  x[n].style.display = "block";
  //... and fix the Previous/Next buttons:
  if (n == 0) {
    document.getElementById("prevBtn").style.display = "none";
  } else {
    document.getElementById("prevBtn").style.display = "inline";
  }
  if (n == (x.length - 1)) {
    document.getElementById("nextBtn").innerHTML = "Submit";
  } else {
    document.getElementById("nextBtn").innerHTML = "Next";
  }
  //... and run a function that will display the correct step indicator:
  fixStepIndicator(n)
}

function nextPrev(n) {
  // This function will figure out which tab to display
  var x = document.getElementsByClassName("tab");
  // Exit the function if any field in the current tab is invalid:
  if (n == 1 && !validateForm()) return false;
  // Hide the current tab:
  x[currentTab].style.display = "none";
  // Increase or decrease the current tab by 1:
  currentTab = currentTab + n;
  // if you have reached the end of the form...
  if (currentTab >= x.length) {
    // ... the form gets submitted:
    document.getElementById("regForm").submit();
    return false;
  }
  // Otherwise, display the correct tab:
  showTab(currentTab);
}

function validateForm() {
  // This function deals with validation of the form fields
  var x, y, i, valid = true;
  x = document.getElementsByClassName("tab");
  y = x[currentTab].getElementsByTagName("input");
  // A loop that checks every input field in the current tab:
  for (i = 0; i < y.length; i++) {
    // If a field is empty...
    if (y[i].value == "") {
      // add an "invalid" class to the field:
      y[i].className += " invalid";
      // and set the current valid status to false
      valid = false;
    }
  }
  // If the valid status is true, mark the step as finished and valid:
  if (valid) {
    document.getElementsByClassName("step")[currentTab].className += " finish";
  }
  return valid; // return the valid status
}

function fixStepIndicator(n) {
  // This function removes the "active" class of all steps...
  var i, x = document.getElementsByClassName("step");
  for (i = 0; i < x.length; i++) {
    x[i].className = x[i].className.replace(" active", "");
  }
  //... and adds the "active" class on the current step:
  x[n].className += " active";
}
</script>


<script type="text/javascript" src="jquery.js"></script> 

<script type="text/javascript">
  $(document).ready(function(){
    $("#simpanpencairan").click(function(){
      var data = $('#form-simpanpencairan').serialize();
      var rekening= $('#rekening').val();
      var tgl= $('#tgl').val();
      var plafond= $('#plafond').val();
      var jcair= $('#jcair').val();
      var pbarang= $('#pbarang').val();
      var jbarang= $('#jbarang').val();
      var kelengkapan= $('#kelengkapan').val();
      var jaminan= $('#jaminan').val();
      var taksasi= $('#taksasi').val();
      var jwaktu= $('#jwaktu').val();
      var margin= $('#margin').val();
      var noseri= $('#noseri').val();
      var kondisi= $('#kondisi').val();
      var keterangan= $('#keterangan').val();
      var nama= $('#nama').val();
      
 

      if(rekening== "0"|| tgl=="0" ||plafond=="0"||jcair=="0"||pbarang=="0"||jbarang=="0"||kelengkapan=="0"||jaminan=="0"||taksasi=="0"||jwaktu=="0"||margin=="0"||noseri=="0"||kondisi=="0"||keterangan=="0"||nama=="0"){ 
Swal.fire({
  icon: 'error',
  title: 'Hati-hati...',
  text: 'Data masih ada yg belum diisi!',
  footer: '<a href="">Anda Perlu teliti sedikit lagi?</a>'
});

      
    }else if(rekening== ""|| tgl=="" ||plafond==""||jcair==""||pbarang==""||jbarang==""||kelengkapan==""||jaminan==""||taksasi==""||jwaktu==""||margin==""||noseri==""||kondisi==""||keterangan==""||nama==""){ 

      Swal.fire(
  'Data Masih ada yang Kosong !',
  'Mohon data dilengkapi dlu !',
  'question'
);
        /*alert ("Data Masih ada yang kosong 2");*/
       
    }else{

      $.ajax({
        type: 'POST',
        url: 'simpan/simpan_pinjaman11.php',
        data: data,
        success: function(data) {
         console.log(data)
 
         Swal.fire({
  title: 'Alhamdulillah...Data Sukses Tersimpan...!!!!',
  text: 'Bisa Anda Cek...!!!',
  imageUrl: 'img/logougt.png',
  imageWidth: 75,
  imageHeight: 80,
  imageAlt: 'Custom image',
  animation: false
})

        },
        error: function(error){
          console.log(`error ${error}`)
         
        }
      });
    }
    });
  });
  
</script>

<script type="text/javascript">
 // untuk format koma
  //https://cobangoding.com/tips-dan-trick/memberi-titik-otomatis-pada-angka-saat-menginput-dengan-javascript/#comment-757
  //https://codepen.io/cobangoding/pen/QWOoLXN

 $('#plafond').on('keyup',function(){
  var angka = $(this).val();
  var hasilAngka = formatRibuan(angka);
  $(this).val(hasilAngka);
  });
  function formatRibuan(angka) {
  var number_string = angka.replace(/[^\.\d]/g, '').toString(),
    split = number_string.split('.'),
    sisa = split[0].length % 3,
    angka_hasil = split[0].substr(0, sisa),
    ribuan = split[0].substr(sisa).match(/\d{3}/gi);
  // tambahkan titik jika yang di input sudah menjadi angka ribuan
  if (ribuan) {separator = sisa ? ',' : '';
    angka_hasil += separator + ribuan.join(',');
  }
  angka_hasil = split[1] != undefined ? angka_hasil + '.' + split[1] : angka_hasil;
  return angka_hasil;
}

$('#taksasi').on('keyup',function(){
  var angka = $(this).val();
  var hasilAngka = formatRibuan(angka);
  $(this).val(hasilAngka);
  });
  function formatRibuan(angka) {
  var number_string = angka.replace(/[^\.\d]/g, '').toString(),
    split = number_string.split('.'),
    sisa = split[0].length % 3,
    angka_hasil = split[0].substr(0, sisa),
    ribuan = split[0].substr(sisa).match(/\d{3}/gi);
  // tambahkan titik jika yang di input sudah menjadi angka ribuan
  if (ribuan) {separator = sisa ? ',' : '';
    angka_hasil += separator + ribuan.join(',');
  }
  angka_hasil = split[1] != undefined ? angka_hasil + '.' + split[1] : angka_hasil;
  return angka_hasil;
}
</script>   

<!-- 
input huruf besar
https://bloggerbodrex.blogspot.com/2017/05/cara-agar-input-data-menjadi-huruf.html
  <td><input type="text" name="vnama" size="20" onkeyup="this.value = this.value.toUpperCase()" required></td>
 -->
<script>
  /*required onkeypress='return harusHuruf(event)' tinggal pasang ke input
  https://kursuswebdesign.org/cara-membuat-validasi-input-form-hanya-text-dengan-javascript/*/
function harusHuruf(evt){
        var charCode = (evt.which) ? evt.which : event.keyCode
        if ((charCode < 65 || charCode > 90)&&(charCode < 97 || charCode > 122)&&charCode>32)
            return false;
        return true;
}
</script>

<script>
    function hanyaAngka(evt) {
      var charCode = (evt.which) ? evt.which : event.keyCode
       if (charCode > 31 && (charCode < 48 || charCode > 57))
 
        return false;
      return true;
    }
  </script>

<script type="text/javascript">
  function ClearFields() {
    /*https://stackoverflow.com/questions/14837466/clearing-a-text-field-on-button-click*/

     /*document.getElementById("tgl").value = "";
     document.getElementById("register").value = "";
     document.getElementById("plafond").value = "";*/
}
</script>



}



</head>
</html>