feat: extend teamer dashboard

This commit is contained in:
Björn Fromme
2023-12-12 18:04:01 +01:00
parent 8ff59b3068
commit b5781df8d9
16 changed files with 286 additions and 30 deletions
@@ -4,6 +4,7 @@ namespace App\Controller\HouseManager\Feedback;
use App\Entity\Disposition;
use App\Entity\Feedback;
use App\Entity\User;
use App\Event\FeedbackProvidedEvent;
use App\Form\FeedbackType;
use Doctrine\ORM\EntityManagerInterface;
@@ -28,6 +29,8 @@ class ProvideController extends AbstractController
#[IsGranted('FEEDBACK', subject: 'disposition')]
public function index(Disposition $disposition, Request $request): Response
{
/** @var User $user */
$user = $this->getUser();
$assignment = $disposition->getAssignment();
$destination = $assignment->getDestination();
@@ -42,7 +45,7 @@ class ProvideController extends AbstractController
->getFeedbackSet()
;
$feedback = new Feedback($assignment);
$feedback = new Feedback($assignment, $user);
$form = $this->createForm(FeedbackType::class, $feedback, ['feedback_set' => $feedbackSet]);
$form->handleRequest($request);
@@ -0,0 +1,25 @@
<?php
namespace App\Controller\Teamer;
use App\Entity\Feedback;
use App\Model\AjaxModalResponseDto;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
class FeedbackController extends AbstractController
{
#[Route('/teamer/feedback/{uuid}', name: 'app_teamer_feedback')]
#[IsGranted('VIEW', subject: 'feedback')]
public function index(Feedback $feedback): JsonResponse
{
$response = new AjaxModalResponseDto();
$response->setContent($this->renderView('teamer/feedback/index.html.twig', [
'feedback' => $feedback,
]));
return $this->json($response);
}
}
+24
View File
@@ -2,7 +2,10 @@
namespace App\Controller\Teamer;
use App\Entity\Application;
use App\Entity\Assignment;
use App\Entity\Disposition;
use App\Entity\Feedback;
use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@@ -30,8 +33,29 @@ class IndexController extends AbstractController
->getNewMatchingTeamerProfile($teamer)
;
$recentFeedback = $this
->entityManager
->getRepository(Feedback::class)
->getRecentForTeamer($teamer)
;
$pendingApplications = $this
->entityManager
->getRepository(Application::class)
->getPendingForTeamer($teamer)
;
$upcomingDispositions = $this
->entityManager
->getRepository(Disposition::class)
->getUpcomingDispositionsByTeamer($teamer)
;
return $this->render('teamer/index.html.twig', [
'matchingAssignments' => $matchingAssignments,
'recentFeedback' => $recentFeedback,
'pendingApplications' => $pendingApplications,
'upcomingDispositions' => $upcomingDispositions,
]);
}
}