Added font-awesome icons to the report chooser.
This commit is contained in:
parent
10d1be8bd1
commit
041a905fc0
@ -22,7 +22,8 @@
|
||||
class OptionLink:
|
||||
"""An option link."""
|
||||
|
||||
def __init__(self, title: str, url: str, is_active: bool):
|
||||
def __init__(self, title: str, url: str, is_active: bool,
|
||||
fa_icon: str | None = None):
|
||||
"""Constructs an option link.
|
||||
|
||||
:param title: The title.
|
||||
@ -32,3 +33,4 @@ class OptionLink:
|
||||
self.title: str = title
|
||||
self.url: str = url
|
||||
self.is_active: bool = is_active
|
||||
self.fa_icon: str | None = fa_icon
|
||||
|
@ -85,7 +85,8 @@ class ReportChooser:
|
||||
if self.__period.is_default \
|
||||
else url_for("accounting.report.journal", period=self.__period)
|
||||
return OptionLink(gettext("Journal"), url,
|
||||
self.__active_report == ReportType.JOURNAL)
|
||||
self.__active_report == ReportType.JOURNAL,
|
||||
fa_icon="fa-solid fa-book")
|
||||
|
||||
@property
|
||||
def __ledger(self) -> OptionLink:
|
||||
@ -100,7 +101,8 @@ class ReportChooser:
|
||||
currency=self.__currency, account=self.__account,
|
||||
period=self.__period)
|
||||
return OptionLink(gettext("Ledger"), url,
|
||||
self.__active_report == ReportType.LEDGER)
|
||||
self.__active_report == ReportType.LEDGER,
|
||||
fa_icon="fa-solid fa-clipboard")
|
||||
|
||||
@property
|
||||
def __income_expenses(self) -> OptionLink:
|
||||
@ -118,7 +120,8 @@ class ReportChooser:
|
||||
currency=self.__currency, account=account,
|
||||
period=self.__period)
|
||||
return OptionLink(gettext("Income and Expenses Log"), url,
|
||||
self.__active_report == ReportType.INCOME_EXPENSES)
|
||||
self.__active_report == ReportType.INCOME_EXPENSES,
|
||||
fa_icon="fa-solid fa-money-bill-wave")
|
||||
|
||||
@property
|
||||
def __trial_balance(self) -> OptionLink:
|
||||
@ -132,7 +135,8 @@ class ReportChooser:
|
||||
else url_for("accounting.report.trial-balance",
|
||||
currency=self.__currency, period=self.__period)
|
||||
return OptionLink(gettext("Trial Balance"), url,
|
||||
self.__active_report == ReportType.TRIAL_BALANCE)
|
||||
self.__active_report == ReportType.TRIAL_BALANCE,
|
||||
fa_icon="fa-solid fa-scale-unbalanced")
|
||||
|
||||
@property
|
||||
def __income_statement(self) -> OptionLink:
|
||||
@ -146,7 +150,8 @@ class ReportChooser:
|
||||
else url_for("accounting.report.income-statement",
|
||||
currency=self.__currency, period=self.__period)
|
||||
return OptionLink(gettext("Income Statement"), url,
|
||||
self.__active_report == ReportType.INCOME_STATEMENT)
|
||||
self.__active_report == ReportType.INCOME_STATEMENT,
|
||||
fa_icon="fa-solid fa-file-invoice-dollar")
|
||||
|
||||
@property
|
||||
def __balance_sheet(self) -> OptionLink:
|
||||
@ -160,7 +165,8 @@ class ReportChooser:
|
||||
else url_for("accounting.report.balance-sheet",
|
||||
currency=self.__currency, period=self.__period)
|
||||
return OptionLink(gettext("Balance Sheet"), url,
|
||||
self.__active_report == ReportType.BALANCE_SHEET)
|
||||
self.__active_report == ReportType.BALANCE_SHEET,
|
||||
fa_icon="fa-solid fa-scale-balanced")
|
||||
|
||||
def __iter__(self) -> t.Iterator[OptionLink]:
|
||||
"""Returns the iteration of the reports.
|
||||
|
@ -54,10 +54,16 @@ First written: 2023/3/8
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-label="{{ A_("Report") }}">
|
||||
{% for report in report.report_chooser %}
|
||||
<li><a class="dropdown-item {% if report.is_active %} active {% endif %}" href="{{ report.url }}">{{ report.title }}</a></li>
|
||||
<li>
|
||||
<a class="dropdown-item {% if report.is_active %} active {% endif %}" href="{{ report.url }}">
|
||||
<i class="{{ report.fa_icon }}"></i>
|
||||
{{ report.title }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
<li>
|
||||
<span class="dropdown-item accounting-clickable" data-bs-toggle="modal" data-bs-target="#accounting-search-modal">
|
||||
<i class="fa-solid fa-magnifying-glass"></i>
|
||||
{{ A_("Search") }}
|
||||
</span>
|
||||
</li>
|
||||
|
Loading…
Reference in New Issue
Block a user