mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-13 16:00:13 +00:00
Code to catch empty lists and nudge user in the right direction.
This commit is contained in:
@@ -183,20 +183,23 @@ class TagController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param TagRepositoryInterface $repository
|
||||||
*
|
*
|
||||||
|
* @return View
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index(TagRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
$title = 'Tags';
|
$title = 'Tags';
|
||||||
$mainTitleIcon = 'fa-tags';
|
$mainTitleIcon = 'fa-tags';
|
||||||
$types = ['nothing', 'balancingAct', 'advancePayment'];
|
$types = ['nothing', 'balancingAct', 'advancePayment'];
|
||||||
|
$count = $repository->count();
|
||||||
|
|
||||||
// loop each types and get the tags, group them by year.
|
// loop each types and get the tags, group them by year.
|
||||||
$collection = [];
|
$collection = [];
|
||||||
foreach ($types as $type) {
|
foreach ($types as $type) {
|
||||||
|
|
||||||
/** @var Collection $tags */
|
/** @var Collection $tags */
|
||||||
$tags = auth()->user()->tags()->where('tagMode', $type)->orderBy('date', 'ASC')->get();
|
$tags = $repository->getByType($type);
|
||||||
$tags = $tags->sortBy(
|
$tags = $tags->sortBy(
|
||||||
function (Tag $tag) {
|
function (Tag $tag) {
|
||||||
$date = !is_null($tag->date) ? $tag->date->format('Ymd') : '000000';
|
$date = !is_null($tag->date) ? $tag->date->format('Ymd') : '000000';
|
||||||
@@ -216,7 +219,7 @@ class TagController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('tags.index', compact('title', 'mainTitleIcon', 'types', 'collection'));
|
return view('tags.index', compact('title', 'mainTitleIcon', 'types', 'collection','count'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -68,6 +68,14 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function count(): int
|
||||||
|
{
|
||||||
|
return $this->user->tags()->count();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Tag $tag
|
* @param Tag $tag
|
||||||
*
|
*
|
||||||
@@ -163,6 +171,16 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
return $tags;
|
return $tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $type
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function getByType(string $type): Collection
|
||||||
|
{
|
||||||
|
return $this->user->tags()->where('tagMode', $type)->orderBy('date', 'ASC')->get();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Tag $tag
|
* @param Tag $tag
|
||||||
*
|
*
|
||||||
|
@@ -37,6 +37,11 @@ interface TagRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function connect(TransactionJournal $journal, Tag $tag): bool;
|
public function connect(TransactionJournal $journal, Tag $tag): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function count(): int;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method destroys a tag.
|
* This method destroys a tag.
|
||||||
*
|
*
|
||||||
@@ -83,6 +88,13 @@ interface TagRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function get(): Collection;
|
public function get(): Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $type
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function getByType(string $type): Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Tag $tag
|
* @param Tag $tag
|
||||||
*
|
*
|
||||||
|
@@ -968,18 +968,44 @@ return [
|
|||||||
// sandstorm.io errors and messages:
|
// sandstorm.io errors and messages:
|
||||||
'sandstorm_not_available' => 'This function is not available when you are using Firefly III within a Sandstorm.io environment.',
|
'sandstorm_not_available' => 'This function is not available when you are using Firefly III within a Sandstorm.io environment.',
|
||||||
|
|
||||||
// empty lists? instructions:
|
// empty lists? no objects? instructions:
|
||||||
'empty_accounts_title_asset' => 'Let\'s create an asset account!',
|
'no_transactions_in_period' => 'There are no transactions in this period.',
|
||||||
'empty_accounts_intro_asset' => 'You have no asset accounts yet. Asset accounts are your main accounts: your checking account, savings account, shared account or even your credit card.',
|
'no_accounts_title_asset' => 'Let\'s create an asset account!',
|
||||||
'empty_accounts_imperative_asset' => 'To start using Firefly III you must create at least one asset account. Let\'s do so now:',
|
'no_accounts_intro_asset' => 'You have no asset accounts yet. Asset accounts are your main accounts: your checking account, savings account, shared account or even your credit card.',
|
||||||
'empty_accounts_create_asset' => 'Create an asset account',
|
'no_accounts_imperative_asset' => 'To start using Firefly III you must create at least one asset account. Let\'s do so now:',
|
||||||
'empty_accounts_title_expense' => 'Let\'s create an expense account!',
|
'no_accounts_create_asset' => 'Create an asset account',
|
||||||
'empty_accounts_intro_expense' => 'You have no expense accounts yet. Expense accounts are the places where you spend money, such as shops and supermarkets.',
|
'no_accounts_title_expense' => 'Let\'s create an expense account!',
|
||||||
'empty_accounts_imperative_expense' => 'Expense accounts are created automatically when you create transactions, but you can create one manually too, if you want.',
|
'no_accounts_intro_expense' => 'You have no expense accounts yet. Expense accounts are the places where you spend money, such as shops and supermarkets.',
|
||||||
'empty_accounts_create_expense' => 'Create an expense account',
|
'no_accounts_imperative_expense' => 'Expense accounts are created automatically when you create transactions, but you can create one manually too, if you want. Let\'s create one now:',
|
||||||
'empty_accounts_title_revenue' => 'Let\'s create a revenue account!',
|
'no_accounts_create_expense' => 'Create an expense account',
|
||||||
'empty_accounts_intro_revenue' => 'You have no revenue accounts yet. Revenue accounts are the places where you receive money from, such as your employer.',
|
'no_accounts_title_revenue' => 'Let\'s create a revenue account!',
|
||||||
'empty_accounts_imperative_revenue' => 'Expense accounts are created automatically when you create transactions, but you can create one manually too, if you want.',
|
'no_accounts_intro_revenue' => 'You have no revenue accounts yet. Revenue accounts are the places where you receive money from, such as your employer.',
|
||||||
'empty_accounts_create_revenue' => 'Create a revenue account',
|
'no_accounts_imperative_revenue' => 'Expense accounts are created automatically when you create transactions, but you can create one manually too, if you want. Let\'s create one now:',
|
||||||
|
'no_accounts_create_revenue' => 'Create a revenue account',
|
||||||
|
'no_budgets_title_default' => 'Let\'s create a budget',
|
||||||
|
'no_budgets_intro_default' => 'You have no budgets yet. Budgets are used to organise your expenses into logical groups, which you can give a soft-cap to limit your expenses',
|
||||||
|
'no_budgets_imperative_default' => 'Budgets are the basic tools of financial management. Let\'s create one now:',
|
||||||
|
'no_budgets_create_default' => 'Create a new budget',
|
||||||
|
'no_categories_title_default' => 'Let\'s create a category',
|
||||||
|
'no_categories_intro_default' => 'You have no categories yet. Categories are used to fine tune your transactions and label them with their designated category.',
|
||||||
|
'no_categories_imperative_default' => 'Categories are created automatically when you create transactions, but you can create one manually too. Let\'s create one now:',
|
||||||
|
'no_categories_create_default' => 'Create a new category',
|
||||||
|
'no_tags_title_default' => 'Let\'s create a tags',
|
||||||
|
'no_tags_intro_default' => 'You have no tags yet. Tags are used to fine tune your transactions and label them with specific keywords.',
|
||||||
|
'no_tags_imperative_default' => 'Tags are created automatically when you create transactions, but you can create one manually too. Let\'s create one now:',
|
||||||
|
'no_tags_create_default' => 'Create a new tag',
|
||||||
|
'no_transactions_title_withdrawal' => 'Let\'s create an expense',
|
||||||
|
'no_transactions_intro_withdrawal' => 'You have no expenses yet. You should create expenses to start managing your finances.',
|
||||||
|
'no_transactions_imperative_withdrawal' => 'Have you spent some money? Then you should write it down:',
|
||||||
|
'no_transactions_create_withdrawal' => 'Create a new expense',
|
||||||
|
'no_transactions_title_deposit' => 'Let\'s create some income',
|
||||||
|
'no_transactions_intro_deposit' => 'You have no recorded income yet. You should create income entries to start managing your finances.',
|
||||||
|
'no_transactions_imperative_deposit' => 'Have you received some money? Then you should write it down:',
|
||||||
|
'no_transactions_create_deposit' => 'Create a new deposit',
|
||||||
|
'no_transactions_title_transfers' => 'Let\'s create a transfer',
|
||||||
|
'no_transactions_intro_transfers' => 'You have no transfers yet. When you move money between asset accounts, it is recorded as a transfer.',
|
||||||
|
'no_transactions_imperative_transfers' => 'Have you moved some money around? Then you should write it down:',
|
||||||
|
'no_transactions_create_transfers' => 'Create a new transfer',
|
||||||
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% if budgets.count == 0 and inactive.count == 0 %}
|
{% if budgets.count == 0 and inactive.count == 0 %}
|
||||||
{% include 'empty.budgets' %}
|
{% include 'partials.empty' with {what: 'default', type: 'budgets',route: route('budgets.create')} %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% for budget in budgets %}
|
{% for budget in budgets %}
|
||||||
|
@@ -5,6 +5,7 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
{% if categories.count > 0 %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
@@ -28,15 +29,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% else %}
|
||||||
|
{% include 'partials.empty' with {what: 'default', type: 'categories',route: route('categories.create')} %}
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block styles %}
|
{% block styles %}
|
||||||
<link rel="stylesheet" href="css/bootstrap-sortable.css" type="text/css" media="all"/>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script type="text/javascript" src="js/lib/Chart.bundle.min.js"></script>
|
|
||||||
<script type="text/javascript" src="js/ff/charts.defaults.js"></script>
|
|
||||||
<script type="text/javascript" src="js/ff/charts.js"></script>
|
|
||||||
<script type="text/javascript" src="js/lib/bootstrap-sortable.js"></script>
|
|
||||||
<script type="text/javascript" src="js/ff/categories/index.js"></script>
|
<script type="text/javascript" src="js/ff/categories/index.js"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -2,19 +2,19 @@
|
|||||||
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 col-lg-offset-3 col-md-offset-3">
|
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 col-lg-offset-3 col-md-offset-3">
|
||||||
<div class="box box-success">
|
<div class="box box-success">
|
||||||
<div class="box-header with-border">
|
<div class="box-header with-border">
|
||||||
<h3 class="box-title">{{ ('empty_accounts_title_'~what)|_ }}</h3>
|
<h3 class="box-title">{{ ('no_'~type~'_title_'~what)|_ }}</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="box-body table-responsive">
|
<div class="box-body table-responsive">
|
||||||
<p>
|
<p>
|
||||||
{{ ('empty_accounts_intro_'~what)|_ }}
|
{{ ('no_'~type~'_intro_'~what)|_ }}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
{{ ('empty_accounts_imperative_'~what)|_ }}
|
{{ ('no_'~type~'_imperative_'~what)|_ }}
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
<p style="text-align: center;">
|
<p style="text-align: center;">
|
||||||
<a class="btn btn-lg btn-success" href="{{ route('accounts.create', [what]) }}">{{ ('empty_accounts_create_'~what)|_ }}</a>
|
<a class="btn btn-lg btn-success" href="{{ route }}">{{ ('no_'~type~'_create_'~what)|_ }}</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@@ -30,6 +30,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% if count == 0 %}
|
||||||
|
{% include 'partials.empty' with {what: 'default', type: 'tags',route: route('tags.create')} %}
|
||||||
|
{% else %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% for type in types %}
|
{% for type in types %}
|
||||||
<div class="col-lg-4">
|
<div class="col-lg-4">
|
||||||
@@ -68,8 +71,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
|
@@ -5,6 +5,9 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
{% if journals.count == 0 %}
|
||||||
|
{% include 'partials.empty' with {what: what, type: 'transactions',route: route('transactions.create', [what])} %}
|
||||||
|
{% else %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12 col-sm-12 col-md-12">
|
<div class="col-lg-12 col-sm-12 col-md-12">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
@@ -17,6 +20,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script type="text/javascript" src="js/ff/transactions/list.js"></script>
|
<script type="text/javascript" src="js/ff/transactions/list.js"></script>
|
||||||
|
@@ -5,6 +5,15 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
{% if journals.count == 0 %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12 col-sm-12 col-md-12">
|
||||||
|
<p class="well">
|
||||||
|
{{ 'no_transactions_in_period'|_ }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12 col-sm-12 col-md-12">
|
<div class="col-lg-12 col-sm-12 col-md-12">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
@@ -17,6 +26,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script type="text/javascript" src="js/ff/transactions/list.js"></script>
|
<script type="text/javascript" src="js/ff/transactions/list.js"></script>
|
||||||
|
@@ -5,6 +5,11 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
|
||||||
|
{% if journals.count == 0 %}
|
||||||
|
{% include 'partials.empty' with {what: what, type: 'transactions',route: route('transactions.create', [what])} %}
|
||||||
|
{% else %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-10 col-md-10 col-sm-12">
|
<div class="col-lg-10 col-md-10 col-sm-12">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
@@ -39,6 +44,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script type="text/javascript" src="js/ff/transactions/list.js"></script>
|
<script type="text/javascript" src="js/ff/transactions/list.js"></script>
|
||||||
|
Reference in New Issue
Block a user