/** * @param TransactionJournal $journal * @param Tag $tag * * @return string */ protected function formatJournalByTag(TransactionJournal $journal, Tag $tag) { if ($tag->tagMode == 'balancingAct') { // return tag formatted for a "balancing act", even if other // tags are present. $amount = app('amount')->format($journal->amount_positive, false); $string = '<a href="' . route('tags.show', [$tag->id]) . '" class="label label-success" title="' . $amount . '"><i class="fa fa-fw fa-refresh"></i> ' . $tag->tag . '</a>'; return $string; } if ($tag->tagMode == 'advancePayment') { if ($journal->isDeposit()) { $amount = app('amount')->formatJournal($journal, false); $string = '<a href="' . route('tags.show', [$tag->id]) . '" class="label label-success" title="' . $amount . '"><i class="fa fa-fw fa-sort-numeric-desc"></i> ' . $tag->tag . '</a>'; return $string; } /* * AdvancePayment with a withdrawal will show the amount with a link to * the tag. The TransactionJournal should properly calculate the amount. */ if ($journal->isWithdrawal()) { $amount = app('amount')->formatJournal($journal); $string = '<a href="' . route('tags.show', [$tag->id]) . '">' . $amount . '</a>'; return $string; } } return $this->relevantTagsNoTags($journal); }