Make sure user interface works for new recurring transactions.

This commit is contained in:
James Cole
2019-08-27 06:36:16 +02:00
parent ce5fcbbda2
commit 4ff8b3b556
10 changed files with 387 additions and 363 deletions

View File

@@ -127,9 +127,10 @@ class EditController extends Controller
'apply_rules' => $hasOldInput ? (bool)$request->old('apply_rules') : $recurrence->apply_rules, 'apply_rules' => $hasOldInput ? (bool)$request->old('apply_rules') : $recurrence->apply_rules,
'deposit_source_id' => $array['transactions'][0]['source_id'], 'deposit_source_id' => $array['transactions'][0]['source_id'],
'withdrawal_destination_id' => $array['transactions'][0]['destination_id'], 'withdrawal_destination_id' => $array['transactions'][0]['destination_id'],
]; ];
$array['transactions'][0]['tags'] = implode(',', $array['transactions'][0]['tags']);
return view( return view(
'recurring.edit', 'recurring.edit',
compact('recurrence', 'array', 'weekendResponses', 'budgets', 'preFilled', 'currentRepType', 'repetitionEnd', 'repetitionEnds') compact('recurrence', 'array', 'weekendResponses', 'budgets', 'preFilled', 'currentRepType', 'repetitionEnd', 'repetitionEnds')
@@ -148,6 +149,7 @@ class EditController extends Controller
public function update(RecurrenceFormRequest $request, Recurrence $recurrence) public function update(RecurrenceFormRequest $request, Recurrence $recurrence)
{ {
$data = $request->getAll(); $data = $request->getAll();
$this->recurring->update($recurrence, $data); $this->recurring->update($recurrence, $data);
$request->session()->flash('success', (string)trans('firefly.updated_recurrence', ['title' => $recurrence->title])); $request->session()->flash('success', (string)trans('firefly.updated_recurrence', ['title' => $recurrence->title]));

View File

@@ -68,6 +68,7 @@ class IndexController extends Controller
} }
/** /**
* TODO the notes of a recurrence are pretty pointless at this moment.
* Show all recurring transactions. * Show all recurring transactions.
* *
* @param Request $request * @param Request $request
@@ -108,33 +109,4 @@ class IndexController extends Controller
return view('recurring.index', compact('paginator', 'page', 'pageSize', 'total')); return view('recurring.index', compact('paginator', 'page', 'pageSize', 'total'));
} }
/**
* Show a single recurring transaction.
*
* @param Recurrence $recurrence
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @throws FireflyException
*/
public function show(Recurrence $recurrence)
{
/** @var RecurrenceTransformer $transformer */
$transformer = app(RecurrenceTransformer::class);
$transformer->setParameters(new ParameterBag);
$array = $transformer->transform($recurrence);
$groups = $this->recurring->getTransactions($recurrence);
// transform dates back to Carbon objects:
foreach ($array['recurrence_repetitions'] as $index => $repetition) {
foreach ($repetition['occurrences'] as $item => $occurrence) {
$array['recurrence_repetitions'][$index]['occurrences'][$item] = new Carbon($occurrence);
}
}
$subTitle = (string)trans('firefly.overview_for_recurrence', ['title' => $recurrence->title]);
return view('recurring.show', compact('recurrence', 'subTitle', 'array', 'groups'));
}
} }

View File

@@ -0,0 +1,96 @@
<?php
/**
* ShowController.php
* Copyright (c) 2019 thegrumpydictator@gmail.com
*
* This file is part of Firefly III.
*
* Firefly III is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Firefly III is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Recurring;
use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Recurrence;
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
use FireflyIII\Support\Http\Controllers\GetConfigurationData;
use FireflyIII\Transformers\RecurrenceTransformer;
use Symfony\Component\HttpFoundation\ParameterBag;
/**
*
* Class ShowController
*/
class ShowController extends Controller
{
use GetConfigurationData;
/** @var RecurringRepositoryInterface Recurring repository */
private $recurring;
/**
* IndexController constructor.
* @codeCoverageIgnore
*/
public function __construct()
{
parent::__construct();
// translations:
$this->middleware(
function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-paint-brush');
app('view')->share('title', (string)trans('firefly.recurrences'));
$this->recurring = app(RecurringRepositoryInterface::class);
return $next($request);
}
);
}
/**
* Show a single recurring transaction.
*
* @param Recurrence $recurrence
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @throws FireflyException
*/
public function show(Recurrence $recurrence)
{
/** @var RecurrenceTransformer $transformer */
$transformer = app(RecurrenceTransformer::class);
$transformer->setParameters(new ParameterBag);
$array = $transformer->transform($recurrence);
$groups = $this->recurring->getTransactions($recurrence);
// transform dates back to Carbon objects:
foreach ($array['repetitions'] as $index => $repetition) {
foreach ($repetition['occurrences'] as $item => $occurrence) {
$array['repetitions'][$index]['occurrences'][$item] = new Carbon($occurrence);
}
}
$subTitle = (string)trans('firefly.overview_for_recurrence', ['title' => $recurrence->title]);
return view('recurring.show', compact('recurrence', 'subTitle', 'array', 'groups'));
}
}

View File

@@ -86,15 +86,11 @@ class RecurrenceFormRequest extends Request
'budget_name' => null, 'budget_name' => null,
'category_id' => null, 'category_id' => null,
'category_name' => $this->string('category'), 'category_name' => $this->string('category'),
'tags' => '' !== $this->string('tags') ? explode(',', $this->string('tags')) : [],
'piggy_bank_id' => $this->integer('piggy_bank_id'),
'piggy_bank_name' => null,
], ],
], ],
'meta' => [
// tags and piggy bank ID.
'tags' => '' !== $this->string('tags') ? explode(',', $this->string('tags')) : [],
'piggy_bank_id' => $this->integer('piggy_bank_id'),
'piggy_bank_name' => null,
],
'repetitions' => [ 'repetitions' => [
[ [
'type' => $repetitionData['type'], 'type' => $repetitionData['type'],
@@ -137,86 +133,6 @@ class RecurrenceFormRequest extends Request
return $return; return $return;
} }
/**
* Configure the validator instance with special rules for after the basic validation rules.
*
* @param Validator $validator
*
* @return void
*/
public function withValidator(Validator $validator): void
{
$validator->after(
function (Validator $validator) {
// validate all account info
$this->validateAccountInformation($validator);
}
);
}
/**
* Validates the given account information. Switches on given transaction type.
*
* @param Validator $validator
* @throws FireflyException
*/
public function validateAccountInformation(Validator $validator): void
{
Log::debug('Now in validateAccountInformation()');
/** @var AccountValidator $accountValidator */
$accountValidator = app(AccountValidator::class);
$data = $validator->getData();
$transactionType = $data['transaction_type'] ?? 'invalid';
$accountValidator->setTransactionType($transactionType);
// default values:
$sourceId = null;
$destinationId = null;
switch ($this->string('transaction_type')) {
default:
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->string('transaction_type'))); // @codeCoverageIgnore
case 'withdrawal':
$sourceId = (int)$data['source_id'];
$destinationId = (int)$data['withdrawal_destination_id'];
break;
case 'deposit':
$sourceId = (int)$data['deposit_source_id'];
$destinationId = (int)$data['destination_id'];
break;
case 'transfer':
$sourceId = (int)$data['source_id'];
$destinationId = (int)$data['destination_id'];
break;
}
// validate source account.
$validSource = $accountValidator->validateSource($sourceId, null);
// do something with result:
if (false === $validSource) {
$message = (string)trans('validation.generic_invalid_source');
$validator->errors()->add('source_id', $message);
$validator->errors()->add('deposit_source_id', $message);
return;
}
// validate destination account
$validDestination = $accountValidator->validateDestination($destinationId, null);
// do something with result:
if (false === $validDestination) {
$message = (string)trans('validation.generic_invalid_destination');
$validator->errors()->add('destination_id', $message);
$validator->errors()->add('withdrawal_destination_id', $message);
return;
}
}
/** /**
* The rules for this request. * The rules for this request.
* *
@@ -310,6 +226,86 @@ class RecurrenceFormRequest extends Request
return $rules; return $rules;
} }
/**
* Validates the given account information. Switches on given transaction type.
*
* @param Validator $validator
*
* @throws FireflyException
*/
public function validateAccountInformation(Validator $validator): void
{
Log::debug('Now in validateAccountInformation()');
/** @var AccountValidator $accountValidator */
$accountValidator = app(AccountValidator::class);
$data = $validator->getData();
$transactionType = $data['transaction_type'] ?? 'invalid';
$accountValidator->setTransactionType($transactionType);
// default values:
$sourceId = null;
$destinationId = null;
switch ($this->string('transaction_type')) {
default:
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->string('transaction_type'))); // @codeCoverageIgnore
case 'withdrawal':
$sourceId = (int)$data['source_id'];
$destinationId = (int)$data['withdrawal_destination_id'];
break;
case 'deposit':
$sourceId = (int)$data['deposit_source_id'];
$destinationId = (int)$data['destination_id'];
break;
case 'transfer':
$sourceId = (int)$data['source_id'];
$destinationId = (int)$data['destination_id'];
break;
}
// validate source account.
$validSource = $accountValidator->validateSource($sourceId, null);
// do something with result:
if (false === $validSource) {
$message = (string)trans('validation.generic_invalid_source');
$validator->errors()->add('source_id', $message);
$validator->errors()->add('deposit_source_id', $message);
return;
}
// validate destination account
$validDestination = $accountValidator->validateDestination($destinationId, null);
// do something with result:
if (false === $validDestination) {
$message = (string)trans('validation.generic_invalid_destination');
$validator->errors()->add('destination_id', $message);
$validator->errors()->add('withdrawal_destination_id', $message);
return;
}
}
/**
* Configure the validator instance with special rules for after the basic validation rules.
*
* @param Validator $validator
*
* @return void
*/
public function withValidator(Validator $validator): void
{
$validator->after(
function (Validator $validator) {
// validate all account info
$this->validateAccountInformation($validator);
}
);
}
/** /**
* Parses repetition data. * Parses repetition data.
* *

View File

@@ -91,7 +91,7 @@ class RecurrenceUpdateService
// update all meta data: // update all meta data:
//$this->updateMetaData($recurrence, $data); //$this->updateMetaData($recurrence, $data);
if (null !== $data['recurrence']['notes']) { if (isset($data['recurrence']['notes']) && null !== $data['recurrence']['notes']) {
$this->setNoteText($recurrence, $data['recurrence']['notes']); $this->setNoteText($recurrence, $data['recurrence']['notes']);
} }

View File

@@ -178,6 +178,8 @@ class RecurrenceTransformer extends AbstractTransformer
switch ($transactionMeta->name) { switch ($transactionMeta->name) {
default: default:
throw new FireflyException(sprintf('Recurrence transformer cant handle field "%s"', $transactionMeta->name)); throw new FireflyException(sprintf('Recurrence transformer cant handle field "%s"', $transactionMeta->name));
case 'bill_id':
break;
case 'tags': case 'tags':
$array['tags'] = json_decode($transactionMeta->value); $array['tags'] = json_decode($transactionMeta->value);
break; break;

View File

@@ -23,65 +23,66 @@
declare(strict_types=1); declare(strict_types=1);
return [ return [
'buttons' => 'Buttons', 'buttons' => 'Buttons',
'icon' => 'Icon', 'icon' => 'Icon',
'id' => 'ID', 'id' => 'ID',
'create_date' => 'Created at', 'create_date' => 'Created at',
'update_date' => 'Updated at', 'update_date' => 'Updated at',
'updated_at' => 'Updated at', 'updated_at' => 'Updated at',
'balance_before' => 'Balance before', 'balance_before' => 'Balance before',
'balance_after' => 'Balance after', 'balance_after' => 'Balance after',
'name' => 'Name', 'name' => 'Name',
'role' => 'Role', 'role' => 'Role',
'currentBalance' => 'Current balance', 'currentBalance' => 'Current balance',
'linked_to_rules' => 'Relevant rules', 'linked_to_rules' => 'Relevant rules',
'active' => 'Is active?', 'active' => 'Is active?',
'transaction_type' => 'Type', 'transaction_type' => 'Type',
'lastActivity' => 'Last activity', 'lastActivity' => 'Last activity',
'balanceDiff' => 'Balance difference', 'balanceDiff' => 'Balance difference',
'matchesOn' => 'Matched on', 'matchesOn' => 'Matched on',
'account_type' => 'Account type', 'other_meta_data' => 'Other meta data',
'created_at' => 'Created at', 'account_type' => 'Account type',
'account' => 'Account', 'created_at' => 'Created at',
'matchingAmount' => 'Amount', 'account' => 'Account',
'split_number' => 'Split #', 'matchingAmount' => 'Amount',
'destination' => 'Destination', 'split_number' => 'Split #',
'source' => 'Source', 'destination' => 'Destination',
'next_expected_match' => 'Next expected match', 'source' => 'Source',
'automatch' => 'Auto match?', 'next_expected_match' => 'Next expected match',
'repeat_freq' => 'Repeats', 'automatch' => 'Auto match?',
'description' => 'Description', 'repeat_freq' => 'Repeats',
'amount' => 'Amount', 'description' => 'Description',
'internal_reference' => 'Internal reference', 'amount' => 'Amount',
'date' => 'Date', 'internal_reference' => 'Internal reference',
'interest_date' => 'Interest date', 'date' => 'Date',
'book_date' => 'Book date', 'interest_date' => 'Interest date',
'process_date' => 'Processing date', 'book_date' => 'Book date',
'due_date' => 'Due date', 'process_date' => 'Processing date',
'payment_date' => 'Payment date', 'due_date' => 'Due date',
'invoice_date' => 'Invoice date', 'payment_date' => 'Payment date',
'interal_reference' => 'Internal reference', 'invoice_date' => 'Invoice date',
'notes' => 'Notes', 'interal_reference' => 'Internal reference',
'from' => 'From', 'notes' => 'Notes',
'piggy_bank' => 'Piggy bank', 'from' => 'From',
'to' => 'To', 'piggy_bank' => 'Piggy bank',
'budget' => 'Budget', 'to' => 'To',
'category' => 'Category', 'budget' => 'Budget',
'bill' => 'Bill', 'category' => 'Category',
'withdrawal' => 'Withdrawal', 'bill' => 'Bill',
'deposit' => 'Deposit', 'withdrawal' => 'Withdrawal',
'transfer' => 'Transfer', 'deposit' => 'Deposit',
'type' => 'Type', 'transfer' => 'Transfer',
'completed' => 'Completed', 'type' => 'Type',
'iban' => 'IBAN', 'completed' => 'Completed',
'paid_current_period' => 'Paid this period', 'iban' => 'IBAN',
'email' => 'Email', 'paid_current_period' => 'Paid this period',
'registered_at' => 'Registered at', 'email' => 'Email',
'is_blocked' => 'Is blocked', 'registered_at' => 'Registered at',
'is_admin' => 'Is admin', 'is_blocked' => 'Is blocked',
'has_two_factor' => 'Has 2FA', 'is_admin' => 'Is admin',
'blocked_code' => 'Block code', 'has_two_factor' => 'Has 2FA',
'source_account' => 'Source account', 'blocked_code' => 'Block code',
'source_account' => 'Source account',
'destination_account' => 'Destination account', 'destination_account' => 'Destination account',
'accounts_count' => 'Number of accounts', 'accounts_count' => 'Number of accounts',
'journals_count' => 'Number of transactions', 'journals_count' => 'Number of transactions',

View File

@@ -125,20 +125,10 @@
{{ ExpandedForm.text('category',array.transactions[0].category_name) }} {{ ExpandedForm.text('category',array.transactions[0].category_name) }}
{# TAGS #} {# TAGS #}
{% set tags = '' %} {{ ExpandedForm.text('tags', array.transactions[0].tags) }}
{% set piggyBankId = 0 %}
{% for metaValue in array.meta %}
{% if metaValue.name == 'tags' %}
{% set tags = metaValue.value %}
{% endif %}
{% if metaValue.name == 'piggy_bank_id' %}
{% set piggyBankId = metaValue.value %}
{% endif %}
{% endfor %}
{{ ExpandedForm.text('tags', tags) }}
{# RELATE THIS TRANSFER TO A PIGGY BANK #} {# RELATE THIS TRANSFER TO A PIGGY BANK #}
{{ PiggyBankForm.piggyBankList('piggy_bank_id',piggyBankId) }} {{ PiggyBankForm.piggyBankList('piggy_bank_id',array.transactions[0].piggy_bank_id) }}
</div> </div>
</div> </div>
</div> </div>

View File

@@ -5,188 +5,153 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
<!-- basic info --> <!-- basic info -->
<div class="col-lg-8 col-md-12 col-sm-12"> <div class="col-lg-8 col-md-12 col-sm-12">
<div class="box"> <div class="box">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title"> <h3 class="box-title">
{{ array.title }} {{ array.title }}
({{ array.transaction_type }}) ({{ array.type }})
{% if array.active == false %}
({{ 'inactive'|_|lower }})
{% endif %}
</h3>
</div>
<div class="box-body">
<p><em>{{ array.description }}</em></p>
{% if array.active == false %} {% if array.active == false %}
<p> ({{ 'inactive'|_|lower }})
{{ 'recurrence_is_inactive'|_ }}
</p>
{% endif %} {% endif %}
</h3>
<ul>
{% for rep in array.repetitions %}
<li>{{ rep.description }}</li>
{% endfor %}
</ul>
</div>
<div class="box-footer">
<div class="btn-group">
<a href="{{ route('recurring.edit', [array.id]) }}" class="btn btn-sm btn-default"><i class="fa fa-pencil"></i> {{ 'edit'|_ }}</a>
<a href="{{ route('recurring.delete', [array.id]) }}" class="btn btn-sm btn-danger">{{ 'delete'|_ }} <i class="fa fa-trash"></i></a>
</div>
</div>
</div> </div>
</div> <div class="box-body">
<!-- next and previous repetitions --> <p><em>{{ array.description }}</em></p>
<div class="col-lg-4 col-md-12 col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">
{{ ('expected_'~array.transaction_type~'s')|_ }}
</h3>
</div>
<div class="box-body">
<ul> {% if array.active == false %}
{% for rep in array.recurrence_repetitions %} <p>
<li> {{ 'recurrence_is_inactive'|_ }}
{{ rep.description }} </p>
{% if rep.repetition_skip == 1 %} {% endif %}
({{ trans('firefly.recurring_skips_one')|lower }})
{% endif %} <ul>
{% if rep.repetition_skip > 1 %} {% for rep in array.repetitions %}
({{ trans('firefly.recurring_skips_more', {count: rep.repetition_skip})|lower }}) <li>{{ rep.description }}</li>
{% endif %} {% endfor %}
<ul> </ul>
{% for occ in rep.occurrences %} </div>
<li>{{ occ.formatLocalized(trans('config.month_and_date_day')) }}</li> <div class="box-footer">
{% endfor %} <div class="btn-group">
</ul> <a href="{{ route('recurring.edit', [array.id]) }}" class="btn btn-sm btn-default"><i class="fa fa-pencil"></i> {{ 'edit'|_ }}</a>
</li> <a href="{{ route('recurring.delete', [array.id]) }}" class="btn btn-sm btn-danger">{{ 'delete'|_ }} <i class="fa fa-trash"></i></a>
{% endfor %}
</ul>
</div>
<div class="box-footer">
<small>
<em>{{ 'warning_duplicates_repetitions'|_ }}</em>
</small>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <!-- next and previous repetitions -->
<!-- transactions --> <div class="col-lg-4 col-md-12 col-sm-12">
<div class="col-lg-8 col-md-12 col-sm-12"> <div class="box">
<div class="box"> <div class="box-header with-border">
<div class="box-header with-border"> <h3 class="box-title">
<h3 class="box-title"> {{ ('expected_'~array.type~'s')|_ }}
{{ 'transaction_data'|_ }} </h3>
</h3> </div>
</div> <div class="box-body">
<div class="box-body no-padding">
<table class="table table-hover sortable"> <ul>
<thead> {% for rep in array.repetitions %}
<li>
{{ rep.description }}
{% if rep.repetition_skip == 1 %}
({{ trans('firefly.recurring_skips_one')|lower }})
{% endif %}
{% if rep.repetition_skip > 1 %}
({{ trans('firefly.recurring_skips_more', {count: rep.repetition_skip})|lower }})
{% endif %}
<ul>
{% for occ in rep.occurrences %}
<li>{{ occ.formatLocalized(trans('config.month_and_date_day')) }}</li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
</div>
<div class="box-footer">
<small>
<em>{{ 'warning_duplicates_repetitions'|_ }}</em>
</small>
</div>
</div>
</div>
</div>
<div class="row">
<!-- transactions -->
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">
{{ 'transaction_data'|_ }}
</h3>
</div>
<div class="box-body no-padding">
<table class="table table-hover sortable">
<thead>
<tr>
<th data-defaultsign="az">{{ trans('list.description') }}</th> <th data-defaultsign="az">{{ trans('list.description') }}</th>
<th data-defaultsign="az">{{ trans('list.source') }}</th> <th data-defaultsign="az">{{ trans('list.source') }}</th>
<th data-defaultsign="az">{{ trans('list.destination') }}</th> <th data-defaultsign="az">{{ trans('list.destination') }}</th>
<th data-defaultsign="_19">{{ trans('list.amount') }}</th> <th data-defaultsign="_19">{{ trans('list.amount') }}</th>
<th data-defaultsign="az">{{ trans('list.category') }}</th> <th data-defaultsign="az">{{ trans('list.category') }}</th>
<th data-defaultsign="az">{{ trans('list.budget') }}</th> <th data-defaultsign="az">{{ trans('list.budget') }}</th>
</thead> <th>{{ trans('list.other_meta_data') }}</th>
<tbody> </tr>
{% for transaction in array.transactions %} </thead>
<tr> <tbody>
<td data-value="{{ transaction.description }}"> {% for transaction in array.transactions %}
{{ transaction.description }} <tr>
</td> <td data-value="{{ transaction.description }}">
<td data-value="{{ transaction.source_name }}"> {{ transaction.description }}
<a href="{{ route('accounts.show', [transaction.source_id]) }}">{{ transaction.source_name }}</a> </td>
</td> <td data-value="{{ transaction.source_name }}">
<td data-value="{{ transaction.destination_name }}"> <a href="{{ route('accounts.show', [transaction.source_id]) }}">{{ transaction.source_name }}</a>
<a href="{{ route('accounts.show', [transaction.destination_id]) }}">{{ transaction.destination_name }}</a> </td>
</td> <td data-value="{{ transaction.destination_name }}">
<td> <a href="{{ route('accounts.show', [transaction.destination_id]) }}">{{ transaction.destination_name }}</a>
{{ formatAmountBySymbol(transaction.amount,transaction.currency_symbol,transaction.currency_decimal_places) }} </td>
{% if null != transaction.foreign_amount %} <td>
({{ formatAmountBySymbol(transaction.foreign_amount,transaction.foreign_currency_symbol,transaction.foreign_currency_decimal_places) }}) {{ formatAmountBySymbol(transaction.amount,transaction.currency_symbol,transaction.currency_decimal_places) }}
{% endif %} {% if null != transaction.foreign_amount %}
</td> ({{ formatAmountBySymbol(transaction.foreign_amount,transaction.foreign_currency_symbol,transaction.foreign_currency_decimal_places) }})
<td data-value="{% for meta in transaction.meta %}{% if meta.name == 'category_name' %}{{ meta.category_id }}{% endif %}{% endfor %}"> {% endif %}
{% for meta in transaction.meta %} </td>
{% if meta.name == 'category_name' %} <td data-value="{{ transaction.category_id|default(0) }}">
<a href="{{ route('categories.show', [meta.category_id]) }}"> {% if '' != transaction.category_name %}
{{ meta.category_name }} <a href="{{ route('categories.show', [transaction.category_id]) }}">
</a> {{ transaction.category_name }}
{% endif %} </a>
{% endfor %} {% endif %}
</td> </td>
<td data-value="{% for meta in transaction.meta %}{% if meta.name == 'budget_id' %}{{ meta.budget_id }}{% endif %}{% endfor %}"> <td data-value="{{ transaction.budget_id|default(0) }}">
{% for meta in transaction.meta %} {% if '' != transaction.budget_name %}
{% if meta.name == 'budget_id' %} <a href="{{ route('budgets.show', [transaction.budget_id]) }}">
<a href="{{ route('budgets.show', [meta.budget_id]) }}"> {{ transaction.budget_name }}
{{ meta.budget_name }} </a>
</a> {% endif %}
{% endif %} </td>
{% endfor %} <td>
</td> {% if transaction.tags|length > 0 %}
</tr> <p>
{% endfor %} {% for tag in transaction.tags %}
</tbody> <span class="label label-success">{{ tag }}</span>
</table> {% endfor %}
</div> </p>
{% endif %}
{% if 0 != transaction.piggy_bank_id and array.type == 'Transfer' %}
<a href="{{ route('piggy-banks.show', [transaction.piggy_bank_id]) }}">{{ transaction.piggy_bank_name }}</a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div> </div>
</div> </div>
<!-- meta data -->
{% if array.meta|length > 0 %}
<div class="col-lg-4 col-md-12 col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">
{{ 'meta_data'|_ }}
</h3>
</div>
<div class="box-body no-padding">
<table class="table table-hover sortable">
<thead>
<th style="width:30%;" data-defaultsign="az">{{ trans('list.field') }}</th>
<th data-defaultsign="az">{{ trans('list.value') }}</th>
</thead>
<tbody>
{% for meta in array.meta %}
<tr>
<td>{{ trans('firefly.recurring_meta_field_'~meta.name) }}</td>
<td>
{% if meta.name == 'tags' %}
{% for tag in meta.tags %}
<span class="label label-info">{{ tag }}</span>
{% endfor %}
{% endif %}
{% if meta.name == 'notes' %}
{{ meta.value|markdown }}
{% endif %}
{% if meta.name == 'bill_id' %}
<a href="{{ route('bills.show', [meta.bill_id]) }}">{{ meta.bill_name }}</a>
{% endif %}
{% if meta.name == 'piggy_bank_id' %}
<a href="{{ route('piggy-banks.show', [meta.piggy_bank_id]) }}">{{ meta.piggy_bank_name }}</a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
</div> </div>
<div class="row"> <div class="row">
<!-- meta data --> <!-- meta data -->
@@ -203,14 +168,14 @@
</div> </div>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
{% block styles %} {% block styles %}
<link rel="stylesheet" href="v1/css/bootstrap-sortable.css?v={{ FF_VERSION }}" type="text/css" media="all"/> <link rel="stylesheet" href="v1/css/bootstrap-sortable.css?v={{ FF_VERSION }}" type="text/css" media="all"/>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script type="text/javascript" src="v1/js/lib/bootstrap-sortable.js?v={{ FF_VERSION }}"></script> <script type="text/javascript" src="v1/js/lib/bootstrap-sortable.js?v={{ FF_VERSION }}"></script>
{# required for groups.twig #} {# required for groups.twig #}
<script type="text/javascript" src="v1/js/ff/list/groups.js?v={{ FF_VERSION }}"></script> <script type="text/javascript" src="v1/js/ff/list/groups.js?v={{ FF_VERSION }}"></script>
{% endblock %} {% endblock %}

View File

@@ -657,7 +657,7 @@ Route::group(
Route::get('', ['uses' => 'Recurring\IndexController@index', 'as' => 'index']); Route::get('', ['uses' => 'Recurring\IndexController@index', 'as' => 'index']);
Route::get('show/{recurrence}', ['uses' => 'Recurring\IndexController@show', 'as' => 'show']); Route::get('show/{recurrence}', ['uses' => 'Recurring\ShowController@show', 'as' => 'show']);
Route::get('create', ['uses' => 'Recurring\CreateController@create', 'as' => 'create']); Route::get('create', ['uses' => 'Recurring\CreateController@create', 'as' => 'create']);
Route::get('edit/{recurrence}', ['uses' => 'Recurring\EditController@edit', 'as' => 'edit']); Route::get('edit/{recurrence}', ['uses' => 'Recurring\EditController@edit', 'as' => 'edit']);
Route::get('delete/{recurrence}', ['uses' => 'Recurring\DeleteController@delete', 'as' => 'delete']); Route::get('delete/{recurrence}', ['uses' => 'Recurring\DeleteController@delete', 'as' => 'delete']);