<div class="row">
    <!-- begin col-8 -->
    <div class="col-sm-12">
        <!-- begin panel -->
        <form class="form-horizontal" method="post">
          <div class="panel panel-grey">
              <div class="panel-heading">
          		 <div class="panel-heading-btn">
                    <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-grey" data-click="panel-expand"><i class="fa fa-expand"></i></a>
                    <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-grey" data-click="panel-remove"><i class="fa fa-times"></i></a>
                </div>
                <div class="btn-group" role="group" aria-label="Group Button Penyiapan Sampel">
                  <a onclick="goBack();" class="btn btn-primary m-b-5"><span class="fa fa-arrow-left"></span> Kembali</a>
                  <?php $vget = $this->input->get(); ?>
                </div>

                <hr>

              </div>
              <div class="panel-body">
                <div class="col-sm-10">
                  <div class="form-group m-b-11">
                      <label class="col-md-4 col-form-label control-label">Nomor Sampel<span class="text-danger">*</span></label>
                      <div class="col-md-7">
                          <div class="input-group">
                              <input value="<?= $edit['nomor_sampel']; ?>" type="text" class="form-control" readonly required>
                          </div>
                      </div>
                  </div>
                  <div class="form-group m-b-11">
                      <label class="col-md-4 col-form-label control-label">Tanggal Pukul sebelum Dioven<span class="text-danger">*</span></label>
                      <div class="col-md-7">
                          <div class="input-group datetimepicker1">
                            <?php echo $edit['tgl_pukul_sebelum_dioven']; ?>
                              <input value="<?php echo isset($edit) ? $edit['tgl_pukul_sebelum_dioven'] : '' ?>" class="form-control" name="tgl_pukul_sebelum_dioven" type="text" placeholder="Tanggal Pukul sebelum Dioven" required>
                              <span class="input-group-addon"><i class="fa fa-clock"></i></span>
                          </div>
                      </div>
                  </div>
                  <div class="form-group m-b-11">
                      <label class="col-md-4 col-form-label control-label">Berat Segar (gram)<span class="text-danger">*</span></label>
                      <div class="col-md-7">
                          <div class="input-group">
                              <input value="<?php echo isset($edit['berat_segar']) ? $edit['berat_segar'] : $berat_sampel; ?>" name="berat_segar" type="text" class="form-control berat_segar" onkeyup="persenAir()" placeholder="Silahkan input berat segar" required>
                          </div>
                      </div>
                  </div>
                  <div class="form-group m-b-11">
                      <label class="col-md-4 col-form-label control-label">Tanggal Pukul setelah Dioven<span class="text-danger">*</span></label>
                      <div class="col-md-7">
                          <div class="input-group datetimepicker1">
                              <input value="<?php echo isset($edit) ? $edit['tgl_pukul_setelah_dioven'] : '' ?>" class="form-control" name="tgl_pukul_setelah_dioven" type="text" placeholder="Tanggal Pukul setelah Dioven" required>
                              <span class="input-group-addon"><i class="fa fa-clock"></i></span>
                          </div>
                      </div>
                  </div>
                  <div class="form-group m-b-11">
                      <label class="col-md-4 col-form-label control-label">Berat Kering (gram)<span class="text-danger">*</span></label>
                      <div class="col-md-7">
                          <div class="input-group">
                              <input value="<?php echo isset($edit) ? $edit['berat_kering'] : '' ?>" name="berat_kering" type="text" class="form-control berat_kering" onkeyup="persenAir()" placeholder="Silahkan input berat kering" required>
                          </div>
                      </div>
                  </div>
                  <div class="form-group m-b-11">
                      <label class="col-md-4 col-form-label control-label">Kadar Air I (%)<span class="text-danger">*</span></label>
                      <div class="col-md-7">
                          <div class="input-group">
                              <input value="<?php echo isset($edit) ? $edit['kadar_air'] : '' ?>" name="kadar_air" type="text" class="form-control kadar_air" placeholder="Silahkan input kadar_air" required>
                          </div>
                      </div>
                  </div>
                  <div class="form-group m-b-11">
                      <label class="col-md-4 col-form-label control-label">Nama Pelaksana<span class="text-danger">*</span></label>
                      <div class="col-md-7">
                          <div class="input-group">
                              <input value="<?php echo isset($edit['nama_pelaksana']) ? $edit['nama_pelaksana'] : $user['username'] ?>" name="nama_pelaksana" type="text" class="form-control" placeholder="Silahkan input nama pelaksana" required>
                          </div>
                      </div>
                  </div>
                  <div class="form-group m-b-11">
                      <label class="col-md-4 col-form-label control-label">Keterangan</label>
                      <div class="col-md-7">
                          <div class="input-group">
                              <input value="<?php echo isset($edit) ? $edit['keterangan'] : '' ?>" name="keterangan" type="text" class="form-control" placeholder="Silahkan input keterangan">
                          </div>
                      </div>
                  </div>

                </div>
              </div>
              <div class="panel-footer">
                <div class="col-sm-10">
                  <div class="row">
                    <div class="col-md-4"></div>
                    <div class="col-md-7">
                      <button type="submit" class="btn btn-primary">Simpan</button>
                      <button type="button" onclick="goBack();" class="btn btn-danger">Batal</button>
                    </div>
                  </div>
                </div>
              </div>
          </div>
        </form>

    </div>
</div>

<script type="text/javascript">
		function persenAir(){
			var f = $('.berat_segar').val();
			var g = $('.berat_kering').val();

			if(f === '') f = 0;
			if(g === '') g = 0;

			var i = (parseFloat(f)-parseFloat(g))/parseFloat(f)*100;

			if(isNaN(parseFloat(i))){
					$('.kadar_air').val(0);
			}else{
				$('.kadar_air').val(parseFloat(i.toFixed(2)));
			}
		}
</script>
