@extends('layout')


@section('content')

<div class="page-header page-header-default">
	<div class="breadcrumb-line">
		<ul class="breadcrumb">
			<li><a href="#"><i class="icon-home2 position-left"></i> Keuangan</a></li>
			<li class="active">Biaya Overhead Pabrik</li>
		</ul>
	</div>
</div>

<div class="content">
	<div class="panel panel-flat">
		<div class="panel-heading">
			<h5 class="panel-title">Tambah Biaya Overhead Pabrik</h5>
			<div class="heading-elements">
				<ul class="icons-list">
		      		<li>&nbsp;</li>
		      	</ul>
	       	</div>
	    </div>
	    
	    <form class="form-horizontal" id="form-overhead" method="post" action="{{ url('overhead_pabrik/simpan_realisasi') }}">
	    	{{ Form::token() }}
	    	{{ Form::hidden("id_bop", $bop->id) }}
	    <div class="panel-body">
	    	<div class="form-group">
	    		{{ Form::label("Tanggal", "", ['class'=>'control-label col-sm-2 col-md-2']) }}
	    		<div class="col-sm-3 col-md-3">
	    			{{ Form::text("tanggal_bop", date_format(date_create($bop->tanggal_bop), 'd-m-Y'), ['class'=>'form-control', 'readonly'=>'']) }}
	    		</div>
	    	</div>
	    	<div class="form-group">
	    		{{ Form::label("Nomor", "", ['class'=>'control-label col-sm-2 col-md-2']) }}
	    		<div class="col-sm-3 col-md-3">
	    			{{ Form::text("nomor_bop", $bop->nomor_bop, ['class'=>'form-control', 'readonly'=>'']) }}
	    		</div>
	    	</div>
	    	<div class="form-group">
	    		{{ Form::label("Bulan", "", ['class'=>'control-label col-sm-2 col-md-2']) }}
	    		<div class="col-sm-3 col-md-3">
	    			{{ Form::text("bulan_bop", bln_tostr($bop->bulan_bop),  ['class'=>'form-control', 'readonly'=>'']) }}
	    		</div>
	    		<div class="col-sm-2 col-md-2">
	    			{{ Form::text('tahun_bop', $bop->tahun, ['class'=>'form-control', 'readonly'=>'']) }}
	    		</div>
	    	</div>

	    	<div class="form-group">
	    		<div class="responsive">
	    			<table class="table" id="tabel-akun-bop">
	    				<thead>
	    					<tr>
	    						<th>Akun BOP</th>
	    						<th>Keterangan</th>
	    						<th>Nominal</th>
	    						<th>Realisasi</th>
	    					</tr>
	    				</thead>
	    				<tbody>
	    					@foreach($bop_detail AS $key => $value)
	    					<tr>
	    						<td>{{ format_akun_perkiraan($value)}}</td>
	    						<td>{{ $value->keterangan }}</td>
	    						<td>{{ $value->nominal }}</td>
	    						<td>
	    							{{ Form::hidden("id_bop_detail[]", $value->id) }}
	    							{{ Form::text("nominal_realisasi[]", $value->nominal_realisasi, ['class'=>'form-control text-right', 'onkeyup'=>'setFormatMoney($(this), "td")']) }}
									<strong><span class='help-block text-right'>0,00</span></strong>
	    						</td>
	    					</tr>
	    					@endforeach
	    				</tbody>
	    				<tfoot>

	    				</tfoot>
	    			</table>
	    		</div>
	    	</div>
	    </div>
	    <div class="panel-footer">
	    	<div class="col-sm-12 col-md-12 text-right">
	    		<a href="{{ url('overhead_pabrik') }}" class="btn btn-md btn-default">Batal</a>
	    		<button type="submit" class="btn btn-md btn-success">Simpan</button>
	    	</div>
	    </div>
		</form>

	</div>
</div>

<script type="text/javascript">
$(document).ready(function () {
	$(".set_datepicker").datepicker({
		format : 'dd-mm-yyyy',
		autoclose : true,
		zIndexOffset : 9999,
	});

	$("input[name='nominal_realisasi[]']").keyup();
});

function setFormatMoney(this_, p) {
	var div = this_.parents(p);
	var data = this_.val();
	if(data==""){
		data = 0;
	}
	div.find(".help-block").html(curr(data));
}

</script>
@endsection
