@extends('layouts.app') @section('content') @php $amount = null; if ($originalTransaction) { $amount = format_number($originalTransaction->amount); } @endphp
@can('create', new App\Transaction) @if (request('action') == 'add-income') @section('title', __('transaction.income'))
{!! Form::open(['route' => 'transactions.store', 'autocomplete' => 'off', 'files' => true]) !!} {{ Form::hidden('in_out', 1) }}
{!! FormField::text('date', [ 'required' => true, 'label' => __('app.date'), 'value' => old('date', $selectedDate), 'class' => 'date-select' ]) !!}
{!! FormField::select('category_id', $categories, [ 'label' => __('category.category'), 'placeholder' => __('category.uncategorized'), 'value' => old('category_id', optional($originalTransaction)->category_id), 'info' => ['text' => __('transaction.category_help_text', ['link' => $categorySettingLink])], ]) !!}
{!! FormField::textarea('description', [ 'required' => true, 'label' => __('transaction.description'), 'value' => old('description', optional($originalTransaction)->description), ]) !!}
{!! FormField::text('amount', [ 'required' => true, 'label' => __('transaction.amount'), 'addon' => ['before' => config('money.currency_code')], 'step' => number_step(), 'value' => old('amount', $amount), ]) !!}
@if ($partnerTypeCodes) {!! FormField::select('partner_id', $partners, [ 'label' => $partnerSelectionLabel, 'placeholder' => $partnerDefaultValue, 'value' => old('partner_id', optional($originalTransaction)->partner_id), 'info' => ['text' => __('transaction.partner_help_text', ['partner' => $partnerSelectionLabel, 'link' => $partnerSettingLink])], ]) !!} @else {{ Form::hidden('partner_id') }} @endif
{!! FormField::select('bank_account_id', $bankAccounts, [ 'label' => __('transaction.destination'), 'placeholder' => __('transaction.cash'), 'value' => old('bank_account_id', optional($originalTransaction)->bank_account_id), ]) !!}
@if($isDiskFull) @else {{ Form::file('files[]', ['multiple' => true, 'class' => 'form-control-file border p-2 rounded '.($errors->has('files.*') ? 'is-invalid' : ''), 'accept' => 'image/*', 'disabled' => $isDiskFull ? 'disabled' : null]) }} @if ($errors->has('files.*')) @foreach ($errors->get('files.*') as $key => $errorMessages) {!! $errors->first($key, ':message') !!} @endforeach @endif @endif
{{ Form::close() }}
@endif @if (request('action') == 'add-spending') @section('title', __('transaction.spending'))
{!! Form::open(['route' => 'transactions.store', 'autocomplete' => 'off', 'files' => true]) !!} {{ Form::hidden('in_out', 0) }}
{!! FormField::select('bank_account_id', $bankAccounts, [ 'label' => __('transaction.origin'), 'placeholder' => __('transaction.cash'), 'value' => old('bank_account_id', optional($originalTransaction)->bank_account_id), ]) !!}
{!! FormField::text('date', [ 'required' => true, 'label' => __('app.date'), 'value' => old('date', $selectedDate), 'class' => 'date-select' ]) !!}
{!! FormField::select('category_id', $categories, [ 'label' => __('category.category'), 'placeholder' => __('category.uncategorized'), 'value' => old('category_id', optional($originalTransaction)->category_id), 'info' => ['text' => __('transaction.category_help_text', ['link' => $categorySettingLink])], ]) !!}
{!! FormField::textarea('description', [ 'required' => true, 'label' => __('transaction.description'), 'value' => old('description', optional($originalTransaction)->description), ]) !!}
{!! FormField::text('amount', [ 'required' => true, 'label' => __('transaction.amount'), 'addon' => ['before' => config('money.currency_code')], 'step' => number_step(), 'value' => old('amount', $amount), ]) !!}
@if ($partnerTypeCodes) {!! FormField::select('partner_id', $partners, [ 'label' => $partnerSelectionLabel, 'placeholder' => $partnerDefaultValue, 'value' => old('partner_id', optional($originalTransaction)->partner_id), 'info' => ['text' => __('transaction.partner_help_text', ['partner' => $partnerSelectionLabel, 'link' => $partnerSettingLink])], ]) !!} @else {{ Form::hidden('partner_id') }} @endif
@if($isDiskFull) @else {{ Form::file('files[]', ['multiple' => true, 'class' => 'form-control-file border p-2 rounded '.($errors->has('files.*') ? 'is-invalid' : ''), 'accept' => 'image/*', 'disabled' => $isDiskFull ? 'disabled' : null]) }} @if ($errors->has('files.*')) @foreach ($errors->get('files.*') as $key => $errorMessages) {!! $errors->first($key, ':message') !!} @endforeach @endif @endif
{{ Form::close() }}
@endif @endcan
@endsection @section('styles') {{ Html::style(url('css/plugins/jquery.datetimepicker.css')) }} {{ Html::style(url('css/plugins/select2.min.css')) }} {{ Html::style(url('css/plugins/select2-bootstrap.min.css')) }} @endsection @push('scripts') {{ Html::script(url('js/plugins/jquery.datetimepicker.js')) }} {{ Html::script(url('js/plugins/select2.min.js')) }} {{ Html::script(url('js/plugins/number-format.js')) }} @endpush