Feat: Implement disposition document handling for admins
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Upload;
|
||||
use App\Model\DocumentCheckDto;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
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;
|
||||
|
||||
class DocumentCheckType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('status', ChoiceType::class, [
|
||||
'label' => 'neuer Status',
|
||||
'choices' => $options['status_choices'][$options['document_type']],
|
||||
])
|
||||
->add('comment', TextareaType::class, [
|
||||
'label' => 'Kommentar/Begründung',
|
||||
'required' => false,
|
||||
'attr' => [
|
||||
'rows' => 3,
|
||||
],
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver
|
||||
->setDefaults([
|
||||
'data_class' => DocumentCheckDto::class,
|
||||
'status_choices' => [
|
||||
Upload::TYPE_CONTRACT => [
|
||||
'bestätigt' => Upload::STATUS_CHECKED,
|
||||
'abgelehnt' => Upload::STATUS_REJECTED,
|
||||
],
|
||||
Upload::TYPE_INVOICE => [
|
||||
'bezahlt' => Upload::STATUS_PAID,
|
||||
'abgelehnt' => Upload::STATUS_REJECTED,
|
||||
],
|
||||
],
|
||||
])
|
||||
->setRequired(['document_type'])
|
||||
->setAllowedTypes('document_type', 'string')
|
||||
->setAllowedValues('document_type', [Upload::TYPE_INVOICE, Upload::TYPE_CONTRACT])
|
||||
;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user