{% sw_extends '@Storefront/storefront/page/product-detail/buy-widget.html.twig' %}
{% set mwRequiredFieldIsPossible = 1 %}
{% block page_product_detail_configurator_include %}
{{ parent() }}
{% block page_product_detail_configurator_include_customerinput %}
{% set extension = page.product.extensions %}
{% set mwCustomerInputCountValue = extension['mwCustomerInputCountValue'].value %}
{% set mwCustomerInputActiveValues = 0 %}
{% for mwCustomerInputCount in 1..mwCustomerInputCountValue %}
{% set productId = page.product.id %}
{% set productNumber = page.product.productNumber %}
{% set mwCustomerInputValue = extension['mwCustomerInput' ~ mwCustomerInputCount].value %}
{% set requiredFormName = 'productDetailPageBuyProductForm' %}
{% set customFields = page.product.translated.customFields %}
{% set mwCustomerInputActive = 'mw_customer_input_' ~ mwCustomerInputCount ~ '_active' %}
{% set mwCustomerInputFieldtype = 'mw_customer_input_' ~ mwCustomerInputCount ~ '_fieldtype' %}
{% set mwCustomerInputTitle = 'mw_customer_input_' ~ mwCustomerInputCount ~ '_title' %}
{% set mwCustomerInputPlaceholder = 'mw_customer_input_' ~ mwCustomerInputCount ~ '_placeholder' %}
{% set mwCustomerInputRequired = 'mw_customer_input_' ~ mwCustomerInputCount ~ '_required' %}
{% set mwCustomerInputMinvalue = 'mw_customer_input_' ~ mwCustomerInputCount ~ '_minvalue' %}
{% set mwCustomerInputMaxvalue = 'mw_customer_input_' ~ mwCustomerInputCount ~ '_maxvalue' %}
{% set mwCustomerInputStepvalue = 'mw_customer_input_' ~ mwCustomerInputCount ~ '_stepsvalue' %}
{% set mwCustomerInputStartdate = 'mw_customer_input_' ~ mwCustomerInputCount ~ '_startdate' %}
{% set mwCustomerInputEnddate = 'mw_customer_input_' ~ mwCustomerInputCount ~ '_enddate' %}
{% set mwCustomerInputDisableddates = 'mw_customer_input_' ~ mwCustomerInputCount ~ '_disableddates' %}
{% set mwCustomerInputStarttime = 'mw_customer_input_' ~ mwCustomerInputCount ~ '_starttime' %}
{% set mwCustomerInputEndtime = 'mw_customer_input_' ~ mwCustomerInputCount ~ '_endtime' %}
{% set mwCustomerInputDaterange = 'mw_customer_input_' ~ mwCustomerInputCount ~ '_daterange' %}
{% set mwCustomerInputSelectfieldvalues = 'mw_customer_input_' ~ mwCustomerInputCount ~ '_selectfieldvalues' %}
{% if customFields[mwCustomerInputActive] and config('MwProductCustomerInputs.config.mwCustomerInputShowOnProductDetailPage') and ((customFields[mwCustomerInputFieldtype] == "select" and customFields[mwCustomerInputSelectfieldvalues]) or (customFields[mwCustomerInputFieldtype] != "select")) %}
<form id="productCustomerInputForm-{{ productId }}-{{ mwCustomerInputCount }}" class="mw-customer-input-detail-box-form{% if config('MwProductCustomerInputs.config.mwCustomerInputHighlightRequiredFieldInColor') and (customFields[mwCustomerInputRequired]) %} was-validated{% endif %}" action="{{ path('frontend.savecustomerinputs.request') }}" method="post"><div class="form-group row">
{{ sw_csrf('frontend.detail.mw-customer-input') }}
{% if customFields[mwCustomerInputFieldtype] == "input" or customFields[mwCustomerInputFieldtype] == "textarea" or customFields[mwCustomerInputFieldtype] == "datetime" or customFields[mwCustomerInputFieldtype] == "date" or customFields[mwCustomerInputFieldtype] == "time" or customFields[mwCustomerInputFieldtype] == "select" or customFields[mwCustomerInputFieldtype] == "number" %}<label class="col-sm-4 col-form-label" for="mw-customer-input-value-{{ productId }}-{{ mwCustomerInputCount }}">{% elseif customFields[mwCustomerInputFieldtype] == "boolean" %}<div class="col-sm-4 col-form-label">{% endif %}
{% if customFields[mwCustomerInputTitle] %}
{{ customFields[mwCustomerInputTitle] }}
{% else %}
{{ "mw.mwCustomerInput.titleLabel"|trans|raw }}
{% endif %}
{% if customFields[mwCustomerInputFieldtype] == "input" or customFields[mwCustomerInputFieldtype] == "textarea" or customFields[mwCustomerInputFieldtype] == "datetime" or customFields[mwCustomerInputFieldtype] == "date" or customFields[mwCustomerInputFieldtype] == "time" or customFields[mwCustomerInputFieldtype] == "select" or customFields[mwCustomerInputFieldtype] == "number" %}</label>{% elseif customFields[mwCustomerInputFieldtype] == "boolean" %}</div>{% endif %}
<div class="col-sm-8 {% if customFields[mwCustomerInputFieldtype] == "input" or customFields[mwCustomerInputFieldtype] == "textarea" or customFields[mwCustomerInputFieldtype] == "datetime" or customFields[mwCustomerInputFieldtype] == "date" or customFields[mwCustomerInputFieldtype] == "time" or customFields[mwCustomerInputFieldtype] == "select" %}input-group{% elseif customFields[mwCustomerInputFieldtype] == "boolean" %}custom-control custom-checkbox{% endif %}">
{% sw_include '@MwProductCustomerInputs/storefront/page/product-detail/buy-widget-customer-input-fields.html.twig' with {
prefix: ""
} %}
</div>
{% if customFields[mwCustomerInputRequired] %}
<div class="col-sm-12"><small class="form-text required-text{% if customFields[mwCustomerInputFieldtype] == "boolean" %} is-checkbox{% endif %}">
{{ "mw.mwCustomerInput.requiredLabel"|trans|raw }}
</small></div>
<br/>
{% endif %}
</div></form>
{% endif %}
{% if customFields[mwCustomerInputActive] %}
{% set mwCustomerInputActiveValues = mwCustomerInputActiveValues + 1 %}
{% endif %}
{% endfor %}
{% if (config('MwProductCustomerInputs.config.mwCustomerInputShowInformationMessage')) and (mwCustomerInputActiveValues > 0) %}
{% block page_product_detail_configurator_include_customerinput_informationmessage %}
<div role="alert"
class="alert alert-info alert-has-icon mw-customer-input-alert-info">
{% sw_icon 'info' %}
<div class="alert-content-container">
<div class="alert-content">
{{ "mw.mwCustomerInput.informationMessage"|trans|raw }}
</div>
</div>
</div>
{% endblock %}
{% endif %}
{% endblock %}
{% endblock %}