@extends('adminlte::page') @section('content')
<?php Fun::lang()?>
    <div class="title-page">
        <div class="page-bar">
            <ul class="page-breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> Dashboard</a></li>
                <li><a href="#">Accounting</a></li>
                <li><a href="#">Create Expense</a></li>
            </ul>
        </div>
    </div>
    <div class="page">
        <div class="top-content">
            <div class="row">
                <div class="col-sm-12 col-xs-12">
                    <div class="title-add">
                        <div class="pull-left">
                            <h3>Create Expense</h3>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12 col-xs-12">
                
                <div class="form-wrapper">
                    {!! Form::open(array('route' => 'accouting-expense.store','method'=>'POST')) !!}
                    <div class="row">
                        <div class="form-group col-sm-6 col-xs-12">
                            <label class="required">Pay For</label>
                            {!! Form::select('pay_for', $projects, null, ['class' => 'form-control select2','required']) !!}
                        </div>
                        <div class="form-group col-sm-6 col-xs-12">
                            <label class="required">Account Type</label>
                            {!! Form::select('journal_acccode', $account_chats, null, ['class' => 'form-control select2','required']) !!}
                        </div>
                        <div class="form-group col-sm-6 col-xs-12">
                            <label class="required">Amount</label>
                            {!! Form::text('amount', null, array('placeholder' => 'Amount','class' => 'form-control number-only','required')) !!}
                        </div>
                        <div class="form-group col-sm-6 col-xs-12">
                            <label class="required">Date</label>
                            {!! Form::text('journal_paydate', null, array('placeholder' => 'Date','class' => 'form-control date_picker','autocomplete'=>'off','required')) !!}
                        </div>
                        <div class="form-group col-sm-6 col-xs-12">
                            <label>Reference</label>
                            {!! Form::text('pay_to', null, array('placeholder' => 'Pay To','class' => 'form-control')) !!}
                        </div>
                        <div class="form-group col-sm-6 col-xs-12">
                            <label>Invoice</label>
                            {!! Form::text('journal_invoice', null, array('placeholder' => 'Reference','class' => 'form-control')) !!}
                        </div>
                        <div class="form-group col-sm-6 col-xs-12">
                            <label class="required">Cash Flow Type</label>
                            {!! Form::select('cash_flow_bank', $cash_flow, null, ['id' => 'cash-flow', 'class' => 'form-control select2','required']) !!}
                        </div>
                        <div class="form-group col-sm-6 col-xs-12" id="bank-list-condition">
                            <label class="required">Bank Name</label>
                            {!! Form::select('bank_id', $bank_data, null, ['id' => 'bank-list', 'class' => 'form-control select2']) !!}
                        </div>
                        <div class="col-sm-6">
                            <div class="form-group">
                                <label>Description</label>
                                {!! Form::textarea('journal_des', null, array('placeholder' => 'Description','class' => 'form-control','rows'=>'3')) !!}
                            </div>
                        </div>
                        <div class="col-sm-12 col-xs-12">
                            <div class="form-group">
                                <button type="submit" class="button_sm button_primary pull-right"><span class="fa fa-save"></span> Save</button>
                                <button type="button"  onClick="javascript:history.go(-1)" class="button_sm button_warning pull-right">
                                    <span class=" fa fa-arrow-circle-left"></span> Back</button>
                            </div>
                        </div>
                    </div>
                    {!! Form::close() !!}
                </div>
            </div>
        </div>
    </div>
    </div>
    @endsection

    @section('js')
        <script type="text/javascript">
            $( document ).ready(function() {
                var cash_flow = $('#cash-flow').val();
                if (cash_flow === "") {
                    $("#bank-list-condition").css({"display":"none"});
                } else if (cash_flow == 10000) {
                    $("#bank-list-condition").css({"display":"none"});
                } else if (cash_flow == 10001) {
                    $("#bank-list-condition").css({"display":"block"});
                }
                $("#cash-flow").change(function(){
                    var cash_flow = $(this).val();
                    if (cash_flow === "") {
                        $("#bank-list-condition").css({"display":"none"});
                    } else if (cash_flow == 10000) {
                        $("#bank-list-condition").css({"display":"none"});
                    } else if (cash_flow == 10001) {
                        $("#bank-list-condition").css({"display":"block"});
                    }
                });
            });
        </script>
    @endsection