Various code cleanup and fixed alignments.

This commit is contained in:
James Cole
2024-01-01 14:43:56 +01:00
parent 1368aafe5f
commit f963ac63f1
443 changed files with 3668 additions and 3672 deletions

View File

@@ -95,7 +95,7 @@ class CreateController extends Controller
// store attachment(s):
/** @var null|array $files */
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
if (null !== $files && !auth()->user()->hasRole('demo')) {
$this->attachments->saveAttachmentsForModel($category, $files);
}

View File

@@ -69,7 +69,7 @@ class EditController extends Controller
*/
public function edit(Request $request, Category $category)
{
$subTitle = (string)trans('firefly.edit_category', ['name' => $category->name]);
$subTitle = (string)trans('firefly.edit_category', ['name' => $category->name]);
// put previous url in session if not redirect from store (not "return_to_edit").
if (true !== session('categories.edit.fromUpdate')) {
@@ -91,7 +91,7 @@ class EditController extends Controller
*/
public function update(CategoryFormRequest $request, Category $category)
{
$data = $request->getCategoryData();
$data = $request->getCategoryData();
$this->repository->update($category, $data);
$request->session()->flash('success', (string)trans('firefly.updated_category', ['name' => $category->name]));
@@ -99,7 +99,7 @@ class EditController extends Controller
// store new attachment(s):
/** @var null|array $files */
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
if (null !== $files && !auth()->user()->hasRole('demo')) {
$this->attachments->saveAttachmentsForModel($category, $files);
}

View File

@@ -76,14 +76,14 @@ class NoCategoryController extends Controller
// @var Carbon $start
$start ??= session('start');
// @var Carbon $end
$end ??= session('end');
$page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
$subTitle = trans(
$end ??= session('end');
$page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
$subTitle = trans(
'firefly.without_category_between',
['start' => $start->isoFormat($this->monthAndDayFormat), 'end' => $end->isoFormat($this->monthAndDayFormat)]
);
$periods = $this->getNoCategoryPeriodOverview($start);
$periods = $this->getNoCategoryPeriodOverview($start);
app('log')->debug(sprintf('Start for noCategory() is %s', $start->format('Y-m-d')));
app('log')->debug(sprintf('End for noCategory() is %s', $end->format('Y-m-d')));
@@ -95,7 +95,7 @@ class NoCategoryController extends Controller
->withAccountInformation()->withBudgetInformation()
->setTypes([TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER])
;
$groups = $collector->getPaginatedGroups();
$groups = $collector->getPaginatedGroups();
$groups->setPath(route('categories.no-category', [$start->format('Y-m-d'), $end->format('Y-m-d')]));
return view('categories.no-category', compact('groups', 'subTitle', 'periods', 'start', 'end'));
@@ -109,16 +109,16 @@ class NoCategoryController extends Controller
public function showAll(Request $request)
{
// default values:
$start = null;
$end = null;
$periods = new Collection();
$page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
$start = null;
$end = null;
$periods = new Collection();
$page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
app('log')->debug('Start of noCategory()');
$subTitle = (string)trans('firefly.all_journals_without_category');
$first = $this->journalRepos->firstNull();
$start = null === $first ? new Carbon() : $first->date;
$end = today(config('app.timezone'));
$subTitle = (string)trans('firefly.all_journals_without_category');
$first = $this->journalRepos->firstNull();
$start = null === $first ? new Carbon() : $first->date;
$end = today(config('app.timezone'));
app('log')->debug(sprintf('Start for noCategory() is %s', $start->format('Y-m-d')));
app('log')->debug(sprintf('End for noCategory() is %s', $end->format('Y-m-d')));
@@ -128,7 +128,7 @@ class NoCategoryController extends Controller
->withAccountInformation()->withBudgetInformation()
->setTypes([TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER])
;
$groups = $collector->getPaginatedGroups();
$groups = $collector->getPaginatedGroups();
$groups->setPath(route('categories.no-category.all'));
return view('categories.no-category', compact('groups', 'subTitle', 'periods', 'start', 'end'));

View File

@@ -76,7 +76,7 @@ class ShowController extends Controller
// @var Carbon $start
$start ??= session('start', today(config('app.timezone'))->startOfMonth());
// @var Carbon $end
$end ??= session('end', today(config('app.timezone'))->endOfMonth());
$end ??= session('end', today(config('app.timezone'))->endOfMonth());
$subTitleIcon = 'fa-bookmark';
$page = (int)$request->get('page');
$attachments = $this->repository->getAttachments($category);
@@ -94,13 +94,13 @@ class ShowController extends Controller
);
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector = app(GroupCollectorInterface::class);
$collector->setRange($start, $end)->setLimit($pageSize)->setPage($page)
->withAccountInformation()
->setCategory($category)->withBudgetInformation()->withCategoryInformation()
;
$groups = $collector->getPaginatedGroups();
$groups = $collector->getPaginatedGroups();
$groups->setPath($path);
return view('categories.show', compact('category', 'attachments', 'groups', 'periods', 'subTitle', 'subTitleIcon', 'start', 'end'));
@@ -121,23 +121,23 @@ class ShowController extends Controller
$end = null;
$periods = new Collection();
$subTitle = (string)trans('firefly.all_journals_for_category', ['name' => $category->name]);
$first = $this->repository->firstUseDate($category);
$subTitle = (string)trans('firefly.all_journals_for_category', ['name' => $category->name]);
$first = $this->repository->firstUseDate($category);
/** @var Carbon $start */
$start = $first ?? today(config('app.timezone'));
$end = today(config('app.timezone'));
$path = route('categories.show.all', [$category->id]);
$attachments = $this->repository->getAttachments($category);
$start = $first ?? today(config('app.timezone'));
$end = today(config('app.timezone'));
$path = route('categories.show.all', [$category->id]);
$attachments = $this->repository->getAttachments($category);
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector = app(GroupCollectorInterface::class);
$collector->setRange($start, $end)->setLimit($pageSize)->setPage($page)
->withAccountInformation()
->setCategory($category)->withBudgetInformation()->withCategoryInformation()
;
$groups = $collector->getPaginatedGroups();
$groups = $collector->getPaginatedGroups();
$groups->setPath($path);
return view('categories.show', compact('category', 'attachments', 'groups', 'periods', 'subTitle', 'subTitleIcon', 'start', 'end'));