Various updates for split transactions.

This commit is contained in:
James Cole
2016-05-12 22:44:31 +02:00
parent cfcc4ce88a
commit d7ab482ae1
9 changed files with 285 additions and 223 deletions

View File

@@ -15,11 +15,11 @@ use FireflyIII\Crud\Split\JournalInterface;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Requests\SplitJournalFormRequest;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use Illuminate\Http\Request;
use Log;
use Session;
@@ -42,7 +42,13 @@ class SplitController extends Controller
View::share('title', trans('firefly.split-transactions'));
}
public function edit(TransactionJournal $journal)
/**
* @param Request $request
* @param TransactionJournal $journal
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
*/
public function edit(Request $request, TransactionJournal $journal)
{
$count = $journal->transactions()->count();
if ($count === 2) {
@@ -57,25 +63,16 @@ class SplitController extends Controller
/** @var BudgetRepositoryInterface $budgetRepository */
$budgetRepository = app(BudgetRepositoryInterface::class);
/** @var PiggyBankRepositoryInterface $piggyBankRepository */
$piggyBankRepository = app(PiggyBankRepositoryInterface::class);
$what = strtolower(TransactionJournal::transactionTypeStr($journal));
$currencies = ExpandedForm::makeSelectList($currencyRepository->get());
$assetAccounts = ExpandedForm::makeSelectList($accountRepository->getAccounts(['Default account', 'Asset account']));
$budgets = ExpandedForm::makeSelectListWithEmpty($budgetRepository->getActiveBudgets());
$piggyBanks = ExpandedForm::makeSelectListWithEmpty($piggyBankRepository->getPiggyBanks());
$amount = TransactionJournal::amountPositive($journal);
// get source account:
$sourceAccounts = TransactionJournal::sourceAccountList($journal);
$destinationAccounts = TransactionJournal::destinationAccountList($journal);
$preFilled = $this->arrayFromJournal($request, $journal);
// get the transactions:
return view(
'split.journals.edit',
compact('currencies', 'amount', 'piggyBanks', 'sourceAccounts', 'destinationAccounts', 'assetAccounts', 'budgets', 'what', 'journal')
compact('currencies', 'preFilled', 'amount', 'sourceAccounts', 'destinationAccounts', 'assetAccounts', 'budgets', 'what', 'journal')
);
}
@@ -104,19 +101,12 @@ class SplitController extends Controller
/** @var BudgetRepositoryInterface $budgetRepository */
$budgetRepository = app(BudgetRepositoryInterface::class);
/** @var PiggyBankRepositoryInterface $piggyBankRepository */
$piggyBankRepository = app(PiggyBankRepositoryInterface::class);
$currencies = ExpandedForm::makeSelectList($currencyRepository->get());
$assetAccounts = ExpandedForm::makeSelectList($accountRepository->getAccounts(['Default account', 'Asset account']));
$budgets = ExpandedForm::makeSelectListWithEmpty($budgetRepository->getActiveBudgets());
$piggyBanks = ExpandedForm::makeSelectListWithEmpty($piggyBankRepository->getPiggyBanks());
//Session::flash('warning', 'This feature is very experimental. Beware.');
return view('split.journals.from-store', compact('currencies', 'piggyBanks', 'assetAccounts', 'budgets'))->with('data', $preFilled);
return view('split.journals.from-store', compact('currencies', 'assetAccounts', 'budgets', 'preFilled'));
}
@@ -154,6 +144,73 @@ class SplitController extends Controller
return redirect(session('transactions.create.url'));
}
/**
* @param SplitJournalFormRequest $request
* @param JournalInterface $repository
*/
public function update(SplitJournalFormRequest $request, JournalInterface $repository)
{
echo 'ok';
}
/**
* @param Request $request
* @param TransactionJournal $journal
*
* @return array
*/
private function arrayFromJournal(Request $request, TransactionJournal $journal): array
{
if (Session::has('_old_input')) {
Log::debug('Old input: ', session('_old_input'));
}
$sourceAccounts = TransactionJournal::sourceAccountList($journal);
$firstSourceId = $sourceAccounts->first()->id;
$array = [
'journal_description' => $request->old('journal_description', $journal->description),
'journal_amount' => TransactionJournal::amountPositive($journal),
'sourceAccounts' => $sourceAccounts,
'transaction_currency_id' => $request->old('transaction_currency_id', $journal->transaction_currency_id),
'destinationAccounts' => TransactionJournal::destinationAccountList($journal),
'what' => strtolower(TransactionJournal::transactionTypeStr($journal)),
'date' => $request->old('date', $journal->date),
'interest_date' => $request->old('interest_date', $journal->interest_date),
'book_date' => $request->old('book_date', $journal->book_date),
'process_date' => $request->old('process_date', $journal->process_date),
'description' => [],
'destination_account_id' => [],
'destination_account_name' => [],
'amount' => [],
'budget_id' => [],
'category' => [],
];
$index = 0;
/** @var Transaction $transaction */
foreach ($journal->transactions()->get() as $transaction) {
//if ($journal->isWithdrawal() && $transaction->account_id !== $firstSourceId) {
$array['description'][] = $transaction->description;
$array['destination_account_id'][] = $transaction->account_id;
$array['destination_account_name'][] = $transaction->account->name;
$array['amount'][] = $transaction->amount;
//}
$budget = $transaction->budgets()->first();
$budgetId = 0;
if (!is_null($budget)) {
$budgetId = $budget->id;
}
$category = $transaction->categories()->first();
$categoryName = '';
if (!is_null($category)) {
$categoryName = $category->name;
}
$array['budget_id'][] = $budgetId;
$array['category'][] = $categoryName;
}
return $array;
}
/**
* @param array $old
*
@@ -203,7 +260,6 @@ class SplitController extends Controller
'amount' => [],
'budget_id' => [],
'category' => [],
'piggy_bank_id' => [],
];
// create the first transaction:
@@ -213,7 +269,6 @@ class SplitController extends Controller
$preFilled['amount'][] = $data['amount'];
$preFilled['budget_id'][] = $data['budget_id'];
$preFilled['category'][] = $data['category'];
$preFilled['piggy_bank_id'][] = $data['piggy_bank_id'];
// echo '<pre>';
// var_dump($data);

View File

@@ -77,6 +77,7 @@ class SplitJournalFormRequest extends Request
return [
'what' => 'required|in:withdrawal,deposit,transfer',
'journal_description' => 'required|between:1,255',
'id' => 'numeric|belongsToUser:transaction_journals,id',
'journal_source_account_id' => 'numeric|belongsToUser:accounts,id',
'journal_source_account_name.*' => 'between:1,255',
'journal_currency_id' => 'required|exists:transaction_currencies,id',

View File

@@ -225,6 +225,7 @@ class SplitDataSeeder extends Seeder
'account_id' => $source->id,
'transaction_journal_id' => $journal->id,
'amount' => $amounts[$index] * -1,
'description' => 'Split Even Expense #' . $index,
]
);
@@ -234,6 +235,7 @@ class SplitDataSeeder extends Seeder
'account_id' => $destination->id,
'transaction_journal_id' => $journal->id,
'amount' => $amounts[$index],
'description' => 'Split Even Expense #' . $index,
]
);
@@ -279,6 +281,7 @@ class SplitDataSeeder extends Seeder
'account_id' => $source->id,
'transaction_journal_id' => $journal->id,
'amount' => $amounts[$index] * -1,
'description' => 'Split Uneven Expense #' . $index,
]
);
@@ -288,7 +291,7 @@ class SplitDataSeeder extends Seeder
'account_id' => $destination->id,
'transaction_journal_id' => $journal->id,
'amount' => $amounts[$index],
'description' => 'Split Uneven Expense #' . $index,
]
);

View File

@@ -48,6 +48,13 @@ $(document).ready(function () {
$('input[name="source_account_name[]"]').typeahead({source: data});
});
}
// and for split:
if ($('input[name="journal_source_account_name"]').length > 0) {
$.getJSON('json/revenue-accounts').done(function (data) {
$('input[name="journal_source_account_name"]').typeahead({source: data});
});
}
if ($('input[name="description"]').length > 0 && what !== undefined) {
$.getJSON('json/transaction-journals/' + what).done(function (data) {

View File

@@ -811,6 +811,7 @@ return [
'split_intro_three_withdrawal' => 'For example: you could split your :total groceries so you pay :split_one from your "daily groceries" budget and :split_two from your "cigarettes" budget.',
'split_table_intro_withdrawal' => 'Split your withdrawal in as many things as you want. By default the transaction will not split, there is just one entry. Add as many splits as you want to, below. Remember that you should not deviate from your total amount. If you do, Firefly will warn you but not correct you.',
'store_splitted_withdrawal' => 'Store splitted withdrawal',
'update_splitted_withdrawal' => 'Update splitted withdrawal',
'split_title_deposit' => 'Split your new deposit',
'split_intro_one_deposit' => 'Firefly supports the "splitting" of a deposit.',

View File

@@ -22,6 +22,9 @@ return [
'amount_max' => 'Maximum amount',
'match' => 'Matches on',
'repeat_freq' => 'Repeats',
'journal_currency_id' => 'Currency',
'journal_amount' => 'Amount',
'journal_asset_source_account' => 'Asset account (source)',
'account_from_id' => 'From account',
'account_to_id' => 'To account',
'asset_destination_account' => 'Asset account (destination)',

View File

@@ -22,6 +22,9 @@ return [
'balanceDiff' => 'Balance difference between :start and :end',
'matchedOn' => 'Matched on',
'matchesOn' => 'Matched on',
'account_type' => 'Account type',
'new_balance' => 'New balance',
'account' => 'Account',
'matchingAmount' => 'Amount',
'lastMatch' => 'Last match',
'split_number' => 'Split #',

View File

@@ -8,7 +8,7 @@
<input name="_token" type="hidden" value="{{ csrf_token() }}">
<input type="hidden" name="id" value="{{ journal.id }}"/>
<input type="hidden" name="what" value="{{ what }}"/>
<input type="hidden" name="what" value="{{ preFilled.what }}"/>
{% if errors.all()|length > 0 %}
<div class="row">
@@ -42,24 +42,23 @@
</div>
</div>
<div class="box-body">
{{ ExpandedForm.text('journal_description') }}
{{ ExpandedForm.select('journal_currency_id', currencies, journal.transaction_currency_id) }}
{{ ExpandedForm.staticText('journal_amount', amount|formatAmount ) }}
<input type="hidden" name="journal_amount" value="{{ amount }}"/>
{{ ExpandedForm.text('journal_description', journal.description) }}
{{ ExpandedForm.select('journal_currency_id', currencies, preFilled.transaction_currency_id) }}
{{ ExpandedForm.staticText('journal_amount', preFilled.journal_amount|formatAmount ) }}
<input type="hidden" name="journal_amount" value="{{ preFilled.journal_amount }}"/>
<!-- show static source if withdrawal or transfer -->
{% if what == 'withdrawal' or what == 'transfer' %}
{{ ExpandedForm.staticText('journal_asset_source_account', assetAccounts[sourceAccounts.first.id]) }}
<input type="hidden" name="journal_source_account_id" value="{{ sourceAccounts.first.id }}"/>
{{ ExpandedForm.select('journal_asset_source_account_id', assetAccounts, preFilled.sourceAccounts.first.id) }}
{% endif %}
<!-- show static source if deposit: -->
{% if what == 'deposit' %}
{{ ExpandedForm.staticText('revenue_account', sourceAccounts.first.name) }}
<input type="hidden" name="journal_source_account_name" value="{{ sourceAccounts.first.name }}"/>
<input type="hidden" name="journal_source_account_name" value="{{ preFilled.sourceAccounts.first.name }}"/>
{% endif %}
<!-- show static destination if transfer -->
{% if what == 'transfer' %}
{{ ExpandedForm.staticText('asset_destination_account', assetAccounts[sourceAccounts.first.id]) }}
<input type="hidden" name="journal_destination_account_id" value="{{ sourceAccounts.first.id }}"/>
{{ ExpandedForm.staticText('asset_destination_account', assetAccounts[preFilled.destinationAccounts.first.id]) }}
<input type="hidden" name="journal_destination_account_id" value="{{ preFilled.destinationAccounts.first.id }}"/>
{% endif %}
</div>
</div>
@@ -103,27 +102,27 @@
<th>{{ trans('list.description') }}</th>
<!-- split the source of a deposit -->
<!--
{% if data.what == 'deposit' %}
{% if preFilled.what == 'deposit' %}
<th>{{ trans('list.source') }}</th>
{% endif %}
-->
<!-- split where a withdrawal is going -->
<!-- split where a deposit is going -->
{% if data.what == 'withdrawal' or data.what == 'deposit' %}
{% if preFilled.what == 'withdrawal' or preFilled.what == 'deposit' %}
<th>{{ trans('list.destination') }}</th>
{% endif %}
<th>{{ trans('list.amount') }}</th>
{% if data.what == 'withdrawal' %}
{% if preFilled.what == 'withdrawal' %}
<th>{{ trans('list.budget') }}</th>
{% endif %}
<th>{{ trans('list.category') }}</th>
{% if data.what == 'transfer' %}
{% if preFilled.what == 'transfer' %}
<th>{{ trans('list.piggy_bank') }}</th>
{% endif %}
</tr>
</thead>
<tbody>
{% for index, descr in data.description %}
{% for index, descr in preFilled.description %}
<tr class="{% if loop.index == 1 %}initial-row{% else %}not-initial-row{% endif %}">
<td class="count">#{{ loop.index }}</td>
<td>
@@ -131,36 +130,36 @@
</td>
<!-- withdrawal has several destination names. -->
{% if data.what == 'withdrawal' %}
{% if preFilled.what == 'withdrawal' %}
<td>
<input type="text" name="destination_account_name[]" value="{{ data.destination_account_name[index] }}"
<input type="text" name="destination_account_name[]" value="{{ preFilled.destination_account_name[index] }}"
class="form-control"/>
</td>
{% endif %}
<!-- deposit has several destination id's -->
{% if data.what == 'deposit' %}
{% if preFilled.what == 'deposit' %}
<td>
{{ Form.select('destination_account_id[]', assetAccounts, data.destination_account_id[index], {class: 'form-control'}) }}
{{ Form.select('destination_account_id[]', assetAccounts, preFilled.destination_account_id[index], {class: 'form-control'}) }}
</td>
{% endif %}
<td style="width:10%;">
<input type="number" name="amount[]" value="{{ data.amount[index] }}"
<input type="number" name="amount[]" value="{{ preFilled.amount[index] }}"
class="form-control" autocomplete="off" step="any" min="0.01">
</td>
{% if data.what == 'withdrawal' %}
{% if preFilled.what == 'withdrawal' %}
<td>
{{ Form.select('budget_id[]', budgets, data.budget_id[index], {class: 'form-control'}) }}
{{ Form.select('budget_id[]', budgets, preFilled.budget_id[index], {class: 'form-control'}) }}
</td>
{% endif %}
<td>
<input type="text" name="category[]" value="{{ data.category[index] }}" class="form-control"/>
<input type="text" name="category[]" value="{{ preFilled.category[index] }}" class="form-control"/>
</td>
{% if data.what == 'transfer' %}
{% if preFilled.what == 'transfer' %}
<td>
{{ Form.select('piggy_bank_id[]', piggyBanks, data.piggy_bank_id[index], {class: 'form-control'}) }}
{{ Form.select('piggy_bank_id[]', piggyBanks, preFilled.piggy_bank_id[index], {class: 'form-control'}) }}
</td>
{% endif %}
</tr>
@@ -173,7 +172,7 @@
</p>
<p class="pull-right">
<button type="submit" id="transaction-btn" class="btn btn-success pull-right">
{{ ('store_splitted_'~data.what)|_ }}
{{ ('update_splitted_'~preFilled.what)|_ }}
</button>
</p>
</div>
@@ -185,8 +184,8 @@
{% endblock %}
{% block scripts %}
<script type="text/javascript">
var originalSum = {{ data.journal_amount }};
var what = "{{ data.what }}";
var originalSum = {{ preFilled.journal_amount }};
var what = "{{ preFilled.what }}";
</script>
<script type="text/javascript" src="js/lib/bootstrap3-typeahead.min.js"></script>
<script type="text/javascript" src="js/ff/transactions/create-edit.js"></script>

View File

@@ -5,12 +5,12 @@
{% endblock %}
{% block content %}
{{ Form.open({'class' : 'form-horizontal','id' : 'store','url' : route('split.journal.from-store.post')}) }}
<input type="hidden" name="what" value="{{ data.what }}"/>
<input type="hidden" name="what" value="{{ preFilled.what }}"/>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ ('split_title_'~data.what)|_ }}</h3>
<h3 class="box-title">{{ ('split_title_'~preFilled.what)|_ }}</h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
@@ -18,16 +18,16 @@
</div>
<div class="box-body">
<p>
{{ ('split_intro_one_'~data.what)|_ }}
{{ ('split_intro_one_'~preFilled.what)|_ }}
</p>
<p>
{{ ('split_intro_two_'~data.what)|_ }}
{{ ('split_intro_two_'~preFilled.what)|_ }}
</p>
<p>
{% if data.what =='deposit' %}
{{ trans(('firefly.split_intro_three_'~data.what), {total: 500|formatAmount, split_one: 425|formatAmount, split_two: 75|formatAmount})|raw }}
{% if preFilled.what =='deposit' %}
{{ trans(('firefly.split_intro_three_'~preFilled.what), {total: 500|formatAmount, split_one: 425|formatAmount, split_two: 75|formatAmount})|raw }}
{% else %}
{{ trans(('firefly.split_intro_three_'~data.what), {total: 20|formatAmount, split_one: 15|formatAmount, split_two: 5|formatAmount})|raw }}
{{ trans(('firefly.split_intro_three_'~preFilled.what), {total: 20|formatAmount, split_one: 15|formatAmount, split_two: 5|formatAmount})|raw }}
{% endif %}
</p>
<p class="text-danger">This feature is experimental.</p>
@@ -68,23 +68,21 @@
</div>
<div class="box-body">
{{ ExpandedForm.text('journal_description') }}
{{ ExpandedForm.select('journal_currency_id', currencies, data.journal_currency_id) }}
{{ ExpandedForm.staticText('journal_amount', data.journal_amount|formatAmount) }}
<input type="hidden" name="journal_amount" value="{{ data.journal_amount }}"/>
<!-- show static source if withdrawal or transfer -->
{% if data.what == 'withdrawal' or data.what == 'transfer' %}
{{ ExpandedForm.staticText('journal_asset_source_account', assetAccounts[data.journal_source_account_id]) }}
<input type="hidden" name="journal_source_account_id" value="{{ data.journal_source_account_id }}"/>
{{ ExpandedForm.select('journal_currency_id', currencies, preFilled.journal_currency_id) }}
{{ ExpandedForm.staticText('journal_amount', preFilled.journal_amount|formatAmount) }}
<input type="hidden" name="journal_amount" value="{{ preFilled.journal_amount }}"/>
<!-- show source drop down box if withdrawal or transfer -->
{% if preFilled.what == 'withdrawal' or preFilled.what == 'transfer' %}
{{ ExpandedForm.select('journal_asset_source_account_id', assetAccounts, preFilled.journal_source_account_id) }}
{% endif %}
<!-- show static source if deposit: -->
{% if data.what == 'deposit' %}
{{ ExpandedForm.staticText('revenue_account', data.journal_source_account_name) }}
<input type="hidden" name="journal_source_account_name" value="{{ data.journal_source_account_name }}"/>
<!-- show source text input if deposit: -->
{% if preFilled.what == 'deposit' %}
{{ ExpandedForm.text('journal_source_account_name', preFilled.journal_source_account_name) }}
{% endif %}
<!-- show static destination if transfer -->
{% if data.what == 'transfer' %}
{{ ExpandedForm.staticText('asset_destination_account', assetAccounts[data.journal_destination_account_id]) }}
<input type="hidden" name="journal_destination_account_id" value="{{ data.journal_destination_account_id }}"/>
<!-- show destination drop down if transfer -->
{% if preFilled.what == 'transfer' %}
{{ ExpandedForm.select('journal_destination_account_id', assetAccounts, preFilled.journal_destination_account_id) }}
{% endif %}
</div>
</div>
@@ -99,13 +97,13 @@
</div>
</div>
<div class="box-body">
{{ ExpandedForm.date('date', data.date) }}
{{ ExpandedForm.date('date', preFilled.date) }}
{{ ExpandedForm.date('interest_date', data.interest_date) }}
{{ ExpandedForm.date('interest_date', preFilled.interest_date) }}
{{ ExpandedForm.date('book_date', data.book_date) }}
{{ ExpandedForm.date('book_date', preFilled.book_date) }}
{{ ExpandedForm.date('process_date', data.process_date) }}
{{ ExpandedForm.date('process_date', preFilled.process_date) }}
</div>
</div>
</div>
@@ -122,7 +120,7 @@
</div>
<div class="box-body">
<p>
{{ ('split_table_intro_'~data.what)|_ }}
{{ ('split_table_intro_'~preFilled.what)|_ }}
</p>
<table class="table table-bordered table-condensed table-striped split-table">
<thead>
@@ -131,27 +129,24 @@
<th>{{ trans('list.description') }}</th>
<!-- split the source of a deposit -->
<!--
{% if data.what == 'deposit' %}
{% if preFilled.what == 'deposit' %}
<th>{{ trans('list.source') }}</th>
{% endif %}
-->
<!-- split where a withdrawal is going -->
<!-- split where a deposit is going -->
{% if data.what == 'withdrawal' or data.what == 'deposit' %}
{% if preFilled.what == 'withdrawal' or preFilled.what == 'deposit' %}
<th>{{ trans('list.destination') }}</th>
{% endif %}
<th>{{ trans('list.amount') }}</th>
{% if data.what == 'withdrawal' %}
{% if preFilled.what == 'withdrawal' %}
<th>{{ trans('list.budget') }}</th>
{% endif %}
<th>{{ trans('list.category') }}</th>
{% if data.what == 'transfer' %}
<th>{{ trans('list.piggy_bank') }}</th>
{% endif %}
</tr>
</thead>
<tbody>
{% for index, descr in data.description %}
{% for index, descr in preFilled.description %}
<tr class="{% if loop.index == 1 %}initial-row{% else %}not-initial-row{% endif %}">
<td class="count">#{{ loop.index }}</td>
<td>
@@ -159,38 +154,33 @@
</td>
<!-- withdrawal has several destination names. -->
{% if data.what == 'withdrawal' %}
{% if preFilled.what == 'withdrawal' %}
<td>
<input type="text" name="destination_account_name[]" value="{{ data.destination_account_name[index] }}"
<input type="text" name="destination_account_name[]" value="{{ preFilled.destination_account_name[index] }}"
class="form-control"/>
</td>
{% endif %}
<!-- deposit has several destination id's -->
{% if data.what == 'deposit' %}
{% if preFilled.what == 'deposit' %}
<td>
{{ Form.select('destination_account_id[]', assetAccounts, data.destination_account_id[index], {class: 'form-control'}) }}
{{ Form.select('destination_account_id[]', assetAccounts, preFilled.destination_account_id[index], {class: 'form-control'}) }}
</td>
{% endif %}
<td style="width:10%;">
<input type="number" name="amount[]" value="{{ data.amount[index] }}"
<input type="number" name="amount[]" value="{{ preFilled.amount[index] }}"
class="form-control" autocomplete="off" step="any" min="0.01">
</td>
{% if data.what == 'withdrawal' %}
{% if preFilled.what == 'withdrawal' %}
<td>
{{ Form.select('budget_id[]', budgets, data.budget_id[index], {class: 'form-control'}) }}
{{ Form.select('budget_id[]', budgets, preFilled.budget_id[index], {class: 'form-control'}) }}
</td>
{% endif %}
<td>
<input type="text" name="category[]" value="{{ data.category[index] }}" class="form-control"/>
<input type="text" name="category[]" value="{{ preFilled.category[index] }}" class="form-control"/>
</td>
{% if data.what == 'transfer' %}
<td>
{{ Form.select('piggy_bank_id[]', piggyBanks, data.piggy_bank_id[index], {class: 'form-control'}) }}
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
@@ -201,7 +191,7 @@
</p>
<p class="pull-right">
<button type="submit" id="transaction-btn" class="btn btn-success pull-right">
{{ ('store_splitted_'~data.what)|_ }}
{{ ('store_splitted_'~preFilled.what)|_ }}
</button>
</p>
</div>
@@ -213,8 +203,8 @@
{% endblock %}
{% block scripts %}
<script type="text/javascript">
var originalSum = {{ data.journal_amount }};
var what = "{{ data.what }}";
var originalSum = {{ preFilled.journal_amount }};
var what = "{{ preFilled.what }}";
</script>
<script type="text/javascript" src="js/lib/bootstrap3-typeahead.min.js"></script>
<script type="text/javascript" src="js/ff/transactions/create-edit.js"></script>