Make it possible to hide chores/batteries (closes #1069)

This commit is contained in:
Bernd Bestel
2020-12-20 10:19:44 +01:00
parent 31dbb95c58
commit 268b8e87d7
17 changed files with 239 additions and 23 deletions

View File

@@ -36,8 +36,17 @@ class ChoresController extends BaseController
public function ChoresList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
if (isset($request->getQueryParams()['include_disabled']))
{
$chores = $this->getDatabase()->chores()->orderBy('name', 'COLLATE NOCASE');
}
else
{
$chores = $this->getDatabase()->chores()->where('active = 1')->orderBy('name', 'COLLATE NOCASE');
}
return $this->renderPage($response, 'chores', [
'chores' => $this->getDatabase()->chores()->orderBy('name', 'COLLATE NOCASE'),
'chores' => $chores,
'userfields' => $this->getUserfieldsService()->GetFields('chores'),
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('chores')
]);
@@ -52,7 +61,7 @@ class ChoresController extends BaseController
{
return $this->renderPage($response, 'choresjournal', [
'choresLog' => $this->getDatabase()->chores_log()->orderBy('tracked_time', 'DESC'),
'chores' => $this->getDatabase()->chores()->orderBy('name', 'COLLATE NOCASE'),
'chores' => $this->getDatabase()->chores()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'users' => $this->getDatabase()->users()->orderBy('username')
]);
}
@@ -75,7 +84,7 @@ class ChoresController extends BaseController
public function TrackChoreExecution(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->renderPage($response, 'choretracking', [
'chores' => $this->getDatabase()->chores()->orderBy('name', 'COLLATE NOCASE'),
'chores' => $this->getDatabase()->chores()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'users' => $this->getDatabase()->users()->orderBy('username')
]);
}