<div class="modal" id="add_detail" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" >
    <div class="modal-dialog modal-md">
        <div class="modal-content">
            <div class="modal-content" style="border-left: red 2px solid;">
     
<form class="form-horizontal" data-toggle="validator" method="post" id="form-add_detail">
   <?php echo e(csrf_field()); ?> <?php echo e(method_field('POST')); ?>

   
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"> &times; </span> </button>
        <h6 class="modal-title">Detail Product</h6>
    </div>

   <div style="padding:5px 50px">

    <input type="hidden" id="idpo2" name="idpo2">
    <input type="hidden" id="iddetail" name="iddetail">
    <input type="hidden" id="idsup" name="idsup">

    <input type="hidden" id="tp" name="tp" value="1">

	<div class="form-group">
		<div class="col-md-8">
			<input type="radio"  id="tipe" name="tipe" onchange="handleChange(this);" value="1" checked="checked"> ALL Product 
			<input type="radio"  id="tipe" name="tipe" onchange="handleChange(this);" value="2"> Supplier Product <br>
		</div>
	</div>      
   
	<div class="form-group">
		<input id="prd2" type="hidden" class="form-control" name="prd2" readonly="true" autofocus required>	
		<label>Produk</label>
		<div class="input-group">
			<input type="text" class="form-control" id="produk" name="produk" autofocus required readonly="true">
			<span class="input-group-btn">
				<button onclick="showProduk()" id="btnproduk" type="button" class="btn btn-info" style="width:10px;height:30px;">...</button>
			</span>
		</div>
    </div>
    
    <div class="form-group">
        <input type="hidden" id="kms2" name="kms2">
        <label>Kemasan/Isi</label>
        <input type="text" class="form-control" id="kms" name="kms" autofocus required readonly="true">
    </div>
    
    <div class="form-group">
        <label>Harga </label>
        <input type="number" class="form-control" id="harga" name="harga" autofocus>
        <small class="text-muted">Harga modal, bisa diedit </small>
    </div>

    <div class="form-group">
        <label>Discount </label>
        <input type="number" class="form-control" id="dis1" name="dis1" value="0" required autofocus>
        <small class="text-muted">Disc per Item barang dlm %</small>
    </div>

    <div class="form-group">
        <label>QTY</label>
        <input type="number" id="qty" name="qty" class="form-control" value="1" autofocus required>
        <small class="text-muted">Qty barang</small>
    </div>

   
    <div class="text-right">
        <button type="submit-add" class="btn btn-primary btn-save btn-sm"><i class="fa fa-floppy-o"></i> Save </button> 
        <button type="button" class="btn btn-warning btn-close btn-sm" data-dismiss="modal"><i class="fa fa-times-circle"></i> Cancel </button>
    </div>
    <br>
    </div>
    
</form>

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

<!----------------------------------------------------------------->
   
<script type="text/javascript">

function showProduk(){
	var supid=$('#idsup').val();
	var tp=$('#tp').val();
	
    $('#modal-produk').modal('show');
	
    tblproduk.ajax.url("invoice/"+supid+"/"+tp+"/listproduk");
	tblproduk.ajax.reload();
}

function selectProduk(id){
    var tp=$('#tp').val();
	$('#iddetail').val(id);
	$('#modal-produk').modal('hide');
	
	$.ajax({
        url : "<?php echo e(DIR_APP); ?>invoice/"+id+"/"+tp+"/tampilproductlist",
        type : "GET",
        dataType : "JSON",
        success : function(data){
            $('#produk').val(data.nama_brg);
			$('#kms').val(data.satuan. concat('/', data.isi));
			$('#harga').val(data.harga);
        },
        error : function(){
          alert("Tidak dapat menampilkan data!");
        }   
     });  
}

function handleChange(src) {
  $('#tp').val(src.value);
}

</script>
   
        


 
<?php /**PATH /home/u345793601/domains/my-projeq.com/public_html/swa/resources/views/purchase/add_detail.blade.php ENDPATH**/ ?>