<?php

namespace App\Form;

use App\Entity\Clients;
use App\Entity\Commandes;
use App\Entity\Plats;
use App\Entity\StatutCommandes;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class CommandesType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('DateHeure', null, [
                'widget' => 'single_text',
            ])
            ->add('Statut')
            ->add('Total')
            ->add('Client', EntityType::class, [
                'class' => Clients::class,
                'choice_label' => 'id',
                'multiple' => true,
            ])
            ->add('plats', EntityType::class, [
                'class' => Plats::class,
                'choice_label' => 'id',
                'multiple' => true,
            ])
            ->add('StatutCommande', EntityType::class, [
                'class' => StatutCommandes::class,
                'choice_label' => 'id',
            ])
        ;
    }

    public function configureOptions(OptionsResolver $resolver): void
    {
        $resolver->setDefaults([
            'data_class' => Commandes::class,
        ]);
    }
}
