[admin][templates] move job/scope history in an unique template and display history for a given user

This commit is contained in:
2023-10-04 12:13:10 +02:00
parent b4e5618e00
commit c526973475
12 changed files with 167 additions and 216 deletions

View File

@@ -1,29 +0,0 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
use Chill\MainBundle\Pagination\PaginatorInterface;
use Symfony\Component\HttpFoundation\Request;
class UserJobHistoryController extends CRUDController
{
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
{
$query
->addOrderBy('e.startDate', 'DESC')
->addOrderBy('e.user', 'ASC')
;
return parent::orderQuery($action, $query, $request, $paginator);
}
}

View File

@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\Entity\User;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Twig\Environment;
class UserJobScopeHistoriesController extends AbstractController
{
public function __construct(
private readonly Environment $engine,
) {}
/**
* @Route("/{_locale}/admin/main/user/{id}/job-scope-history", name="admin_user_job_scope_history")
*/
public function indexAction(User $user): Response
{
$jobHistories = $user->getUserJobHistories();
$scopeHistories = $user->getMainScopeHistories();
return new Response(
$this->engine->render('@ChillMain/User/history.html.twig', [
'user' => $user,
'jobHistories' => $jobHistories,
'scopeHistories' => $scopeHistories,
]
));
}
}

View File

@@ -1,29 +0,0 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
use Chill\MainBundle\Pagination\PaginatorInterface;
use Symfony\Component\HttpFoundation\Request;
class UserScopeHistoryController extends CRUDController
{
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
{
$query
->addOrderBy('e.startDate', 'DESC')
->addOrderBy('e.user', 'ASC')
;
return parent::orderQuery($action, $query, $request, $paginator);
}
}