mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-06-28 02:48:53 -07:00
New views and helpers.
This commit is contained in:
@@ -38,7 +38,6 @@ use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||
|
||||
use function Safe\json_decode;
|
||||
use function Safe\mb_ord;
|
||||
use function Safe\preg_match;
|
||||
@@ -48,7 +47,7 @@ if (!function_exists('env_default_when_empty')) {
|
||||
/**
|
||||
* @return null|mixed
|
||||
*/
|
||||
function env_default_when_empty(mixed $value, bool|int|string|null $default = null): mixed
|
||||
function env_default_when_empty(mixed $value, bool | int | string | null $default = null): mixed
|
||||
{
|
||||
if (null === $value) {
|
||||
return $default;
|
||||
@@ -61,12 +60,69 @@ if (!function_exists('env_default_when_empty')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('mime_icon')) {
|
||||
function mime_icon(string $file): string
|
||||
{
|
||||
return match ($file) {
|
||||
'application/pdf' => 'bi-file-earmark-pdf',
|
||||
'image/webp',
|
||||
'image/png',
|
||||
'image/jpeg',
|
||||
'image/svg+xml',
|
||||
'image/heic',
|
||||
'image/heic-sequence',
|
||||
'application/vnd.oasis.opendocument.image' => 'bi-file-earmark-image',
|
||||
'application/msword',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
|
||||
'application/x-iwork-pages-sffpages',
|
||||
'application/vnd.sun.xml.writer',
|
||||
'application/vnd.sun.xml.writer.template',
|
||||
'application/vnd.sun.xml.writer.global',
|
||||
'application/vnd.stardivision.writer',
|
||||
'application/vnd.stardivision.writer-global',
|
||||
'application/vnd.oasis.opendocument.text',
|
||||
'application/vnd.oasis.opendocument.text-template',
|
||||
'application/vnd.oasis.opendocument.text-web',
|
||||
'application/vnd.oasis.opendocument.text-master' => 'bi-file-earmark-word',
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
|
||||
'application/vnd.sun.xml.calc',
|
||||
'application/vnd.sun.xml.calc.template',
|
||||
'application/vnd.stardivision.calc',
|
||||
'application/vnd.oasis.opendocument.spreadsheet',
|
||||
'application/vnd.oasis.opendocument.spreadsheet-template' => 'bi-file-earmark-excel',
|
||||
'application/vnd.ms-powerpoint',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.template',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
|
||||
'application/vnd.sun.xml.impress',
|
||||
'application/vnd.sun.xml.impress.template',
|
||||
'application/vnd.stardivision.impress',
|
||||
'application/vnd.oasis.opendocument.presentation',
|
||||
'application/vnd.oasis.opendocument.presentation-template' => 'bi-file-earmark-slides',
|
||||
'application/vnd.sun.xml.draw',
|
||||
'application/vnd.sun.xml.draw.template',
|
||||
'application/vnd.stardivision.draw',
|
||||
'application/vnd.oasis.opendocument.chart' => 'bi-file-earmark-easel',
|
||||
'application/vnd.oasis.opendocument.graphics',
|
||||
'application/vnd.oasis.opendocument.graphics-template',
|
||||
'application/vnd.sun.xml.math',
|
||||
'application/vnd.stardivision.math',
|
||||
'application/vnd.oasis.opendocument.formula',
|
||||
'application/vnd.oasis.opendocument.database' => 'bi-file-earmark-rules',
|
||||
default => 'bi-file-earmark'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('parse_markdown')) {
|
||||
function parse_markdown(string $string): string
|
||||
{
|
||||
$converter = new GithubFlavoredMarkdownConverter(['allow_unsafe_links' => false, 'max_nesting_level' => 5, 'html_input' => 'escape']);
|
||||
|
||||
return (string) $converter->convert($string);
|
||||
return (string)$converter->convert($string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +166,7 @@ if (!function_exists('account_get_meta_field')) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
if(!function_exists('menu_sub_item_active')) {
|
||||
if (!function_exists('menu_sub_item_active')) {
|
||||
function menu_sub_item_active(string $route, string $objectType): string
|
||||
{
|
||||
$name = Route::getCurrentRoute()->getName() ?? '';
|
||||
@@ -123,7 +179,7 @@ if(!function_exists('menu_sub_item_active')) {
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('menu_item_active_partial')) {
|
||||
if (!function_exists('menu_item_active_partial')) {
|
||||
function menu_item_active_partial(string $route): string
|
||||
{
|
||||
$name = Route::getCurrentRoute()->getName() ?? '';
|
||||
@@ -136,8 +192,9 @@ if(!function_exists('menu_item_active_partial')) {
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('menu_open_partial')) {
|
||||
function menu_open_partial(string $route): string {
|
||||
if (!function_exists('menu_open_partial')) {
|
||||
function menu_open_partial(string $route): string
|
||||
{
|
||||
$name = Route::getCurrentRoute()->getName() ?? '';
|
||||
Log::debug(sprintf('menuOpenPartial("%s" starts with "%s")', $name, $route));
|
||||
if (str_starts_with($name, $route)) {
|
||||
@@ -152,11 +209,11 @@ if (!function_exists('account_balance')) {
|
||||
function account_balance(Account $account): string
|
||||
{
|
||||
/** @var Carbon $date */
|
||||
$date = now();
|
||||
$date = now();
|
||||
|
||||
// get the date from the current session. If it's in the future, keep `now()`.
|
||||
/** @var Carbon $session */
|
||||
$session = clone session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$session = clone session('end', today(config('app.timezone'))->endOfMonth());
|
||||
if ($session->lt($date)) {
|
||||
$date = $session->copy();
|
||||
$date->endOfDay();
|
||||
@@ -164,13 +221,13 @@ if (!function_exists('account_balance')) {
|
||||
Log::debug(sprintf('twig balance: Call finalAccountBalance with date/time "%s"', $date->toIso8601String()));
|
||||
|
||||
// 2025-10-08 replace finalAccountBalance with accountsBalancesOptimized.
|
||||
$info = Steam::accountsBalancesOptimized(new Collection()->push($account), $date)[$account->id];
|
||||
$info = Steam::accountsBalancesOptimized(new Collection()->push($account), $date)[$account->id];
|
||||
// $info = Steam::finalAccountBalance($account, $date);
|
||||
$currency = Steam::getAccountCurrency($account);
|
||||
$primary = Amount::getPrimaryCurrency();
|
||||
$convertToPrimary = Amount::convertToPrimary();
|
||||
$usePrimary = $convertToPrimary && $primary->id !== $currency->id;
|
||||
$currency ??= $primary;
|
||||
$currency ??= $primary;
|
||||
$strings = [];
|
||||
foreach ($info as $key => $balance) {
|
||||
if ('balance' === $key) {
|
||||
@@ -206,8 +263,9 @@ if (!function_exists('string_is_equal')) {
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('format_amount_by_code')) {
|
||||
function format_amount_by_code(string $amount, string $code, ?bool $coloured = null): string {
|
||||
if (!function_exists('format_amount_by_code')) {
|
||||
function format_amount_by_code(string $amount, string $code, ?bool $coloured = null): string
|
||||
{
|
||||
$coloured ??= true;
|
||||
|
||||
try {
|
||||
@@ -222,62 +280,68 @@ if(!function_exists('format_amount_by_code')) {
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('format_amount_by_currency')) {
|
||||
function format_amount_by_currency(TransactionCurrency $currency, string $amount, ?bool $coloured = null): string {
|
||||
if (!function_exists('format_amount_by_currency')) {
|
||||
function format_amount_by_currency(TransactionCurrency $currency, string $amount, ?bool $coloured = null): string
|
||||
{
|
||||
$coloured ??= true;
|
||||
|
||||
return Amount::formatAnything($currency, $amount, $coloured);
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('print_nice_filesize')) {
|
||||
function print_nice_filesize (int $size): string {
|
||||
if (!function_exists('print_nice_filesize')) {
|
||||
function print_nice_filesize(int $size): string
|
||||
{
|
||||
// less than one GB, more than one MB
|
||||
if ($size < (1024 * 1024 * 2014) && $size >= (1024 * 1024)) {
|
||||
return round($size / (1024 * 1024), 2).' MB';
|
||||
return round($size / (1024 * 1024), 2) . ' MB';
|
||||
}
|
||||
|
||||
// less than one MB
|
||||
if ($size < (1024 * 1024)) {
|
||||
return round($size / 1024, 2).' KB';
|
||||
return round($size / 1024, 2) . ' KB';
|
||||
}
|
||||
|
||||
return $size.' bytes';
|
||||
return $size . ' bytes';
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('journal_has_meta')) {
|
||||
function journal_has_meta(int $journalId, string $metaField): bool {
|
||||
if (!function_exists('journal_has_meta')) {
|
||||
function journal_has_meta(int $journalId, string $metaField): bool
|
||||
{
|
||||
$count = DB::table('journal_meta')->where('name', $metaField)->where('transaction_journal_id', $journalId)->whereNull('deleted_at')->count();
|
||||
|
||||
return 1 === $count;
|
||||
}
|
||||
}
|
||||
if(!function_exists('journal_get_meta_field')) {
|
||||
function journal_get_meta_field (int $journalId, string $metaField) {
|
||||
if (!function_exists('journal_get_meta_field')) {
|
||||
function journal_get_meta_field(int $journalId, string $metaField)
|
||||
{
|
||||
/** @var null|TransactionJournalMeta $entry */
|
||||
$entry = DB::table('journal_meta')->where('name', $metaField)->where('transaction_journal_id', $journalId)->whereNull('deleted_at')->first();
|
||||
if (null === $entry) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return json_decode((string) $entry->data, true);
|
||||
return json_decode((string)$entry->data, true);
|
||||
}
|
||||
}
|
||||
if(!function_exists('journal_get_meta_date')) {
|
||||
function journal_get_meta_date (int $journalId, string $metaField): Carbon|CarbonInterface {
|
||||
if (!function_exists('journal_get_meta_date')) {
|
||||
function journal_get_meta_date(int $journalId, string $metaField): Carbon | CarbonInterface
|
||||
{
|
||||
/** @var null|TransactionJournalMeta $entry */
|
||||
$entry = DB::table('journal_meta')->where('name', $metaField)->where('transaction_journal_id', $journalId)->whereNull('deleted_at')->first();
|
||||
if (null === $entry) {
|
||||
return today(config('app.timezone'));
|
||||
}
|
||||
|
||||
return new Carbon(json_decode((string) $entry->data, false));
|
||||
return new Carbon(json_decode((string)$entry->data, false));
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('format_amount_by_account')) {
|
||||
function format_amount_by_account (Account $account, string $amount, ?bool $coloured = null): string {
|
||||
if (!function_exists('format_amount_by_account')) {
|
||||
function format_amount_by_account(Account $account, string $amount, ?bool $coloured = null): string
|
||||
{
|
||||
$coloured ??= true;
|
||||
|
||||
/** @var AccountRepositoryInterface $accountRepos */
|
||||
@@ -300,14 +364,14 @@ if (!function_exists('blade_escape_js')) {
|
||||
return preg_replace_callback(
|
||||
'#[^a-zA-Z0-9,\._]#Su',
|
||||
static function ($matches) {
|
||||
$char = $matches[0];
|
||||
$char = $matches[0];
|
||||
|
||||
/*
|
||||
* A few characters have short escape sequences in JSON and JavaScript.
|
||||
* Escape sequences supported only by JavaScript, not JSON, are omitted.
|
||||
* \" is also supported but omitted, because the resulting string is not HTML safe.
|
||||
*/
|
||||
$short = match ($char) {
|
||||
$short = match ($char) {
|
||||
'\\' => '\\\\',
|
||||
'/' => '\/',
|
||||
"\x08" => '\b',
|
||||
@@ -329,9 +393,9 @@ if (!function_exists('blade_escape_js')) {
|
||||
|
||||
// Split characters outside the BMP into surrogate pairs
|
||||
// https://tools.ietf.org/html/rfc2781.html#section-2.1
|
||||
$u = $codepoint - 0x10_000;
|
||||
$high = 0xD800 | ($u >> 10);
|
||||
$low = 0xDC00 | ($u & 0x3FF);
|
||||
$u = $codepoint - 0x10_000;
|
||||
$high = 0xD800 | ($u >> 10);
|
||||
$low = 0xDC00 | ($u & 0x3FF);
|
||||
|
||||
return \sprintf('\u%04X\u%04X', $high, $low);
|
||||
},
|
||||
|
||||
@@ -39,7 +39,6 @@ use Override;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFilter;
|
||||
use Twig\TwigFunction;
|
||||
|
||||
use function Safe\parse_url;
|
||||
|
||||
/**
|
||||
@@ -104,9 +103,9 @@ class General extends AbstractExtension
|
||||
'activeRoutePartialObjectType',
|
||||
static function (array $context): string {
|
||||
[, $route, $objectType] = func_get_args();
|
||||
$activeObjectType = $context['objectType'] ?? false;
|
||||
$activeObjectType = $context['objectType'] ?? false;
|
||||
|
||||
if ($objectType === $activeObjectType && false !== stripos((string) Route::getCurrentRoute()->getName(), (string) $route)) {
|
||||
if ($objectType === $activeObjectType && false !== stripos((string)Route::getCurrentRoute()->getName(), (string)$route)) {
|
||||
return 'active';
|
||||
}
|
||||
|
||||
@@ -145,11 +144,11 @@ class General extends AbstractExtension
|
||||
}
|
||||
|
||||
/** @var Carbon $date */
|
||||
$date = now();
|
||||
$date = now();
|
||||
|
||||
// get the date from the current session. If it's in the future, keep `now()`.
|
||||
/** @var Carbon $session */
|
||||
$session = clone session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$session = clone session('end', today(config('app.timezone'))->endOfMonth());
|
||||
if ($session->lt($date)) {
|
||||
$date = $session->copy();
|
||||
$date->endOfDay();
|
||||
@@ -157,13 +156,13 @@ class General extends AbstractExtension
|
||||
Log::debug(sprintf('twig balance: Call finalAccountBalance with date/time "%s"', $date->toIso8601String()));
|
||||
|
||||
// 2025-10-08 replace finalAccountBalance with accountsBalancesOptimized.
|
||||
$info = Steam::accountsBalancesOptimized(new Collection()->push($account), $date)[$account->id];
|
||||
$info = Steam::accountsBalancesOptimized(new Collection()->push($account), $date)[$account->id];
|
||||
// $info = Steam::finalAccountBalance($account, $date);
|
||||
$currency = Steam::getAccountCurrency($account);
|
||||
$primary = Amount::getPrimaryCurrency();
|
||||
$convertToPrimary = Amount::convertToPrimary();
|
||||
$usePrimary = $convertToPrimary && $primary->id !== $currency->id;
|
||||
$currency ??= $primary;
|
||||
$currency ??= $primary;
|
||||
$strings = [];
|
||||
foreach ($info as $key => $balance) {
|
||||
if ('balance' === $key) {
|
||||
@@ -203,7 +202,7 @@ class General extends AbstractExtension
|
||||
|
||||
protected function carbonize(): TwigFunction
|
||||
{
|
||||
return new TwigFunction('carbonize', static fn (string $date): Carbon => new Carbon($date, config('app.timezone')));
|
||||
return new TwigFunction('carbonize', static fn(string $date): Carbon => new Carbon($date, config('app.timezone')));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,15 +225,15 @@ class General extends AbstractExtension
|
||||
return new TwigFilter('filesize', static function (int $size): string {
|
||||
// less than one GB, more than one MB
|
||||
if ($size < (1024 * 1024 * 2014) && $size >= (1024 * 1024)) {
|
||||
return round($size / (1024 * 1024), 2).' MB';
|
||||
return round($size / (1024 * 1024), 2) . ' MB';
|
||||
}
|
||||
|
||||
// less than one MB
|
||||
if ($size < (1024 * 1024)) {
|
||||
return round($size / 1024, 2).' KB';
|
||||
return round($size / 1024, 2) . ' KB';
|
||||
}
|
||||
|
||||
return $size.' bytes';
|
||||
return $size . ' bytes';
|
||||
});
|
||||
}
|
||||
|
||||
@@ -283,7 +282,7 @@ class General extends AbstractExtension
|
||||
static function (string $text): string {
|
||||
$converter = new GithubFlavoredMarkdownConverter(['allow_unsafe_links' => false, 'max_nesting_level' => 5, 'html_input' => 'escape']);
|
||||
|
||||
return (string) $converter->convert($text);
|
||||
return (string)$converter->convert($text);
|
||||
},
|
||||
['is_safe' => ['html']]
|
||||
);
|
||||
@@ -316,15 +315,15 @@ class General extends AbstractExtension
|
||||
{
|
||||
return new TwigFilter(
|
||||
'mimeIcon',
|
||||
static fn (string $string): string => match ($string) {
|
||||
'application/pdf' => 'fa-file-pdf-o',
|
||||
static fn(string $string): string => match ($string) {
|
||||
'application/pdf' => 'fa-file-pdf-o',
|
||||
'image/webp',
|
||||
'image/png',
|
||||
'image/jpeg',
|
||||
'image/svg+xml',
|
||||
'image/heic',
|
||||
'image/heic-sequence',
|
||||
'application/vnd.oasis.opendocument.image' => 'fa-file-image-o',
|
||||
'application/vnd.oasis.opendocument.image' => 'fa-file-image-o',
|
||||
'application/msword',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
|
||||
@@ -337,7 +336,7 @@ class General extends AbstractExtension
|
||||
'application/vnd.oasis.opendocument.text',
|
||||
'application/vnd.oasis.opendocument.text-template',
|
||||
'application/vnd.oasis.opendocument.text-web',
|
||||
'application/vnd.oasis.opendocument.text-master' => 'fa-file-word-o',
|
||||
'application/vnd.oasis.opendocument.text-master' => 'fa-file-word-o',
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
|
||||
@@ -345,7 +344,7 @@ class General extends AbstractExtension
|
||||
'application/vnd.sun.xml.calc.template',
|
||||
'application/vnd.stardivision.calc',
|
||||
'application/vnd.oasis.opendocument.spreadsheet',
|
||||
'application/vnd.oasis.opendocument.spreadsheet-template' => 'fa-file-excel-o',
|
||||
'application/vnd.oasis.opendocument.spreadsheet-template' => 'fa-file-excel-o',
|
||||
'application/vnd.ms-powerpoint',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.template',
|
||||
@@ -354,18 +353,18 @@ class General extends AbstractExtension
|
||||
'application/vnd.sun.xml.impress.template',
|
||||
'application/vnd.stardivision.impress',
|
||||
'application/vnd.oasis.opendocument.presentation',
|
||||
'application/vnd.oasis.opendocument.presentation-template' => 'fa-file-powerpoint-o',
|
||||
'application/vnd.oasis.opendocument.presentation-template' => 'fa-file-powerpoint-o',
|
||||
'application/vnd.sun.xml.draw',
|
||||
'application/vnd.sun.xml.draw.template',
|
||||
'application/vnd.stardivision.draw',
|
||||
'application/vnd.oasis.opendocument.chart' => 'fa-paint-brush',
|
||||
'application/vnd.oasis.opendocument.chart' => 'fa-paint-brush',
|
||||
'application/vnd.oasis.opendocument.graphics',
|
||||
'application/vnd.oasis.opendocument.graphics-template',
|
||||
'application/vnd.sun.xml.math',
|
||||
'application/vnd.stardivision.math',
|
||||
'application/vnd.oasis.opendocument.formula',
|
||||
'application/vnd.oasis.opendocument.database' => 'fa-calculator',
|
||||
default => 'fa-file-o'
|
||||
'application/vnd.oasis.opendocument.database' => 'fa-calculator',
|
||||
default => 'fa-file-o'
|
||||
},
|
||||
['is_safe' => ['html']]
|
||||
);
|
||||
@@ -400,6 +399,6 @@ class General extends AbstractExtension
|
||||
|
||||
private function fireflyIIIConfig(): TwigFunction
|
||||
{
|
||||
return new TwigFunction('fireflyiiiconfig', static fn (string $string, mixed $default): mixed => AppConfiguration::get($string, $default)->data);
|
||||
return new TwigFunction('fireflyiiiconfig', static fn(string $string, mixed $default): mixed => AppConfiguration::get($string, $default)->data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace FireflyIII\View\Components\Lists;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Attachments extends Component
|
||||
{
|
||||
public Collection $attachments;
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(Collection $attachments)
|
||||
{
|
||||
$this->attachments = $attachments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.lists.attachments');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace FireflyIII\View\Components\Lists;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class PiggyBankEvents extends Component
|
||||
{
|
||||
public Collection $events;
|
||||
public bool $showPiggyBank;
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(Collection $events, bool $showPiggyBank)
|
||||
{
|
||||
$this->events = $events;
|
||||
$this->showPiggyBank = $showPiggyBank;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.lists.piggy-bank-events');
|
||||
}
|
||||
}
|
||||
Generated
+463
-355
File diff suppressed because it is too large
Load Diff
@@ -27,7 +27,7 @@
|
||||
{{ $t('firefly.webhooks') }}
|
||||
</h3>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<div class="card-body p-0">
|
||||
<div style="padding:8px;">
|
||||
<a href="webhooks/create" class="btn btn-success"><span
|
||||
class="fa fa-plus fa-fw"></span>{{ $t('firefly.create_new_webhook') }}</a>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ title }}</h3>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<div class="card-body p-0">
|
||||
<table class="table table-hover" aria-label="A table">
|
||||
<tbody>
|
||||
<tr>
|
||||
@@ -94,7 +94,7 @@
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ $t('firefly.meta_data') }}</h3>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<div class="card-body p-0">
|
||||
<table class="table table-hover" aria-label="A table">
|
||||
<tbody>
|
||||
<tr>
|
||||
@@ -147,7 +147,7 @@
|
||||
<em class="fa fa-spin fa-spinner"></em>
|
||||
</p>
|
||||
</div>
|
||||
<div class="box-body no-padding" v-if="messages.length > 0 && !loading">
|
||||
<div class="card-body p-0" v-if="messages.length > 0 && !loading">
|
||||
<table class="table table-hover" aria-label="A table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -30,12 +30,12 @@
|
||||
@endif
|
||||
|
||||
{{-- INFO MESSAGE (CAN BE MULTIPLE) --}}
|
||||
@if(\Illuminate\Support\Facades\Session::has('info'))
|
||||
@if(session()->has('info'))
|
||||
<div class="alert alert-info alert-dismissible fade show" role="alert">
|
||||
{{-- MULTIPLE INFO MESSAGE --}}
|
||||
@if(!is_string(session('info')) && is_iterable(session('info') && count(session('info')) > 1))
|
||||
@if(!is_string(session('info')) && is_iterable(session('info')) && count(session('info')) > 1)
|
||||
<strong>
|
||||
{{ \Illuminate\Support\Facades\Lang::choice('firefly.flash_info_multiple', count(session('info')), ['count' => count(session('info'))]) }}
|
||||
{{ trans_choice('firefly.flash_info_multiple', count(session('info')), ['count' => count(session('info'))]) }}
|
||||
:</strong>
|
||||
<ul class="list-unstyled">
|
||||
@foreach(session('info') as $item)
|
||||
@@ -44,11 +44,11 @@
|
||||
</ul>
|
||||
@endif
|
||||
{{-- SET OF MULTIPLE INFO MESSAGES, BUT THERE IS JUST ONE --}}
|
||||
@if(!is_string(session('info')) && is_iterable(session('info') && 1 === count(session('info'))))
|
||||
@if(!is_string(session('info')) && is_iterable(session('info')) && 1 === count(session('info')))
|
||||
<strong>{{ __('firefly.flash_info') }}:</strong> {{ session('info')[0] }}
|
||||
@endif
|
||||
{{-- SINGLE INFO MESSAGE --}}
|
||||
@if(is_string(session('info')) && !is_iterable(session('info')))
|
||||
@if(is_string(session('info')))
|
||||
@if(\Illuminate\Support\Facades\Session::has('info_url'))
|
||||
<a href="{{ session('info_url') }}">
|
||||
@endif
|
||||
@@ -74,7 +74,7 @@
|
||||
@if(\Illuminate\Support\Facades\Session::has('error'))
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
{{-- MULTIPLE ERRORS (BAD) --}}
|
||||
@if(!is_string(session('error')) && is_iterable(session('error') && count(session('error')) > 1))
|
||||
@if(!is_string(session('error')) && is_iterable(session('error')) && count(session('error')) > 1)
|
||||
<strong>
|
||||
{{ \Illuminate\Support\Facades\Lang::choice('firefly.flash_error_multiple', count(session('error')), ['count' => session('error')]) }}:
|
||||
</strong>
|
||||
@@ -86,7 +86,7 @@
|
||||
@endif
|
||||
|
||||
{{-- SET OF MULTIPLE ERRORS, BUT THERE IS JUST ONE --}}
|
||||
@if(!is_string(session('error')) && is_iterable(session('error') && 1 === count(session('error'))))
|
||||
@if(!is_string(session('error')) && is_iterable(session('error')) && 1 === count(session('error')))
|
||||
<strong>{{ __('firefly.flash_error') }}</strong>
|
||||
{{ session('error')[0] }}
|
||||
@endif
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
<table class="table table-responsive table-hover">
|
||||
@foreach($attachments as $attachment)
|
||||
<tr>
|
||||
<td class="onetwenty">
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="{{ route('attachments.edit', $attachment->id) }}" class="btn btn-outline-secondary"><span class="bi bi-pencil"></span></a>
|
||||
<a href="{{ route('attachments.delete', $attachment->id) }}" class="btn btn-danger"><span class="bi bi-trash"></span></a>
|
||||
@if($attachment->file_exists)
|
||||
<a href="{{ route('attachments.download', $attachment->id) }}" class="btn btn-outline-secondary"><span class="bi bi-download"></span></a>
|
||||
@endif
|
||||
@if(!$attachment->file_exists)
|
||||
<a href="#" class="btn btn-danger"><span class="bi bi-exclamation-triangle"></span></a>
|
||||
@endif
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
@if($attachment->file_exists)
|
||||
<span class="bi {{ mime_icon($attachment->mime) }}"></span>
|
||||
<a href="{{ route('attachments.view', $attachment->id) }}" title="{{ $attachment->filename }}">
|
||||
@if($attachment->title)
|
||||
{{ $attachment->title }}
|
||||
@else
|
||||
{{ $attachment->filename }}
|
||||
@endif
|
||||
</a>
|
||||
({{ print_nice_filesize($attachment->size) }})
|
||||
@if('' !== (string)$attachment->notes_text)
|
||||
{!! parse_markdown($attachment->notes_text) !!}
|
||||
@endif
|
||||
@endif
|
||||
@if(!$attachment->file_exists)
|
||||
<span class="bi bi-exclamation-triangle"></span>
|
||||
@if($attachment->title)
|
||||
{{ $attachment->title }}
|
||||
@else
|
||||
{{ $attachment->filename }}
|
||||
@endif
|
||||
<br>
|
||||
<span class="text-danger">{{ __('firefly.attachment_not_found') }}</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
@@ -0,0 +1,33 @@
|
||||
<table class="table table-hover table-responsive">
|
||||
<tr>
|
||||
@if($showPiggyBank)
|
||||
<th>{{ trans('list.piggy_bank') }}</th>
|
||||
@endif
|
||||
<th>{{ trans('list.date') }}</th>
|
||||
<th>{{ trans('list.amount') }}</th>
|
||||
</tr>
|
||||
@foreach($events as $event)
|
||||
<tr>
|
||||
@if($showPiggyBank)
|
||||
<td>
|
||||
<a href="{{ route('piggy-banks.show',$event->piggyBank->id) }}">{{ $event->piggyBank->name }}</a>
|
||||
</td>
|
||||
@endif
|
||||
<td>
|
||||
@if($event->transaction_journal_id)
|
||||
<a href="{{ route('transactions.show',$event->transactionJournal->transaction_group_id) }}" title="{{ $event->transactionJournal->description }}">{{ $event->date->isoFormat($monthAndDayFormat) }}</a>
|
||||
@else
|
||||
{{ $event->date->isoFormat($monthAndDayFormat) }}
|
||||
@endif
|
||||
</td>
|
||||
|
||||
<td class="text-right">
|
||||
@if($event->amount < 0)
|
||||
<span class="text-danger money-negative">{{ trans('firefly.removed_amount', ['amount' => format_amount_by_symbol($event->amount,$event->piggyBank->transactionCurrency->symbol, $event->piggyBank->transactionCurrency->decimal_places, false)]) }}</span>
|
||||
@else
|
||||
<span class="text-success money-positive">{{ trans('firefly.added_amount', ['amount' => format_amount_by_symbol($event->amount,$event->piggyBank->transactionCurrency->symbol, $event->piggyBank->transactionCurrency->decimal_places, false)]) }}</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
@@ -2,7 +2,7 @@
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-md-8 col-sm-6">
|
||||
<div class="card" id="piggyChart">
|
||||
<div class="card mb-2" id="piggyChart">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">{{ __('firefly.events') }}</h3>
|
||||
</div>
|
||||
@@ -12,7 +12,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4 col-sm-6">
|
||||
<div class="card">
|
||||
<div class="card mb-2">
|
||||
<div class="card-header">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@@ -112,12 +112,12 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card mb-2">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">{{ __('firefly.event_history') }} (<a class="confirm-history-delete reset-link" href="#">{{ __('firefly.reset_history') }}</a>)</h3>
|
||||
</div>
|
||||
<div class="box-body no-padding" id="piggyEvents">
|
||||
@include('list.piggy-bank-events')
|
||||
<div class="card-body p-0" id="piggyEvents">
|
||||
<x-lists.piggy-bank-events :events="$events" :show-piggy-bank="false"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -125,7 +125,7 @@
|
||||
<div class="row">
|
||||
|
||||
@if('' !== (string) $piggy['notes'])
|
||||
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
|
||||
<div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
@@ -138,15 +138,15 @@
|
||||
</div>
|
||||
@endif
|
||||
@if($attachments->count() > 0)
|
||||
<div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
|
||||
<div class="card">
|
||||
<div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
|
||||
<div class="card mb-2">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">
|
||||
{{ __('firefly.attachments') }}
|
||||
</h3>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
{% include 'list.attachments' %}
|
||||
<x-lists.attachments :attachments="$attachments" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user