First code set for #330

This commit is contained in:
James Cole 2016-10-29 15:14:33 +02:00
parent ba65e982fd
commit 39749aa113
9 changed files with 473 additions and 92 deletions

View File

@ -0,0 +1,108 @@
<?php
/**
* ConvertController.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
declare(strict_types = 1);
namespace FireflyIII\Http\Controllers\Transaction;
use ExpandedForm;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Illuminate\Http\Request;
use Session;
use View;
/**
* Class ConvertController
*
* @package FireflyIII\Http\Controllers\Transaction
*/
class ConvertController extends Controller
{
/** @var AccountRepositoryInterface */
private $accounts;
/**
* ConvertController constructor.
*/
public function __construct()
{
parent::__construct();
// some useful repositories:
$this->middleware(
function ($request, $next) {
$this->accounts = app(AccountRepositoryInterface::class);
View::share('title', trans('firefly.transactions'));
View::share('mainTitleIcon', 'fa-exchange');
return $next($request);
}
);
}
/**
* @param TransactionType $destinationType
* @param TransactionJournal $journal
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
*/
public function convert(TransactionType $destinationType, TransactionJournal $journal)
{
$positiveAmount = TransactionJournal::amountPositive($journal);
$assetAccounts = ExpandedForm::makeSelectList($this->accounts->getActiveAccountsByType([AccountType::DEFAULT, AccountType::ASSET]));
$sourceType = $journal->transactionType;
$subTitle = trans('firefly.convert_to_' . $destinationType->type, ['description' => $journal->description]);
$subTitleIcon = 'fa-exchange';
if ($sourceType->type === $destinationType->type) {
Session::flash('info', trans('firefly.convert_is_already_type_' . $destinationType->type));
return redirect(route('transactions.show', [$journal->id]));
}
if ($journal->transactions()->count() > 2) {
Session::flash('error', trans('firefly.cannot_convert_split_journl'));
return redirect(route('transactions.show', [$journal->id]));
}
$sourceAccount = TransactionJournal::sourceAccountList($journal)->first();
$destinationAccount = TransactionJournal::destinationAccountList($journal)->first();
return view(
'transactions.convert', compact(
'sourceType', 'destinationType', 'journal', 'assetAccounts',
'positiveAmount', 'sourceAccount', 'destinationAccount', 'sourceType',
'subTitle', 'subTitleIcon'
)
);
// convert withdrawal to deposit requires a new source account ()
// or to transfer requires
}
public function submit(Request $request)
{
echo '<pre>';
var_dump($request->all());
exit;
}
}

View File

@ -25,6 +25,7 @@ use FireflyIII\Models\RuleGroup;
use FireflyIII\Models\Tag;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use FireflyIII\User;
/**
@ -595,13 +596,24 @@ Breadcrumbs::register(
Breadcrumbs::register(
'transactions.show', function (BreadCrumbGenerator $breadcrumbs, TransactionJournal $journal) {
$what = strtolower($journal->transaction_type_type ?? $journal->transactionType->type);
$what = strtolower($journal->transactionType->type);
$breadcrumbs->parent('transactions.index', $what);
$breadcrumbs->push($journal->description, route('transactions.show', [$journal->id]));
}
);
Breadcrumbs::register(
'transactions.convert', function (BreadCrumbGenerator $breadcrumbs, TransactionType $destinationType, TransactionJournal $journal) {
$breadcrumbs->parent('transactions.show', $journal);
$breadcrumbs->push(
trans('firefly.convert_to_' . $destinationType->type, ['description' => $journal->description]),
route('transactions.convert', [strtolower($destinationType->type), $journal->id])
);
}
);
/**
* SPLIT
*/

View File

@ -15,6 +15,7 @@ namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* FireflyIII\Models\TransactionType
@ -43,6 +44,25 @@ class TransactionType extends Model
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
/**
* @param string $type
*
* @return Model|null|static
*/
public static function routeBinder(string $type)
{
if (!auth()->check()) {
throw new NotFoundHttpException;
}
$transactionType = self::where('type', $type)->first();
if (!is_null($transactionType)) {
return $transactionType;
}
throw new NotFoundHttpException;
}
/**
* @return bool
*/

View File

@ -137,6 +137,7 @@ return [
'bill' => 'FireflyIII\Models\Bill',
'budget' => 'FireflyIII\Models\Budget',
'category' => 'FireflyIII\Models\Category',
'transaction_type' => 'FireflyIII\Models\TransactionType',
'currency' => 'FireflyIII\Models\TransactionCurrency',
'limitrepetition' => 'FireflyIII\Models\LimitRepetition',
'piggyBank' => 'FireflyIII\Models\PiggyBank',

View File

@ -242,6 +242,7 @@ return [
'rule_action_set_source_account' => 'Set source account to :action_value',
'rule_action_set_destination_account_choice' => 'Set destination account to...',
'rule_action_set_destination_account' => 'Set destination account to :action_value',
// tags
'store_new_tag' => 'Store new tag',
'update_tag' => 'Update tag',
@ -352,6 +353,21 @@ return [
'title_transfer' => 'Transfers',
'title_transfers' => 'Transfers',
// convert stuff:
'convert_is_already_type_Withdrawal' => 'This transaction is already a withdrawal',
'convert_is_already_type_Deposit' => 'This transaction is already a deposit',
'convert_is_already_type_Transfer' => 'This transaction is already a transfer',
'convert_to_Withdrawal' => 'Convert ":description" to a withdrawal',
'convert_to_Deposit' => 'Convert ":description" to a deposit',
'convert_to_Transfer' => 'Convert ":description" to a transfer',
'convert_options_WithdrawalDeposit' => 'Convert a withdrawal into a deposit',
'convert_options_WithdrawalTransfer' => 'Convert a withdrawal into a transfer',
'convert_options_DepositTransfer' => 'Convert a deposit into a transfer',
'convert_options_DepositWithdrawal' => 'Convert a deposit into a withdrawal',
'convert_options_TransferWithdrawal' => 'Convert a transfer into a withdrawal',
'convert_options_TransferDeposit' => 'Convert a transfer into a deposit',
// create new stuff:
'create_new_withdrawal' => 'Create new withdrawal',
'create_new_deposit' => 'Create new deposit',

View File

@ -31,6 +31,8 @@ return [
'journal_source_account_id' => 'Asset account (source)',
'account_from_id' => 'From account',
'account_to_id' => 'To account',
'source_account' => 'Source account',
'destination_account' => 'Destination account',
'journal_destination_account_id' => 'Asset account (destination)',
'asset_destination_account' => 'Asset account (destination)',
'asset_source_account' => 'Asset account (source)',
@ -58,95 +60,107 @@ return [
'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',
'has_headers' => 'Headers',
'date_format' => 'Date format',
'specifix' => 'Bank- or file specific fixes',
'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_old_uploads' => 'Include imported data',
'accounts' => 'Export transactions from these accounts',
'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.',
'revenue_account_source' => 'Revenue account (source)',
'source_account_asset' => 'Source account (asset account)',
'destination_account_expense' => 'Destination account (expense account)',
'destination_account_asset' => 'Destination account (asset account)',
'source_account_revenue' => 'Source account (revenue account)',
'type' => 'Type',
'convert_Withdrawal' => 'Convert withdrawal',
'convert_Deposit' => 'Convert deposit',
'convert_Transfer' => 'Convert transfer',
'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',
'has_headers' => 'Headers',
'date_format' => 'Date format',
'specifix' => 'Bank- or file specific fixes',
'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_old_uploads' => 'Include imported data',
'accounts' => 'Export transactions from these accounts',
'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.',
// admin
'domain' => 'Domain',
'single_user_mode' => 'Single user mode',
'domain' => 'Domain',
'single_user_mode' => 'Single user mode',
// import
'import_file' => 'Import file',
'configuration_file' => 'Configuration file',
'import_file_type' => 'Import file type',
'csv_comma' => 'A comma (,)',
'csv_semicolon' => 'A semicolon (;)',
'csv_tab' => 'A tab (invisible)',
'csv_delimiter' => 'CSV field delimiter',
'csv_import_account' => 'Default import account',
'csv_config' => 'CSV import configuration',
'import_file' => 'Import file',
'configuration_file' => 'Configuration file',
'import_file_type' => 'Import file type',
'csv_comma' => 'A comma (,)',
'csv_semicolon' => 'A semicolon (;)',
'csv_tab' => 'A tab (invisible)',
'csv_delimiter' => 'CSV field delimiter',
'csv_import_account' => 'Default import account',
'csv_config' => 'CSV import configuration',
'due_date' => 'Due date',

View File

@ -0,0 +1,176 @@
{% extends "./layout/default.twig" %}
{% block breadcrumbs %}
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, destinationType, journal) }}
{% endblock %}
{% block content %}
<form method="POST" action="{{ route('transactions.convert.post', [destinationType.type|lower, journal.id]) }}" accept-charset="UTF-8" class="form-horizontal" id="store"
enctype="multipart/form-data">
<input name="_token" type="hidden" value="{{ csrf_token() }}">
<div class="row">
<div class="col-lg-10 col-md-12 col-sm-12">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">{{ ('convert_options_'~sourceType.type~destinationType.type)|_ }}</h3>
</div>
<div class="box-body">
{{ ExpandedForm.staticText('type', sourceType.type|_) }}
{{ ExpandedForm.staticText('description', '<a href="'~route('transactions.show', journal.id)~'">'~journal.description~'</a>') }}
{{ ExpandedForm.staticText('date', journal.date.formatLocalized(monthAndDayFormat)) }}
{# in case of withdrawal #}
{% if sourceType.type == "Withdrawal" %}
{{ ExpandedForm.staticText('source_account_asset', '<a href="'~route('accounts.show',[sourceAccount.id])~'">'~sourceAccount.name~'</a>') }}
{{ ExpandedForm.staticText('destination_account_expense', '<a href="'~route('accounts.show',[destinationAccount.id])~'">'~destinationAccount.name~'</a>') }}
{% endif %}
{# in case of deposit #}
{% if sourceType.type == "Deposit" %}
{{ ExpandedForm.staticText('source_account_revenue', '<a href="'~route('accounts.show',[sourceAccount.id])~'">'~sourceAccount.name~'</a>') }}
{{ ExpandedForm.staticText('destination_account_asset', '<a href="'~route('accounts.show',[destinationAccount.id])~'">'~destinationAccount.name~'</a>') }}
{% endif %}
{# in case of transfer #}
{% if sourceType.type == "Transfer" %}
{{ ExpandedForm.staticText('source_account_asset', '<a href="'~route('accounts.show',[sourceAccount.id])~'">'~sourceAccount.name~'</a>') }}
{{ ExpandedForm.staticText('destination_account_asset', '<a href="'~route('accounts.show',[destinationAccount.id])~'">'~destinationAccount.name~'</a>') }}
{% endif %}
{# ONE #}
{% if sourceType.type == 'Withdrawal' and destinationType.type == 'Deposit' %}
<p><em>
If you convert this withdrawal into a deposit, {{ positiveAmount|formatAmount }}
will be deposited into <a href="{{ route('accounts.show',[sourceAccount.id]) }}">{{ sourceAccount.name }}</a>
instead of taken from it.
</em>
</p>
<p><em>
Please pick the revenue account where the money will come from.
</em>
</p>
{{ ExpandedForm.text('source_account_revenue', destinationAccount.name) }}
{% endif %}
{# TWO #}
{% if sourceType.type == 'Withdrawal' and destinationType.type == 'Transfer' %}
<p><em>
If you convert this withdrawal into a transfer, {{ positiveAmount|formatAmount }}
will be transferred from <a href="{{ route('accounts.show',[sourceAccount.id]) }}">{{ sourceAccount.name }}</a>
to a new asset account, instead of being paid to
<a href="{{ route('accounts.show',[destinationAccount.id]) }}">{{ destinationAccount.name }}</a>.
</em></p>
<p>
<em>
Please pick the asset account where the money will go to.
</em>
</p>
{{ ExpandedForm.select('destination_account_asset', assetAccounts) }}
{% endif %}
{# THREE #}
{% if sourceType.type == 'Deposit' and destinationType.type == 'Withdrawal' %}
<p>
<em>
If you convert this deposit into a withdrawal, {{ positiveAmount|formatAmount }}
will be removed from <a href="{{ route('accounts.show',[destinationAccount.id]) }}">{{ destinationAccount.name }}</a>
instead of added to it.
</em>
</p>
<p>
<em>
Please pick the expense account where the money will go to.
</em>
</p>
{{ ExpandedForm.text('destination_account_expense', destinationAccount.name) }}
{% endif %}
{# FOUR #}
{% if sourceType.type == 'Deposit' and destinationType.type == 'Transfer' %}
<p>
<em>
If you convert this deposit into a transfer, {{ positiveAmount|formatAmount }} will be transferred
from an asset account of your choice into
<a href="{{ route('accounts.show',[destinationAccount.id]) }}">{{ destinationAccount.name }}</a>.
</em>
</p>
<p>
<em>
Please pick the asset account where the money will come from.
</em>
</p>
{{ ExpandedForm.select('source_account_asset', assetAccounts) }}
{% endif %}
{# FIVE #}
{% if sourceType.type == 'Transfer' and destinationType.type == 'Withdrawal' %}
<p>
<em>
If you convert this transfer into a withdrawal, {{ positiveAmount|formatAmount }}
will go from <a href="{{ route('accounts.show',[sourceAccount.id]) }}">{{ sourceAccount.name }}</a>
to a new destination as an expense, instead of to
<a href="{{ route('accounts.show',[destinationAccount.id]) }}">{{ destinationAccount.name }}</a>
as a transfer.
</em>
</p>
<p>
<em>
Please pick the expense account where the money will go to.
</em>
</p>
{{ ExpandedForm.text('destination_account_expense', destinationAccount.name) }}
{% endif %}
{# SIX #}
{% if sourceType.type == 'Transfer' and destinationType.type == 'Deposit' %}
<p>
<em>
If you convert this transfer into a deposit, {{ positiveAmount|formatAmount }}
will be deposited into account <a href="{{ route('accounts.show',[destinationAccount.id]) }}">{{ destinationAccount.name }}</a>
instead of being transferred there.
</em>
</p>
<p>
<em>
Please pick the revenue account where the money will come from.
</em>
</p>
{{ ExpandedForm.text('source_account_revenue', sourceAccount.name) }}
{% endif %}
</div>
<div class="box-footer">
<a href="{{ route('transactions.show', journal.id) }}" class="btn btn-danger">{{ 'cancel'|_ }}</a>
<button type="submit" id="transaction-btn" class="btn btn-success pull-right">
{{ trans('form.convert_'~sourceType.type) }}
</button>
</div>
</div>
</div>
</div>
</form>
{% endblock %}
{% block scripts %}
<script type="text/javascript" src="js/lib/bootstrap3-typeahead.min.js"></script>
<script type="text/javascript" src="js/lib/bootstrap-tagsinput.min.js"></script>
{% endblock %}
{% block styles %}
<link href="css/bootstrap-tagsinput.css" type="text/css" rel="stylesheet" media="all">
{% endblock %}

View File

@ -169,8 +169,6 @@
</table>
</div>
</div>
{% if journal.attachments|length > 0 %}
<div class="box">
<div class="box-header with-border">
@ -210,10 +208,44 @@
</div>
</div>
{% endif %}
{% if transactions|length == 1 %}
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'transaction_journal_convert_options'|_ }}</h3>
</div>
<div class="box-body">
{% if journal.transactionType.type != "Withdrawal" %}
<p>
<i class="fa fa-exchange" aria-hidden="true"></i>
<a href="{{ route('transactions.convert', ['withdrawal', journal.id]) }}">
Convert this {{ journal.transactionType.type }} to a withdrawal.
</a>
</p>
{% endif %}
{% if journal.transactionType.type != "Deposit" %}
<p>
<i class="fa fa-exchange" aria-hidden="true"></i>
<a href="{{ route('transactions.convert', ['deposit', journal.id]) }}">
Convert this {{ journal.transactionType.type }} to a deposit.
</a>
</p>
{% endif %}
{% if journal.transactionType.type != "Transfer" %}
<p>
<i class="fa fa-exchange" aria-hidden="true"></i>
<a href="{{ route('transactions.convert', ['transfer', journal.id]) }}">
Convert this {{ journal.transactionType.type }} to a transfer.
</a>
</p>
{% endif %}
</div>
</div>
{% endif %}
</div>
</div>
<!-- more than two transactions-->
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">

View File

@ -284,10 +284,8 @@ Route::group(
Route::post('/piggy-banks/store', ['uses' => 'PiggyBankController@store', 'as' => 'piggy-banks.store']);
Route::post('/piggy-banks/update/{piggyBank}', ['uses' => 'PiggyBankController@update', 'as' => 'piggy-banks.update']);
Route::post('/piggy-banks/destroy/{piggyBank}', ['uses' => 'PiggyBankController@destroy', 'as' => 'piggy-banks.destroy']);
Route::post('/piggy-banks/add/{piggyBank}', ['uses' => 'PiggyBankController@postAdd', 'as' => 'piggy-banks.add']);
Route::post('/piggy-banks/remove/{piggyBank}', ['uses' => 'PiggyBankController@postRemove', 'as' => 'piggy-banks.remove']);
Route::post('/piggy-banks/sort', ['uses' => 'PiggyBankController@order', 'as' => 'piggy-banks.order']);
/**
@ -425,6 +423,10 @@ Route::group(
Route::get('/transaction/split/edit/{tj}', ['uses' => 'Transaction\SplitController@edit', 'as' => 'transactions.edit-split']);
Route::post('/transaction/split/update/{tj}', ['uses' => 'Transaction\SplitController@update', 'as' => 'split.journal.update']);
// convert controller:
Route::get('transactions/convert/{transaction_type}/{tj}', ['uses' => 'Transaction\ConvertController@convert', 'as' => 'transactions.convert']);
Route::post('transactions/convert/{transaction_type}/{tj}', ['uses' => 'Transaction\ConvertController@submit', 'as' => 'transactions.convert.post']);
/**
* POPUP Controllers
*/