mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-07 15:25:00 +00:00
Layout of saved export page
This commit is contained in:
@@ -18,6 +18,7 @@ use Chill\MainBundle\Export\ExportInterface;
|
||||
use Chill\MainBundle\Export\ExportManager;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Chill\MainBundle\Form\SavedExportType;
|
||||
use Chill\MainBundle\Repository\ExportGenerationRepository;
|
||||
use Chill\MainBundle\Repository\SavedExportRepositoryInterface;
|
||||
use Chill\MainBundle\Security\Authorization\ExportGenerationVoter;
|
||||
use Chill\MainBundle\Security\Authorization\SavedExportVoter;
|
||||
@@ -46,6 +47,7 @@ final readonly class SavedExportController
|
||||
private Security $security,
|
||||
private TranslatorInterface $translator,
|
||||
private UrlGeneratorInterface $urlGenerator,
|
||||
private ExportGenerationRepository $exportGenerationRepository,
|
||||
) {}
|
||||
|
||||
#[Route(path: '/{_locale}/exports/saved/{id}/delete', name: 'chill_main_export_saved_delete')]
|
||||
@@ -172,7 +174,10 @@ final readonly class SavedExportController
|
||||
throw new AccessDeniedHttpException();
|
||||
}
|
||||
|
||||
$exports = $this->savedExportRepository->findByUser($user, ['title' => 'ASC']);
|
||||
$exports = array_filter(
|
||||
$this->savedExportRepository->findSharedWithUser($user, ['exportAlias' => 'ASC', 'title' => 'ASC']),
|
||||
fn (SavedExport $savedExport): bool => $this->security->isGranted(SavedExportVoter::GENERATE, $savedExport),
|
||||
);
|
||||
|
||||
// group by center
|
||||
/** @var array<string, array{saved: SavedExport, export: ExportInterface}> $exportsGrouped */
|
||||
@@ -189,12 +194,20 @@ final readonly class SavedExportController
|
||||
|
||||
ksort($exportsGrouped);
|
||||
|
||||
// get last executions
|
||||
$lastExecutions = [];
|
||||
foreach ($exports as $savedExport) {
|
||||
$lastExecutions[$savedExport->getId()->toString()] = $this->exportGenerationRepository
|
||||
->findExportGenerationBySavedExportAndUser($savedExport, $user, 5);
|
||||
}
|
||||
|
||||
return new Response(
|
||||
$this->templating->render(
|
||||
'@ChillMain/SavedExport/index.html.twig',
|
||||
[
|
||||
'grouped_exports' => $exportsGrouped,
|
||||
'total' => \count($exports),
|
||||
'last_executions' => $lastExecutions,
|
||||
],
|
||||
),
|
||||
);
|
||||
|
Reference in New Issue
Block a user