feat: call off single disposition as admin with optional notification

This commit is contained in:
Björn Fromme
2025-07-22 16:15:18 +02:00
parent b5314d270a
commit 231d0f315b
19 changed files with 1383 additions and 14 deletions
+52
View File
@@ -0,0 +1,52 @@
<?php
namespace App\Form;
use App\Entity\Disposition;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\NotBlank;
class DispositionCallOffType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('calledOffBy', ChoiceType::class, [
'label' => 'abgesagt durch',
'choices' => [
'Teamer:in' => Disposition::CALLED_OFF_BY_TEAMER,
'E&P' => Disposition::CALLED_OFF_BY_OFFICE,
],
])
->add('calledOffReason', TextareaType::class, [
'label' => 'Begründung',
'attr' => [
'data-controller' => 'textarea-autosize',
'data-action' => 'textarea-autosize#resize',
],
'constraints' => [
new NotBlank([
'message' => 'Bitte gib die Begründung ein',
]),
],
])
->add('sendNotification', CheckboxType::class, [
'label' => 'Benachrichtigung mit Begründung versenden',
'required' => false,
'mapped' => false,
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Disposition::class,
]);
}
}