src/Form/App/ReserveType.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Form\App;
  3. use App\Entity\Reserve;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  6. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  7. use Symfony\Component\Form\Extension\Core\Type\DateType;
  8. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  9. use Symfony\Component\Form\Extension\Core\Type\TelType;
  10. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  11. use Symfony\Component\Form\Extension\Core\Type\TextType;
  12. use Symfony\Component\Form\Extension\Core\Type\TimeType;
  13. use Symfony\Component\Form\FormBuilderInterface;
  14. use Symfony\Component\OptionsResolver\OptionsResolver;
  15. use Symfony\Component\Validator\Constraints\IsTrue;
  16. class ReserveType extends AbstractType
  17. {
  18.     public function buildForm(FormBuilderInterface $builder, array $options): void
  19.     {
  20.         $builder
  21.             ->add('lastName'TextType::class, [
  22.                 'label' => false,
  23.                 'attr' => ['placeholder' => '姓'],
  24.                 'error_bubbling' => true,
  25.             ])
  26.             ->add('firstName'TextType::class, [
  27.                 'label' => false,
  28.                 'attr' => ['placeholder' => '名'],
  29.                 'error_bubbling' => true,
  30.             ])
  31.             ->add('tel'TextType::class, [
  32.                 'label' => false,
  33.                 'attr' => ['placeholder' => '電話番号'],
  34.                 'error_bubbling' => true,
  35.             ])
  36.             ->add('mail'EmailType::class, [
  37.                 'label' => false,
  38.                 'attr' => ['placeholder' => 'メールアドレス'],
  39.                 'error_bubbling' => true,
  40.             ])
  41. //            ->add('carModel', ChoiceType::class, [
  42. //                'label' => false,
  43. //                'placeholder' => '車種',
  44. //                'error_bubbling' => true,
  45. //                'choices' => [
  46. //                    "三菱ミニキャブバン ブラボーキャンパー4WD" => "三菱ミニキャブバン ブラボーキャンパー4WD",
  47. //                    "スズキエブリィ ジョインターボハイルーフ" => "スズキエブリィ ジョインターボハイルーフ",
  48. //                    "ダイハツアトレーRS 車中泊セット付き" => "ダイハツアトレーRS 車中泊セット付き",
  49. //                    "トヨタピクシスバン リンエイキャンピング仕様" => "トヨタピクシスバン リンエイキャンピング仕様",
  50. //                    "トヨタハイエースワゴン ナッツRVトライアルB" => "トヨタハイエースワゴン ナッツRVトライアルB",
  51. //                    "日産セレナ ハイウェイスター" => "日産セレナ ハイウェイスター",
  52. //                ],
  53. //            ])
  54. //            ->add('startDate', DateType::class, [
  55. //                'label' => false,
  56. //                'widget' => 'single_text',
  57. //                'placeholder' => '出発日',
  58. //                'error_bubbling' => true,
  59. //            ])
  60. //            ->add('startTime', TimeType::class, [
  61. //                'label' => false,
  62. //                'widget' => 'single_text',
  63. //                'placeholder' => '出発時刻',
  64. //                'error_bubbling' => true,
  65. //            ])
  66. //            ->add('endDate', DateType::class, [
  67. //                'label' => false,
  68. //                'widget' => 'single_text',
  69. //                'placeholder' => '返却日',
  70. //                'error_bubbling' => true,
  71. //            ])
  72. //            ->add('endTime', TimeType::class, [
  73. //                'label' => false,
  74. //                'widget' => 'single_text',
  75. //                'placeholder' => '返却時刻',
  76. //                'error_bubbling' => true,
  77. //            ])
  78.             ->add('remarks'TextareaType::class, [
  79.                 'label' => false,
  80.                 'attr' => ['placeholder' => 'お問合せ・ご相談内容をご記入下さい。'],
  81.             ])
  82.             ->add('agreeTerms'CheckboxType::class, [
  83.                 'mapped' => false,
  84.                 'label' => false,
  85.                 'constraints' => [
  86.                     new IsTrue([
  87.                         'message' => '利用規約に同意して下さい'
  88.                     ])
  89.                 ],
  90.                 'error_bubbling' => true,
  91.             ])
  92.         ;
  93.     }
  94.     public function configureOptions(OptionsResolver $resolver): void
  95.     {
  96.         $resolver->setDefaults([
  97.             'data_class' => Reserve::class,
  98.         ]);
  99.     }
  100. }