diff --git a/app/Http/Controllers/Transaction/SplitController.php b/app/Http/Controllers/Transaction/SplitController.php index b14581509a..27ed8387d2 100644 --- a/app/Http/Controllers/Transaction/SplitController.php +++ b/app/Http/Controllers/Transaction/SplitController.php @@ -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 '
';
// var_dump($data);
diff --git a/app/Http/Requests/SplitJournalFormRequest.php b/app/Http/Requests/SplitJournalFormRequest.php
index 526fd30c45..142796293d 100644
--- a/app/Http/Requests/SplitJournalFormRequest.php
+++ b/app/Http/Requests/SplitJournalFormRequest.php
@@ -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',
diff --git a/database/seeds/SplitDataSeeder.php b/database/seeds/SplitDataSeeder.php
index a7c01b30db..826290d40b 100644
--- a/database/seeds/SplitDataSeeder.php
+++ b/database/seeds/SplitDataSeeder.php
@@ -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,
]
);
diff --git a/public/js/ff/transactions/create-edit.js b/public/js/ff/transactions/create-edit.js
index 9bcf6b18f1..2561dbe90d 100644
--- a/public/js/ff/transactions/create-edit.js
+++ b/public/js/ff/transactions/create-edit.js
@@ -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) {
diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php
index 843459a908..7bd6d7fd79 100644
--- a/resources/lang/en_US/firefly.php
+++ b/resources/lang/en_US/firefly.php
@@ -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.',
diff --git a/resources/lang/en_US/form.php b/resources/lang/en_US/form.php
index f6ca7908bc..6e2c70cd48 100644
--- a/resources/lang/en_US/form.php
+++ b/resources/lang/en_US/form.php
@@ -10,125 +10,128 @@
return [
// new user:
- 'bank_name' => 'Bank name',
- 'bank_balance' => 'Balance',
- 'savings_balance' => 'Savings balance',
- 'credit_card_limit' => 'Credit card limit',
- 'automatch' => 'Match automatically',
- 'skip' => 'Skip',
- 'name' => 'Name',
- 'active' => 'Active',
- 'amount_min' => 'Minimum amount',
- 'amount_max' => 'Maximum amount',
- 'match' => 'Matches on',
- 'repeat_freq' => 'Repeats',
- 'account_from_id' => 'From account',
- 'account_to_id' => 'To account',
- 'asset_destination_account' => 'Asset account (destination)',
- 'asset_source_account' => 'Asset account (source)',
- 'journal_description' => 'Description',
- 'split_journal' => 'Split this transaction',
- 'split_journal_explanation' => 'Split this transaction in multiple parts',
- 'currency' => 'Currency',
- 'account_id' => 'Asset account',
- 'budget_id' => 'Budget',
- 'openingBalance' => 'Opening balance',
- 'tagMode' => 'Tag mode',
- 'tagPosition' => 'Tag location',
- 'virtualBalance' => 'Virtual balance',
- 'longitude_latitude' => 'Location',
- 'targetamount' => 'Target amount',
- 'accountRole' => 'Account role',
- 'openingBalanceDate' => 'Opening balance date',
- 'ccType' => 'Credit card payment plan',
- 'ccMonthlyPaymentDate' => 'Credit card monthly payment date',
- 'piggy_bank_id' => 'Piggy bank',
- 'returnHere' => 'Return here',
- 'returnHereExplanation' => 'After storing, return here to create another one.',
- 'returnHereUpdateExplanation' => 'After updating, return here.',
- 'description' => 'Description',
- 'expense_account' => 'Expense account',
- 'revenue_account' => 'Revenue account',
- 'amount' => 'Amount',
- 'date' => 'Date',
- 'interest_date' => 'Interest date',
- 'book_date' => 'Book date',
- 'process_date' => 'Processing date',
- 'category' => 'Category',
- 'tags' => 'Tags',
- 'deletePermanently' => 'Delete permanently',
- 'cancel' => 'Cancel',
- 'targetdate' => 'Target date',
- 'tag' => 'Tag',
- 'under' => 'Under',
- 'symbol' => 'Symbol',
- 'code' => 'Code',
- 'iban' => 'IBAN',
- 'accountNumber' => 'Account number',
- 'csv' => 'CSV file',
- 'has_headers' => 'Headers',
- 'date_format' => 'Date format',
- 'csv_config' => 'CSV import configuration',
- 'specifix' => 'Bank- or file specific fixes',
- 'csv_import_account' => 'Default import account',
- 'csv_delimiter' => 'CSV field delimiter',
- 'attachments[]' => 'Attachments',
- 'store_new_withdrawal' => 'Store new withdrawal',
- 'store_new_deposit' => 'Store new deposit',
- 'store_new_transfer' => 'Store new transfer',
- 'add_new_withdrawal' => 'Add a new withdrawal',
- 'add_new_deposit' => 'Add a new deposit',
- 'add_new_transfer' => 'Add a new transfer',
- 'noPiggybank' => '(no piggy bank)',
- 'title' => 'Title',
- 'notes' => 'Notes',
- 'filename' => 'File name',
- 'mime' => 'Mime type',
- 'size' => 'Size',
- 'trigger' => 'Trigger',
- 'stop_processing' => 'Stop processing',
- 'start_date' => 'Start of range',
- 'end_date' => 'End of range',
- 'export_start_range' => 'Start of export range',
- 'export_end_range' => 'End of export range',
- 'export_format' => 'File format',
- 'include_attachments' => 'Include uploaded attachments',
- 'include_config' => 'Include configuration file',
- 'include_old_uploads' => 'Include imported data',
- 'accounts' => 'Export transactions from these accounts',
- 'csv_comma' => 'A comma (,)',
- 'csv_semicolon' => 'A semicolon (;)',
- 'csv_tab' => 'A tab (invisible)',
- 'delete_account' => 'Delete account ":name"',
- 'delete_bill' => 'Delete bill ":name"',
- 'delete_budget' => 'Delete budget ":name"',
- 'delete_category' => 'Delete category ":name"',
- 'delete_currency' => 'Delete currency ":name"',
- 'delete_journal' => 'Delete transaction with description ":description"',
- 'delete_attachment' => 'Delete attachment ":name"',
- 'delete_rule' => 'Delete rule ":title"',
- 'delete_rule_group' => 'Delete rule group ":title"',
- 'attachment_areYouSure' => 'Are you sure you want to delete the attachment named ":name"?',
- 'account_areYouSure' => 'Are you sure you want to delete the account named ":name"?',
- 'bill_areYouSure' => 'Are you sure you want to delete the bill named ":name"?',
- 'rule_areYouSure' => 'Are you sure you want to delete the rule titled ":title"?',
- 'ruleGroup_areYouSure' => 'Are you sure you want to delete the rule group titled ":title"?',
- 'budget_areYouSure' => 'Are you sure you want to delete the budget named ":name"?',
- 'category_areYouSure' => 'Are you sure you want to delete the category named ":name"?',
- 'currency_areYouSure' => 'Are you sure you want to delete the currency named ":name"?',
- 'piggyBank_areYouSure' => 'Are you sure you want to delete the piggy bank named ":name"?',
- 'journal_areYouSure' => 'Are you sure you want to delete the transaction described ":description"?',
- 'mass_journal_are_you_sure' => 'Are you sure you want to delete these transactions?',
- 'tag_areYouSure' => 'Are you sure you want to delete the tag ":tag"?',
- 'permDeleteWarning' => 'Deleting stuff from Firely is permanent and cannot be undone.',
- 'mass_make_selection' => 'You can still prevent items from being deleted by removing the checkbox.',
- 'delete_all_permanently' => 'Delete selected permanently',
- 'update_all_journals' => 'Update these transactions',
- 'also_delete_transactions' => 'The only transaction connected to this account will be deleted as well.|All :count transactions connected to this account will be deleted as well.',
- 'also_delete_rules' => 'The only rule connected to this rule group will be deleted as well.|All :count rules connected to this rule group will be deleted as well.',
- 'also_delete_piggyBanks' => 'The only piggy bank connected to this account will be deleted as well.|All :count piggy bank connected to this account will be deleted as well.',
- 'bill_keep_transactions' => 'The only transaction connected to this bill will not be deleted.|All :count transactions connected to this bill will spared deletion.',
- 'budget_keep_transactions' => 'The only transaction connected to this budget will not be deleted.|All :count transactions connected to this budget will spared deletion.',
- 'category_keep_transactions' => 'The only transaction connected to this category will not be deleted.|All :count transactions connected to this category will spared deletion.',
- 'tag_keep_transactions' => 'The only transaction connected to this tag will not be deleted.|All :count transactions connected to this tag will spared deletion.',
+ 'bank_name' => 'Bank name',
+ 'bank_balance' => 'Balance',
+ 'savings_balance' => 'Savings balance',
+ 'credit_card_limit' => 'Credit card limit',
+ 'automatch' => 'Match automatically',
+ 'skip' => 'Skip',
+ 'name' => 'Name',
+ 'active' => 'Active',
+ 'amount_min' => 'Minimum amount',
+ '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)',
+ 'asset_source_account' => 'Asset account (source)',
+ 'journal_description' => 'Description',
+ 'split_journal' => 'Split this transaction',
+ 'split_journal_explanation' => 'Split this transaction in multiple parts',
+ 'currency' => 'Currency',
+ 'account_id' => 'Asset account',
+ 'budget_id' => 'Budget',
+ 'openingBalance' => 'Opening balance',
+ 'tagMode' => 'Tag mode',
+ 'tagPosition' => 'Tag location',
+ 'virtualBalance' => 'Virtual balance',
+ 'longitude_latitude' => 'Location',
+ 'targetamount' => 'Target amount',
+ 'accountRole' => 'Account role',
+ 'openingBalanceDate' => 'Opening balance date',
+ 'ccType' => 'Credit card payment plan',
+ 'ccMonthlyPaymentDate' => 'Credit card monthly payment date',
+ 'piggy_bank_id' => 'Piggy bank',
+ 'returnHere' => 'Return here',
+ 'returnHereExplanation' => 'After storing, return here to create another one.',
+ 'returnHereUpdateExplanation' => 'After updating, return here.',
+ 'description' => 'Description',
+ 'expense_account' => 'Expense account',
+ 'revenue_account' => 'Revenue account',
+ 'amount' => 'Amount',
+ 'date' => 'Date',
+ 'interest_date' => 'Interest date',
+ 'book_date' => 'Book date',
+ 'process_date' => 'Processing date',
+ 'category' => 'Category',
+ 'tags' => 'Tags',
+ 'deletePermanently' => 'Delete permanently',
+ 'cancel' => 'Cancel',
+ 'targetdate' => 'Target date',
+ 'tag' => 'Tag',
+ 'under' => 'Under',
+ 'symbol' => 'Symbol',
+ 'code' => 'Code',
+ 'iban' => 'IBAN',
+ 'accountNumber' => 'Account number',
+ 'csv' => 'CSV file',
+ 'has_headers' => 'Headers',
+ 'date_format' => 'Date format',
+ 'csv_config' => 'CSV import configuration',
+ 'specifix' => 'Bank- or file specific fixes',
+ 'csv_import_account' => 'Default import account',
+ 'csv_delimiter' => 'CSV field delimiter',
+ 'attachments[]' => 'Attachments',
+ 'store_new_withdrawal' => 'Store new withdrawal',
+ 'store_new_deposit' => 'Store new deposit',
+ 'store_new_transfer' => 'Store new transfer',
+ 'add_new_withdrawal' => 'Add a new withdrawal',
+ 'add_new_deposit' => 'Add a new deposit',
+ 'add_new_transfer' => 'Add a new transfer',
+ 'noPiggybank' => '(no piggy bank)',
+ 'title' => 'Title',
+ 'notes' => 'Notes',
+ 'filename' => 'File name',
+ 'mime' => 'Mime type',
+ 'size' => 'Size',
+ 'trigger' => 'Trigger',
+ 'stop_processing' => 'Stop processing',
+ 'start_date' => 'Start of range',
+ 'end_date' => 'End of range',
+ 'export_start_range' => 'Start of export range',
+ 'export_end_range' => 'End of export range',
+ 'export_format' => 'File format',
+ 'include_attachments' => 'Include uploaded attachments',
+ 'include_config' => 'Include configuration file',
+ 'include_old_uploads' => 'Include imported data',
+ 'accounts' => 'Export transactions from these accounts',
+ 'csv_comma' => 'A comma (,)',
+ 'csv_semicolon' => 'A semicolon (;)',
+ 'csv_tab' => 'A tab (invisible)',
+ 'delete_account' => 'Delete account ":name"',
+ 'delete_bill' => 'Delete bill ":name"',
+ 'delete_budget' => 'Delete budget ":name"',
+ 'delete_category' => 'Delete category ":name"',
+ 'delete_currency' => 'Delete currency ":name"',
+ 'delete_journal' => 'Delete transaction with description ":description"',
+ 'delete_attachment' => 'Delete attachment ":name"',
+ 'delete_rule' => 'Delete rule ":title"',
+ 'delete_rule_group' => 'Delete rule group ":title"',
+ 'attachment_areYouSure' => 'Are you sure you want to delete the attachment named ":name"?',
+ 'account_areYouSure' => 'Are you sure you want to delete the account named ":name"?',
+ 'bill_areYouSure' => 'Are you sure you want to delete the bill named ":name"?',
+ 'rule_areYouSure' => 'Are you sure you want to delete the rule titled ":title"?',
+ 'ruleGroup_areYouSure' => 'Are you sure you want to delete the rule group titled ":title"?',
+ 'budget_areYouSure' => 'Are you sure you want to delete the budget named ":name"?',
+ 'category_areYouSure' => 'Are you sure you want to delete the category named ":name"?',
+ 'currency_areYouSure' => 'Are you sure you want to delete the currency named ":name"?',
+ 'piggyBank_areYouSure' => 'Are you sure you want to delete the piggy bank named ":name"?',
+ 'journal_areYouSure' => 'Are you sure you want to delete the transaction described ":description"?',
+ 'mass_journal_are_you_sure' => 'Are you sure you want to delete these transactions?',
+ 'tag_areYouSure' => 'Are you sure you want to delete the tag ":tag"?',
+ 'permDeleteWarning' => 'Deleting stuff from Firely is permanent and cannot be undone.',
+ 'mass_make_selection' => 'You can still prevent items from being deleted by removing the checkbox.',
+ 'delete_all_permanently' => 'Delete selected permanently',
+ 'update_all_journals' => 'Update these transactions',
+ 'also_delete_transactions' => 'The only transaction connected to this account will be deleted as well.|All :count transactions connected to this account will be deleted as well.',
+ 'also_delete_rules' => 'The only rule connected to this rule group will be deleted as well.|All :count rules connected to this rule group will be deleted as well.',
+ 'also_delete_piggyBanks' => 'The only piggy bank connected to this account will be deleted as well.|All :count piggy bank connected to this account will be deleted as well.',
+ 'bill_keep_transactions' => 'The only transaction connected to this bill will not be deleted.|All :count transactions connected to this bill will spared deletion.',
+ 'budget_keep_transactions' => 'The only transaction connected to this budget will not be deleted.|All :count transactions connected to this budget will spared deletion.',
+ 'category_keep_transactions' => 'The only transaction connected to this category will not be deleted.|All :count transactions connected to this category will spared deletion.',
+ 'tag_keep_transactions' => 'The only transaction connected to this tag will not be deleted.|All :count transactions connected to this tag will spared deletion.',
];
diff --git a/resources/lang/en_US/list.php b/resources/lang/en_US/list.php
index d894d21ee1..8a69fced9e 100644
--- a/resources/lang/en_US/list.php
+++ b/resources/lang/en_US/list.php
@@ -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 #',
diff --git a/resources/views/split/journals/edit.twig b/resources/views/split/journals/edit.twig
index e62198f22c..bde2f724d5 100644
--- a/resources/views/split/journals/edit.twig
+++ b/resources/views/split/journals/edit.twig
@@ -8,7 +8,7 @@
-
+
{% if errors.all()|length > 0 %}
@@ -42,24 +42,23 @@
- {{ ExpandedForm.text('journal_description') }}
- {{ ExpandedForm.select('journal_currency_id', currencies, journal.transaction_currency_id) }}
- {{ ExpandedForm.staticText('journal_amount', amount|formatAmount ) }}
-
+ {{ ExpandedForm.text('journal_description', journal.description) }}
+ {{ ExpandedForm.select('journal_currency_id', currencies, preFilled.transaction_currency_id) }}
+ {{ ExpandedForm.staticText('journal_amount', preFilled.journal_amount|formatAmount ) }}
+
{% if what == 'withdrawal' or what == 'transfer' %}
- {{ ExpandedForm.staticText('journal_asset_source_account', assetAccounts[sourceAccounts.first.id]) }}
-
+ {{ ExpandedForm.select('journal_asset_source_account_id', assetAccounts, preFilled.sourceAccounts.first.id) }}
{% endif %}
{% if what == 'deposit' %}
{{ ExpandedForm.staticText('revenue_account', sourceAccounts.first.name) }}
-
+
{% endif %}
{% if what == 'transfer' %}
- {{ ExpandedForm.staticText('asset_destination_account', assetAccounts[sourceAccounts.first.id]) }}
-
+ {{ ExpandedForm.staticText('asset_destination_account', assetAccounts[preFilled.destinationAccounts.first.id]) }}
+
{% endif %}
@@ -103,27 +102,27 @@
{{ trans('list.description') }}
- {% if data.what == 'withdrawal' or data.what == 'deposit' %}
+ {% if preFilled.what == 'withdrawal' or preFilled.what == 'deposit' %}
{{ trans('list.destination') }}
{% endif %}
{{ trans('list.amount') }}
- {% if data.what == 'withdrawal' %}
+ {% if preFilled.what == 'withdrawal' %}
{{ trans('list.budget') }}
{% endif %}
{{ trans('list.category') }}
- {% if data.what == 'transfer' %}
+ {% if preFilled.what == 'transfer' %}
{{ trans('list.piggy_bank') }}
{% endif %}
- {% for index, descr in data.description %}
+ {% for index, descr in preFilled.description %}
#{{ loop.index }}
@@ -131,36 +130,36 @@
- {% if data.what == 'withdrawal' %}
+ {% if preFilled.what == 'withdrawal' %}
-
{% endif %}
- {% if data.what == 'deposit' %}
+ {% if preFilled.what == 'deposit' %}
- {{ 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'}) }}
{% endif %}
-
- {% if data.what == 'withdrawal' %}
+ {% if preFilled.what == 'withdrawal' %}
- {{ Form.select('budget_id[]', budgets, data.budget_id[index], {class: 'form-control'}) }}
+ {{ Form.select('budget_id[]', budgets, preFilled.budget_id[index], {class: 'form-control'}) }}
{% endif %}
-
+
- {% if data.what == 'transfer' %}
+ {% if preFilled.what == 'transfer' %}
- {{ 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'}) }}
{% endif %}
@@ -173,7 +172,7 @@
@@ -185,8 +184,8 @@
{% endblock %}
{% block scripts %}
diff --git a/resources/views/split/journals/from-store.twig b/resources/views/split/journals/from-store.twig
index 10e1f88d5c..8fb955924b 100644
--- a/resources/views/split/journals/from-store.twig
+++ b/resources/views/split/journals/from-store.twig
@@ -5,12 +5,12 @@
{% endblock %}
{% block content %}
{{ Form.open({'class' : 'form-horizontal','id' : 'store','url' : route('split.journal.from-store.post')}) }}
-
+
- {{ ('split_title_'~data.what)|_ }}
+ {{ ('split_title_'~preFilled.what)|_ }}
@@ -18,16 +18,16 @@
- {{ ('split_intro_one_'~data.what)|_ }}
+ {{ ('split_intro_one_'~preFilled.what)|_ }}
- {{ ('split_intro_two_'~data.what)|_ }}
+ {{ ('split_intro_two_'~preFilled.what)|_ }}
- {% 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 %}
This feature is experimental.
@@ -68,23 +68,21 @@
{{ ExpandedForm.text('journal_description') }}
- {{ ExpandedForm.select('journal_currency_id', currencies, data.journal_currency_id) }}
- {{ ExpandedForm.staticText('journal_amount', data.journal_amount|formatAmount) }}
-
-
- {% if data.what == 'withdrawal' or data.what == 'transfer' %}
- {{ ExpandedForm.staticText('journal_asset_source_account', assetAccounts[data.journal_source_account_id]) }}
-
+ {{ ExpandedForm.select('journal_currency_id', currencies, preFilled.journal_currency_id) }}
+ {{ ExpandedForm.staticText('journal_amount', preFilled.journal_amount|formatAmount) }}
+
+
+
+ {% if preFilled.what == 'withdrawal' or preFilled.what == 'transfer' %}
+ {{ ExpandedForm.select('journal_asset_source_account_id', assetAccounts, preFilled.journal_source_account_id) }}
{% endif %}
-
- {% if data.what == 'deposit' %}
- {{ ExpandedForm.staticText('revenue_account', data.journal_source_account_name) }}
-
+
+ {% if preFilled.what == 'deposit' %}
+ {{ ExpandedForm.text('journal_source_account_name', preFilled.journal_source_account_name) }}
{% endif %}
-
- {% if data.what == 'transfer' %}
- {{ ExpandedForm.staticText('asset_destination_account', assetAccounts[data.journal_destination_account_id]) }}
-
+
+ {% if preFilled.what == 'transfer' %}
+ {{ ExpandedForm.select('journal_destination_account_id', assetAccounts, preFilled.journal_destination_account_id) }}
{% endif %}
@@ -99,13 +97,13 @@
- {{ 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) }}
@@ -122,7 +120,7 @@
- {{ ('split_table_intro_'~data.what)|_ }}
+ {{ ('split_table_intro_'~preFilled.what)|_ }}
@@ -131,27 +129,24 @@
{{ trans('list.description') }}
- {% if data.what == 'withdrawal' or data.what == 'deposit' %}
+ {% if preFilled.what == 'withdrawal' or preFilled.what == 'deposit' %}
{{ trans('list.destination') }}
{% endif %}
{{ trans('list.amount') }}
- {% if data.what == 'withdrawal' %}
+ {% if preFilled.what == 'withdrawal' %}
{{ trans('list.budget') }}
{% endif %}
{{ trans('list.category') }}
- {% if data.what == 'transfer' %}
- {{ trans('list.piggy_bank') }}
- {% endif %}
- {% for index, descr in data.description %}
+ {% for index, descr in preFilled.description %}
#{{ loop.index }}
@@ -159,38 +154,33 @@
- {% if data.what == 'withdrawal' %}
+ {% if preFilled.what == 'withdrawal' %}
-
{% endif %}
- {% if data.what == 'deposit' %}
+ {% if preFilled.what == 'deposit' %}
- {{ 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'}) }}
{% endif %}
-
- {% if data.what == 'withdrawal' %}
+ {% if preFilled.what == 'withdrawal' %}
- {{ Form.select('budget_id[]', budgets, data.budget_id[index], {class: 'form-control'}) }}
+ {{ Form.select('budget_id[]', budgets, preFilled.budget_id[index], {class: 'form-control'}) }}
{% endif %}
-
+
- {% if data.what == 'transfer' %}
-
- {{ Form.select('piggy_bank_id[]', piggyBanks, data.piggy_bank_id[index], {class: 'form-control'}) }}
-
- {% endif %}
{% endfor %}
@@ -201,7 +191,7 @@
@@ -213,8 +203,8 @@
{% endblock %}
{% block scripts %}