add price feature
This commit is contained in:
parent
15f8db46a0
commit
64f5341371
18 changed files with 484 additions and 157 deletions
44
src/Form/OrderItemFinalize.php
Normal file
44
src/Form/OrderItemFinalize.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\OrderItem;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
final class OrderItemFinalize extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add(child: 'name', options: [
|
||||
'label' => 'order item',
|
||||
'disabled' => true,
|
||||
])
|
||||
->add(child: 'extras', options: [
|
||||
'disabled' => true,
|
||||
])
|
||||
->add(child: 'createdBy', options: [
|
||||
'disabled' => true,
|
||||
])
|
||||
->add(child: 'priceCents', type: MoneyType::class, options: [
|
||||
'label' => 'price',
|
||||
'divisor' => 100,
|
||||
])
|
||||
->add(child: 'isPaid', type: CheckboxType::class, options: [
|
||||
'required' => false,
|
||||
'label' => 'paid?',
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => OrderItem::class,
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue