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