You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
2.8KB

  1. <?php
  2. namespace Lc\ShopBundle\Form\Frontend;
  3. use App\Entity\Address;
  4. use App\Entity\OrderShop;
  5. use Doctrine\ORM\EntityManagerInterface;
  6. use Lc\ShopBundle\Model\Ticket;
  7. use Lc\ShopBundle\Services\UtilsManager;
  8. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  9. use Symfony\Component\Form\AbstractType;
  10. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  11. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  12. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  13. use Symfony\Component\Form\Extension\Core\Type\FileType;
  14. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  15. use Symfony\Component\Form\Extension\Core\Type\TextType;
  16. use Symfony\Component\Form\FormBuilderInterface;
  17. use Symfony\Component\OptionsResolver\OptionsResolver;
  18. use Symfony\Component\Security\Core\Security;
  19. use Symfony\Component\Validator\Constraints\File;
  20. class TicketMessageType extends AbstractType
  21. {
  22. public function buildForm(FormBuilderInterface $builder, array $options)
  23. {
  24. $builder
  25. ->add('message', TextareaType::class, [
  26. 'label' => 'field.Ticket.yourAnswer',
  27. 'translation_domain' => 'lcshop',
  28. ])
  29. ->add('image', FileType::class, [
  30. 'label' => 'Photo',
  31. 'mapped' => false,
  32. 'required' => false,
  33. 'constraints' => [
  34. new File([
  35. 'maxSize' => '2048k',
  36. 'mimeTypes' => [
  37. 'image/png',
  38. 'image/jpeg',
  39. 'image/jpg',
  40. 'image/gif',
  41. ],
  42. 'mimeTypesMessage' => "Mauvais format d'image (formats acceptés : jpeg, png, gif)",
  43. ])
  44. ],
  45. ])
  46. ->add('closeTicket', CheckboxType::class, [
  47. 'label' => 'field.Ticket.closeTicket',
  48. 'translation_domain' => 'lcshop',
  49. 'required' => false,
  50. ]);
  51. }
  52. public function configureOptions(OptionsResolver $resolver)
  53. {
  54. $resolver->setDefaults([
  55. // Configure your form options here
  56. ]);
  57. }
  58. }