@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><a href="#">Sumber Dana</a></li>
			<li class="active">Transaksi : Transfer</li>
		</ul>
	</div>
</div>

<div class="content">
	<div class="panel panel-flat">
		<div class="panel-heading">
			<h5 class="panel-title">Transaksi : EDIT TRANSFER</h5>

			<div class="heading-elements">
				<ul class="icons-list">
		      		<li><a href="{{ url('sumberdana/transaksi/daftar_transaksi') }}" class="text-warning"><i class="icon-circle-left2 warning"></i> Kembali</a></li>
		      	</ul>
	       	</div>

	    </div>

	    <form class="" role="form" id="form-transaksi-transfer-edit" method="post" action="{{ url('sumberdana/transaksi/edit_transaksi') }}">
	    	{{ Form::hidden("id", $transaksi->id) }}
	    	{{ Form::token() }}
	    	{{ Form::hidden('jenis_transaksi', '1') }}
	    	{{ Form::hidden('id_keu_sumber_dana', $transaksi->id_keu_sumber_dana) }}
	    	{{ Form::hidden('penerima_transaksi', '-') }}
	    <div class="panel-body">
	    	<div class="row">
	    		<div class="col-sm-12 col-md-12">
	    			<div class="col-sm-3 col-md-3">
				    	<div class="form-group">
			    			<label class="control-label">Lokasi</label>
			    			<select name="lokasi" class="form-control set_select2" required="">
			    				@foreach($lokasi_produksi AS $key => $value)
			    				<option value="{{ $value->id_lokasi }}" {{ ($value->id_lokasi==$transaksi->lokasi) ? "selected=''" : "" }}>{{ $value->nama_lokasi }}</option>
			    				@endforeach
			    			</select>
			    		</div>
	    			</div>
	    		</div>
	    		<div class="col-sm-12 col-md-12">
	    			<div class="col-sm-3 col-md-3">
	    				<div class="form-group">
		    				{{ Form::label("No. Transaksi", "", ['class'=>'control-label']) }}
		    				{{ Form::label("nomor_transaksi", $transaksi->nomor_transaksi, ['class'=>'form-control', 'disabled'=>'']) }}
		    			</div>
	    			</div>
	    			<div class="col-sm-3 col-md-3">
	    				<div class="form-group">
		    				{{ Form::label("Tanggal", "", ['class'=>'control-label']) }}
		    				{{ Form::text("tanggal_transaksi", $transaksi->tanggal_transaksi, ['class'=>'form-control', 'disabled'=>'']) }}
		    			</div>
	    			</div>
	    		</div>
	    		<div class="col-sm-12 col-md-12">
	    			<div class="col-sm-3 col-md-3">
	    				<div class="form-group">
		    				{{ Form::label("Transfer dari", "", ['class'=>'control-label']) }}
		    				{{ Form::select("dari_akun", $akun, $akun_asal->id, ['class'=>'form-control set_select2']) }}
		    				{{-- Form::text("dari_akun", "$akun_asal->kode_perkiraan $akun_asal->nama_perkiraan", ['class'=>'form-control', 'disabled'=>'']) --}}
		    			</div>
	    			</div>
	    			<div class="col-sm-3 col-md-3">
	    				<div class="form-group">
		    				{{ Form::label("Setor ke", "", ['class'=>'control-label']) }}
		    				{{ Form::select("ke_akun", $akun, $transaksi->ke_akun, ['class'=>'form-control set_select2']) }}
		    				{{-- Form::text("ke_akun", "$transaksi->kode_perkiraan $transaksi->nama_perkiraan", ['class'=>'form-control', 'disabled'=>'']) --}}
		    			</div>
	    			</div>
	    			<div class="col-sm-3 col-md-3">
	    				<div class="form-group">
		    				{{ Form::label("Nominal", "", ['class'=>'control-label']) }}
		    				{{ Form::text("nominal_transaksi[]", $transaksi->nominal_transaksi, ['class'=>'form-control text-right', 'onkeyup'=>'setFormatMoney($(this), "div")', 'required'=>'']) }}
		    				<span class="help-block text-nominal text-right" style="font-weight: bold;">Rp {{ number_format($transaksi->nominal_transaksi, 2, ',', '.') }}</span>
		    			</div>
	    			</div>
	    		</div>
	    		<div class="col-sm-12 col-md-12">
	    			<div class="col-sm-6 col-md-6">
	    				<div class="form-group">
		    				{{ Form::label("Keterangan", "", ['class'=>'control-label']) }}
		    				{{ Form::text("keterangan[]", $transaksi->keterangan, ['class'=>'form-control', 'required'=>'']) }}
		    			</div>
	    			</div>
	    		</div>
	    		<div class="col-sm-12 col-md-12">
	    			<div class="col-sm-9 col-md-9 text-right">
	    				<div class="form-group">
					    	<button type="submit" class="btn btn-md btn-success"><i class="icon-floppy-disk"></i> Simpan</button>
		    			</div>
	    			</div>
	    		</div>
	    	</div>
	    </div>
		</form>
	    
	</div>
</div>

<script type="text/javascript">
var formTransfer = $("#form-transaksi-transfer-edit");
var idTransfer = formTransfer.find("input[name=id]");

$(document).ready(function () {
	$(".set_select2").select2();
	$(".set_datepicker").datepicker({
		format : 'dd/mm/yyyy',
		autoclose : true,
      	zIndexOffset : 9999,
	});

});

function resetFormTransfer() {
	$('body').loading({
        start : true,
        message : 'Memuat ...'
    });
    setTimeout(function(){
		formTransfer[0].reset();
		formTransfer.find("select").change();
		idTransfer.val("");
    	$('body').loading({
	        start : false,
	        message : 'Memuat ...'
	    });
    }, 1000);

}
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