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

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\Common\EccubeConfig;
  14. use Eccube\Entity\Shipping;
  15. use Eccube\Form\Type\Master\OrderStatusType;
  16. use Eccube\Form\Type\Master\PaymentType;
  17. use Eccube\Form\Type\PriceType;
  18. use Symfony\Component\Form\AbstractType;
  19. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  20. use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
  21. use Symfony\Component\Form\Extension\Core\Type\DateType;
  22. use Symfony\Component\Form\Extension\Core\Type\HiddenType;
  23. use Symfony\Component\Form\Extension\Core\Type\TextType;
  24. use Symfony\Component\Form\FormBuilderInterface;
  25. use Symfony\Component\Validator\Constraints as Assert;
  26. class SearchOrderType extends AbstractType
  27. {
  28.     /**
  29.      * @var EccubeConfig
  30.      */
  31.     protected $eccubeConfig;
  32.     public function __construct(EccubeConfig $eccubeConfig)
  33.     {
  34.         $this->eccubeConfig $eccubeConfig;
  35.     }
  36.     /**
  37.      * {@inheritdoc}
  38.      */
  39.     public function buildForm(FormBuilderInterface $builder, array $options)
  40.     {
  41.         $builder
  42.             // 受注ID・注文者名・注文者(フリガナ)・注文者会社名
  43.             ->add('multi'TextType::class, [
  44.                 'label' => 'admin.order.multi_search_label',
  45.                 'required' => false,
  46.                 'constraints' => [
  47.                     new Assert\Length(['max' => $this->eccubeConfig['eccube_stext_len']]),
  48.                 ],
  49.             ])
  50.             ->add('status'OrderStatusType::class, [
  51.                 'label' => 'admin.order.order_status',
  52.                 'expanded' => true,
  53.                 'multiple' => true,
  54.             ])
  55.             ->add('name'TextType::class, [
  56.                 'label' => 'admin.order.orderer_name',
  57.                 'required' => false,
  58.             ])
  59.             ->add($builder
  60.                 ->create('kana'TextType::class, [
  61.                     'label' => 'admin.order.orderer_kana',
  62.                     'required' => false,
  63.                     'constraints' => [
  64.                         new Assert\Regex([
  65.                             'pattern' => '/^[ァ-ヶヲ-゚ー]+$/u',
  66.                             'message' => 'form_error.kana_only',
  67.                         ]),
  68.                     ],
  69.                 ])
  70.                 ->addEventSubscriber(new \Eccube\Form\EventListener\ConvertKanaListener('CV')
  71.             ))
  72.             ->add('company_name'TextType::class, [
  73.                 'label' => 'admin.order.orderer_company_name',
  74.                 'required' => false,
  75.             ])
  76.             ->add('email'TextType::class, [
  77.                 'label' => 'admin.common.mail_address',
  78.                 'required' => false,
  79.             ])
  80.             ->add('order_no'TextType::class, [
  81.                 'label' => 'admin.order.order_no',
  82.                 'required' => false,
  83.             ])
  84.             ->add('phone_number'TextType::class, [
  85.                 'label' => 'admin.common.phone_number',
  86.                 'required' => false,
  87.                 'constraints' => [
  88.                     new Assert\Regex([
  89.                         'pattern' => "/^[\d-]+$/u",
  90.                         'message' => 'form_error.graph_and_hyphen_only',
  91.                     ]),
  92.                 ],
  93.             ])
  94.             ->add('tracking_number'TextType::class, [
  95.                 'label' => 'admin.order.tracking_number',
  96.                 'required' => false,
  97.             ])
  98.             ->add('shipping_mail'ChoiceType::class, [
  99.                 'label' => 'admin.order.shipping_mail',
  100.                 'placeholder' => false,
  101.                 'choices' => [
  102.                     'admin.order.shipping_mail__unsent' => Shipping::SHIPPING_MAIL_UNSENT,
  103.                     'admin.order.shipping_mail__sent' => Shipping::SHIPPING_MAIL_SENT,
  104.                 ],
  105.                 'expanded' => true,
  106.                 'multiple' => true,
  107.             ])
  108.             ->add('payment'PaymentType::class, [
  109.                 'label' => 'admin.common.payment_method',
  110.                 'required' => false,
  111.                 'expanded' => true,
  112.                 'multiple' => true,
  113.             ])
  114.             ->add('order_date_start'DateType::class, [
  115.                 'label' => 'admin.order.order_date__start',
  116.                 'required' => false,
  117.                 'input' => 'datetime',
  118.                 'widget' => 'single_text',
  119.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  120.                 'constraints' => [
  121.                     new Assert\Range([
  122.                         'min'=> '0003-01-01',
  123.                         'minMessage' => 'form_error.out_of_range',
  124.                     ]),
  125.                 ],
  126.                 'attr' => [
  127.                     'class' => 'datetimepicker-input',
  128.                     'data-target' => '#'.$this->getBlockPrefix().'_order_date_start',
  129.                     'data-toggle' => 'datetimepicker',
  130.                 ],
  131.             ])
  132.             ->add('order_datetime_start'DateTimeType::class, [
  133.                 'label' => 'admin.order.order_date__start',
  134.                 'required' => false,
  135.                 'input' => 'datetime',
  136.                 'widget' => 'single_text',
  137.                 'constraints' => [
  138.                     new Assert\Range([
  139.                         'min'=> '0003-01-01',
  140.                         'minMessage' => 'form_error.out_of_range',
  141.                     ]),
  142.                 ],
  143.                 'attr' => [
  144.                     'class' => 'datetimepicker-input',
  145.                     'data-target' => '#'.$this->getBlockPrefix().'_order_datetime_start',
  146.                     'data-toggle' => 'datetimepicker',
  147.                 ],
  148.             ])
  149.             ->add('order_date_end'DateType::class, [
  150.                 'label' => 'admin.order.order_date__end',
  151.                 'required' => false,
  152.                 'input' => 'datetime',
  153.                 'widget' => 'single_text',
  154.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  155.                 'constraints' => [
  156.                     new Assert\Range([
  157.                         'min'=> '0003-01-01',
  158.                         'minMessage' => 'form_error.out_of_range',
  159.                     ]),
  160.                 ],
  161.                 'attr' => [
  162.                     'class' => 'datetimepicker-input',
  163.                     'data-target' => '#'.$this->getBlockPrefix().'_order_date_end',
  164.                     'data-toggle' => 'datetimepicker',
  165.                 ],
  166.             ])
  167.             ->add('order_datetime_end'DateTimeType::class, [
  168.                 'label' => 'admin.order.order_date__end',
  169.                 'required' => false,
  170.                 'input' => 'datetime',
  171.                 'widget' => 'single_text',
  172.                 'constraints' => [
  173.                     new Assert\Range([
  174.                         'min'=> '0003-01-01',
  175.                         'minMessage' => 'form_error.out_of_range',
  176.                     ]),
  177.                 ],
  178.                 'attr' => [
  179.                     'class' => 'datetimepicker-input',
  180.                     'data-target' => '#'.$this->getBlockPrefix().'_order_datetime_end',
  181.                     'data-toggle' => 'datetimepicker',
  182.                 ],
  183.             ])
  184.             ->add('payment_date_start'DateType::class, [
  185.                 'label' => 'admin.order.payment_date__start',
  186.                 'required' => false,
  187.                 'input' => 'datetime',
  188.                 'widget' => 'single_text',
  189.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  190.                 'constraints' => [
  191.                     new Assert\Range([
  192.                         'min'=> '0003-01-01',
  193.                         'minMessage' => 'form_error.out_of_range',
  194.                     ]),
  195.                 ],
  196.                 'attr' => [
  197.                     'class' => 'datetimepicker-input',
  198.                     'data-target' => '#'.$this->getBlockPrefix().'_payment_date_start',
  199.                     'data-toggle' => 'datetimepicker',
  200.                 ],
  201.             ])
  202.             ->add('payment_datetime_start'DateTimeType::class, [
  203.                 'label' => 'admin.order.payment_date__start',
  204.                 'required' => false,
  205.                 'input' => 'datetime',
  206.                 'widget' => 'single_text',
  207.                 'constraints' => [
  208.                     new Assert\Range([
  209.                         'min'=> '0003-01-01',
  210.                         'minMessage' => 'form_error.out_of_range',
  211.                     ]),
  212.                 ],
  213.                 'attr' => [
  214.                     'class' => 'datetimepicker-input',
  215.                     'data-target' => '#'.$this->getBlockPrefix().'_payment_datetime_start',
  216.                     'data-toggle' => 'datetimepicker',
  217.                 ],
  218.             ])
  219.             ->add('payment_date_end'DateType::class, [
  220.                 'label' => 'admin.order.payment_date__end',
  221.                 'required' => false,
  222.                 'input' => 'datetime',
  223.                 'widget' => 'single_text',
  224.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  225.                 'constraints' => [
  226.                     new Assert\Range([
  227.                         'min'=> '0003-01-01',
  228.                         'minMessage' => 'form_error.out_of_range',
  229.                     ]),
  230.                 ],
  231.                 'attr' => [
  232.                     'class' => 'datetimepicker-input',
  233.                     'data-target' => '#'.$this->getBlockPrefix().'_payment_date_end',
  234.                     'data-toggle' => 'datetimepicker',
  235.                 ],
  236.             ])
  237.             ->add('payment_datetime_end'DateTimeType::class, [
  238.                 'label' => 'admin.order.payment_date__end',
  239.                 'required' => false,
  240.                 'input' => 'datetime',
  241.                 'widget' => 'single_text',
  242.                 'constraints' => [
  243.                     new Assert\Range([
  244.                         'min'=> '0003-01-01',
  245.                         'minMessage' => 'form_error.out_of_range',
  246.                     ]),
  247.                 ],
  248.                 'attr' => [
  249.                     'class' => 'datetimepicker-input',
  250.                     'data-target' => '#'.$this->getBlockPrefix().'_payment_datetime_end',
  251.                     'data-toggle' => 'datetimepicker',
  252.                 ],
  253.             ])
  254.             ->add('update_date_start'DateType::class, [
  255.                 'label' => 'admin.common.update_date__start',
  256.                 'required' => false,
  257.                 'input' => 'datetime',
  258.                 'widget' => 'single_text',
  259.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  260.                 'constraints' => [
  261.                     new Assert\Range([
  262.                         'min'=> '0003-01-01',
  263.                         'minMessage' => 'form_error.out_of_range',
  264.                     ]),
  265.                 ],
  266.                 'attr' => [
  267.                     'class' => 'datetimepicker-input',
  268.                     'data-target' => '#'.$this->getBlockPrefix().'_update_date_start',
  269.                     'data-toggle' => 'datetimepicker',
  270.                 ],
  271.             ])
  272.             ->add('update_datetime_start'DateTimeType::class, [
  273.                 'label' => 'admin.common.update_date__start',
  274.                 'required' => false,
  275.                 'input' => 'datetime',
  276.                 'widget' => 'single_text',
  277.                 'constraints' => [
  278.                     new Assert\Range([
  279.                         'min'=> '0003-01-01',
  280.                         'minMessage' => 'form_error.out_of_range',
  281.                     ]),
  282.                 ],
  283.                 'attr' => [
  284.                     'class' => 'datetimepicker-input',
  285.                     'data-target' => '#'.$this->getBlockPrefix().'_update_datetime_start',
  286.                     'data-toggle' => 'datetimepicker',
  287.                 ],
  288.             ])
  289.             ->add('update_date_end'DateType::class, [
  290.                 'label' => 'admin.common.update_date__end',
  291.                 'required' => false,
  292.                 'input' => 'datetime',
  293.                 'widget' => 'single_text',
  294.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  295.                 'constraints' => [
  296.                     new Assert\Range([
  297.                         'min'=> '0003-01-01',
  298.                         'minMessage' => 'form_error.out_of_range',
  299.                     ]),
  300.                 ],
  301.                 'attr' => [
  302.                     'class' => 'datetimepicker-input',
  303.                     'data-target' => '#'.$this->getBlockPrefix().'_update_date_end',
  304.                     'data-toggle' => 'datetimepicker',
  305.                 ],
  306.             ])
  307.             ->add('update_datetime_end'DateTimeType::class, [
  308.                 'label' => 'admin.common.update_date__end',
  309.                 'required' => false,
  310.                 'input' => 'datetime',
  311.                 'widget' => 'single_text',
  312.                 'constraints' => [
  313.                     new Assert\Range([
  314.                         'min'=> '0003-01-01',
  315.                         'minMessage' => 'form_error.out_of_range',
  316.                     ]),
  317.                 ],
  318.                 'attr' => [
  319.                     'class' => 'datetimepicker-input',
  320.                     'data-target' => '#'.$this->getBlockPrefix().'_update_datetime_end',
  321.                     'data-toggle' => 'datetimepicker',
  322.                 ],
  323.             ])
  324.             ->add('shipping_delivery_date_start'DateType::class, [
  325.                 'label' => 'admin.order.delivery_date__start',
  326.                 'required' => false,
  327.                 'input' => 'datetime',
  328.                 'widget' => 'single_text',
  329.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  330.                 'constraints' => [
  331.                     new Assert\Range([
  332.                         'min'=> '0003-01-01',
  333.                         'minMessage' => 'form_error.out_of_range',
  334.                     ]),
  335.                 ],
  336.                 'attr' => [
  337.                     'class' => 'datetimepicker-input',
  338.                     'data-target' => '#'.$this->getBlockPrefix().'_shipping_delivery_date_start',
  339.                     'data-toggle' => 'datetimepicker',
  340.                 ],
  341.             ])
  342.             ->add('shipping_delivery_datetime_start'DateTimeType::class, [
  343.                 'label' => 'admin.order.delivery_date__start',
  344.                 'required' => false,
  345.                 'input' => 'datetime',
  346.                 'widget' => 'single_text',
  347.                 'constraints' => [
  348.                     new Assert\Range([
  349.                         'min'=> '0003-01-01',
  350.                         'minMessage' => 'form_error.out_of_range',
  351.                     ]),
  352.                 ],
  353.                 'attr' => [
  354.                     'class' => 'datetimepicker-input',
  355.                     'data-target' => '#'.$this->getBlockPrefix().'_shipping_delivery_datetime_start',
  356.                     'data-toggle' => 'datetimepicker',
  357.                 ],
  358.             ])
  359.             ->add('shipping_delivery_date_end'DateType::class, [
  360.                 'label' => 'admin.order.delivery_date__end',
  361.                 'required' => false,
  362.                 'input' => 'datetime',
  363.                 'widget' => 'single_text',
  364.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  365.                 'constraints' => [
  366.                     new Assert\Range([
  367.                         'min'=> '0003-01-01',
  368.                         'minMessage' => 'form_error.out_of_range',
  369.                     ]),
  370.                 ],
  371.                 'attr' => [
  372.                     'class' => 'datetimepicker-input',
  373.                     'data-target' => '#'.$this->getBlockPrefix().'_shipping_delivery_date_end',
  374.                     'data-toggle' => 'datetimepicker',
  375.                 ],
  376.             ])
  377.             ->add('shipping_delivery_datetime_end'DateTimeType::class, [
  378.                 'label' => 'admin.order.delivery_date__end',
  379.                 'required' => false,
  380.                 'input' => 'datetime',
  381.                 'widget' => 'single_text',
  382.                 'constraints' => [
  383.                     new Assert\Range([
  384.                         'min'=> '0003-01-01',
  385.                         'minMessage' => 'form_error.out_of_range',
  386.                     ]),
  387.                 ],
  388.                 'attr' => [
  389.                     'class' => 'datetimepicker-input',
  390.                     'data-target' => '#'.$this->getBlockPrefix().'_shipping_delivery_datetime_end',
  391.                     'data-toggle' => 'datetimepicker',
  392.                 ],
  393.             ])
  394.             ->add('payment_total_start'PriceType::class, [
  395.                 'label' => 'admin.order.purchase_price__start',
  396.                 'required' => false,
  397.             ])
  398.             ->add('payment_total_end'PriceType::class, [
  399.                 'label' => 'admin.order.purchase_price__end',
  400.                 'required' => false,
  401.             ])
  402.             ->add('buy_product_name'TextType::class, [
  403.                 'label' => 'admin.order.purchase_product',
  404.                 'required' => false,
  405.             ])
  406.             // ソート用
  407.             ->add('sortkey'HiddenType::class, [
  408.                 'label' => 'admin.list.sort.key',
  409.                 'required' => false,
  410.             ])
  411.             ->add('sorttype'HiddenType::class, [
  412.                 'label' => 'admin.list.sort.type',
  413.                 'required' => false,
  414.             ]);
  415.     }
  416.     /**
  417.      * {@inheritdoc}
  418.      */
  419.     public function getBlockPrefix()
  420.     {
  421.         return 'admin_search_order';
  422.     }
  423. }