Show list of currencies to choose from in TransactionWizard component
MODIFY
app/Http/Controllers/TransactionController.php
app/Http/Controllers/TransactionController.php
namespace App\Http\Controllers;
+use App\Repositories\CurrencyRepository;
use App\Repositories\RecurringRepository;
use App\Repositories\TransactionRepository;
use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
class TransactionController extends Controller
{
+ private $currencyRepository;
private $recurringRepository;
- public function __construct(TransactionRepository $transactionRepository, RecurringRepository $recurringRepository)
- {
+ public function __construct(
+ TransactionRepository $transactionRepository,
+ CurrencyRepository $currencyRepository,
+ RecurringRepository $recurringRepository
+ ) {
$this->repository = $transactionRepository;
+ $this->currencyRepository = $currencyRepository;
$this->recurringRepository = $recurringRepository;
}
@@ -43,6 +50,8 @@ class TransactionController extends Controller
return view('transactions.create', [
'tags' => $tags,
+ 'currencies' => $this->currencyRepository->getAll(),
+ 'defaultCurrencyId' => session('space')->currency_id,
'recurringsIntervals' => $this->recurringRepository->getSupportedIntervals()
]);
}

MODIFY
resources/assets/js/components/TransactionWizard.vue
resources/assets/js/components/TransactionWizard.vue
</div>
<div class="input">
<label>Amount</label>
+ <div class="row">
+ <div class="row__column row__column--double">
<input type="text" v-model="amount" />
+ </div>
+ <div class="row__column ml-2">
+ <select v-model="selectedCurrencyId">
+ <option v-for="currency in currencies" :key="'currencies-' + currency.id" :value="currency.id">
+ <span v-html="currency.symbol"></span>
+ </option>
+ </select>
+ </div>
+ </div>
+ <div class="hint mt-05" v-if="selectedCurrencyId !== defaultCurrencyId">{{ currencies.find(c => c.id === selectedCurrencyId).name }} will be converted into {{ currencies.find(c => c.id === defaultCurrencyId).name }}</div>
<validation-error v-if="errors.amount" :message="errors.amount"></validation-error>
</div>
<div>
export default {
props: [
'tags',
+ 'currencies',
+ 'defaultCurrencyId',
'recurringsIntervals'
],
date: this.getTodaysDate(),
description: '',
amount: '10.00',
+ selectedCurrencyId: this.defaultCurrencyId,
isRecurring: false,
recurringInterval: 'monthly',
recurringEnd: 'forever',

MODIFY
resources/views/transactions/create.blade.php
resources/views/transactions/create.blade.php
@section('body')
<div class="wrapper mw-400 my-3">
<h2 class="mb-3">{{ __('actions.create') }} Transaction</h2>
- <transaction-wizard :tags='@json($tags)' :recurrings-intervals='@json($recurringsIntervals)'></transaction-wizard>
+ <transaction-wizard
+ :tags='@json($tags)'
+ :currencies='@json($currencies)'
+ :default-currency-id='{{ $defaultCurrencyId }}'
+ :recurrings-intervals='@json($recurringsIntervals)'
+ ></transaction-wizard>
</div>
@endsection

Show list of currencies to choose from in TransactionWizard component