feat: add forms
QREntities (FORM) fix: QRCodeMoneyType nekam zarad
This commit is contained in:
parent
f450e2db43
commit
cb24d39930
41
src/Form/Type/QRCodeMoneyType.php
Normal file
41
src/Form/Type/QRCodeMoneyType.php
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Form\Type;
|
||||||
|
|
||||||
|
use App\Entity\QRCode\QRCodeMoney;
|
||||||
|
use App\Service\CurrencyListerInterface;
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\NumberType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
|
class QRCodeMoneyType extends AbstractType
|
||||||
|
{
|
||||||
|
private readonly CurrencyListerInterface $currencyLister;
|
||||||
|
|
||||||
|
public function __construct(CurrencyListerInterface $currencyLister) {
|
||||||
|
$this->currencyLister = $currencyLister;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
|
{
|
||||||
|
$builder
|
||||||
|
->add('amount', NumberType::class)
|
||||||
|
->add('currency', ChoiceType::class, [
|
||||||
|
'choices' => array_combine(
|
||||||
|
iterator_to_array($this->currencyLister->getCurrencies()),
|
||||||
|
iterator_to_array($this->currencyLister->getCurrencies())
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
|
{
|
||||||
|
$resolver->setDefaults([
|
||||||
|
'data_class' => QRCodeMoney::class,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
28
src/Form/Type/QRCodePaymentIdentificationType.php
Normal file
28
src/Form/Type/QRCodePaymentIdentificationType.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Form\Type;
|
||||||
|
|
||||||
|
use App\Entity\QRCode\QRCodePaymentIdentification;
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
|
class QRCodePaymentIdentificationType extends AbstractType
|
||||||
|
{
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
|
{
|
||||||
|
$builder
|
||||||
|
->add('variableSymbol', IntegerType::class, ['required' => false])
|
||||||
|
->add('specificSymbol', IntegerType::class, ['required' => false])
|
||||||
|
->add('constantSymbol', IntegerType::class, ['required' => false]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
|
{
|
||||||
|
$resolver->setDefaults([
|
||||||
|
'data_class' => QRCodePaymentIdentification::class,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
34
src/Form/Type/QRCodeType.php
Normal file
34
src/Form/Type/QRCodeType.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Form\Type;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Entity\QRCode\QRCode;
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
|
class QRCodeType extends AbstractType
|
||||||
|
{
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
|
{
|
||||||
|
$builder
|
||||||
|
->add('iban', TextType::class)
|
||||||
|
->add('dueDate', DateType::class)
|
||||||
|
->add('message', TextType::class)
|
||||||
|
->add('money', QRCodeMoneyType::class)
|
||||||
|
->add('paymentIdentification', QRCodePaymentIdentificationType::class)
|
||||||
|
->add('save', SubmitType::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
|
{
|
||||||
|
$resolver->setDefaults([
|
||||||
|
'data_class' => QRCode::class,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user