app/Customize/Form/Type/Front/LoanType.php line 857

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 Customize\Form\Type\Front;
  13. use Eccube\Common\EccubeConfig;
  14. use Eccube\Form\Type\Master\PrefType;
  15. use Eccube\Form\Type\AddressType;
  16. use Eccube\Form\Type\KanaType;
  17. use Eccube\Form\Type\NameType;
  18. use Eccube\Form\Type\PhoneNumberType;
  19. use Eccube\Form\Type\PostalType;
  20. use Eccube\Form\Validator\Email;
  21. use Eccube\Form\Type\Master\SexType;
  22. use Eccube\Form\Type\Master\JobType;
  23. use Symfony\Component\Form\AbstractType;
  24. use Symfony\Component\Form\Extension\Core\Type\BirthdayType;
  25. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  26. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  27. use Symfony\Component\Form\Extension\Core\Type\NumberType;
  28. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  29. use Symfony\Component\Form\Extension\Core\Type\TextType;
  30. use Symfony\Component\Form\Extension\Core\Type\FileType;
  31. use Symfony\Component\Form\Extension\Core\Type\CollectionType;
  32. use Symfony\Component\Form\Extension\Core\Type\HiddenType;
  33. use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
  34. use Symfony\Component\Form\Extension\Core\Type\DateType;
  35. use Symfony\Component\Form\FormEvent;
  36. use Symfony\Component\Form\FormEvents;
  37. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  38. use Symfony\Component\Form\FormBuilderInterface;
  39. use Symfony\Component\Validator\Constraints as Assert;
  40. use Eccube\Repository\ProductRepository;
  41. use Eccube\Repository\CategoryRepository;
  42. use Customize\Service\FileUploader;
  43. class LoanType extends AbstractType
  44. {
  45.     /**
  46.      * @var EccubeConfig
  47.      */
  48.     protected $eccubeConfig;
  49.     /**
  50.      * @var FileUploader
  51.      */
  52.     protected $fileUploader;
  53.     protected $productRepository;
  54.     protected $categoryRepository;
  55.     /**
  56.      * ContactType constructor.
  57.      *
  58.      * @param EccubeConfig $eccubeConfig
  59.      */
  60.     public function __construct(
  61.         CategoryRepository $categoryRepository,
  62.         ProductRepository $productRepository,
  63.         EccubeConfig $eccubeConfig,
  64.         FileUploader $fileUploader) {
  65.         $this->categoryRepository $categoryRepository;
  66.         $this->productRepository $productRepository;
  67.         $this->eccubeConfig $eccubeConfig;
  68.         $this->fileUploader $fileUploader;
  69.     }
  70.     /**
  71.      * {@inheritdoc}
  72.      */
  73.     public function buildForm(FormBuilderInterface $builder, array $options)
  74.     {
  75.         // 【ご本人様について】
  76.         $builder
  77.             // お名前
  78.             ->add('name'NameType::class, [
  79.                 'required' => true,
  80.             ])
  81.             // フリガナ
  82.             ->add('kana'KanaType::class, [
  83.                 'required' => true,
  84.             ])
  85.             // 性別
  86.             ->add('sex'SexType::class, [
  87.                 'required' => true,
  88.             ])
  89.             // 生年月日
  90.             ->add('birth'BirthdayType::class, [
  91.                 'required' => true,
  92.                 'input' => 'datetime',
  93.                 'years' => range(date('Y'), date('Y') - $this->eccubeConfig['eccube_birth_max']),
  94.                 'widget' => 'choice',
  95.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  96.                 'constraints' => [
  97.                     new Assert\LessThanOrEqual([
  98.                         'value' => date('Y-m-d'strtotime('-1 day')),
  99.                         'message' => 'form_error.select_is_future_or_now_date',
  100.                     ]),
  101.                 ],
  102.             ])
  103.             // 郵便番号
  104.             ->add('postal_code'PostalType::class, [
  105.                 'required' => true,
  106.             ])
  107.             // 住所
  108.             ->add('address'AddressType::class, [
  109.                 'required' => true,
  110.             ])
  111.             // 電話番号(ご自宅)
  112.             ->add('tel_number_type'ChoiceType::class, [
  113.                 'choices'  => [
  114.                     '自宅' => '自宅',
  115.                     '呼び出し' => '呼び出し',
  116.                 ],
  117.                 'expanded' => true,
  118.                 'multiple' => false,
  119.                 'required' => true,
  120.             ])
  121.             // 電話番号(ご自宅)
  122.             ->add('tel_number'PhoneNumberType::class, [
  123.                 'required' => true,
  124.             ])
  125.             // 電話番号(携帯)
  126.             ->add('phone_number'PhoneNumberType::class, [
  127.                 'required' => true,
  128.             ])
  129.             // メールアドレス
  130.             ->add('email'EmailType::class, [
  131.                 'required' => true,
  132.                 'constraints' => [
  133.                     // new Assert\NotBlank(),
  134.                     new Email(nullnull$this->eccubeConfig['eccube_rfc_email_check'] ? 'strict' null),
  135.                 ],
  136.             ])
  137.             // 配偶者
  138.             ->add('spouse'ChoiceType::class, [
  139.                 'choices'  => [
  140.                     '有り' => '有り',
  141.                     '無し' => '無し',
  142.                 ],
  143.                 'expanded' => true,
  144.                 'multiple' => false,
  145.                 'required' => true,
  146.             ])
  147.             // 配偶者の職業
  148.             ->add('spouse_job'ChoiceType::class, [
  149.                 'choices'  => [
  150.                     '選択してください' => '',
  151.                     '公務員' => '公務員',
  152.                     '公的資格者' => '公的資格者',
  153.                     '会社員(内勤)' => '会社員(内勤)',
  154.                     '会社員(外勤)' => '会社員(外勤)',
  155.                     '自営業' => '自営業',
  156.                     '自由業' => '自由業',
  157.                     '臨時・パート・アルバイト' => '臨時・パート・アルバイト',
  158.                     'なし' => 'なし',
  159.                 ],
  160.                 'expanded' => false,
  161.                 'multiple' => false,
  162.                 'required' => true,
  163.             ])
  164.             // 世帯主とのご関係
  165.             ->add('relationship'ChoiceType::class, [
  166.                 'choices'  => [
  167.                     '本人' => '本人',
  168.                     '配偶者' => '配偶者',
  169.                     'その他' => 'その他',
  170.                 ],
  171.                 'expanded' => true,
  172.                 'multiple' => false,
  173.                 'required' => true,
  174.             ])
  175.             // 世帯主とのご関係
  176.             ->add('relationship_other'TextType::class, [
  177.                 'required' => false,
  178.             ])
  179.             // 世帯人数
  180.             ->add('people_cnt'TextType::class, [
  181.                 'required' => true,
  182.             ])
  183.             // 住宅ローン/家賃支払い
  184.             ->add('housing_loan'ChoiceType::class, [
  185.                 'choices'  => [
  186.                     '有り' => '有り',
  187.                     '無し' => '無し',
  188.                 ],
  189.                 'expanded' => true,
  190.                 'multiple' => false,
  191.                 'required' => true,
  192.             ])
  193.             // 住居区分
  194.             ->add('housing_type'ChoiceType::class, [
  195.                 'choices'  => [
  196.                     '選択してください' => '',
  197.                     '自己所有' => '自己所有',
  198.                     '家族所有' => '家族所有',
  199.                     '社宅・官舎' => '社宅・官舎',
  200.                     '借家' => '借家',
  201.                     '賃貸マンション' => '賃貸マンション',
  202.                     '公営・公団' => '公営・公団',
  203.                     'アパート' => 'アパート',
  204.                     '寮' => '寮',
  205.                     'その他' => 'その他',
  206.                 ],
  207.                 'expanded' => false,
  208.                 'multiple' => false,
  209.                 'required' => true,
  210.             ])
  211.             // 居住年数(年)
  212.             ->add('residence_year'TextType::class, [
  213.                 'required' => true,
  214.             ])
  215.             // 居住年数(月)
  216.             ->add('residence_month'TextType::class, [
  217.                 'required' => true,
  218.             ])
  219.             ->add('job'ChoiceType::class, [
  220.                 'choices'  => [
  221.                     '選択してください' => '',
  222.                     '公務員' => '公務員',
  223.                     '公的資格者' => '公的資格者',
  224.                     // '会社員(内勤)' => '会社員(内勤)',
  225.                     // '会社員(外勤)' => '会社員(外勤)',
  226.                     '会社員' => '会社員',
  227.                     '自営業' => '自営業',
  228.                     '自由業' => '自由業',
  229.                     '臨時・パート・アルバイト' => '臨時・パート・アルバイト',
  230.                     'その他' => 'その他',
  231.                 ],
  232.                 'expanded' => false,
  233.                 'multiple' => false,
  234.                 'required' => true,
  235.             ])
  236.             // 世帯主との居住状況
  237.             ->add('head_of_household'ChoiceType::class, [
  238.                 'choices'  => [
  239.                     '同居' => '同居',
  240.                     '別居' => '別居',
  241.                     '本人のみ' => '本人のみ',
  242.                 ],
  243.                 'expanded' => true,
  244.                 'multiple' => false,
  245.                 'required' => true,
  246.             ])
  247.         ;
  248.         // 【お勤め先・ご収入について】
  249.         $builder
  250.             // 職種
  251.             // ->add('employed_job', JobType::class, [
  252.             //     'required' => true,
  253.             // ])
  254.             ->add('employed_job'ChoiceType::class, [
  255.                 'choices'  => [
  256.                     '選択してください' => '',
  257.                     '公務員' => '公務員',
  258.                     '公的資格者' => '公的資格者',
  259.                     // '会社員(内勤)' => '会社員(内勤)',
  260.                     // '会社員(外勤)' => '会社員(外勤)',
  261.                     '会社員' => '会社員',
  262.                     '自営業' => '自営業',
  263.                     '自由業' => '自由業',
  264.                     '臨時・パート・アルバイト' => '臨時・パート・アルバイト',
  265.                     'その他' => 'その他',
  266.                 ],
  267.                 'expanded' => false,
  268.                 'multiple' => false,
  269.                 'required' => true,
  270.             ])
  271.             // 業種
  272.             ->add('employed_industry'ChoiceType::class, [
  273.                 'choices'  => [
  274.                     '選択してください' => '',
  275.                     '公務員' => '公務員',
  276.                     '公的資格者' => '公的資格者',
  277.                     '一次産業' => '一次産業',
  278.                     '鉱業' => '鉱業',
  279.                     '土木・建築' => '土木・建築',
  280.                     '不動産' => '不動産',
  281.                     '金融' => '金融',
  282.                     '運輸・倉庫' => '運輸・倉庫',
  283.                     '製造' => '製造',
  284.                     '卸' => '卸',
  285.                     '小売' => '小売',
  286.                     '情報・通信' => '情報・通信',
  287.                     '旅行宿泊' => '旅行宿泊',
  288.                     'その他サービス' => 'その他サービス',
  289.                     '医療機関' => '医療機関',
  290.                     '組合団体' => '組合団体',
  291.                     '施設・期間' => '施設・期間',
  292.                     '個人業' => '個人業',
  293.                     'その他' => 'その他',
  294.                 ],
  295.                 'expanded' => false,
  296.                 'multiple' => false,
  297.                 'required' => true,
  298.             ])
  299.             // お勤め先(派遣元)
  300.             ->add('employed_company'TextType::class, [
  301.                 'required' => true,
  302.             ])
  303.             // お勤め先フリガナ
  304.             ->add('employed_company_kana'TextType::class, [
  305.                 'required' => true,
  306.             ])
  307.             // お勤め先住所 郵便番号
  308.             ->add('employed_postal_code'PostalType::class, [
  309.                 'required' => true,
  310.             ])
  311.             // お勤め先住所
  312.             // ->add('employed_address', AddressType::class, [
  313.             //     'required' => true,
  314.             // ])
  315.             ->add('employed_address_pref'PrefType::class, [
  316.                 'required' => true,
  317.             ])
  318.             ->add('employed_address_addr01'TextType::class, [
  319.                 'required' => true,
  320.             ])
  321.             ->add('employed_address_addr02'TextType::class, [
  322.                 'required' => false,
  323.             ])
  324.             // お勤め先電話番号
  325.             ->add('employed_phone_number'PhoneNumberType::class, [
  326.                 'required' => true,
  327.             ])
  328.             // 勤続年数(年)
  329.             ->add('employed_year'TextType::class, [
  330.                 'required' => true,
  331.             ])
  332.             // 勤続年数(月)
  333.             ->add('employed_month'TextType::class, [
  334.                 'required' => true,
  335.             ])
  336.             // 税込年収
  337.             ->add('employed_income'TextType::class, [
  338.                 'required' => true,
  339.             ])
  340.             // 従業員数
  341.             ->add('employed_cnt'ChoiceType::class, [
  342.                 'choices'  => [
  343.                     '10人未満' => '10人未満'//TODO: ???
  344.                     '10人以上20人未満' => '10人以上20人未満',
  345.                     '20人以上' => '20人以上'
  346.                 ],
  347.                 'expanded' => false,
  348.                 'multiple' => false,
  349.                 'required' => true,
  350.             ])
  351.             // 出向先・派遣先電話番号
  352.             ->add('employed_company_phone_number'PhoneNumberType::class, [
  353.                 'required' => false,
  354.             ])
  355.         ;
  356.         // 【主婦・年金受給者の方】
  357.         $builder
  358.             // 世帯主お名前
  359.             ->add('pensioner_name'NameType::class, [
  360.                 'required' => true,
  361.             ])
  362.             // フリガナ
  363.             ->add('pensioner_kana'KanaType::class, [
  364.                 'required' => true,
  365.             ])
  366.             // 世帯主税込年収
  367.             ->add('pensioner_income'TextType::class, [
  368.                 'required' => true,
  369.             ])
  370.             // 世帯主のお支払中の クレジット返済額
  371.             ->add('household_paying'ChoiceType::class, [
  372.                 'choices'  => [
  373.                     '有り' => '有り',
  374.                     '無し' => '無し',
  375.                 ],
  376.                 'expanded' => true,
  377.                 'multiple' => false,
  378.                 'required' => true,
  379.             ])
  380.             // 世帯主のお支払中の クレジット返済額
  381.             ->add('household_paying_amount'TextType::class, [
  382.                 'required' => true,
  383.             ])
  384.             // 年金の種類
  385.             ->add('pensioner_type'ChoiceType::class, [
  386.                 'choices'  => [
  387.                     '国民' => '国民',
  388.                     '厚生' => '厚生',
  389.                     '共済' => '共済',
  390.                     'その他' => 'その他',
  391.                 ],
  392.                 'expanded' => true,
  393.                 'multiple' => true,
  394.                 'required' => true,
  395.             ])
  396.             // 年金の種類
  397.             ->add('pensioner_type_other'TextType::class, [
  398.                 'required' => false,
  399.             ])
  400.             // 年金以外の収入
  401.             ->add('pensioner_income_other'ChoiceType::class, [
  402.                 'choices'  => [
  403.                     '有り' => '有り',
  404.                     '無し' => '無し',
  405.                 ],
  406.                 'expanded' => true,
  407.                 'multiple' => false,
  408.                 'required' => true,
  409.             ])
  410.             // 今回のお支払い
  411.             ->add('pensioner_payment'ChoiceType::class, [
  412.                 'choices'  => [
  413.                     '年金' => '年金',
  414.                     '不動産収入' => '不動産収入',
  415.                     'その他' => 'その他',
  416.                 ],
  417.                 'expanded' => true,
  418.                 'multiple' => true,
  419.                 'required' => true,
  420.             ])
  421.             // 今回のお支払い
  422.             ->add('pensioner_payment_other'TextType::class, [
  423.                 'required' => false,
  424.             ])
  425.             // お勤め先電話番号
  426.             ->add('pensioner_company_phone_number'PhoneNumberType::class, [
  427.                 'required' => true,
  428.             ])
  429.             // 年金受給者の税込年収
  430.             ->add('pensioner_income2'TextType::class, [
  431.                 'required' => true,
  432.             ])
  433.             // 口座名義人
  434.             ->add('pensioner_acount'ChoiceType::class, [
  435.                 'choices'  => [
  436.                     '申込者' => '申込者',
  437.                     '申込者以外' => '申込者以外',
  438.                 ],
  439.                 'expanded' => true,
  440.                 'multiple' => false,
  441.                 'required' => true,
  442.             ])
  443.         ;
  444.         // 【連帯保証人の方】
  445.         $builder
  446.             // お名前
  447.             ->add('guarantor_name'NameType::class, [
  448.                 'required' => true,
  449.             ])
  450.             // フリガナ
  451.             ->add('guarantor_kana'KanaType::class, [
  452.                 'required' => true,
  453.             ])
  454.             // 性別
  455.             ->add('guarantor_sex'SexType::class, [
  456.                 'required' => true,
  457.             ])
  458.             // 生年月日
  459.             ->add('guarantor_birth'BirthdayType::class, [
  460.                 'required' => true,
  461.                 'input' => 'datetime',
  462.                 'years' => range(date('Y'), date('Y') - $this->eccubeConfig['eccube_birth_max']),
  463.                 'widget' => 'choice',
  464.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  465.                 'constraints' => [
  466.                     new Assert\LessThanOrEqual([
  467.                         'value' => date('Y-m-d'strtotime('-1 day')),
  468.                         'message' => 'form_error.select_is_future_or_now_date',
  469.                     ]),
  470.                 ],
  471.             ])
  472.             // 郵便番号
  473.             ->add('guarantor_postal_code'PostalType::class, [
  474.                 'required' => true,
  475.             ])
  476.             // 住所
  477.             // ->add('guarantor_address', AddressType::class, [
  478.             //     'required' => true,
  479.             // ])
  480.             ->add('guarantor_address_pref'PrefType::class, [
  481.                 'required' => true,
  482.             ])
  483.             ->add('guarantor_address_addr01'TextType::class, [
  484.                 'required' => true,
  485.             ])
  486.             ->add('guarantor_address_addr02'TextType::class, [
  487.                 'required' => false,
  488.             ])
  489.             // // 電話番号(ご自宅)
  490.             // ->add('guarantor_tel_number_type', ChoiceType::class, [
  491.             //     'choices'  => [
  492.             //         '自宅' => '自宅',
  493.             //         '呼び出し' => '呼び出し',
  494.             //     ],
  495.             //     'expanded' => true,
  496.             //     'multiple' => false,
  497.             //     'required' => true,
  498.             // ])
  499.             // // 電話番号(ご自宅)
  500.             // ->add('guarantor_tel_number', PhoneNumberType::class, [
  501.             //     'required' => true,
  502.             // ])
  503.             // 電話番号
  504.             ->add('guarantor_phone_number'PhoneNumberType::class, [
  505.                 'required' => true,
  506.             ])
  507.             // メールアドレス (半角英数字)
  508.             ->add('guarantor_email'EmailType::class, [
  509.                 'required' => true,
  510.                 'constraints' => [
  511.                     // new Assert\NotBlank(),
  512.                     new Email(nullnull$this->eccubeConfig['eccube_rfc_email_check'] ? 'strict' null),
  513.                 ],
  514.             ])
  515.             // メールアドレス確認用 (半角英数字)
  516.             ->add('guarantor_email_confirm'EmailType::class, [
  517.                 'required' => true,
  518.                 'constraints' => [
  519.                     // new Assert\NotBlank(),
  520.                     new Email(nullnull$this->eccubeConfig['eccube_rfc_email_check'] ? 'strict' null),
  521.                 ],
  522.             ])
  523.             // 契約者との続柄
  524.             ->add('guarantor_relation'TextType::class, [
  525.                 'required' => true,
  526.             ])
  527.             // 職業
  528.             // ->add('guarantor_job', JobType::class, [
  529.             //     'required' => true,
  530.             // ])
  531.             ->add('guarantor_job'ChoiceType::class, [
  532.                 'choices'  => [
  533.                     '選択してください' => '',
  534.                     '公務員' => '公務員',
  535.                     '公的資格者' => '公的資格者',
  536.                     // '会社員(内勤)' => '会社員(内勤)',
  537.                     // '会社員(外勤)' => '会社員(外勤)',
  538.                     '会社員' => '会社員',
  539.                     '自営業' => '自営業',
  540.                     '自由業' => '自由業',
  541.                     '臨時・パート・アルバイト' => '臨時・パート・アルバイト',
  542.                     'その他' => 'その他',
  543.                 ],
  544.                 'expanded' => false,
  545.                 'multiple' => false,
  546.                 'required' => true,
  547.             ])
  548.             // 業種
  549.             ->add('guarantor_industry'ChoiceType::class, [
  550.                 'choices'  => [
  551.                     '選択してください' => '',
  552.                     '公務員' => '公務員',
  553.                     '公的資格者' => '公的資格者',
  554.                     '一次産業' => '一次産業',
  555.                     '鉱業' => '鉱業',
  556.                     '土木・建築' => '土木・建築',
  557.                     '不動産' => '不動産',
  558.                     '金融' => '金融',
  559.                     '運輸・倉庫' => '運輸・倉庫',
  560.                     '製造' => '製造',
  561.                     '卸' => '卸',
  562.                     '小売' => '小売',
  563.                     '情報・通信' => '情報・通信',
  564.                     '旅行宿泊' => '旅行宿泊',
  565.                     'その他サービス' => 'その他サービス',
  566.                     '医療機関' => '医療機関',
  567.                     '組合団体' => '組合団体',
  568.                     '施設・期間' => '施設・期間',
  569.                     '個人業' => '個人業',
  570.                     'その他' => 'その他',
  571.                 ],
  572.                 'expanded' => false,
  573.                 'multiple' => false,
  574.                 'required' => true,
  575.             ])
  576.             // お勤め先(派遣元)
  577.             ->add('guarantor_company'TextType::class, [
  578.                 'required' => true,
  579.             ])
  580.             // お勤め先フリガナ
  581.             ->add('guarantor_company_kana'TextType::class, [
  582.                 'required' => true,
  583.             ])
  584.             // お勤め先住所 郵便番号
  585.             ->add('guarantor_company_postal_code'PostalType::class, [
  586.                 'required' => true,
  587.             ])
  588.             // お勤め先住所
  589.             // ->add('guarantor_company_address', AddressType::class, [
  590.             //     'required' => true,
  591.             // ])
  592.             ->add('guarantor_company_address_pref'PrefType::class, [
  593.                 'required' => true,
  594.             ])
  595.             ->add('guarantor_company_address_addr01'TextType::class, [
  596.                 'required' => true,
  597.             ])
  598.             ->add('guarantor_company_address_addr02'TextType::class, [
  599.                 'required' => false,
  600.             ])
  601.             // お勤め先電話番号
  602.             ->add('guarantor_company_phone_number'PhoneNumberType::class, [
  603.                 'required' => true,
  604.             ])
  605.             // 勤続年数(年)
  606.             ->add('guarantor_year'TextType::class, [
  607.                 'required' => true,
  608.             ])
  609.             // 勤続年数(月)
  610.             ->add('guarantor_month'TextType::class, [
  611.                 'required' => true,
  612.             ])
  613.             // 税込年収
  614.             ->add('guarantor_income'TextType::class, [
  615.                 'required' => true,
  616.             ])
  617.             // 従業員数
  618.             ->add('guarantor_cnt'ChoiceType::class, [
  619.                 'choices'  => [
  620.                     '10人未満' => '10人未満'//TODO: ???
  621.                     '10人以上20人未満' => '10人以上20人未満',
  622.                     '20人以上' => '20人以上',
  623.                 ],
  624.                 'expanded' => false,
  625.                 'multiple' => false,
  626.                 'required' => true,
  627.             ])
  628.             // 出向先・派遣先電話番号
  629.             ->add('guarantor_company_phone_number2'PhoneNumberType::class, [
  630.                 'required' => false,
  631.             ])
  632.         ;
  633.         // 工事項目
  634.         $builder
  635.             ->add('express_tickets_price'HiddenType::class, [])
  636.             ->add('construction_air'HiddenType::class, [])
  637.             ->add('construction_6'NumberType::class, [])
  638.             ->add('construction_16'NumberType::class, [])
  639.             ->add('construction_23'NumberType::class, [])
  640.             ->add('number_install'HiddenType::class, [])
  641.             ->add('number_install_price'HiddenType::class, [])
  642.             ->add('construction_type_07_02_v1_price'HiddenType::class, [])
  643.             ->add('construction_type_07_03_v2_price'HiddenType::class, [])
  644.             ->add('construction_type_07_04_v1_price'HiddenType::class, [])
  645.             ->add('construction_type_07_04_v2_price'HiddenType::class, [])
  646.             ->add('construction_type_07_04_v3_price'HiddenType::class, [])
  647.             ->add('elevator_07_price'HiddenType::class, [])
  648.             ->add('electrical_outlet_07_price'HiddenType::class, [])
  649.             ->add('electrical_outlet_07_02_price'HiddenType::class, [])
  650.             ->add('room_size_07_03_v1_price'HiddenType::class, [])
  651.             ->add('room_size_07_03_v2_price'HiddenType::class, [])
  652.             ->add('piping_status_07_02_price'HiddenType::class, [])
  653.             ->add('indoor_cover_07_price'HiddenType::class, [])
  654.             ->add('outdoor_cover_02_price'HiddenType::class, [])
  655.             ->add('construction_outdoor_07_price'HiddenType::class, [])
  656.             ->add('construction_method_07_v1_price'HiddenType::class, [])
  657.             ->add('construction_method_07_v2_price'HiddenType::class, [])
  658.             ->add('construction_base_price_1'HiddenType::class, [])
  659.             ->add('construction_base_price_2'HiddenType::class, [])
  660.             ->add('construction_base_price_3'HiddenType::class, [])
  661.             ->add('construction_total_price'HiddenType::class, [])
  662.             ->add('construction_discount'HiddenType::class, [])
  663.             ->add('product_total_price'HiddenType::class, [])
  664.             //希望する工事
  665.             ->add('desired_construction_work'ChoiceType::class, [
  666.                 'choices'  => [
  667.                     'エアコン本体のみ購入の方' => 'エアコン本体のみ購入の方',
  668.                     'エアコン本体と設置工事をご希望の方' => 'エアコン本体と設置工事をご希望の方',
  669.                 ],
  670.                 'expanded' => true,
  671.                 'multiple' => false,
  672.                 'required' => false,
  673.             ])
  674.             //希望する工事 → エアコン本体と設置工事をご希望の方
  675.             ->add('desired_construction_work_02'ChoiceType::class, [
  676.                 'choices'  => [
  677.                     '最終金額算出' => '最終金額算出',
  678.                     '新居等への引越しのため設置場所の詳細確認不可' => '新居等への引越しのため設置場所の詳細確認不可',
  679.                 ],
  680.                 'expanded' => true,
  681.                 'multiple' => false,
  682.                 'required' => false,
  683.             ])
  684.             // 特急券の購入
  685.             ->add('express_tickets'ChoiceType::class, [
  686.                 'choices'  => [
  687.                     'する' => 'する',
  688.                     'しない' => 'しない',
  689.                 ],
  690.                 'expanded' => true,
  691.                 'multiple' => false,
  692.                 'required' => false,
  693.                 'choice_attr' => function($choice$key$value) {
  694.                     if ($choice === 'する') {
  695.                         return ['price' => 5500];
  696.                     } elseif ($choice === 'しない') {
  697.                         return ['price' => 0];
  698.                     }
  699.                     return [];
  700.                 },
  701.             ])
  702.             // お住まい
  703.             ->add('osumai'ChoiceType::class, [
  704.                 'choices'  => [
  705.                     '一戸建て' => '一戸建て',
  706.                     '集合住宅' => '集合住宅',
  707.                 ],
  708.                 'expanded' => true,
  709.                 'multiple' => false,
  710.                 'required' => false,
  711.             ])
  712.             // 建物の所有
  713.             ->add('building_ownership'ChoiceType::class, [
  714.                 'choices'  => [
  715.                     '持ち家' => '持ち家',
  716.                     '賃貸' => '賃貸',
  717.                 ],
  718.                 'expanded' => true,
  719.                 'multiple' => false,
  720.                 'required' => false,
  721.             ])
  722.             // 構造
  723.             ->add('structure'ChoiceType::class, [
  724.                 'choices'  => [
  725.                     '木造' => '木造',
  726.                     '鉄骨' => '鉄骨',
  727.                     'コンクリート(RC)' => 'コンクリート(RC)',
  728.                     'その他' => 'その他',
  729.                     '不明' => '不明',
  730.                 ],
  731.                 'expanded' => true,
  732.                 'multiple' => false,
  733.                 'required' => false,
  734.             ])
  735.             // // 設置台数
  736.             // ->add('number_install', ChoiceType::class, [
  737.             //     'choices'  => [
  738.             //         '1台' => '1台',
  739.             //         '2台' => '2台',
  740.             //         '3台' => '3台',
  741.             //         '4台以上' => '4台以上',
  742.             //     ],
  743.             //     'expanded' => true,
  744.             //     'multiple' => false,
  745.             //     'required' => false,
  746.             //     'choice_attr' => function($choice, $key, $value) {
  747.             //         if ($choice === '1台') {
  748.             //             return ['percent' => 0];
  749.             //         } elseif ($choice === '2台') {
  750.             //             return ['percent' => 0.05];
  751.             //         } elseif ($choice === '3台') {
  752.             //             return ['percent' => 0.1];
  753.             //         } elseif ($choice === '4台以上') {
  754.             //             return ['percent' => 0.15];
  755.             //         }
  756.             //         return [];
  757.             //     },
  758.             // ])            
  759.             //工事希望日1
  760.             ->add('construction_date_1'DateType::class, [
  761.                 'required' => false,
  762.                 'input' => 'datetime',
  763.                 'widget' => 'single_text',
  764.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  765.             ])
  766.             //工事希望日2
  767.             ->add('construction_date_2'DateType::class, [
  768.                 'required' => false,
  769.                 'input' => 'datetime',
  770.                 'widget' => 'single_text',
  771.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  772.             ])
  773.             //工事希望日3
  774.             ->add('construction_date_3'DateType::class, [
  775.                 'required' => false,
  776.                 'input' => 'datetime',
  777.                 'widget' => 'single_text',
  778.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  779.             ])
  780.             // 希望時間帯_1
  781.             ->add('time_slot_1'ChoiceType::class, [
  782.                 'choices'  => [
  783.                     '午前' => '午前',
  784.                     '午後' => '午後',
  785.                 ],
  786.                 'expanded' => true,
  787.                 'multiple' => false,
  788.                 'required' => false,
  789.             ])
  790.             // 希望時間帯_2
  791.             ->add('time_slot_2'ChoiceType::class, [
  792.                 'choices'  => [
  793.                     '午前' => '午前',
  794.                     '午後' => '午後',
  795.                 ],
  796.                 'expanded' => true,
  797.                 'multiple' => false,
  798.                 'required' => false,
  799.             ])
  800.             // 希望時間帯_3
  801.             ->add('time_slot_3'ChoiceType::class, [
  802.                 'choices'  => [
  803.                     '午前' => '午前',
  804.                     '午後' => '午後',
  805.                 ],
  806.                 'expanded' => true,
  807.                 'multiple' => false,
  808.                 'required' => false,
  809.             ])
  810.             //その他希望
  811.             ->add('contents'TextareaType::class, [
  812.                 'required' => false,
  813.                 'constraints' => [
  814.                     // new Assert\NotBlank(),
  815.                     new Assert\Length([
  816.                         'max' => $this->eccubeConfig['eccube_lltext_len'],
  817.                     ])
  818.                 ],
  819.             ])
  820.             // 工事内訳
  821.             ->add('construction_type_07'ChoiceType::class, [
  822.                 'choices'  => [
  823.                     '新設' => '新設',
  824.                     '交換' => '交換',
  825.                     '新設工事に加えて移設工事も希望' => '新設工事に加えて移設工事も希望',
  826.                 ],
  827.                 'expanded' => true,
  828.                 'multiple' => false,
  829.                 'required' => false,
  830.             ])
  831.             // 工事内訳 → 交換
  832.             ->add('construction_type_07_02_v1'ChoiceType::class, [
  833.                 'choices'  => [
  834.                     '処分を希望する(リサイクル&収集運搬費)' => '処分を希望する(リサイクル&収集運搬費)',
  835.                     '処分を希望しない' => '処分を希望しない',
  836.                 ],
  837.                 'expanded' => true,
  838.                 'multiple' => false,
  839.                 'required' => false,
  840.                 'choice_attr' => function($choice$key$value) {
  841.                     if ($choice === '処分を希望する(リサイクル&収集運搬費)') {
  842.                         return ['price' => 7180];
  843.                     } elseif ($choice === '処分を希望しない') {
  844.                         return ['price' => 5980];
  845.                     }
  846.                     return [];
  847.                 },
  848.             ])
  849.             // 工事内訳 → 新設工事に加えて移設工事も希望
  850.             ->add('construction_type_07_02_v2'ChoiceType::class, [
  851.                 'choices'  => [
  852.                     '分解洗浄を希望する' => '分解洗浄を希望する',
  853.                     '分解洗浄を希望しない' => '分解洗浄を希望しない',
  854.                 ],
  855.                 'expanded' => true,
  856.                 'multiple' => false,
  857.                 'required' => false,
  858.             ])
  859.             // 工事内訳 → 新設工事に加えて移設工事も希望 → 分解洗浄を希望する
  860.             ->add('construction_type_07_03_v1'ChoiceType::class, [
  861.                 'choices'  => [
  862.                     '移設6~14畳(取外し含む)' => '移設6~14畳(取外し含む)',
  863.                     '移設16~20畳(取外し含む)' => '移設16~20畳(取外し含む)',
  864.                     '移設23畳~(取外し含む)' => '移設23畳~(取外し含む)',
  865.                 ],
  866.                 'expanded' => true,
  867.                 'multiple' => false,
  868.                 'required' => false,
  869.             ])
  870.             // 工事内訳 → 新設工事に加えて移設工事も希望 → 分解洗浄を希望しない
  871.             ->add('construction_type_07_03_v2'ChoiceType::class, [
  872.                 'choices'  => [
  873.                     '移設6~14畳(取外し含む)' => '移設6~14畳(取外し含む)',
  874.                     '移設16~20畳(取外し含む)' => '移設16~20畳(取外し含む)',
  875.                     '移設23畳~(取外し含む)' => '移設23畳~(取外し含む)',
  876.                 ],
  877.                 'expanded' => true,
  878.                 'multiple' => false,
  879.                 'required' => false,
  880.                 'choice_attr' => function($choice$key$value) {
  881.                     if ($choice === '移設6~14畳(取外し含む)') {
  882.                         return ['price' => 24980];
  883.                     } elseif ($choice === '移設16~20畳(取外し含む)') {
  884.                         return ['price' => 28980];
  885.                     } elseif ($choice === '移設23畳~(取外し含む)') {
  886.                         return ['price' => 32980];
  887.                     }
  888.                     return [];
  889.                 },
  890.             ])
  891.             // 工事内訳 → 新設工事に加えて移設工事も希望 → 分解洗浄を希望する → 移設6~14畳(取外し含む)
  892.             ->add('construction_type_07_04_v1'ChoiceType::class, [
  893.                 'choices'  => [
  894.                     '掃除機能付き' => '掃除機能付き',
  895.                     '掃除機能なし' => '掃除機能なし',
  896.                 ],
  897.                 'expanded' => true,
  898.                 'multiple' => false,
  899.                 'required' => false,
  900.                 'choice_attr' => function($choice$key$value) {
  901.                     if ($choice === '掃除機能付き') {
  902.                         return ['price' => 50980];
  903.                     } elseif ($choice === '掃除機能なし') {
  904.                         return ['price' => 47980];
  905.                     }
  906.                     return [];
  907.                 },
  908.             ])
  909.             // 工事内訳 → 新設工事に加えて移設工事も希望 → 分解洗浄を希望する → 移設16~20畳(取外し含む)
  910.             ->add('construction_type_07_04_v2'ChoiceType::class, [
  911.                 'choices'  => [
  912.                     '掃除機能付き' => '掃除機能付き',
  913.                     '掃除機能なし' => '掃除機能なし',
  914.                 ],
  915.                 'expanded' => true,
  916.                 'multiple' => false,
  917.                 'required' => false,
  918.                 'choice_attr' => function($choice$key$value) {
  919.                     if ($choice === '掃除機能付き') {
  920.                         return ['price' => 54980];
  921.                     } elseif ($choice === '掃除機能なし') {
  922.                         return ['price' => 51980];
  923.                     }
  924.                     return [];
  925.                 },
  926.             ])
  927.             // 工事内訳 → 新設工事に加えて移設工事も希望 → 分解洗浄を希望する → 移設23畳~(取外し含む)
  928.             ->add('construction_type_07_04_v3'ChoiceType::class, [
  929.                 'choices'  => [
  930.                     '掃除機能付き' => '掃除機能付き',
  931.                     '掃除機能なし' => '掃除機能なし',
  932.                 ],
  933.                 'expanded' => true,
  934.                 'multiple' => false,
  935.                 'required' => false,
  936.                 'choice_attr' => function($choice$key$value) {
  937.                     if ($choice === '掃除機能付き') {
  938.                         return ['price' => 58980];
  939.                     } elseif ($choice === '掃除機能なし') {
  940.                         return ['price' => 55980];
  941.                     }
  942.                     return [];
  943.                 },
  944.             ])
  945.             // エアコン設置場所
  946.             ->add('construction_floor_07'ChoiceType::class, [
  947.                 'choices'  => [
  948.                     '1階' => '1階',
  949.                     '2階' => '2階',
  950.                     '3階' => '3階',
  951.                     '4階以上' => '4階以上',
  952.                     '未定' => '未定',
  953.                 ],
  954.                 'expanded' => true,
  955.                 'multiple' => false,
  956.                 'required' => false,
  957.             ])
  958.             // エレベーターの有無
  959.             ->add('elevator_07'ChoiceType::class, [
  960.                 'choices'  => [
  961.                     'あり' => 'あり',
  962.                     'なし(新設)' => 'なし(新設)',
  963.                     'なし(交換)' => 'なし(交換)',
  964.                 ],
  965.                 'expanded' => true,
  966.                 'multiple' => false,
  967.                 'required' => false,
  968.                 'choice_attr' => function($choice$key$value) {
  969.                     if ($choice === 'あり') {
  970.                         return ['price' => 0];
  971.                     } elseif ($choice === 'なし(新設)') {
  972.                         return ['price' => 5980];
  973.                     } elseif ($choice === 'なし(交換)') {
  974.                         return ['price' => 11980];
  975.                     }
  976.                     return [];
  977.                 },
  978.             ])
  979.             // コンセントの有無
  980.             ->add('electrical_outlet_07'ChoiceType::class, [
  981.                 'choices'  => [
  982.                     'あり' => 'あり',
  983.                     'なし(別途工事が必要になります)' => 'なし(別途工事が必要になります)',
  984.                     '不明' => '不明',
  985.                 ],
  986.                 'expanded' => true,
  987.                 'multiple' => false,
  988.                 'required' => false,
  989.                 'choice_attr' => function($choice$key$value) {
  990.                     if ($choice === 'なし(別途工事が必要になります)') {
  991.                         return ['price' => 16980];
  992.                     }
  993.                     return [];
  994.                 },
  995.             ])
  996.             // コンセントの有無 → あり
  997.             ->add('electrical_outlet_07_02'ChoiceType::class, [
  998.                 'choices'  => [
  999.                     '既存コンセントの延長の有' => '既存コンセントの延長の有',
  1000.                     '既存コンセントの延長の無' => '既存コンセントの延長の無',
  1001.                     '不明' => '不明',
  1002.                 ],
  1003.                 'expanded' => true,
  1004.                 'multiple' => false,
  1005.                 'required' => false,
  1006.                 'choice_attr' => function($choice$key$value) {
  1007.                     if ($choice === '既存コンセントの延長の有') {
  1008.                         return ['price' => 3980];
  1009.                     } elseif ($choice === '既存コンセントの延長の無') {
  1010.                         return ['price' => 0];
  1011.                     }
  1012.                     return [];
  1013.                 },
  1014.             ])
  1015.             // 建物の契約アンペア
  1016.             ->add('contract_amp'ChoiceType::class, [
  1017.                 'choices'  => [
  1018.                     '30A' => '30A',
  1019.                     '40A' => '40A',
  1020.                     '50A' => '50A',
  1021.                     '50A以上' => '50A以上',
  1022.                     '不明' => '不明',
  1023.                 ],
  1024.                 'expanded' => true,
  1025.                 'multiple' => false,
  1026.                 'required' => false,
  1027.             ])
  1028.             // コンセントアース端子
  1029.             ->add('outlet_earth'ChoiceType::class, [
  1030.                 'choices'  => [
  1031.                     'あり' => 'あり',
  1032.                     'なし' => 'なし',
  1033.                     '不明' => '不明',
  1034.                 ],
  1035.                 'expanded' => true,
  1036.                 'multiple' => false,
  1037.                 'required' => false,
  1038.             ])
  1039.             // 配管穴の有無
  1040.             ->add('room_size_07'ChoiceType::class, [
  1041.                 'choices'  => [
  1042.                     'あり' => 'あり',
  1043.                     'なし' => 'なし',
  1044.                     '不明' => '不明',
  1045.                 ],
  1046.                 'expanded' => true,
  1047.                 'multiple' => false,
  1048.                 'required' => false,
  1049.             ])
  1050.             // 配管穴の有無 → なし
  1051.             ->add('room_size_07_02'ChoiceType::class, [
  1052.                 'choices'  => [
  1053.                     '建物が2009年6月以降に着工した証明書あり' => '建物が2009年6月以降に着工した証明書あり',
  1054.                     '建物が2009年6月以降に着工した証明書なし' => '建物が2009年6月以降に着工した証明書なし',
  1055.                 ],
  1056.                 'expanded' => true,
  1057.                 'multiple' => false,
  1058.                 'required' => false,
  1059.             ])
  1060.             // 配管穴の有無 → なし → 建物が2009年6月以降に着工した証明書あり
  1061.             ->add('room_size_07_03_v1'ChoiceType::class, [
  1062.                 'choices'  => [
  1063.                     '木造' => '木造',
  1064.                     'コンクリート' => 'コンクリート',
  1065.                     '鉄骨系(ALC)' => '鉄骨系(ALC)',
  1066.                     'その他' => 'その他',
  1067.                     '不明' => '不明',
  1068.                 ],
  1069.                 'expanded' => true,
  1070.                 'multiple' => false,
  1071.                 'required' => false,
  1072.                 'choice_attr' => function($choice$key$value) {
  1073.                     if ($choice === '木造') {
  1074.                         return ['price' => 7980];
  1075.                     } elseif ($choice === 'コンクリート') {
  1076.                         return ['price' => 39980];
  1077.                     } elseif ($choice === '鉄骨系(ALC)') {
  1078.                         return ['price' => 7980];
  1079.                     }
  1080.                     return [];
  1081.                 },
  1082.             ])
  1083.             // 配管穴の有無 → なし → 建物が2009年6月以降に着工した証明書なし
  1084.             ->add('room_size_07_03_v2'ChoiceType::class, [
  1085.                 'choices'  => [
  1086.                     '木造' => '木造',
  1087.                     'コンクリート' => 'コンクリート',
  1088.                     '鉄骨系(ALC)' => '鉄骨系(ALC)',
  1089.                     'その他' => 'その他',
  1090.                     '不明' => '不明',
  1091.                 ],
  1092.                 'expanded' => true,
  1093.                 'multiple' => false,
  1094.                 'required' => false,
  1095.                 'choice_attr' => function($choice$key$value) {
  1096.                     if ($choice === '木造') {
  1097.                         return ['price' => 34980];
  1098.                     } elseif ($choice === 'コンクリート') {
  1099.                         return ['price' => 74980];
  1100.                     } elseif ($choice === '鉄骨系(ALC)') {
  1101.                         return ['price' => 34980];
  1102.                     }
  1103.                     return [];
  1104.                 },
  1105.             ])
  1106.             //設置予定場所の配管の状態
  1107.             ->add('piping_status_07'ChoiceType::class, [
  1108.                 'choices'  => [
  1109.                     '通常配管' => '通常配管',
  1110.                     '隠蔽配管' => '隠蔽配管',
  1111.                     '不明' => '不明',
  1112.                 ],
  1113.                 'expanded' => true,
  1114.                 'multiple' => false,
  1115.                 'required' => false,
  1116.             ])
  1117.             // 設置予定場所の配管の状態 → 隠蔽配管
  1118.             ->add('piping_status_07_02'ChoiceType::class, [
  1119.                 'choices'  => [
  1120.                     '新設' => '新設',
  1121.                     '交換(再使用接続・洗浄費含む)' => '交換(再使用接続・洗浄費含む)',
  1122.                 ],
  1123.                 'expanded' => true,
  1124.                 'multiple' => false,
  1125.                 'required' => false,
  1126.                 'choice_attr' =>  function($choice$key$value) {
  1127.                     if ($choice === '新設') {
  1128.                         return ['price' => 9800];
  1129.                     } elseif ($choice === '交換(再使用接続・洗浄費含む)') {
  1130.                         return ['price' => 49800];
  1131.                     }
  1132.                     return [];
  1133.                 },
  1134.             ])
  1135.             //室内化粧カバー
  1136.             ->add('indoor_cover_07'ChoiceType::class, [
  1137.                 'choices'  => [
  1138.                     '必要(2m以内)' => '必要(2m以内)',
  1139.                     '不要' => '不要',
  1140.                     '未定' => '未定',
  1141.                 ],
  1142.                 'expanded' => true,
  1143.                 'multiple' => false,
  1144.                 'required' => false,
  1145.                 'choice_attr' =>  function($choice$key$value) {
  1146.                     if ($choice === '必要(2m以内)') {
  1147.                         return ['price' => 9980];
  1148.                     }
  1149.                     return [];
  1150.                 },
  1151.             ])
  1152.             // 室外化粧カバー
  1153.             ->add('outdoor_cover'ChoiceType::class, [
  1154.                 'choices'  => [
  1155.                     '必要' => '必要',
  1156.                     '不要' => '不要',
  1157.                     'その他' => 'その他',
  1158.                 ],
  1159.                 'expanded' => true,
  1160.                 'multiple' => false,
  1161.                 'required' => false,
  1162.             ])
  1163.             // 室外化粧カバー
  1164.             ->add('outdoor_cover_02'ChoiceType::class, [
  1165.                 'choices'  => [
  1166.                     '新規同階' => '新規同階',
  1167.                     '新規異階' => '新規異階',
  1168.                     '再使用(交換)同階' => '再使用(交換)同階',
  1169.                     '再使用(交換)異階' => '再使用(交換)異階',
  1170.                 ],
  1171.                 'expanded' => true,
  1172.                 'multiple' => false,
  1173.                 'required' => false,
  1174.                 'choice_attr' =>  function($choice$key$value) {
  1175.                     if ($choice === '新規同階') {
  1176.                         return ['price' => 9980];
  1177.                     } elseif ($choice === '新規異階') {
  1178.                         return ['price' => 44960];
  1179.                     } elseif ($choice === '再使用(交換)同階') {
  1180.                         return ['price' => 3380];
  1181.                     } elseif ($choice === '再使用(交換)異階') {
  1182.                         return ['price' => 19880];
  1183.                     }
  1184.                     return [];
  1185.                 },
  1186.             ])
  1187.             // 室外機の設置場所
  1188.             ->add('construction_outdoor_07'ChoiceType::class, [
  1189.                 'choices'  => [
  1190.                     '室内機と同階' => '室内機と同階',
  1191.                     '1階差(室内機2階、室外機1階)' => '1階差(室内機2階、室外機1階)',
  1192.                     '2階差(室内機3階、室外機1階)' => '2階差(室内機3階、室外機1階)',
  1193.                     'その他' => 'その他',
  1194.                 ],
  1195.                 'expanded' => true,
  1196.                 'multiple' => false,
  1197.                 'required' => false,
  1198.                 'choice_attr' =>  function($choice$key$value) {
  1199.                     if ($choice === '1階差(室内機2階、室外機1階)') {
  1200.                         return ['price' => 33880];
  1201.                     } elseif ($choice === '2階差(室内機3階、室外機1階)') {
  1202.                         return ['price' => 66880];
  1203.                     }
  1204.                     return [];
  1205.                 },
  1206.             ])
  1207.             //設置方法
  1208.             ->add('setting_install_method'ChoiceType::class, [
  1209.                 'choices'  => [
  1210.                     '新規取付' => '新規取付',
  1211.                     '交換' => '交換',
  1212.                 ],
  1213.                 'expanded' => true,
  1214.                 'multiple' => false,
  1215.                 'required' => false,
  1216.             ])
  1217.             // 設置方法 → 新規取付
  1218.             ->add('construction_method_07_v1'ChoiceType::class, [
  1219.                 'choices'  => [
  1220.                     '①床置き(基本料金に含まれます)' => '①床置き(基本料金に含まれます)',
  1221.                     '②二段置き' => '②二段置き',
  1222.                     '③壁掛け' => '③壁掛け',
  1223.                     '④屋根置き(屋根に対して垂直)' => '④屋根置き(屋根に対して垂直)',
  1224.                     '⑤屋根置き(屋根に対して水平)' => '⑤屋根置き(屋根に対して水平)',
  1225.                     '⑥公団吊り(天井吊り)' => '⑥公団吊り(天井吊り)',
  1226.                     '⑦サービスバルコニー' => '⑦サービスバルコニー',
  1227.                     '⑧不明(記載)' => '⑧不明(記載)',
  1228.                 ],
  1229.                 'expanded' => true,
  1230.                 'multiple' => false,
  1231.                 'required' => false,
  1232.                 'choice_attr' =>  function($choice$key$value) {
  1233.                     if ($choice === '②二段置き') {
  1234.                         return ['price' => 29800];
  1235.                     } elseif ($choice === '③壁掛け') {
  1236.                         return ['price' => 17800];
  1237.                     } elseif ($choice === '④屋根置き(屋根に対して垂直)') {
  1238.                         return ['price' => 21980];
  1239.                     } elseif ($choice === '⑤屋根置き(屋根に対して水平)') {
  1240.                         return ['price' => 21980];
  1241.                     } elseif ($choice === '⑥公団吊り(天井吊り)') {
  1242.                         return ['price' => 28800];
  1243.                     } elseif ($choice === '⑦サービスバルコニー') {
  1244.                         return ['price' => 7980];
  1245.                     }
  1246.                     return [];
  1247.                 },
  1248.             ])
  1249.             // 設置方法 → 交換
  1250.             ->add('construction_method_07_v2'ChoiceType::class, [
  1251.                 'choices'  => [
  1252.                     '①床置き(基本料金に含まれます)' => '①床置き(基本料金に含まれます)',
  1253.                     '②二段置き' => '②二段置き',
  1254.                     '③壁掛け' => '③壁掛け',
  1255.                     '④屋根置き(屋根に対して垂直)' => '④屋根置き(屋根に対して垂直)',
  1256.                     '⑤屋根置き(屋根に対して水平)' => '⑤屋根置き(屋根に対して水平)',
  1257.                     '⑥公団吊り(天井吊り)' => '⑥公団吊り(天井吊り)',
  1258.                     '⑦サービスバルコニー' => '⑦サービスバルコニー',
  1259.                     '⑧不明(記載)' => '⑧不明(記載)',
  1260.                 ],
  1261.                 'expanded' => true,
  1262.                 'multiple' => false,
  1263.                 'required' => false,
  1264.                 'choice_attr' =>  function($choice$key$value) {
  1265.                     if ($choice === '②二段置き') {
  1266.                         return ['price' => 7280];
  1267.                     } elseif ($choice === '③壁掛け') {
  1268.                         return ['price' => 21800];
  1269.                     } elseif ($choice === '④屋根置き(屋根に対して垂直)') {
  1270.                         return ['price' => 21980];
  1271.                     } elseif ($choice === '⑤屋根置き(屋根に対して水平)') {
  1272.                         return ['price' => 21980];
  1273.                     } elseif ($choice === '⑥公団吊り(天井吊り)') {
  1274.                         return ['price' => 21800];
  1275.                     } elseif ($choice === '⑦サービスバルコニー') {
  1276.                         return ['price' => 7980];
  1277.                     }
  1278.                     return [];
  1279.                 },
  1280.             ])
  1281.             ->add('image_1'FileType::class, [
  1282.                 'multiple' => false,
  1283.                 'required' => false,
  1284.                 'mapped' => false,
  1285.             ])
  1286.             ->add('image_2'FileType::class, [
  1287.                 'multiple' => false,
  1288.                 'required' => false,
  1289.                 'mapped' => false,
  1290.             ])
  1291.             ->add('image_3'FileType::class, [
  1292.                 'multiple' => false,
  1293.                 'required' => false,
  1294.                 'mapped' => false,
  1295.             ])
  1296.             ->add('image_4'FileType::class, [
  1297.                 'multiple' => false,
  1298.                 'required' => false,
  1299.                 'mapped' => false,
  1300.             ])
  1301.             ->add('image_5'FileType::class, [
  1302.                 'multiple' => false,
  1303.                 'required' => false,
  1304.                 'mapped' => false,
  1305.             ])
  1306.             ->add('image_reason'FileType::class, [
  1307.                 'multiple' => false,
  1308.                 'required' => false,
  1309.                 'mapped' => false,
  1310.             ])
  1311.             ->add('filename_image_1'HiddenType::class)
  1312.             ->add('filename_image_2'HiddenType::class)
  1313.             ->add('filename_image_3'HiddenType::class)
  1314.             ->add('filename_image_4'HiddenType::class)
  1315.             ->add('filename_image_5'HiddenType::class)
  1316.             ->add('location'TextType::class, [
  1317.                 'required' => false,
  1318.             ])
  1319.             ->add('floor'FileType::class, [
  1320.                 'multiple' => false,
  1321.                 'required' => false,
  1322.                 'mapped' => false,
  1323.             ])
  1324.             ->add('filename_floor'HiddenType::class)
  1325.         ;
  1326.         $builder->get('address')->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
  1327.             $form $event->getForm();
  1328.             $form->add('addr02', \Symfony\Component\Form\Extension\Core\Type\TextType::class, [
  1329.                 'required' => false,
  1330.             ]);
  1331.         });
  1332.         // 自社ローン商品を取得
  1333.         $constructionItems = array();
  1334.         $constructionTatamis = array();
  1335.         $Category $this->categoryRepository->find(118);
  1336.         foreach ($Category->getProductCategories() as $productCategorie) {
  1337.             $product $productCategorie->getProduct();
  1338.             $productId $product->getId();
  1339.             $productName $product->getName();
  1340.             $constructionItems[$productId] = $productName;
  1341.             $constructionTatamis[$productId]['data-loan'] = 1;
  1342.             $constructionTatamis[$productId]['data-price'] = $product->getPrice02IncTaxMin();
  1343.             $constructionTatamis[$productId]['data-quantity'] = 1;
  1344.             foreach ($product->getProductCategories() as $ProductCategories) {
  1345.                 $categoryName $ProductCategories->getCategory()->getName();
  1346.                 if (mb_strpos($categoryName"畳") !== false) {
  1347.                     $constructionItems[$productId] = $productName {$categoryName}";
  1348.                     $constructionTatamis[$productId]['data-tatami'] = str_replace("畳"""$categoryName);
  1349.                 }
  1350.             }
  1351.         }       
  1352.         $builder->add('construction_airs'ChoiceType::class, [
  1353.             'choices'  => $constructionItems,
  1354.             'expanded' => true,
  1355.             'multiple' => true,
  1356.             'required' => false,
  1357.             'choice_attr' =>  function($choice$key$value) use ($constructionTatamis){   
  1358.                 return empty($constructionTatamis[$key]) ? [] : $constructionTatamis[$key];
  1359.             },
  1360.         ]);
  1361.         /**
  1362.          * SUBMIT前にファイルをアップロードしてfilenameにセットする
  1363.          */
  1364.         $builder->addEventListener(FormEvents::PRE_SUBMIT, function(FormEvent $event) {
  1365.             $data $event->getData();
  1366.             // ファイルをアップロード
  1367.             if (!empty($data['image_1'])) {
  1368.                 $filename $this->fileUploader->upload($data['image_1'], 'construction');
  1369.                 $data['filename_image_1'] = $filename;
  1370.                 unset($data['image_1']);
  1371.             }
  1372.             if (!empty($data['image_2'])) {
  1373.                 $filename $this->fileUploader->upload($data['image_2'], 'construction');
  1374.                 $data['filename_image_2'] = $filename;
  1375.                 unset($data['image_2']);
  1376.             }
  1377.             if (!empty($data['image_3'])) {
  1378.                 $filename $this->fileUploader->upload($data['image_3'], 'construction');
  1379.                 $data['filename_image_3'] = $filename;
  1380.                 unset($data['image_3']);
  1381.             }
  1382.             if (!empty($data['image_4'])) {
  1383.                 $filename $this->fileUploader->upload($data['image_4'], 'construction');
  1384.                 $data['filename_image_4'] = $filename;
  1385.                 unset($data['image_4']);
  1386.             }
  1387.             if (!empty($data['image_5'])) {
  1388.                 $filename $this->fileUploader->upload($data['image_5'], 'construction');
  1389.                 $data['filename_image_5'] = $filename;
  1390.                 unset($data['image_5']);
  1391.             }
  1392.             if (!empty($data['floor'])) {
  1393.                 $filename $this->fileUploader->upload($data['floor'], 'construction');
  1394.                 $data['filename_floor'] = $filename;
  1395.                 unset($data['floor']);
  1396.             }
  1397.             // アップロードしたデータを保存
  1398.             $event->setData($data);
  1399.         });
  1400.     }
  1401.     /**
  1402.      * {@inheritdoc}
  1403.      */
  1404.     public function getBlockPrefix()
  1405.     {
  1406.         return 'loan';
  1407.     }
  1408. }