Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Improvements for #616 and others.
James Cole394e92d538e0
diff --git a/app/Http/Controllers/Admin/LinkController.php b/app/Http/Controllers/Admin/LinkController.phpindex 06bf9daf69..e4bdeff52b 100644--- a/app/Http/Controllers/Admin/LinkController.php+++ b/app/Http/Controllers/Admin/LinkController.php@@ -152,6 +152,18 @@ class LinkController extends Controllerreturn view('admin.link.index', compact('subTitle', 'subTitleIcon', 'linkTypes'));}+ /**+ * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View+ */+ public function show(LinkType $linkType)+ {+ $subTitle = trans('firefly.overview_for_link', ['name' => $linkType->name]);+ $subTitleIcon = 'fa-link';+ $links = $linkType->transactionJournalLinks()->get();++ return view('admin.link.show', compact('subTitle', 'subTitleIcon', 'linkType', 'links'));+ }+/*** @param LinkTypeFormRequest $request* @param LinkTypeRepositoryInterface $repositorydiff --git a/app/Http/Controllers/Transaction/LinkController.php b/app/Http/Controllers/Transaction/LinkController.phpindex 3f5c1a1a37..09036ea562 100644--- a/app/Http/Controllers/Transaction/LinkController.php+++ b/app/Http/Controllers/Transaction/LinkController.php@@ -13,17 +13,83 @@ declare(strict_types=1);namespace FireflyIII\Http\Controllers\Transaction;+use FireflyIII\Http\Controllers\Controller;use FireflyIII\Http\Requests\JournalLinkRequest;use FireflyIII\Models\TransactionJournal;use FireflyIII\Models\TransactionJournalLink;use FireflyIII\Repositories\Journal\JournalRepositoryInterface;use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;use Log;+use Preferences;use Session;+use URL;+use View;-class LinkController+/**+ * Class LinkController+ *+ * @package FireflyIII\Http\Controllers\Transaction+ */+class LinkController extends Controller{++ /**+ *+ */+ public function __construct()+ {+ parent::__construct();+ // some useful repositories:+ $this->middleware(+ function ($request, $next) {+ View::share('title', trans('firefly.transactions'));+ View::share('mainTitleIcon', 'fa-repeat');++ return $next($request);+ }+ );++ }+++ /**+ * @param TransactionJournalLink $link+ *+ * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View+ */+ public function delete(TransactionJournalLink $link)+ {+ $subTitleIcon = 'fa-link';+ $subTitle = trans('breadcrumbs.delete_journal_link');+ $this->rememberPreviousUri('journal_links.delete.uri');++ return view('transactions.links.delete', compact('link', 'subTitle', 'subTitleIcon'));+ }++ /**+ * @param LinkTypeRepositoryInterface $repository+ * @param TransactionJournalLink $link+ *+ * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector+ */+ public function destroy(LinkTypeRepositoryInterface $repository, TransactionJournalLink $link)+ {+ $repository->destroyLink($link);++ Session::flash('success', strval(trans('firefly.deleted_link')));+ Preferences::mark();++ return redirect(strval(session('journal_links.delete.uri')));+ }++ public function switch(LinkTypeRepositoryInterface $repository, TransactionJournalLink $link) {++ $repository->switchLink($link);++ return redirect(URL::previous());+ }+/*** @param JournalLinkRequest $request* @param LinkTypeRepositoryInterface $repositorydiff --git a/app/Http/breadcrumbs.php b/app/Http/breadcrumbs.phpindex 98ba0c7234..cd0ed7939f 100644--- a/app/Http/breadcrumbs.php+++ b/app/Http/breadcrumbs.php@@ -28,6 +28,7 @@ use FireflyIII\Models\RuleGroup;use FireflyIII\Models\Tag;use FireflyIII\Models\TransactionCurrency;use FireflyIII\Models\TransactionJournal;+use FireflyIII\Models\TransactionJournalLink;use FireflyIII\Models\TransactionType;use FireflyIII\User;use Illuminate\Support\Collection;@@ -167,6 +168,13 @@ Breadcrumbs::register(});+Breadcrumbs::register(+ 'admin.links.show', function (BreadCrumbGenerator $breadcrumbs, LinkType $linkType) {+ $breadcrumbs->parent('admin.links.index');+ $breadcrumbs->push(trans('firefly.overview_for_link', [$linkType->name]), route('admin.links.show', [$linkType->id]));+}+);+Breadcrumbs::register('admin.links.edit', function (BreadCrumbGenerator $breadcrumbs, LinkType $linkType) {$breadcrumbs->parent('admin.links.index');@@ -181,6 +189,14 @@ Breadcrumbs::register(});+Breadcrumbs::register(+ 'transactions.link.delete', function (BreadCrumbGenerator $breadcrumbs, TransactionJournalLink $link) {+ $breadcrumbs->parent('home');+ $breadcrumbs->push(trans('breadcrumbs.delete_journal_link'), route('transactions.link.delete', $link->id));++}+);+/*** ATTACHMENTS*/diff --git a/app/Models/LinkType.php b/app/Models/LinkType.phpindex da8d60de5b..ced7c9a08f 100644--- a/app/Models/LinkType.php+++ b/app/Models/LinkType.php@@ -14,6 +14,7 @@ namespace FireflyIII\Models;use Illuminate\Database\Eloquent\Model;+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/*** @property int $journalCount@@ -36,7 +37,25 @@ class LinkType extends Model'editable' => 'boolean',];- public function transactionJournalLinks() {+ /**+ * @param $value+ *+ * @return mixed+ * @throws NotFoundHttpException+ */+ public static function routeBinder($value)+ {+ if (auth()->check()) {+ $model = self::where('id', $value)->first();+ if (!is_null($model)) {+ return $model;+ }+ }+ throw new NotFoundHttpException;+ }++ public function transactionJournalLinks()+ {return $this->hasMany(TransactionJournalLink::class);}diff --git a/app/Models/TransactionJournalLink.php b/app/Models/TransactionJournalLink.phpindex 0bbcb2aa49..5569091f5d 100644--- a/app/Models/TransactionJournalLink.php+++ b/app/Models/TransactionJournalLink.php@@ -16,6 +16,7 @@ namespace FireflyIII\Models;use Crypt;use Illuminate\Database\Eloquent\Model;use Illuminate\Database\Eloquent\Relations\BelongsTo;+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/*** Class TransactionJournalLink@@ -26,6 +27,28 @@ class TransactionJournalLink extends Model{protected $table = 'journal_links';+ /**+ * @param $value+ *+ * @return mixed+ * @throws NotFoundHttpException+ */+ public static function routeBinder($value)+ {+ if (auth()->check()) {+ $model = self::where('journal_links.id', $value)+ ->leftJoin('transaction_journals as t_a', 't_a.id', '=', 'source_id')+ ->leftJoin('transaction_journals as t_b', 't_b.id', '=', 'destination_id')+ ->where('t_a.user_id', auth()->user()->id)+ ->where('t_b.user_id', auth()->user()->id)+ ->first(['journal_links.*']);+ if (!is_null($model)) {+ return $model;+ }+ }+ throw new NotFoundHttpException;+ }+/*** @return \Illuminate\Database\Eloquent\Relations\BelongsTo*/diff --git a/app/Repositories/LinkType/LinkTypeRepository.php b/app/Repositories/LinkType/LinkTypeRepository.phpindex e2786718ca..71227914f4 100644--- a/app/Repositories/LinkType/LinkTypeRepository.php+++ b/app/Repositories/LinkType/LinkTypeRepository.php@@ -54,6 +54,18 @@ class LinkTypeRepository implements LinkTypeRepositoryInterfacereturn true;}+ /**+ * @param TransactionJournalLink $link+ *+ * @return bool+ */+ public function destroyLink(TransactionJournalLink $link): bool+ {+ $link->delete();++ return true;+ }+/*** @param int $id*@@ -135,6 +147,21 @@ class LinkTypeRepository implements LinkTypeRepositoryInterfacereturn $linkType;}+ /**+ * @param TransactionJournalLink $link+ *+ * @return bool+ */+ public function switchLink(TransactionJournalLink $link): bool+ {+ $source = $link->source_id;+ $link->source_id = $link->destination_id;+ $link->destination_id = $source;+ $link->save();++ return true;+ }+/*** @param LinkType $linkType* @param array $datadiff --git a/app/Repositories/LinkType/LinkTypeRepositoryInterface.php b/app/Repositories/LinkType/LinkTypeRepositoryInterface.phpindex 145a69be35..2be29a4084 100644--- a/app/Repositories/LinkType/LinkTypeRepositoryInterface.php+++ b/app/Repositories/LinkType/LinkTypeRepositoryInterface.php@@ -14,6 +14,7 @@ namespace FireflyIII\Repositories\LinkType;use FireflyIII\Models\LinkType;use FireflyIII\Models\TransactionJournal;+use FireflyIII\Models\TransactionJournalLink;use Illuminate\Support\Collection;/**@@ -45,6 +46,20 @@ interface LinkTypeRepositoryInterface*/public function find(int $id): LinkType;+ /**+ * @param TransactionJournalLink $link+ *+ * @return bool+ */+ public function destroyLink(TransactionJournalLink $link):bool;++ /**+ * @param TransactionJournalLink $link+ *+ * @return bool+ */+ public function switchLink(TransactionJournalLink $link): bool;+/*** Check if link exists between journals.*diff --git a/app/Support/Amount.php b/app/Support/Amount.phpindex 5662f8261b..f1b6247cf8 100644--- a/app/Support/Amount.php+++ b/app/Support/Amount.php@@ -300,6 +300,7 @@ class Amountpublic function transactionAmount(TransactionModel $transaction, bool $coloured = true): string{$amount = bcmul(app('steam')->positive(strval($transaction->transaction_amount)), '-1');+$format = '%s';if ($transaction->transaction_type_type === TransactionType::DEPOSIT) {@@ -322,7 +323,11 @@ class Amountif (!is_null($transaction->transaction_foreign_amount)) {- $amount = strval($transaction->transaction_foreign_amount);+ $amount = bcmul(app('steam')->positive(strval($transaction->transaction_foreign_amount)), '-1');+ if ($transaction->transaction_type_type === TransactionType::DEPOSIT) {+ $amount = bcmul($amount, '-1');+ }+if ($transaction->transaction_type_type === TransactionType::TRANSFER) {$amount = app('steam')->positive($amount);diff --git a/app/Support/Twig/AmountFormat.php b/app/Support/Twig/AmountFormat.phpindex 55e5c28942..5033388258 100644--- a/app/Support/Twig/AmountFormat.php+++ b/app/Support/Twig/AmountFormat.php@@ -46,6 +46,7 @@ class AmountFormat extends Twig_Extension{return [$this->formatAmountByAccount(),+ $this->formatAmountBySymbol(),$this->transactionAmount(),$this->journalAmount(),$this->formatDestinationAfter(),@@ -108,6 +109,26 @@ class AmountFormat extends Twig_Extension);}+ /**+ * Will format the amount by the currency related to the given account.+ *+ * @return Twig_SimpleFunction+ */+ protected function formatAmountBySymbol(): Twig_SimpleFunction+ {+ return new Twig_SimpleFunction(+ 'formatAmountBySymbol', function (string $amount, string $symbol, int $decimalPlaces = 2, bool $coloured = true): string {++ $currency = new TransactionCurrency;+ $currency->symbol = $symbol;+ $currency->decimal_places = $decimalPlaces;+ return app('amount')->formatAnything($currency, $amount, $coloured);+++ }, ['is_safe' => ['html']]+ );+ }+/*** Will format the amount by the currency related to the given account.*diff --git a/resources/lang/en_US/breadcrumbs.php b/resources/lang/en_US/breadcrumbs.phpindex 7cdacba597..f1674d1f37 100644--- a/resources/lang/en_US/breadcrumbs.php+++ b/resources/lang/en_US/breadcrumbs.php@@ -13,31 +13,32 @@ declare(strict_types=1);*/return [- 'home' => 'Home',- 'edit_currency' => 'Edit currency ":name"',- 'delete_currency' => 'Delete currency ":name"',- 'newPiggyBank' => 'Create a new piggy bank',- 'edit_piggyBank' => 'Edit piggy bank ":name"',- 'preferences' => 'Preferences',- 'profile' => 'Profile',- 'changePassword' => 'Change your password',- 'bills' => 'Bills',- 'newBill' => 'New bill',- 'edit_bill' => 'Edit bill ":name"',- 'delete_bill' => 'Delete bill ":name"',- 'reports' => 'Reports',- 'search_result' => 'Search results for ":query"',- 'withdrawal_list' => 'Expenses',- 'deposit_list' => 'Revenue, income and deposits',- 'transfer_list' => 'Transfers',- 'transfers_list' => 'Transfers',- 'create_withdrawal' => 'Create new withdrawal',- 'create_deposit' => 'Create new deposit',- 'create_transfer' => 'Create new transfer',- 'edit_journal' => 'Edit transaction ":description"',- 'delete_journal' => 'Delete transaction ":description"',- 'tags' => 'Tags',- 'createTag' => 'Create new tag',- 'edit_tag' => 'Edit tag ":tag"',- 'delete_tag' => 'Delete tag ":tag"',+ 'home' => 'Home',+ 'edit_currency' => 'Edit currency ":name"',+ 'delete_currency' => 'Delete currency ":name"',+ 'newPiggyBank' => 'Create a new piggy bank',+ 'edit_piggyBank' => 'Edit piggy bank ":name"',+ 'preferences' => 'Preferences',+ 'profile' => 'Profile',+ 'changePassword' => 'Change your password',+ 'bills' => 'Bills',+ 'newBill' => 'New bill',+ 'edit_bill' => 'Edit bill ":name"',+ 'delete_bill' => 'Delete bill ":name"',+ 'reports' => 'Reports',+ 'search_result' => 'Search results for ":query"',+ 'withdrawal_list' => 'Expenses',+ 'deposit_list' => 'Revenue, income and deposits',+ 'transfer_list' => 'Transfers',+ 'transfers_list' => 'Transfers',+ 'create_withdrawal' => 'Create new withdrawal',+ 'create_deposit' => 'Create new deposit',+ 'create_transfer' => 'Create new transfer',+ 'edit_journal' => 'Edit transaction ":description"',+ 'delete_journal' => 'Delete transaction ":description"',+ 'tags' => 'Tags',+ 'createTag' => 'Create new tag',+ 'edit_tag' => 'Edit tag ":tag"',+ 'delete_tag' => 'Delete tag ":tag"',+ 'delete_journal_link' => 'Delete link between journals',];diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.phpindex aedee71623..89d1ae1afb 100644--- a/resources/lang/en_US/firefly.php+++ b/resources/lang/en_US/firefly.php@@ -965,6 +965,9 @@ return ['this_withdrawal' => 'This withdrawal','this_deposit' => 'This deposit','this_transfer' => 'This transfer',+ 'overview_for_link' => 'Overview for link type ":name"',+ 'delete_journal_link' => 'Delete the link between <a href=":source_link">:source</a> and <a href=":destination_link">:destination</a>',+ 'deleted_link' => 'Deleted link',// split a transaction:diff --git a/resources/lang/en_US/form.php b/resources/lang/en_US/form.phpindex f47f680876..311133b340 100644--- a/resources/lang/en_US/form.php+++ b/resources/lang/en_US/form.php@@ -148,13 +148,14 @@ return ['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"?',+ 'journal_link_areYouSure' => 'Are you sure you want to delete the link between <a href=":source_link">:source</a> and <a href=":destination_link">:destination</a>?','linkType_areYouSure' => 'Are you sure you want to delete the link type ":name" (":inward" / ":outward")?','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_connections' => 'The only transaction linked with this link type will lose this connection.|All :count transactions linked with this link type will lose their connection.',+ 'also_delete_connections' => 'The only transaction linked with this link type will lose this connection.|All :count transactions linked with this link type will lose their connection.','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.',diff --git a/resources/views/admin/link/index.twig b/resources/views/admin/link/index.twigindex 4aafa5470c..72e7391e02 100644--- a/resources/views/admin/link/index.twig+++ b/resources/views/admin/link/index.twig@@ -42,7 +42,7 @@{{ linkType.outward }}</td><td data-value="{{ linkType.journalCount }}">- {{ linkType.journalCount }}+ <a href="{{ route('admin.links.show', [linkType.id]) }}">{{ linkType.journalCount }}</a></td></tr>{% endfor %}@@ -55,6 +55,12 @@</div></div></div>+{% endblock %}-+{% block scripts %}+ <script type="text/javascript" src="js/lib/bootstrap-sortable.js"></script>{% endblock %}++{% block styles %}+ <link rel="stylesheet" href="css/bootstrap-sortable.css" type="text/css" media="all"/>+{% endblock %}\ No newline at end of filediff --git a/resources/views/admin/link/show.twig b/resources/views/admin/link/show.twignew file mode 100644index 0000000000..06a834d683--- /dev/null+++ b/resources/views/admin/link/show.twig@@ -0,0 +1,62 @@+{% extends "./layout/default" %}++{% block breadcrumbs %}+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, linkType) }}+{% endblock %}+{% block content %}+ <div class="row">+ <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">+ <div class="box box-default">+ <div class="box-header with-border">+ <h3 class="box-title">{{ trans('firefly.overview_for_link', {name: linkType.name}) }}</h3>+ </div>+ <div class="box-body no-padding">+ <table class="table table-hover sortable">+ <thead>+ <tr>+ <th> </th>+ <th>Source transaction</th>+ <th> </th>+ <th>Link description</th>+ <th>Destination transaction</th>+ <th> </th>+ </tr>+ </thead>+ <tbody>+ {% for link in links %}+ <tr>+ <td>+ <div class="btn-group btn-group-xs">+ <a href="{{ route('transactions.link.delete', [link.id]) }}" class="btn btn-danger"><i class="fa fa-trash"></i></a>+ <a href="{{ route('transactions.link.switch', [link.id]) }}" class="btn btn-default"><i class="fa fa-fw fa-arrows-h"></i></a>+ </div>+ </td>+ <td data-value="{{ link.source.description }}">+ <a href="{{ route('transactions.show', [link.source_id]) }}">{{ link.source.description }}</a>+ </td>+ <td>{{ journalAmount(link.source) }}</td>+ <td>{{ linkType.outward }}</td>+ <td data-value="{{ link.destination.description }}">+ <a href="{{ route('transactions.show', [link.destination_id]) }}">{{ link.destination.description }}</a>+ </td>+ <td>+ {{ journalAmount(link.destination) }}+ </td>+ </tr>+ {% endfor %}+ </tbody>+ </table>+ </div>+ </div>+ </div>+ </div>+++{% endblock %}+{% block scripts %}+ <script type="text/javascript" src="js/lib/bootstrap-sortable.js"></script>+{% endblock %}++{% block styles %}+ <link rel="stylesheet" href="css/bootstrap-sortable.css" type="text/css" media="all"/>+{% endblock %}\ No newline at end of filediff --git a/resources/views/partials/menu-sidebar.twig b/resources/views/partials/menu-sidebar.twigindex 83985bf6ad..f35d8770f0 100644--- a/resources/views/partials/menu-sidebar.twig+++ b/resources/views/partials/menu-sidebar.twig@@ -138,7 +138,7 @@<!-- options and preferences --><li id="option-menu"- class="{{ activeRoutePartial('admin') }} {{ activeRoutePartial('profile') }} {{ activeRoutePartial('preferences') }} {{ activeRoutePartial('currency') }} treeview">+ class="{{ activeRoutePartial('admin') }} {{ activeRoutePartial('profile') }} {{ activeRoutePartial('preferences') }} {{ activeRoutePartial('currencies') }} treeview"><a href="#"><i class="fa fa-gears fa-fw"></i><span>{{ 'options'|_ }}</span>@@ -158,8 +158,8 @@<a class="{{ activeRouteStrict('preferences.index') }}" href="{{ route('preferences.index') }}"><iclass="fa fa-gear fa-fw"></i> {{ 'preferences'|_ }}</a></li>- <li class="{{ activeRoutePartial('currency') }}">- <a class="{{ activeRoutePartial('currency') }}" href="{{ route('currencies.index') }}"><i class="fa fa-usd fa-fw"></i> {{ 'currencies'|_ }}</a>+ <li class="{{ activeRoutePartial('currencies') }}">+ <a class="{{ activeRoutePartial('currencies') }}" href="{{ route('currencies.index') }}"><i class="fa fa-usd fa-fw"></i> {{ 'currencies'|_ }}</a></li><!-- admin (if user admin) -->{% if Auth.user.hasRole('owner') %}diff --git a/resources/views/tags/delete.twig b/resources/views/tags/delete.twigindex 794c6e7f05..9ee307a8b4 100644--- a/resources/views/tags/delete.twig+++ b/resources/views/tags/delete.twig@@ -12,7 +12,7 @@<div class="col-lg-6 col-lg-offset-3 col-md-6 col-sm-12"><div class="box box-danger"><div class="box-header with-border">- <h3 class="box-title">Delete tag "{{ tag.tag }}"</h3>+ <h3 class="box-title">{{ trans('firefly.delete_tag',{tag: tag.tag}) }}</h3></div><div class="box-body"><p class="text-danger">diff --git a/resources/views/transactions/links/delete.twig b/resources/views/transactions/links/delete.twignew file mode 100644index 0000000000..e84db20c69--- /dev/null+++ b/resources/views/transactions/links/delete.twig@@ -0,0 +1,33 @@+{% extends "./layout/default" %}++{% block breadcrumbs %}+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, link) }}+{% endblock %}++{% block content %}++ <form method="POST" action="{{ route('transactions.link.destroy', [link.id]) }}" accept-charset="UTF-8" class="form-horizontal" id="destroy">+ <input name="_token" type="hidden" value="{{ csrf_token() }}">+ <div class="row">+ <div class="col-lg-6 col-lg-offset-3 col-md-6 col-sm-12">+ <div class="box box-danger">+ <div class="box-header with-border">+ <h3 class="box-title">{{ trans('firefly.delete_journal_link', {source: link.source.description, destination: link.destination.description, source_link: route('transactions.show', [link.source_id]) , destination_link: route('transactions.show',link.destination_id)})|raw }}</h3>+ </div>+ <div class="box-body">+ <p class="text-danger">+ {{ trans('form.permDeleteWarning') }}+ </p>+ <p>+ {{ trans('form.journal_link_areYouSure', {source: link.source.description, destination: link.destination.description, source_link: route('transactions.show', [link.source_id]) , destination_link: route('transactions.show',link.destination_id)})|raw }}+ </p>+ </div>+ <div class="box-footer">+ <input type="submit" name="submit" value="{{ trans('form.deletePermanently') }}" class="btn pull-right btn-danger"/>+ <a href="{{ URL.previous() }}" class="btn-default btn">{{ trans('form.cancel') }}</a>+ </div>+ </div>+ </div>+ </div>+ </form>+{% endblock %}diff --git a/resources/views/transactions/show.twig b/resources/views/transactions/show.twigindex 0fdbd5e3de..4b19773112 100644--- a/resources/views/transactions/show.twig+++ b/resources/views/transactions/show.twig@@ -322,21 +322,22 @@<tr><td><div class="btn-group btn-group-xs">- <a href="{{ route('attachments.delete', att.id) }}" class="btn btn-danger"><i class="fa fa-trash"></i></a>+ <a href="{{ route('transactions.link.delete', [link.id]) }}" class="btn btn-danger"><i class="fa fa-trash"></i></a>+ <a href="{{ route('transactions.link.switch', [link.id]) }}" class="btn btn-default"><i class="fa fa-fw fa-arrows-h"></i></a></div></td><td>{{ ('this_'~(what|lower))|_ }}- (<a href="{{ route('transactions.show',journal.id) }}">#{{ journal.id }}</a>){% if link.source.id == journal.id %}{{ link.linkType.outward }}- <a href="{{ route('transactions.show',link.destination.id) }}">#{{ link.destination.id }}</a>:- <a href="{{ route('transactions.show',link.destination.id) }}">{{ link.destination.description }}</a>+ <a href="{{ route('transactions.show',link.destination.id) }}">+ #{{ link.destination.id }}: {{ link.destination.description }}+ </a>({{ journalAmount(link.destination) }}){% else %}{{ link.linkType.inward }}- <a href="{{ route('transactions.show',link.source.id) }}">#{{ link.source.id }}</a>:- <a href="{{ route('transactions.show',link.source.id) }}">{{ link.source.description }}</a>+ <a href="{{ route('transactions.show',link.source.id) }}">+ #{{ link.source.id }}: {{ link.source.description }}</a>({{ journalAmount(link.source) }}){% endif %}{% if link.comment != "" %}@@ -364,20 +365,20 @@<table class="table table-bordered table-striped"><thead><tr>- <th>{{ trans('list.description') }}</th>+ <th class="hidden-md hidden-sm hidden-xs">{{ trans('list.description') }}</th><th>{{ trans('list.source_account') }}</th>- <th>Δ</th>+ <th class="hidden-sm hidden-xs">Δ</th><th>{{ trans('list.destination_account') }}</th>- <th>Δ</th>+ <th class="hidden-sm hidden-xs">Δ</th><th>{{ trans('list.amount') }}</th>- <th>{{ trans('list.budget') }}</th>- <th>{{ trans('list.category') }}</th>+ <th class="hidden-md hidden-xs">{{ trans('list.budget') }}</th>+ <th class="hidden-md hidden-xs">{{ trans('list.category') }}</th></tr></thead><tbody>{% for transaction in transactions %}<tr>- <td>+ <td class="hidden-md hidden-sm hidden-xs">{% if transaction.description == "" %}{{ journal.description }}{% else %}@@ -392,7 +393,7 @@{% endif %}</td>- <td>+ <td class="hidden-sm hidden-xs">{{ formatSourceBefore(transaction) }} → {{ formatSourceAfter(transaction) }}</td><td>@@ -403,16 +404,27 @@{% endif %}</td>- <td>+ <td class="hidden-sm hidden-xs">{{ formatDestinationBefore(transaction) }} → {{ formatDestinationAfter(transaction) }}</td><td>- {{ journalAmount(journal) }}+ {% if journal.transactionType.type == "Withdrawal" %}+ {{ formatAmountBySymbol(transaction.source_amount, transaction.transaction_currency_symbol, transaction.transaction_currency_dp, true) }}+ {% if(transaction.foreign_source_amount) %}+ ({{ formatAmountBySymbol(transaction.foreign_source_amount, transaction.foreign_currency_symbol, transaction.foreign_currency_dp, true) }})+ {% endif %}+ {% else %}+ {{ formatAmountBySymbol(transaction.destination_amount, transaction.transaction_currency_symbol,2) }}++ {% if(transaction.foreign_source_amount) %}+ ({{ formatAmountBySymbol(transaction.foreign_destination_amount, transaction.foreign_currency_symbol, transaction.foreign_currency_dp, true) }})+ {% endif %}+ {% endif %}</td>- <td>+ <td class="hidden-md hidden-xs">{{ transactionIdBudgets(transaction.source_id) }}</td>- <td>+ <td class="hidden-md hidden-xs">{{ transactionIdCategories(transaction.source_id) }}</td></tr>diff --git a/routes/web.php b/routes/web.phpindex 6e25737e6b..99ceda197d 100755--- a/routes/web.php+++ b/routes/web.php@@ -740,6 +740,11 @@ Route::group(Route::group(['middleware' => 'user-full-auth', 'namespace' => 'Transaction', 'prefix' => 'transactions/link', 'as' => 'transactions.link.'], function () {Route::post('store/{tj}', ['uses' => 'LinkController@store', 'as' => 'store']);++ Route::get('delete/{journalLink}', ['uses' => 'LinkController@delete', 'as' => 'delete']);+ Route::get('switch/{journalLink}', ['uses' => 'LinkController@switch', 'as' => 'switch']);++ Route::post('destroy/{journalLink}', ['uses' => 'LinkController@destroy', 'as' => 'destroy']);});@@ -771,6 +776,7 @@ Route::group(// journal links managerRoute::get('links', ['uses' => 'LinkController@index', 'as' => 'links.index']);Route::get('links/create', ['uses' => 'LinkController@create', 'as' => 'links.create']);+ Route::get('links/show/{linkType}', ['uses' => 'LinkController@show', 'as' => 'links.show']);Route::get('links/edit/{linkType}', ['uses' => 'LinkController@edit', 'as' => 'links.edit']);Route::get('links/delete/{linkType}', ['uses' => 'LinkController@delete', 'as' => 'links.delete']);