@if(isset($transaction) && $transaction->id) {!! Form::model($transaction, ['route' => ['admin.finances.budgets.transactions.update', ['budget' => $budget, 'transaction' => $transaction]], 'method' => 'PUT']) !!} @else {!! Form::model($budget, ['route' => ['admin.finances.budgets.transactions.store', [$budget->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] : [$budget->id =>$budget->name], @$transaction->type == 'Credit' ? $transaction->related->accountBalance->id : $budget->id, [ 'class' => 'form-control', 'data-kt-select2' => 'true', 'disabled' => $transaction->type != 'Credit', 'data-remote' => route('resource-select', ['resource' => 'AccountBalance', 'except' => $budget->id]), 'placeholer' => __('Select Account') ] ) !!} @else {!! Form::text('this_account', $budget->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' ? [$budget->id =>$budget->name] : [$transaction->related->accountBalance->id => $transaction->related->accountBalance->name], @$transaction->type == 'Credit' ? $budget->id : $transaction->related->accountBalance->id, [ 'class' => 'form-control', 'data-kt-select2' => 'true', 'disabled' => @$transaction->type == 'Credit', 'data-remote' => route('resource-select', ['resource' => 'AccountBalance', 'except' => $budget->id, 'ia_trancation_type' => 'transfer_from_budget']), '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' => $budget->id, 'ia_trancation_type' => 'transfer_from_budget']), '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')]) !!}
@if(request()->type != 'transfer') {{-- select funding source --}}
{{ Form::label('funding_source_id', __('Funding Source'), ['class' => 'col-form-label']) }} {!! Form::select('funding_source_id', $fundingSources ?? [], null, ['class' => 'form-control', 'data-kt-select2' => 'true', 'data-tags' => 'true', 'data-remote' => route('resource-select', ['FundingSource']), 'placeholder' => __('Select Funding Source')]) !!}
@endif {{-- description --}}
{{ Form::label('description', __('Description'), ['class' => 'col-form-label']) }} {!! Form::textarea('description', null, ['class' => 'form-control', 'placeholder' => __('Description'), 'rows' => '3']) !!}
{!! Form::close() !!}