WIP: Implement application process

This commit is contained in:
Björn Fromme
2023-10-10 17:17:30 +02:00
parent 3a458df94f
commit 6910ab6134
34 changed files with 937 additions and 119 deletions
+25 -5
View File
@@ -2,22 +2,30 @@
namespace App\Controller\Teamer;
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 AssignmentController extends AbstractController
{
public function __construct(private readonly ApplicationRepository $applicationRepository)
{}
use ReturnUrlTrait;
public function __construct(
private readonly ApplicationRepository $applicationRepository,
private readonly DispositionRepository $dispositionRepository
) {
}
#[Route('/teamer/assignment/{uuid}', name: 'app_teamer_assignment')]
#[IsGranted('ROLE_TEAMER')]
public function index(Assignment $assignment): Response
public function index(Assignment $assignment, Request $request): Response
{
/** @var User $user */
$user = $this->getUser();
@@ -31,11 +39,23 @@ class AssignmentController extends AbstractController
])
;
return $this->render('teamer/assignment.html.twig', [
$disposition = $this
->dispositionRepository
->findOneBy([
'assignment' => $assignment,
'teamer' => $teamer,
])
;
$isBookmarked = $teamer->getBookmarks()->contains($assignment);
return $this->render('teamer/assignment/index.html.twig', [
'teamer' => $teamer,
'assignment' => $assignment,
'disposition' => $disposition,
'application' => $application,
'isBookmarked' => $teamer->getBookmarks()->contains($assignment),
'isBookmarked' => $isBookmarked,
'returnUrl' => $this->getReturnUrl($request, 'app_teamer_index'),
]);
}
}
@@ -0,0 +1,49 @@
<?php
namespace App\Controller\Teamer\Bookmark;
use App\Entity\User;
use App\Repository\AssignmentRepository;
use Knp\Component\Pager\PaginatorInterface;
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 IndexController extends AbstractController
{
public function __construct(
private readonly AssignmentRepository $assignmentRepository,
private readonly PaginatorInterface $paginator
) {
}
#[Route('/teamer/bookmark', name: 'app_teamer_bookmark_index')]
#[IsGranted('ROLE_TEAMER')]
public function index(Request $request): Response
{
/** @var User $user */
$user = $this->getUser();
$teamer = $user->getTeamer();
$query = $this
->assignmentRepository
->getBookmarkQueryForTeamer($teamer)
;
$pagination = $this->paginator->paginate(
$query,
$request->query->getInt('page', 1),
10,
[
'defaultSortFieldName' => 'assignment.dateFrom',
'defaultSortDirection' => 'asc',
]
);
return $this->render('teamer/bookmark/index.html.twig', [
'pagination' => $pagination,
]);
}
}
+1 -1
View File
@@ -11,6 +11,6 @@ class ContactController extends AbstractController
#[Route('/teamer/contact', name: 'app_teamer_contact')]
public function index(): Response
{
return $this->render('teamer/contact.html.twig');
return $this->render('teamer/contact/index.html.twig');
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Controller\Teamer\Disposition;
use App\Entity\Disposition;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
class DetailController extends AbstractController
{
#[Route('/teamer/disposition/detail/{uuid}', name: 'app_teamer_disposition_detail')]
#[IsGranted('VIEW', subject: 'disposition')]
public function index(Disposition $disposition): Response
{
return $this->render('teamer/disposition/detail.html.twig', [
'disposition' => $disposition,
]);
}
}
@@ -1,18 +0,0 @@
<?php
namespace App\Controller\Teamer\Disposition;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
class IndexController extends AbstractController
{
#[Route('/teamer/disposition', name: 'app_teamer_disposition_index')]
#[IsGranted('ROLE_TEAMER')]
public function index(): Response
{
return $this->render('');
}
}
@@ -0,0 +1,49 @@
<?php
namespace App\Controller\Teamer\Disposition;
use App\Entity\User;
use App\Repository\DispositionRepository;
use Knp\Component\Pager\PaginatorInterface;
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 RecentController extends AbstractController
{
public function __construct(
private readonly DispositionRepository $dispositionRepository,
private readonly PaginatorInterface $paginator
) {
}
#[Route('/teamer/disposition/recent', name: 'app_teamer_disposition_recent')]
#[IsGranted('ROLE_TEAMER')]
public function index(Request $request): Response
{
/** @var User $user */
$user = $this->getUser();
$teamer = $user->getTeamer();
$query = $this
->dispositionRepository
->getRecentQuery($teamer)
;
$pagination = $this->paginator->paginate(
$query,
$request->query->getInt('page', 1),
10,
[
'defaultSortFieldName' => 'assignment.dateFrom',
'defaultSortDirection' => 'asc',
]
);
return $this->render('teamer/disposition/recent.html.twig', [
'pagination' => $pagination,
]);
}
}
@@ -0,0 +1,49 @@
<?php
namespace App\Controller\Teamer\Disposition;
use App\Entity\User;
use App\Repository\DispositionRepository;
use Knp\Component\Pager\PaginatorInterface;
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 UpcomingController extends AbstractController
{
public function __construct(
private readonly DispositionRepository $dispositionRepository,
private readonly PaginatorInterface $paginator
) {
}
#[Route('/teamer/disposition/upcoming', name: 'app_teamer_disposition_upcoming')]
#[IsGranted('ROLE_TEAMER')]
public function index(Request $request): Response
{
/** @var User $user */
$user = $this->getUser();
$teamer = $user->getTeamer();
$query = $this
->dispositionRepository
->getUpcomingQuery($teamer)
;
$pagination = $this->paginator->paginate(
$query,
$request->query->getInt('page', 1),
10,
[
'defaultSortFieldName' => 'assignment.dateFrom',
'defaultSortDirection' => 'asc',
]
);
return $this->render('teamer/disposition/upcoming.html.twig', [
'pagination' => $pagination,
]);
}
}
@@ -1,18 +0,0 @@
<?php
namespace App\Controller\Teamer\Disposition;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
class WatchlistController extends AbstractController
{
#[Route('/teamer/disposition/watchlist', name: 'app_teamer_disposition_watchlist')]
#[IsGranted('ROLE_TEAMER')]
public function index(): Response
{
return $this->render('');
}
}
+1 -1
View File
@@ -19,7 +19,7 @@ class FaqController extends AbstractController
{
$faqs = $this->faqRepository->findBy([], ['sorting' => 'ASC']);
return $this->render('teamer/faq.html.twig', [
return $this->render('teamer/faq/index.html.twig', [
'faqs' => $faqs,
]);
}