mirror of
https://github.com/grocy/grocy.git
synced 2025-08-23 05:19:11 +00:00
Started working on user-defined-fields for all entities (references #176)
This commit is contained in:
@@ -4,6 +4,7 @@ namespace Grocy\Controllers;
|
||||
|
||||
use \Grocy\Services\ChoresService;
|
||||
use \Grocy\Services\UsersService;
|
||||
use \Grocy\Services\UserfieldsService;
|
||||
|
||||
class ChoresController extends BaseController
|
||||
{
|
||||
@@ -11,9 +12,11 @@ class ChoresController extends BaseController
|
||||
{
|
||||
parent::__construct($container);
|
||||
$this->ChoresService = new ChoresService();
|
||||
$this->UserfieldsService = new UserfieldsService();
|
||||
}
|
||||
|
||||
protected $ChoresService;
|
||||
protected $UserfieldsService;
|
||||
|
||||
public function Overview(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
|
||||
{
|
||||
@@ -23,7 +26,9 @@ class ChoresController extends BaseController
|
||||
return $this->AppContainer->view->render($response, 'choresoverview', [
|
||||
'chores' => $this->Database->chores()->orderBy('name'),
|
||||
'currentChores' => $this->ChoresService->GetCurrent(),
|
||||
'nextXDays' => $nextXDays
|
||||
'nextXDays' => $nextXDays,
|
||||
'userfields' => $this->UserfieldsService->GetFields('chores'),
|
||||
'userfieldValues' => $this->UserfieldsService->GetAllValues('chores')
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -38,7 +43,9 @@ class ChoresController extends BaseController
|
||||
public function ChoresList(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
|
||||
{
|
||||
return $this->AppContainer->view->render($response, 'chores', [
|
||||
'chores' => $this->Database->chores()->orderBy('name')
|
||||
'chores' => $this->Database->chores()->orderBy('name'),
|
||||
'userfields' => $this->UserfieldsService->GetFields('chores'),
|
||||
'userfieldValues' => $this->UserfieldsService->GetAllValues('chores')
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -57,7 +64,8 @@ class ChoresController extends BaseController
|
||||
{
|
||||
return $this->AppContainer->view->render($response, 'choreform', [
|
||||
'periodTypes' => GetClassConstants('\Grocy\Services\ChoresService'),
|
||||
'mode' => 'create'
|
||||
'mode' => 'create',
|
||||
'userfields' => $this->UserfieldsService->GetFields('chores')
|
||||
]);
|
||||
}
|
||||
else
|
||||
@@ -65,7 +73,8 @@ class ChoresController extends BaseController
|
||||
return $this->AppContainer->view->render($response, 'choreform', [
|
||||
'chore' => $this->Database->chores($args['choreId']),
|
||||
'periodTypes' => GetClassConstants('\Grocy\Services\ChoresService'),
|
||||
'mode' => 'edit'
|
||||
'mode' => 'edit',
|
||||
'userfields' => $this->UserfieldsService->GetFields('chores')
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user