<?php 
  include '_header-artibut.php';
  $id = $_POST['id'];
?>
	
  <?php  
    $keranjang = query("SELECT * FROM data_servis_sparepart WHERE dss_id = $id")[0];
    $barangId  = $keranjang['barang_id'];

    $barang = query("SELECT * FROM barang WHERE barang_id = $barangId")[0];
    $barangStock    = $barang['barang_stock'];
    $barang_terjual = $barang['barang_terjual'];
  ?>

	<input type="hidden" name="dss_id" value="<?= $id; ?>">
  <?php /*
  <input type="hidden" name="dss_harga_utama" value="<?= $keranjang['dss_harga_utama']; ?>">*/ 
  ?>
  <input type="hidden" name="dss_qty_old" value="<?= $keranjang['dss_qty']; ?>">
  <input type="hidden" name="barang_stock" value="<?= $barangStock; ?>">
  <input type="hidden" name="barang_terjual" value="<?= $barang_terjual; ?>">
  <input type="hidden" name="barang_id" value="<?= $barangId; ?>">

	<div class="form-group">
      <label for="dss_qty">QTY</label>
      <?php  
        $max = $barangStock + $keranjang['dss_qty'];
      ?>
      <input type="number" min="1" max="<?= $max; ?>" class="form-control" name="dss_qty" value="<?= $keranjang['dss_qty']; ?>">
      <small>Stock Tersedia <?= $barangStock; ?></small>
  </div>
  <div class="form-group">
      <label for="dss_harga">Harga</label>
       <input type="number" name="dss_harga" class="form-control" id="dss_harga" value="<?= $keranjang['dss_harga']; ?>" required>
  </div>

