feat: additional functionality and layout adjustments for season teamers

This commit is contained in:
fromme committed 2026-09-26 12:13:16 +02:00
1 parent 80c6016da3
commit 4cab57d136
30 files changed
+916 -192

No files matched your search

+18 -1
View File
@@ -5,21 +5,38 @@ namespace App\Form;
use App\Entity\SeasonTaskDocument;
use App\Entity\Upload;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* Either an existing library document or a newly uploaded one.
*
* The upload itself does not travel in the form - it goes through the dropzone into the upload
* session, like everywhere else in this app - so the controller decides which of the two the
* mapping ends up with: a dropped file wins over the pick, and a submit carrying neither is
* refused.
*/
class SeasonTaskDocumentType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('document', AutocompleteEntityType::class, [
'label' => 'Dokument',
'label' => 'Vorhandenes Dokument',
'required' => false,
'class' => Upload::class,
'label_property' => 'originalFilename',
'label_function' => fn (Upload $upload) => $upload->getDisplayName() ?? $upload->getOriginalFilename(),
'endpoint_route' => 'app_admin_autocomplete_document',
])
// Unmapped: it names the uploaded file, which is an Upload and not part of the
// mapping. Renaming a picked document would rename it for the whole library.
->add('displayName', TextType::class, [
'label' => 'angezeigter Name der neuen Datei',
'required' => false,
'mapped' => false,
])
;
}