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
@@ -2,17 +2,43 @@
namespace App\Controller\Admin\Application;
use App\Repository\ApplicationRepository;
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 ApplicationRepository $applicationRepository,
private readonly PaginatorInterface $paginator
) {
}
#[Route('/admin/application', name: 'app_admin_application_index')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
public function index(): Response
public function index(Request $request): Response
{
return $this->render('admin/application/index.html.twig');
$query = $this
->applicationRepository
->getListQuery()
;
$pagination = $this->paginator->paginate(
$query,
$request->query->getInt('page', 1),
10,
[
'defaultSortFieldName' => 'destination.dateFrom',
'defaultSortDirection' => 'asc',
]
);
return $this->render('admin/application/index.html.twig', [
'pagination' => $pagination,
]);
}
}
@@ -0,0 +1,42 @@
<?php
namespace App\Controller\Admin\DIsposition;
use App\Entity\Application;
use App\Entity\Disposition;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
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 CreateController extends AbstractController
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly LoggerInterface $logger
) {
}
#[Route('/admin/disposition/create/{uuid}', name: 'app_admin_disposition_create')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
public function index(Application $application): Response
{
$disposition = new Disposition($application);
$this->entityManager->persist($disposition);
$this->entityManager->remove($application);
$this->entityManager->flush();
$this->addFlash('success', 'Der Teamer wurde eingeteilt');
$this->logger->info('Create disposition', [
'disposition' => $disposition->getUuid(),
]);
return $this->redirectToRoute('app_admin_assignment_detail', [
'uuid' => $application->getAssignment()->getUuid(),
]);
}
}