feat: list upcoming season assignments among a teamer's dispositions
This commit is contained in:
1 parent
300bb2058f
commit
c00dd86eb4
17 files changed
+386
-97
No files matched your search
@@ -5,8 +5,8 @@ namespace App\Controller\Admin\Teamer;
|
||||
use App\Entity\Teamer;
|
||||
use App\Htmx\HxRedirectResponse;
|
||||
use App\Repository\ApplicationRepository;
|
||||
use App\Repository\DispositionRepository;
|
||||
use App\Service\Teamer\AccountDeletionHandler;
|
||||
use App\Service\Teamer\UpcomingPlacementCollector;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -18,7 +18,7 @@ class DeleteAccountController extends AbstractController
|
||||
public function __construct(
|
||||
private readonly AccountDeletionHandler $accountDeletionHandler,
|
||||
private readonly ApplicationRepository $applicationRepository,
|
||||
private readonly DispositionRepository $dispositionRepository,
|
||||
private readonly UpcomingPlacementCollector $upcomingPlacementCollector,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -39,7 +39,8 @@ class DeleteAccountController extends AbstractController
|
||||
return $this->render('admin/teamer/modal_delete_account.html.twig', [
|
||||
'teamer' => $teamer,
|
||||
'pendingApplicationCount' => count($this->applicationRepository->getPendingForTeamer($teamer, 100)),
|
||||
'upcomingDispositionCount' => count($this->dispositionRepository->getUpcomingDispositionsByTeamer($teamer, 100)),
|
||||
// season assignments included: an active season placement is an open commitment as well
|
||||
'upcomingPlacementCount' => count($this->upcomingPlacementCollector->collect($teamer)),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace App\Controller\Administrative\Teamer;
|
||||
|
||||
use App\Entity\Teamer;
|
||||
use App\Repository\DispositionRepository;
|
||||
use App\Service\Teamer\UpcomingPlacementCollector;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -14,7 +14,7 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
class UpcomingAssignmentsController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly DispositionRepository $dispositionRepository,
|
||||
private readonly UpcomingPlacementCollector $upcomingPlacementCollector,
|
||||
private readonly PaginatorInterface $paginator,
|
||||
) {
|
||||
}
|
||||
@@ -23,19 +23,11 @@ class UpcomingAssignmentsController extends AbstractController
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(Teamer $teamer, Request $request): Response
|
||||
{
|
||||
$query = $this
|
||||
->dispositionRepository
|
||||
->getUpcomingDispositionsByTeamerQuery($teamer)
|
||||
;
|
||||
|
||||
// an array rather than a query: dispositions and season assignments are merged in PHP
|
||||
$pagination = $this->paginator->paginate(
|
||||
$query,
|
||||
$this->upcomingPlacementCollector->collect($teamer),
|
||||
$request->query->getInt('page', 1),
|
||||
10,
|
||||
[
|
||||
'defaultSortFieldName' => 'destination.dateFrom',
|
||||
'defaultSortDirection' => 'asc',
|
||||
]
|
||||
10
|
||||
);
|
||||
|
||||
return $this->render('administrative/teamer/upcoming_assignments.html.twig', [
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
namespace App\Controller\Teamer\Disposition;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\Repository\DispositionRepository;
|
||||
use App\Service\Season\SeasonAssignmentResolver;
|
||||
use App\Service\Teamer\UpcomingPlacementCollector;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -14,7 +15,8 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
class UpcomingController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly DispositionRepository $dispositionRepository,
|
||||
private readonly UpcomingPlacementCollector $upcomingPlacementCollector,
|
||||
private readonly SeasonAssignmentResolver $seasonAssignmentResolver,
|
||||
private readonly PaginatorInterface $paginator,
|
||||
) {
|
||||
}
|
||||
@@ -27,24 +29,18 @@ class UpcomingController extends AbstractController
|
||||
$user = $this->getUser();
|
||||
$teamer = $user->getTeamer();
|
||||
|
||||
$query = $this
|
||||
->dispositionRepository
|
||||
->getUpcomingDispositionsByTeamerQuery($teamer)
|
||||
;
|
||||
|
||||
// an array rather than a query: dispositions and season assignments are merged in PHP
|
||||
$pagination = $this->paginator->paginate(
|
||||
$query,
|
||||
$this->upcomingPlacementCollector->collect($teamer),
|
||||
$request->query->getInt('page', 1),
|
||||
9,
|
||||
[
|
||||
'defaultSortFieldName' => 'destination.dateFrom',
|
||||
'defaultSortDirection' => 'asc',
|
||||
]
|
||||
9
|
||||
);
|
||||
|
||||
return $this->render('teamer/disposition/upcoming.html.twig', [
|
||||
'teamer' => $teamer,
|
||||
'pagination' => $pagination,
|
||||
// the season page shows only this one, so only this one is linked
|
||||
'linkedSeasonAssignment' => $this->seasonAssignmentResolver->resolveFor($teamer),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ use App\Entity\Disposition;
|
||||
use App\Entity\Feedback;
|
||||
use App\Entity\News;
|
||||
use App\Entity\User;
|
||||
use App\Service\Season\SeasonAssignmentResolver;
|
||||
use App\Service\Teamer\UpcomingPlacementCollector;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -16,8 +18,11 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class IndexController extends AbstractController
|
||||
{
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager)
|
||||
{
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly UpcomingPlacementCollector $upcomingPlacementCollector,
|
||||
private readonly SeasonAssignmentResolver $seasonAssignmentResolver,
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/teamer', name: 'app_teamer_index')]
|
||||
@@ -66,6 +71,9 @@ class IndexController extends AbstractController
|
||||
|
||||
$dispositionDocuments = $this->processDocuments($upcomingDispositions);
|
||||
|
||||
// the list merges in season assignments; the document notices above stay on dispositions
|
||||
$upcomingPlacements = array_slice($this->upcomingPlacementCollector->collect($teamer), 0, 5);
|
||||
|
||||
return $this->render('teamer/index.html.twig', [
|
||||
'news' => $news,
|
||||
'teamer' => $teamer,
|
||||
@@ -73,7 +81,9 @@ class IndexController extends AbstractController
|
||||
'recentFeedback' => $recentFeedback,
|
||||
'pendingApplications' => $pendingApplications,
|
||||
'currentDispositions' => $currentDispositions,
|
||||
'upcomingDispositions' => $upcomingDispositions,
|
||||
'upcomingPlacements' => $upcomingPlacements,
|
||||
// the season page shows only this one, so only this one is linked
|
||||
'linkedSeasonAssignment' => $this->seasonAssignmentResolver->resolveFor($teamer),
|
||||
'dispositionDocuments' => $dispositionDocuments,
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user