mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-25 16:31:15 -06:00
Fix #3314
This commit is contained in:
parent
c3c9a2f3c0
commit
9d9053d828
@ -56,7 +56,7 @@ class BulkController extends Controller
|
||||
function ($request, $next) {
|
||||
$this->repository = app(JournalRepositoryInterface::class);
|
||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||
app('view')->share('mainTitleIcon', 'fa-repeat');
|
||||
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ class CreateController extends Controller
|
||||
$this->middleware(
|
||||
static function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||
app('view')->share('mainTitleIcon', 'fa-repeat');
|
||||
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ class DeleteController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||
app('view')->share('mainTitleIcon', 'fa-repeat');
|
||||
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||
|
||||
$this->repository = app(TransactionGroupRepositoryInterface::class);
|
||||
|
||||
|
@ -52,7 +52,7 @@ class EditController extends Controller
|
||||
static function ($request, $next) {
|
||||
|
||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||
app('view')->share('mainTitleIcon', 'fa-repeat');
|
||||
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
@ -56,8 +56,8 @@ class IndexController extends Controller
|
||||
// translations:
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('mainTitleIcon', 'fa-credit-card');
|
||||
app('view')->share('title', (string) trans('firefly.accounts'));
|
||||
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||
|
||||
$this->repository = app(JournalRepositoryInterface::class);
|
||||
|
||||
@ -88,7 +88,9 @@ class IndexController extends Controller
|
||||
$end = session('end');
|
||||
}
|
||||
if (null === $end) {
|
||||
$end = session('end'); // @codeCoverageIgnore
|
||||
// get last transaction ever?
|
||||
$last = $this->repository->getLast();
|
||||
$end = $last ? $last->date : session('end');
|
||||
}
|
||||
|
||||
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
|
||||
@ -134,14 +136,15 @@ class IndexController extends Controller
|
||||
$repository = app(JournalRepositoryInterface::class);
|
||||
|
||||
|
||||
$subTitleIcon = config('firefly.transactionIconsByWhat.' . $objectType);
|
||||
$types = config('firefly.transactionTypesByWhat.' . $objectType);
|
||||
$subTitleIcon = config('firefly.transactionIconsByType.' . $objectType);
|
||||
$types = config('firefly.transactionTypesByType.' . $objectType);
|
||||
$page = (int) $request->get('page');
|
||||
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
|
||||
$path = route('transactions.index.all', [$objectType]);
|
||||
$first = $repository->firstNull();
|
||||
$start = null === $first ? new Carbon : $first->date;
|
||||
$end = new Carbon;
|
||||
$last = $this->repository->getLast();
|
||||
$end = $last ? $last->date : new Carbon;
|
||||
$subTitle = (string) trans('firefly.all_' . $objectType);
|
||||
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
|
@ -57,7 +57,7 @@ class LinkController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||
app('view')->share('mainTitleIcon', 'fa-repeat');
|
||||
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||
|
||||
$this->journalRepository = app(JournalRepositoryInterface::class);
|
||||
$this->repository = app(LinkTypeRepositoryInterface::class);
|
||||
|
@ -62,7 +62,7 @@ class MassController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||
app('view')->share('mainTitleIcon', 'fa-repeat');
|
||||
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||
$this->repository = app(JournalRepositoryInterface::class);
|
||||
|
||||
return $next($request);
|
||||
|
@ -407,4 +407,19 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
|
||||
return $transaction->account;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TransactionJournal|null
|
||||
*/
|
||||
public function getLast(): ?TransactionJournal
|
||||
{
|
||||
/** @var TransactionJournal $entry */
|
||||
$entry = $this->user->transactionJournals()->orderBy('date', 'DESC')->first(['transaction_journals.*']);
|
||||
$result = null;
|
||||
if (null !== $entry) {
|
||||
$result = $entry;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,10 @@ use Illuminate\Support\Collection;
|
||||
*/
|
||||
interface JournalRepositoryInterface
|
||||
{
|
||||
/**
|
||||
* @return TransactionJournal|null
|
||||
*/
|
||||
public function getLast(): ?TransactionJournal;
|
||||
|
||||
/**
|
||||
* TODO maybe create JSON repository?
|
||||
@ -44,6 +48,7 @@ interface JournalRepositoryInterface
|
||||
* Search in journal descriptions.
|
||||
*
|
||||
* @param string $search
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function searchJournalDescriptions(string $search): Collection;
|
||||
|
@ -383,7 +383,7 @@ return [
|
||||
'Opening balance' => 'opening-balance',
|
||||
'Reconciliation' => 'reconciliation',
|
||||
],
|
||||
'transactionIconsByWhat' => [
|
||||
'transactionIconsByType' => [
|
||||
'expenses' => 'fa-long-arrow-left',
|
||||
'withdrawal' => 'fa-long-arrow-left',
|
||||
'revenue' => 'fa-long-arrow-right',
|
||||
|
Loading…
Reference in New Issue
Block a user