@extends('layouts.master')

@section('content')
<section class="content">
     <div class="row">
     <div class="col-xs-12 col-sm-12 col-md-7 col-lg-7">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">Make Payment</h3>
            </div>
            <div class="panel-body">
                @include('layouts.message')
                <form action="{{ url('account/journal/payment/save') }}" method="POST" class="form-horizontal" role="form">
                        {{ csrf_field() }}
                        <input type="hidden" name="hdn_req_id" value="{{ $fund_req->id }}">
                        <input type="hidden" name="hdn_id" value="{{ $fund_req->purpose }}">
                        <input type="hidden" name="hdn_payable_amount" value="{{ $fund_req->amount }}">
                        <div class="form-group">
                            <label for="account_head" class="col-sm-12 col-xs-12 col-md-2 col-lg-2 control-label">Account Head</label>
                            
                            <div class="col-xs-12 col-sm-12 col-md-5 col-lg-5">
                                <select name="account_head" id="account_head" class="form-control">
                                    <option value="">-Select Account Head-</option>
                                    @if($acc_head)
                                        @foreach($acc_head as $head)
                                            <option value="{{ $head->id }}">{{ $head->name }}</option>
                                            @if($head->children)
                                            @foreach($head->children  as $child)
                                            <option value="{{ $child->id }}">&nbsp;&nbsp;&nbsp;{{ $child->name }}</option>
                                            @endforeach
                                            @endif
                                        @endforeach
                                    @endif
                                </select>
                            </div>
                        </div>

                        <div id='bank_div' class="form-group hide">
                            <label for="bank_name" class="col-sm-12 col-xs-12 col-md-2 col-lg-2 control-label">Bank Name</label>
                            
                            <div class="col-xs-12 col-sm-12 col-md-5 col-lg-5">
                                <select name="bank_name" id="bank_name" class="form-control">
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="amount" class="col-sm-12 col-xs-12 col-md-2 col-lg-2 control-label">Amount</label>
                            
                            <div class="col-xs-12 col-sm-12 col-md-5 col-lg-5">
                                <input type="text" name="amount" id="amount" class="form-control" onkeypress="return checkNumber(event)" required placeholder="Amount" value="{{ $fund_req->amount }}"> 
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="remarks" class="col-sm-12 col-xs-12 col-md-2 col-lg-2 control-label">Remarks</label>
                            
                            <div class="col-xs-12 col-sm-12 col-md-5 col-lg-5">
                                <textarea name="remarks" id="remarks" class="form-control date" placeholder="Remarks"></textarea> 
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-10 col-sm-offset-2">
                                <button type="submit" class="btn btn-primary"><i class="fa fa-save"></i> Pay Now</button>

                                <a href="{{ url('account/journal') }}" class="btn btn-default"><i class="fa fa-times"></i> Cancel</a>
                            </div>
                        </div>
                </form>
            </div>
        </div>
     </div>

     <div class="col-xs-12 col-sm-12 col-md-5 col-lg-5">

        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">Requested Amount</h3>
            </div>
            <div class="panel-body">
                <ul class="list-group">
                    <li class="list-group-item">Requested Amount : <span>Tk. {{ $fund_req->amount }}</span></li>
                    {{-- <li class="list-group-item">Remarks:<span>{{ $journal_comment->remarks }}</span></li> --}}
                    <li class="list-group-item">Request By:  <span>{{ $fund_req->user?$fund_req->user->name:'' }}</span></li>
                </ul>
            </div>
        </div>
    </div>

     </div>
</section>
@stop


@section('style')
<style>
    .list-group-item span{
        display: inline-block;
        margin-left: 25%;
    }
</style>
@stop

@section('script')
<script type="text/javascript">
$(document).ready(function() {
    $('#account_type').change(function(){

        var id=$(this).val();

        if(id==4)
        {
            $('#bank_div').removeClass('hide');
        }
        else
        {
            $('#bank_div').addClass('hide');
        }

    });
});
</script>
@stop