@if(isset($transaction) && $transaction->id) {!! Form::model($transaction, ['route' => ['admin.finances.financial-years.transactions.update', ['financial_year' => $financialYear, 'transaction' => $transaction]], 'method' => 'PUT']) !!} @else {!! Form::model($financialYear, ['route' => ['admin.finances.financial-years.transactions.store', [$financialYear->id, 'type' => request()->type]], 'method' => 'POST']) !!} @endif
{{-- Amount --}}
{{ Form::label(@$transaction->type == 'Credit' ? 'account_id' : 'this_account', request()->type == 'deposit' ? __('To Account') : __('From Account'), ['class' => 'col-form-label']) }} @if(isset($transaction) && $transaction->data['trx_purpose'] == 'transfer') {!! Form::select( @$transaction->type == 'Credit' ? 'account_id' : 'this_account', @$transaction->type == 'Credit' ? [$transaction->related->accountBalance->id => $transaction->related->accountBalance->name] : [$financialYear->id =>$financialYear->name], @$transaction->type == 'Credit' ? $transaction->related->accountBalance->id : $financialYear->id, [ 'class' => 'form-control', 'data-kt-select2' => 'true', 'disabled' => $transaction->type != 'Credit', 'data-remote' => route('resource-select', ['resource' => 'AccountBalance', 'except' => $financialYear->id]), 'placeholer' => __('Select Account') ] ) !!} @else {!! Form::text('this_account', $financialYear->name, ['class' => 'form-control', 'disabled','placeholder' => __('Account')]) !!} @endif
@if(request()->type == 'transfer')
@if(isset($transaction) && $transaction->data['trx_purpose'] == 'transfer') {{ Form::label(@$transaction->type == 'Credit' ? 'this_account' : 'account_id', __('To Account'), ['class' => 'col-form-label']) }} {!! Form::select( @$transaction->type == 'Credit' ? 'this_account' : 'account_id', @$transaction->type == 'Credit' ? [$financialYear->id =>$financialYear->name] : [$transaction->related->accountBalance->id => $transaction->related->accountBalance->name], @$transaction->type == 'Credit' ? $financialYear->id : $transaction->related->accountBalance->id, [ 'class' => 'form-control', 'data-kt-select2' => 'true', 'disabled' => @$transaction->type == 'Credit', 'data-remote' => route('resource-select', ['resource' => 'AccountBalance', 'except' => $financialYear->id]), 'placeholer' => __('Select Account') ] ) !!} @else {{ Form::label('account_id', __('To Account'), ['class' => 'col-form-label']) }} {!! Form::select( 'account_id', ['' => __('Select Account')], null, [ 'class' => 'form-control', 'data-kt-select2' => 'true', 'disabled' => @$transaction->type == 'Credit', 'data-remote' => route('resource-select', ['resource' => 'AccountBalance', 'except' => $financialYear->id]), 'placeholer' => __('Select Account') ] ) !!} @endif
@endif {{-- Amount --}}
{{ Form::label('amount', __('Amount'), ['class' => 'col-form-label']) }} {!! Form::number('amount', isset($transaction) ? abs($transaction->amount) : null, ['class' => 'form-control', 'placeholder' => __('Amount')]) !!}
{{-- description --}}
{{ Form::label('description', __('Description'), ['class' => 'col-form-label']) }} {!! Form::textarea('description', null, ['class' => 'form-control', 'placeholder' => __('Description'), 'rows' => '3']) !!}
{!! Form::close() !!}