<?php $__env->startSection('content'); ?>
<div class="page-header page-header-default">
	<div class="breadcrumb-line">
		<ul class="breadcrumb">
			<li><a href="index.html"><i class="icon-home2 position-left"></i> Inventori</a></li>
			<li class="active">Penerimaan Barang</li>
		</ul>
	</div>
</div>

<div class="content">
	<div class="panel panel-flat">
		<div class="panel-heading">
			<h5 class="panel-title">Form Penerimaan Barang</h5>
			<div class="heading-elements">
				<ul class="icons-list">
		      		<li><a data-action="collapse"></a></li>
		      	</ul>
	       	</div>
	    </div>
	    <div class="panel-body">
	    	<form class="form-horizontal" action="" method="post" autocomplete="off" enctype="multipart/form-data">
	    		<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
	    		<input type="hidden" name="id" value="<?php echo e($data['pembelian']->id_pembelian); ?>">
	    		<input type="hidden" name="id_induk" value="<?php echo e($data['penerimaan_induk']['id_induk']); ?>">
	    		<table class="table table-stripped table-responsive">
	    			<tr>
	    				<td width="20%">No. Faktur Pembelian</td>
	    				<td width="5%">:</td>
	    				<td width="25%"><?php echo e($data['pembelian']->no_faktur.$data['pembelian']->sufix_no_faktur); ?></td>

	    				<td width="20%">Tanggal Penerimaan</td>
	    				<td width="5%">:</td>
	    				<?php  $tgl = $data['penerimaan_induk']['tanggal_terima'];  ?>
	    				<td width="25%"><?php echo e(($tgl == '') ? tgl_full($data['pembelian']->tanggal, ''):tgl_full($tgl, '')); ?></td>
	    			</tr>
	    			<tr>
	    				<td>Tanggal Input</td>
	    				<td>:</td>
	    				<td><?php echo e(tgl_full($data['pembelian']->tanggal, '')); ?></td>

	    				<td>Nomor Faktur</td>
	    				<td>:</td> <?php  $no_faktur = $data['penerimaan_induk']['no_faktur']; $faktur = $data['penerimaan_induk']['faktur'];  ?>
	    				<td><?php echo e(($no_faktur == '') ? $data['pembelian']->no_faktur.$data['pembelian']->sufix_no_faktur:$no_faktur.$faktur); ?></td>
	    			</tr>
	    			<tr>
	    				<td>Tanggal Faktur</td>
	    				<td>:</td>
	    				<td><?php echo e(tgl_full($data['pembelian']->tanggal_faktur, '')); ?></td>

	    				<td>Nomor Surat Jalan</td>
	    				<td>:</td>
	    				<td><?php echo e((isset($data['penerimaan_induk']['no_suratjalan'])) ? $data['penerimaan_induk']['no_suratjalan']:""); ?></td>
	    			</tr>
	    			<tr>
	    				<td>Penyedia</td>
	    				<td>:</td>
	    				<td><?php echo e($data['pembelian']->nama_penyedia); ?></td>

	    				<td>Nopol</td>
	    				<td>:</td>
	    				<td><?php echo e((isset($data['penerimaan_induk']['nopol'])) ? $data['penerimaan_induk']['nopol']:"-"); ?></td>
	    			</tr>
	    			<tr>
	    				<td>Lokasi Pembelian</td>
	    				<td>:</td>
	    				<td><?php echo e($data['pembelian']->nama_lokasi); ?></td>

	    				<td>Supir</td>
	    				<td>:</td>
	    				<td><?php echo e((isset($data['penerimaan_induk']['nama_supir'])) ? $data['penerimaan_induk']['nama_supir']:"-"); ?></td>
	    			</tr>
	    		</table>
	    		
	    		<div class="col-sm-12">
	    			<div class="panel panel-primary">
                
                	</div>
                	<h5>Detail Barang</h5>
	    
		            <table class="table datatable-basic table-stripped">
			    	<thead>
						<tr>
							<th>Nama Barang</th>
		                    <th>Qty. Nota</th>
		                    <th>Nama Satuan</th>
							<th>Qty. Terima</th>
		                    <th>Gudang</th>
						</tr>
					</thead>
					<tbody>
						<?php $__currentLoopData = $data['detail']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getFirstLoop(); ?> 
						<tr>
							<td><?php echo e($row['kode_barang'].' - '.$row['nama_barang']); ?></td>
							<td class="text-right"><?php echo e(format_angkav2($row['jml_barang'])); ?></td>
							<td><?php echo e($row['nama_satuan']); ?></td>
							<td class="text-right"><?php echo e(format_angkav2($row['jml_terima'])); ?></td>
							<td><?php echo e($row['nama_gudang']); ?></td>
						</tr>
						<?php endforeach; $__env->popLoop(); $loop = $__env->getFirstLoop(); ?>
						
					</tbody>
			    </table>
	    		</div>
	    		<div class="col-sm-12">
	    		
	    		</div>
	    		</div>
	    	</form>
	    	
	    </div>

	</div>
</div>

<!---Modal--->


<!----Modal---->

<script type="text/javascript">

	$(document).ready(function(){
	
		tb = $(".table_carabayar").DataTable();

		tb.on( 'order.dt search.dt', function () {
            tb.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
                cell.innerHTML = i+1;
            } );
        } ).draw();
        tb.clear().draw();

		
		$("[name=tgl_terima]").trigger('change');
	})

	function maksimal(x) {
    	var min = parseInt(x.attr('min'));
    	var max = parseInt(x.attr('max'));

    	if(x.val() > max) {
    		x.val(max);
    	}else if(x.val() < min){
    		x.val(min);
    	}
	}

	$("[name=status_pembelian]").change(function(){
		var value = $(this).val();
		
	})

	function get_faktur(this_){
		var tgl = this_.val();
		$.ajax({
			url: "<?php echo e(url('penerimaan/get_faktur')); ?>",
			type: 'get',
			dataType: 'json',
			data: {id : $("[name=id_induk]").val() , tgl : tgl},
			success: function(respon){
				$("[name=nomor_faktur]").val(respon.no_faktur);
				$("[name=faktur]").val(respon.faktur);
			}
		})


	}
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>