WIP: Implement teamer dashboard
This commit is contained in:
1 parent
f8207b6731
commit
286064c739
12 files changed
+335
-196
No files matched your search
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Teamer\Assignment;
|
||||
|
||||
use App\Controller\Traits\ReturnUrlTrait;
|
||||
use App\Entity\Assignment;
|
||||
use App\Entity\User;
|
||||
use App\Repository\ApplicationRepository;
|
||||
use App\Repository\DispositionRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class DetailController extends AbstractController
|
||||
{
|
||||
use ReturnUrlTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly ApplicationRepository $applicationRepository,
|
||||
private readonly DispositionRepository $dispositionRepository
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/teamer/assignment/{uuid}', name: 'app_teamer_assignment_detail')]
|
||||
#[IsGranted('ROLE_TEAMER')]
|
||||
public function index(Assignment $assignment, Request $request): Response
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = $this->getUser();
|
||||
$teamer = $user->getTeamer();
|
||||
|
||||
$application = $this
|
||||
->applicationRepository
|
||||
->findOneBy([
|
||||
'assignment' => $assignment,
|
||||
'teamer' => $teamer,
|
||||
])
|
||||
;
|
||||
|
||||
$disposition = $this
|
||||
->dispositionRepository
|
||||
->findOneBy([
|
||||
'assignment' => $assignment,
|
||||
'teamer' => $teamer,
|
||||
])
|
||||
;
|
||||
|
||||
$isBookmarked = $teamer->getBookmarks()->contains($assignment);
|
||||
|
||||
return $this->render('teamer/assignment/detail.html.twig', [
|
||||
'teamer' => $teamer,
|
||||
'assignment' => $assignment,
|
||||
'disposition' => $disposition,
|
||||
'application' => $application,
|
||||
'isBookmarked' => $isBookmarked,
|
||||
'returnUrl' => $this->getReturnUrl($request, 'app_teamer_index'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user