{% from 'utils.html.twig' import ico %}
{% if isModuleActive('product_coupon_module') %}
{# SEE COUPONS #}
{% if productOfferCouponTotal > 0 %}
<div class="avaliable-coupons js--open-modal-coupons-product" data-url="{{ path('listCouponByProductOffers', { productOfferId: productOffer.id }) }}">
<span class="ico" for="product-coupom">{{ ico('ticket') }}</span>
<span class="txt">
{{ getLanguage('avaliable_coupons', 'product') }}
</span>
</div>
{% endif %}
{# INSERT COUPON #}
<div class="coupon js--coupom{{ couponKey is not null ? ' status--aberto' }}">
<div class="add-coupom js--abre">
<span class="ico">{{ ico('ticket') }}</span>
<span>{{ getLanguage('add_coupon', 'product') }}</span>
</div>
<div class="input-wrap js--sub">
<div class="input-coupom">
<label class="ico" for="product-coupom">{{ ico('ticket') }}</label>
<input type="text" name="product-coupom" placeholder="{{ getLanguage('insert_code', 'product') }}">
</div>
<button>{{ getLanguage('apply', 'product') }}</button>
</div>
{# COUPON IF INVALID #}
{% if couponKey is not null %}
{% if not couponKeyValid %}
<div class="coupon-warning">
<p>
{{ getLanguage('coupon_code', 'product') }}
<strong>{{ couponKey }}</strong>
{{ getLanguage('is_invalid', 'product') }}.
</p>
</div>
{% else %}
<div class="coupon-success">
<p>
{{ getLanguage('coupon_code', 'product') }}
<strong>{{ couponKey }}</strong>
{{ getLanguage('successfully_applied', 'product') }}.
</p>
</div>
{% endif %}
{% endif %}
</div>
{% endif %}