get ready
This commit is contained in:
parent
ca9819a436
commit
6b0a478ca5
16 changed files with 395 additions and 124 deletions
41
src/Form/BulkEditDrinkTypeStockForm.php
Normal file
41
src/Form/BulkEditDrinkTypeStockForm.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class BulkEditDrinkTypeStockForm extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('drinkTypes', CollectionType::class, [
|
||||
'entry_type' => DrinkTypeStockEditType::class,
|
||||
'entry_options' => [
|
||||
'label' => false,
|
||||
],
|
||||
'allow_add' => false,
|
||||
'allow_delete' => false,
|
||||
'by_reference' => false,
|
||||
])
|
||||
->add('save', SubmitType::class, [
|
||||
'label' => 'Update Wanted Stock Levels',
|
||||
'attr' => [
|
||||
'class' => 'btn btn-primary',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => null,
|
||||
]);
|
||||
}
|
||||
}
|
45
src/Form/DrinkTypeStockEditType.php
Normal file
45
src/Form/DrinkTypeStockEditType.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\DrinkType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
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 DrinkTypeStockEditType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('id', HiddenType::class, [
|
||||
'mapped' => false,
|
||||
])
|
||||
->add('name', TextType::class, [
|
||||
'disabled' => true,
|
||||
'attr' => [
|
||||
'readonly' => true,
|
||||
],
|
||||
])
|
||||
->add('wantedStock', NumberType::class, [
|
||||
'label' => 'Wanted Stock',
|
||||
'attr' => [
|
||||
'min' => 0,
|
||||
'step' => 1,
|
||||
'class' => 'form-control',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => DrinkType::class,
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue