{% sw_extends '@Storefront/storefront/base.html.twig' %}
{% block base_body_inner %}
{% set useCartDcCodeValidation = config('EwGrecoAdministration.config.useCartDcCodeValidation') %}
{% set dcCode = app.session.get('dc-code') %}
{% if context.customer and context.customer.dcCode %}
{% set dcCode = context.customer.dcCode %}
{% endif %}
{% set currentCategory = page.header.navigation.active %}
{% set hideModal = false %}
{% for k,v in currentCategory.customFields %}
{% if (k === "greco_hide_modal") %}
{% set hideModal = v %}
{% endif %}
{% endfor %}
{% if hideModal == false and dcCode == null and useCartDcCodeValidation == false %}
<div data-frontend-dc-code-modal>
<!-- Modal -->
<div class="modal show" id="dcCodeModal" style="display: block;" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="dcCodeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{{ "dcCode.modal.title"|trans|sw_sanitize }}</h5>
</div>
<form
action="{{ path('frontend.dc-code.submit') }}"
class="register-form"
method="post"
data-form-csrf-handler="true">
<div class="modal-body">
<div class="flashbags">
{% for type, messages in app.flashes %}
{% sw_include '@Storefront/storefront/utilities/alert.html.twig' with {
type: type,
list: messages
} %}
{% endfor %}
</div>
<div class="form-row">
<div class="form-group col-12">
<label class="form-label"
for="dcCode">
{{ "dcCode.modal.code"|trans|sw_sanitize }}
</label>
<input type="text"
class="form-control"
id="dcCode"
placeholder="{{ "dcCode.modal.codePlaceholder"|trans|striptags }}"
name="dc-code"
required="required">
<input type="hidden" name="activeRoute" value="{{ activeRoute }}" />
<input type="hidden" name="landingPageId" value="{{ page.navigationId }}" />
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">{{ "detail.reviewFormSubmitText"|trans|sw_sanitize }}</button>
</div>
</form>
</div>
</div>
</div>
</div>
{% else %}
{{ parent() }}
{% endif %}
{% endblock %}