{#
* Plugin Name : ProductOption
*
* Copyright (C) BraTech Co., Ltd. All Rights Reserved.
* http://www.bratech.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
#}
{% if Product.ProductOptions %}
{% for ProductOption in Product.ProductOptions %}
{% set value = 'productoption' ~ ProductOption.Option.id %}
{# ラジオボタン #}
{% if ProductOption.Option.type == constant('Plugin\\ProductOption42\\Entity\\Option::RADIO_TYPE') %}
<tr class="ec-blockRadio">
<th class="option_Label">
<label for="productoption{{ ProductOption.Option.id }}">{{ form[value].vars.label }}</label>
{# {{ ProductOption.Option.name }} #}
</th>
<td>
{% if ProductOption.Option.description_flg == constant('Plugin\\ProductOption42\\Entity\\Option::DISP_ON') %}
{# <a href="?" id="option_description_link_{{ Product.id }}_{{ ProductOption.Option.id }}" data="{{ Product.id }}"><span class="ec-link ec-font-size-2">{{'productoption.product.option.description.title'|trans}}</span></a> #}
<p class="mod-form-description">{{ ProductOption.Option.description }}</p>
{% endif %}
{# {{ form_widget(form[value]) }} #}
<div id="{{ value }}">
{% for key, child in form[value] %}
<div style="display: block;">
{% set OptionCategory = form[value].vars.choices[key].data %}
{{ form_widget(child) }}
{% if OptionCategory.OptionImages is not null %}
{% for OptionImage in OptionCategory.OptionImages %}
<div class="option-img"><img src="{{ asset(OptionImage.file_name, 'save_image') }}" class="imgFit"></div>
{% endfor %}
{% endif %}
</div>
{% endfor %}
</div>
</td>
</tr>
{# チェックボックス #}
{% elseif ProductOption.Option.type == constant('Plugin\\ProductOption42\\Entity\\Option::CHECKBOX_TYPE')%}
<tr class="ec-checkbox">
<th class="option_Label">
<label for="productoption{{ ProductOption.Option.id }}">{{ form[value].vars.label }}</label>
{# {{ ProductOption.Option.name }} #}
</th>
<td>
{% if ProductOption.Option.description_flg == constant('Plugin\\ProductOption42\\Entity\\Option::DISP_ON') %}
{# <a href="?" id="option_description_link_{{ Product.id }}_{{ ProductOption.Option.id }}" data="{{ Product.id }}"><span class="ec-link ec-font-size-2">{{'productoption.product.option.description.title'|trans}}</span></a> #}
<p class="mod-form-description">{{ ProductOption.Option.description }}</p>
{% endif %}
{{ form_widget(form[value]) }}
</td>
</tr>
{# プルダウンタイプ #}
{% elseif ProductOption.Option.type == constant('Plugin\\ProductOption42\\Entity\\Option::SELECT_TYPE')%}
<tr class="ec-select">
<th class="option_Label">
{{ form_label(form[value]) }}
{{ ProductOption.Option.name }}
</th>
<td {% if form[value].vars.errors is not empty %}class="has-error"{% endif %}>
{% if ProductOption.Option.description_flg == constant('Plugin\\ProductOption42\\Entity\\Option::DISP_ON') %}
{# <a href="?" id="option_description_link_{{ Product.id }}_{{ ProductOption.Option.id }}" data="{{ Product.id }}"><span class="ec-link ec-font-size-2">{{'productoption.product.option.description.title'|trans}}</span></a> #}
<p class="mod-form-description">{{ ProductOption.Option.description }}</p>
{% endif %}
{{ form_widget(form[value], {'attr': {'class': 'mod-form-select'}}) }}
{{ form_errors(form[value]) }}
</td>
</tr>
{# 数値入力タイプ #}
{% elseif ProductOption.Option.type == constant('Plugin\\ProductOption42\\Entity\\Option::NUMBER_TYPE') %}
<tr class="ec-numberInput">
<th class="option_Label">
{{ form_label(form[value]) }}
{{ ProductOption.Option.name }}
</th>
<td {% if form[value].vars.errors is not empty %}class="has-error"{% endif %}>
{% if ProductOption.Option.description_flg == constant('Plugin\\ProductOption42\\Entity\\Option::DISP_ON') %}
{# <a href="?" id="option_description_link_{{ Product.id }}_{{ ProductOption.Option.id }}" data="{{ Product.id }}"><span class="ec-link ec-font-size-2">{{'productoption.product.option.description.title'|trans}}</span></a> #}
<p class="mod-form-description">{{ ProductOption.Option.description }}</p>
{% endif %}
{{ form_widget(form[value], {'attr': {'class': 'mod-form-input-text'}}) }}
{{ form_errors(form[value]) }}
</td>
</tr>
{# 日付タイプ #}
{% elseif ProductOption.Option.type == constant('Plugin\\ProductOption42\\Entity\\Option::DATE_TYPE') %}
<tr class="ec-input">
<th class="option_Label">
{{ form_label(form[value]) }}
{{ ProductOption.Option.name }}
</th>
<td {% if form[value].vars.errors is not empty %}class="has-error"{% endif %} style="position: relative">
{% if ProductOption.Option.description_flg == constant('Plugin\\ProductOption42\\Entity\\Option::DISP_ON') %}
{# <a href="?" id="option_description_link_{{ Product.id }}_{{ ProductOption.Option.id }}" data="{{ Product.id }}"><span class="ec-link ec-font-size-2">{{'productoption.product.option.description.title'|trans}}</span></a> #}
<p class="mod-form-description">{{ ProductOption.Option.description }}</p>
{% endif %}
{{ form_widget(form[value], { attr : { 'data-target' : '#'~form[value].vars.id, 'class': 'mod-form-input-text' }}) }}
{{ form_errors(form[value]) }}
</div>
</div>
{# テキストボックスタイプ #}
{% elseif ProductOption.Option.type == constant('Plugin\\ProductOption42\\Entity\\Option::TEXT_TYPE') %}
{# {{ dump(ProductOption.option) }} #}
<tr class="ec-input">
<th class="option_Label">
{{ form_label(form[value]) }}
{{ ProductOption.Option.name }}
</th>
<td {% if form[value].vars.errors is not empty %}class="has-error"{% endif %}>
{% if ProductOption.Option.description_flg == constant('Plugin\\ProductOption42\\Entity\\Option::DISP_ON') %}
{# <a href="?" id="option_description_link_{{ Product.id }}_{{ ProductOption.Option.id }}" data="{{ Product.id }}"><span class="ec-link ec-font-size-2">{{'productoption.product.option.description.title'|trans}}</span></a> #}
<p class="mod-form-description">{{ ProductOption.Option.description }}</p>
{% endif %}
{{ form_widget(form[value], {'attr': {'class': 'mod-form-input-text'}}) }}
{{ form_errors(form[value]) }}
</td>
</tr>
{# テキストエリアタイプ #}
{% elseif ProductOption.Option.type == constant('Plugin\\ProductOption42\\Entity\\Option::TEXTAREA_TYPE')%}
<tr class="ec-input">
<th class="option_Label">
{{ form_label(form[value]) }}
{{ ProductOption.Option.name }}
</th>
<td {% if form[value].vars.errors is not empty %}class="has-error"{% endif %}>
{% if ProductOption.Option.description_flg == constant('Plugin\\ProductOption42\\Entity\\Option::DISP_ON') %}
{# <a href="?" id="option_description_link_{{ Product.id }}_{{ ProductOption.Option.id }}" data="{{ Product.id }}"><span class="ec-link ec-font-size-2">{{'productoption.product.option.description.title'|trans}}</span></a> #}
<p class="mod-form-description">{{ ProductOption.Option.description }}</p>
{% endif %}
{{ form_widget(form[value], {'attr': {'class': 'mod-form-input-textArea'}}) }}
{{ form_errors(form[value]) }}
</td>
</tr>
{% endif %}
{% endfor %}
{% endif %}