<?php $__env->startSection('content'); ?>
<title>Data Keranjang Keluar</title>

<div class="card-header py-3">
  <h6 class="m-0 font-weight-bold text-dark">Data Keranjang Barang Keluar</h6>
</div>
<div class="card-body">
  <div class="table-responsive">
        <?php if ($errors->has('id_barang')) :
if (isset($message)) { $messageCache = $message; }
$message = $errors->first('id_barang'); ?>
            <span class="invalid-feedback" role="alert">
                <strong class="text-danger"><?php echo e($message); ?></strong>
            </span>
        <?php unset($message);
if (isset($messageCache)) { $message = $messageCache; }
endif; ?> 
    
    <button class="btn btn-success" data-toggle="modal" data-target="#tambah">Tambah Data</button>
      <br>
      <br>
      <table id="dataTable" class="table table-bordered" cellspacing="0">
          <thead>
            <tr>
                  <th>No</th>
                  <th>Barang</th>
                  <th>Jumlah</th>
                  <th>Tujuan</th>
                  <th>Tanggal Masuk</th>
                  <th>Opsi</th>
            </tr>
          </thead>
          <tbody>
            <?php $__currentLoopData = $keluar; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $i => $u): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <tr class="data-row">
                  <td><?php echo e(++$i); ?></td>
                  <td><?php echo e($u->nama_barang); ?></td>
                  <td><?php echo e($u->jumlah_keluar); ?></td>
                  <td><?php echo e($u->untuk); ?></td>
                  <td><?php echo e($u->tanggal_keluar); ?></td>
                  
              <td>  
                <div class="row">
                   <a href="/keranjang_keluar/edit/<?php echo e($u->id_keluar); ?>" class="btn btn-primary btn-sm ml-2">Edit</a>
                   <a href="/keranjang_keluar/hapus/<?php echo e($u->id_keluar); ?>" class="btn btn-danger btn-sm ml-2">Hapus</a>
                </div>
              </td>
            </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
          </tbody>
        </table>
  </div>
  <div class="text-center">
  <a href="/inputkeluar" class="btn btn-dark">Masukan Semua Data</a>
  </div>
  <br>
   <font><b>*Mohon untuk langsung klik masukkan semua data untuk memasukan ke dalam data barang keluar</b></font>
</div>

<div id="tambah" class="modal fade" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <h4 class="modal-title">Masukan Data</h4>
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="modal-body">
        <form action="/keranjang_keluar/store" method="post">
            <?php echo csrf_field(); ?>
         
          <div class="form-group">
             <div class="input_fields_wrap">
            <button class="add_field_button btn btn-primary">Add More Fields</button>
            <table>
              <tr>
                <td>
                  <label for="">Nama Barang</label>
                      <select name="id_barang[]" class="myselect" style="width:200px">
                          <option selected disabled>Pilih Jenis Barang</option>
                          <?php $__currentLoopData = $barang; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $j): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                          <option value="<?php echo e($j->id_barang); ?>"><?php echo e($j->nama_barang); ?></option>
                          <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>  
                    </select>
                    </div>
                </td>
                <td>
                  <label for="">Jumlah</label>
                <input type="number" name="jumlah[]" class="form-control" required placeholder="Masukan Jumlah" required>
                </td>
              </tr>
            </table>
              
          </div>
          <div class="form-group">
                <label for="">Penerima</label>
                <input type="text" name="untuk" class="form-control" required>
            </div>
           <div class="form-group">
                <label for="">Tanggal Keluar</label>
                <input type="date" name="tanggal_keluar" class="form-control" required>
            </div>
             
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
          <button type="submit" class="btn btn-primary">Simpan</button>
        </form>
        </div>
      </div>
    </div>
  </div>

  
  <?php $__env->startPush('scripts'); ?>
  <script type="text/javascript">
        $(document).ready(function() {
	var max_fields      = 100; //maximum input boxes allowed
	var wrapper   		= $(".input_fields_wrap"); //Fields wrapper
  var add_button      = $(".add_field_button"); //Add button ID
	
	var x = 1; //initlal text box count
	$(add_button).click(function(e){ //on add input button click
		e.preventDefault();
		if(x < max_fields){ //max input box allowed
      x++; //text box increment
    

      $(wrapper).append('<div><table><tr><td><select name="id_barang[]" class="myselect" style="width:200px"><option selected disabled>Pilih Jenis Barang</option><?php $__currentLoopData = $barang; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $j): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($j->id_barang); ?>"><?php echo e($j->nama_barang); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select></div></td><td style="padding-left:75px"><input type="number" name="jumlah[]" class="form-control" required placeholder="Masukan Jumlah" required></td></tr></table><a href="#" class="remove_field">Remove</a></div>');
      $('.myselect').select2();
		}
  });
  

	$(wrapper).on("click",".remove_field", function(e){ //user click on remove text
		e.preventDefault(); $(this).parent('div').remove(); x--;
  })
  
  
});



</script>



  <?php $__env->stopPush(); ?>
  
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH R:\software\xampp\htdocs\laravel_sarpras\resources\views/keranjang_keluar/view.blade.php ENDPATH**/ ?>