src/Eccube/Form/Type/Admin/SearchOrderType.php line 28

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.ec-cube.co.jp/
  8.  *
  9.  * For the full copyright and license information, please view the LICENSE
  10.  * file that was distributed with this source code.
  11.  */
  12. namespace Eccube\Form\Type\Admin;
  13. use Eccube\Entity\Shipping;
  14. use Symfony\Component\Form\AbstractType;
  15. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  16. use Symfony\Component\Form\Extension\Core\Type\DateType;
  17. use Symfony\Component\Form\Extension\Core\Type\TextType;
  18. use Symfony\Component\Form\FormBuilderInterface;
  19. use Symfony\Component\Validator\Constraints as Assert;
  20. use Eccube\Common\EccubeConfig;
  21. use Eccube\Form\Type\PriceType;
  22. use Eccube\Form\Type\Master\OrderStatusType;
  23. use Eccube\Form\Type\Master\PaymentType;
  24. class SearchOrderType extends AbstractType
  25. {
  26.     /**
  27.      * @var EccubeConfig
  28.      */
  29.     protected $eccubeConfig;
  30.     public function __construct(EccubeConfig $eccubeConfig)
  31.     {
  32.         $this->eccubeConfig $eccubeConfig;
  33.     }
  34.     /**
  35.      * {@inheritdoc}
  36.      */
  37.     public function buildForm(FormBuilderInterface $builder, array $options)
  38.     {
  39.         $builder
  40.             // 受注ID・注文者名・注文者(フリガナ)・注文者会社名
  41.             ->add('multi'TextType::class, [
  42.                 'label' => 'admin.order.multi_search_label',
  43.                 'required' => false,
  44.                 'constraints' => [
  45.                     new Assert\Length(['max' => $this->eccubeConfig['eccube_stext_len']]),
  46.                 ],
  47.             ])
  48.             ->add('status'OrderStatusType::class, [
  49.                 'label' => 'admin.order.order_status',
  50.                 'expanded' => true,
  51.                 'multiple' => true,
  52.             ])
  53.             ->add('name'TextType::class, [
  54.                 'label' => 'admin.order.orderer_name',
  55.                 'required' => false,
  56.             ])
  57.             ->add($builder
  58.                 ->create('kana'TextType::class, [
  59.                     'label' => 'admin.order.orderer_kana',
  60.                     'required' => false,
  61.                     'constraints' => [
  62.                         new Assert\Regex([
  63.                             'pattern' => '/^[ァ-ヶヲ-゚ー]+$/u',
  64.                             'message' => 'form_error.kana_only',
  65.                         ]),
  66.                     ],
  67.                 ])
  68.                 ->addEventSubscriber(new \Eccube\Form\EventListener\ConvertKanaListener('CV')
  69.             ))
  70.             ->add('company_name'TextType::class, [
  71.                 'label' => 'admin.order.orderer_company_name',
  72.                 'required' => false,
  73.             ])
  74.             ->add('email'TextType::class, [
  75.                 'label' => 'admin.common.mail_address',
  76.                 'required' => false,
  77.             ])
  78.             ->add('order_no'TextType::class, [
  79.                 'label' => 'admin.order.order_no',
  80.                 'required' => false,
  81.             ])
  82.             ->add('phone_number'TextType::class, [
  83.                 'label' => 'admin.common.phone_number',
  84.                 'required' => false,
  85.                 'constraints' => [
  86.                     new Assert\Regex([
  87.                         'pattern' => "/^[\d-]+$/u",
  88.                         'message' => 'form_error.graph_and_hyphen_only',
  89.                     ]),
  90.                 ],
  91.             ])
  92.             ->add('tracking_number'TextType::class, [
  93.                 'label' => 'admin.order.tracking_number',
  94.                 'required' => false,
  95.             ])
  96.             ->add('shipping_mail'ChoiceType::class, [
  97.                 'label' => 'admin.order.shipping_mail',
  98.                 'placeholder' => false,
  99.                 'choices' => [
  100.                     'admin.order.shipping_mail__unsent' => Shipping::SHIPPING_MAIL_UNSENT,
  101.                     'admin.order.shipping_mail__sent' => Shipping::SHIPPING_MAIL_SENT,
  102.                 ],
  103.                 'expanded' => true,
  104.                 'multiple' => true,
  105.             ])
  106.             ->add('payment'PaymentType::class, [
  107.                 'label' => 'admin.common.payment_method',
  108.                 'required' => false,
  109.                 'expanded' => true,
  110.                 'multiple' => true,
  111.             ])
  112.             ->add('order_date_start'DateType::class, [
  113.                 'label' => 'admin.order.order_date__start',
  114.                 'required' => false,
  115.                 'input' => 'datetime',
  116.                 'widget' => 'single_text',
  117.                 'format' => 'yyyy-MM-dd',
  118.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  119.                 'attr' => [
  120.                     'class' => 'datetimepicker-input',
  121.                     'data-target' => '#'.$this->getBlockPrefix().'_order_date_start',
  122.                     'data-toggle' => 'datetimepicker',
  123.                 ],
  124.             ])
  125.             ->add('order_date_end'DateType::class, [
  126.                 'label' => 'admin.order.order_date__end',
  127.                 'required' => false,
  128.                 'input' => 'datetime',
  129.                 'widget' => 'single_text',
  130.                 'format' => 'yyyy-MM-dd',
  131.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  132.                 'attr' => [
  133.                     'class' => 'datetimepicker-input',
  134.                     'data-target' => '#'.$this->getBlockPrefix().'_order_date_end',
  135.                     'data-toggle' => 'datetimepicker',
  136.                 ],
  137.             ])
  138.             ->add('payment_date_start'DateType::class, [
  139.                 'label' => 'admin.order.payment_date__start',
  140.                 'required' => false,
  141.                 'input' => 'datetime',
  142.                 'widget' => 'single_text',
  143.                 'format' => 'yyyy-MM-dd',
  144.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  145.                 'attr' => [
  146.                     'class' => 'datetimepicker-input',
  147.                     'data-target' => '#'.$this->getBlockPrefix().'_payment_date_start',
  148.                     'data-toggle' => 'datetimepicker',
  149.                 ],
  150.             ])
  151.             ->add('payment_date_end'DateType::class, [
  152.                 'label' => 'admin.order.payment_date__start',
  153.                 'required' => false,
  154.                 'input' => 'datetime',
  155.                 'widget' => 'single_text',
  156.                 'format' => 'yyyy-MM-dd',
  157.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  158.                 'attr' => [
  159.                     'class' => 'datetimepicker-input',
  160.                     'data-target' => '#'.$this->getBlockPrefix().'_payment_date_end',
  161.                     'data-toggle' => 'datetimepicker',
  162.                 ],
  163.             ])
  164.             ->add('update_date_start'DateType::class, [
  165.                 'label' => 'admin.common.update_date__start',
  166.                 'required' => false,
  167.                 'input' => 'datetime',
  168.                 'widget' => 'single_text',
  169.                 'format' => 'yyyy-MM-dd',
  170.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  171.                 'attr' => [
  172.                     'class' => 'datetimepicker-input',
  173.                     'data-target' => '#'.$this->getBlockPrefix().'_update_date_start',
  174.                     'data-toggle' => 'datetimepicker',
  175.                 ],
  176.             ])
  177.             ->add('update_date_end'DateType::class, [
  178.                 'label' => 'admin.common.update_date__end',
  179.                 'required' => false,
  180.                 'input' => 'datetime',
  181.                 'widget' => 'single_text',
  182.                 'format' => 'yyyy-MM-dd',
  183.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  184.                 'attr' => [
  185.                     'class' => 'datetimepicker-input',
  186.                     'data-target' => '#'.$this->getBlockPrefix().'_update_date_end',
  187.                     'data-toggle' => 'datetimepicker',
  188.                 ],
  189.             ])
  190.             ->add('shipping_delivery_date_start'DateType::class, [
  191.                 'label' => 'admin.order.delivery_date__start',
  192.                 'required' => false,
  193.                 'input' => 'datetime',
  194.                 'widget' => 'single_text',
  195.                 'format' => 'yyyy-MM-dd',
  196.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  197.                 'attr' => [
  198.                     'class' => 'datetimepicker-input',
  199.                     'data-target' => '#'.$this->getBlockPrefix().'_shipping_delivery_date_start',
  200.                     'data-toggle' => 'datetimepicker',
  201.                 ],
  202.             ])
  203.             ->add('shipping_delivery_date_end'DateType::class, [
  204.                 'label' => 'admin.order.delivery_date__start',
  205.                 'required' => false,
  206.                 'input' => 'datetime',
  207.                 'widget' => 'single_text',
  208.                 'format' => 'yyyy-MM-dd',
  209.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  210.                 'attr' => [
  211.                     'class' => 'datetimepicker-input',
  212.                     'data-target' => '#'.$this->getBlockPrefix().'_shipping_delivery_date_end',
  213.                     'data-toggle' => 'datetimepicker',
  214.                 ],
  215.             ])
  216.             ->add('payment_total_start'PriceType::class, [
  217.                 'label' => 'admin.order.purchase_price__start',
  218.                 'required' => false,
  219.             ])
  220.             ->add('payment_total_end'PriceType::class, [
  221.                 'label' => 'admin.order.purchase_price__end',
  222.                 'required' => false,
  223.             ])
  224.             ->add('buy_product_name'TextType::class, [
  225.                 'label' => 'admin.order.purchase_product',
  226.                 'required' => false,
  227.             ])
  228.         ;
  229.     }
  230.     /**
  231.      * {@inheritdoc}
  232.      */
  233.     public function getBlockPrefix()
  234.     {
  235.         return 'admin_search_order';
  236.     }
  237. }