@extends('layout')


@section('content')

<div class="page-header page-header-default">
	<div class="breadcrumb-line">
		<ul class="breadcrumb">
			<li><i class="icon-home2 position-left"></i> Master</li>
			<li class="active">Upah Tenun</li>
		</ul>
	</div>
</div>

<div class="content">
	<div class="panel panel-flat">
		<div class="panel-heading">
			<h5 class="panel-title">Tambah Upah Tenun</h5>
			<div class="heading-elements">
				<ul class="icons-list">
		      		<li><a href="{{ url('upahtenun') }}" class="text-warning"><i class="icon-circle-left2 warning"></i> Kembali</a></li>
		      		<!-- <li><a data-action="collapse"></a></li> -->
		      	</ul>
	       	</div>
	    </div>
	    <form class="form-horizontal" action="{{ $url_simpan }}" method="POST">
	    	{{ csrf_field() }}
	    <div class="panel-body">
	    	<div class="row">
	    		<div class="col-sm-12 col-md-6">
	    			<div class="form-group">
	    				{{ Form::label('Nama Upah', '', ['class' => 'control-label col-sd-12 col-md-3']) }}
	    				<div class="col-sm-12 col-md-9">
	    					{{ Form::text('nama_upah', $data['nama_upah'], ['class' => 'form-control', 'required' => 'true']) }}
	    				</div>
	    			</div>
	    			<div class="form-group">
	    				{{ Form::label("Lokasi", "", ['class'=>'control-label col-sm-12 col-md-3']) }}
	    				<div class="col-sm-12 col-md-9">
	    					{{ Form::select("id_lokasi", $lokasi, $data['id_lokasi'], ['class'=>'form-control set_select2']) }}
	    				</div>
	    			</div>
	    			<div class="form-group">
	    				{{ Form::label("Tanggal Berlaku", "", ['class'=>'control-label col-sm-12 col-md-3']) }}
	    				<div class="col-sm-12 col-md-9">
	    					{{ Form::text("tanggal_berlaku", $data['tanggal_berlaku'], ['class'=>'form-control set_datepicker', 'readonly'=>'']) }}
	    				</div>
	    			</div>
	    			<div class="form-group">
	    				{{ Form::label("Motif", "", ['class'=>'control-label col-sm-12 col-md-3']) }}
	    				<div class="col-sm-12 col-md-9">
	    					{{ Form::select("id_motif", $motif, $data['id_motif'], ['class'=>'form-control set_select2']) }}
	    				</div>
	    			</div>
	    			<div class="form-group">
	    				{{ Form::label("Satuan", "", ['class'=>'control-label col-sm-12 col-md-3']) }}
	    				<div class="col-sm-12 col-md-9">
	    					{{ Form::select("id_satuan", $satuan, $data['id_satuan'], ['class'=>'form-control set_select2']) }}
	    				</div>
	    			</div>
	    			<div class="form-group">
	    				{{ Form::label('Status', "", ['class' => 'control-label col-sm-12 col-md-3']) }}
	    				<div class="col-sm-12 col-md-9">
	    					{{ Form::select('status', $status, $data['status'], ['class'=>'form-control set_select2']) }}
	    				</div>
	    			</div>
	    		</div>

	    		<div class="col-sm-6 col-md-6">
	    			<div class="form-group">
	    				{{ Form::label("Upah Petenun", "", ['class'=>'control-label col-sm-12 col-md-3']) }}
	    				<div class="col-sm-12 col-md-9">
	    					{{ Form::number("nominal_rekanan", $data['nominal_rekanan'], ['class'=>'form-control text-right', 'onkeyup'=>'setFormatMoney($(this), "div")', 'min'=>0, 'step'=>0.01]) }}
	    					<span class="help-block text-right">Rp0,00</span>
	    				</div>
	    			</div>
	    			<div class="form-group">
	    				{{ Form::label("Upah Makelar", "", ['class'=>'control-label col-sm-12 col-md-3']) }}
	    				<div class="col-sm-12 col-md-9">
	    					{{ Form::number("nominal_rekanan_kelompok", $data['nominal_rekanan_kelompok'], ['class'=>'form-control text-right', 'onkeyup'=>'setFormatMoney($(this), "div")', 'min'=>0, 'step'=>0.01]) }}
	    					<span class="help-block text-right">Rp0,00</span>
	    				</div>
	    			</div>
	    			<div class="form-group">
	    				{{ Form::label("Upah Kualitas D", "", ['class'=>'control-label col-sm-12 col-md-3']) }}
	    				<div class="col-sm-12 col-md-9">
	    					{{ Form::number("potongan_d", $data['potongan_d'], ['class'=>'form-control text-right', 'onkeyup'=>'setFormatMoney($(this), "div")', 'min'=>0, 'step'=>0.01]) }}
	    					<span class="help-block text-right">Rp0,00</span>
	    				</div>
	    			</div>
	    			<div class="form-group">
	    				{{ Form::label("Upah Kualitas N", "", ['class'=>'control-label col-sm-12 col-md-3']) }}
	    				<div class="col-sm-12 col-md-9">
	    					{{ Form::number("potongan_n", $data['potongan_n'], ['class'=>'form-control text-right', 'onkeyup'=>'setFormatMoney($(this), "div")', 'min'=>0, 'step'=>0.01]) }}
	    					<span class="help-block text-right">Rp0,00</span>
	    				</div>
	    			</div>
	    			<div class="form-group">
	    				{{ Form::label("Upah Kualitas BS", "", ['class'=>'control-label col-sm-12 col-md-3']) }}
	    				<div class="col-sm-12 col-md-9">
	    					{{ Form::number("potongan_bs", $data['potongan_bs'], ['class'=>'form-control text-right', 'onkeyup'=>'setFormatMoney($(this), "div")', 'min'=>0, 'step'=>0.01]) }}
	    					<span class="help-block text-right">Rp0,00</span>
	    				</div>
	    			</div>
	    		</div>
	    	</div>
	    </div>
	    <div class="panel-footer">
	    	<div class="col-sm-12 col-md-12 text-right">
	    		<a href="{{ url('upahtenun') }}" class="btn btn-default">Batal</a>
	    		<button type="submit" class="btn btn-success">Simpan</button>
	    	</div>
	    </div>
		</form>

	</div>
</div>



<script type="text/javascript">
	$(document).ready(function(){
		$(".set_select2").select2();
		$(".set_datepicker").datepicker({
			format : "dd-mm-yyyy",
			autoclose : true,
			zIndexOffset : 9999,
		})
		$("input[type=number]").trigger("keyup");

	});

	function setFormatMoney(this_, p) {
		var div = this_.parent(p);
		var data = this_.val();
		if(data==""){
			data = 0;
		}
		div.find(".help-block").html(accounting.formatMoney(data));
	}
</script>

@endsection