{% trans_default_domain 'credits' %}
{% apply spaceless %}
{%- if purchaseResult is defined or ((app.request.hasPreviousSession or app.session.started) and app.session.flashBag.has('credits_purchase_status')) -%}
{% set purchaseData = purchaseResult is defined ? purchaseResult : app.session.flashBag.get('credits_purchase_status')[0] %}
<div class="modal fade dark-modal" id="credits-purchase-status-popup" tabindex="-1" role="dialog" aria-labelledby="credits-purchase-status-popup-header" aria-hidden="true">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<a href="#" class="close" data-dismiss="modal" aria-label="{{ 'general.close'|trans({}, 'popup') }}">
<em class="icon ni ni-cross"></em>
</a>
{% if purchaseData.status is same as(true) %}
<div class="modal-header text-center justify-content-center border-bottom-0" id="credits-purchase-status-popup-header">
<div>
<div class="mb-4 mt-2 credits-purchase-status-popup-icon">
<em class="icon dp-icon-success"></em>
</div>
<h4 class="mb-4 justify-content-center align-items-center">{{ 'success'|trans({}, 'popup') }}</h4>
<p>
{{ 'result_popup.success.text'|trans({'{ credits }': purchaseData.creditsFloat|price_format}) }}
</p>
</div>
</div>
<div class="modal-body">
<div class="text-center">
<a href="#" class="btn btn-primary btn-lg w-100 justify-content-center" data-dismiss="modal" aria-label="{{ 'general.close'|trans({}, 'popup') }}">
{{ 'general.close'|trans({}, 'popup') }}
</a>
</div>
</div>
{% elseif purchaseData.status is same as(false) %}
<div class="modal-header text-center justify-content-center border-bottom-0" id="credits-purchase-status-popup-header">
<div>
<div class="mb-4 mt-2 credits-purchase-status-popup-icon">
<em class="icon dp-icon-failed"></em>
</div>
<h4 class="mb-4 justify-content-center align-items-center">
{{ 'result_popup.declined.headline'|trans }}
</h4>
<p>
{{ 'result_popup.declined.text'|trans }}
</p>
</div>
</div>
<div class="modal-body">
<div class="text-center">
<a href="#" class="btn btn-primary btn-lg w-100 justify-content-center" data-dismiss="modal" aria-label="{{ 'general.close'|trans({}, 'popup') }}">
{{ 'general.close'|trans({}, 'popup') }}
</a>
</div>
</div>
{% else %}
<div class="modal-header text-center justify-content-center border-bottom-0" id="credits-purchase-status-popup-header">
<div>
<div class="mb-4 mt-2 credits-purchase-status-popup-icon">
<div class="spinner-border" role="status"><span class="sr-only">{{ 'loading'|trans({}, 'messages') }}</span></div>
</div>
<h4 class="mb-4 justify-content-center">
{{ 'result_popup.processing.headline'|trans }}
</h4>
<p>
{{ 'result_popup.processing.text'|trans }}
</p>
<p>
{% trans with {'{ support_link }': path('contact')} %}result_popup.processing.text2{% endtrans %}
</p>
</div>
</div>
<div class="modal-body" id="purchase-processing" data-check-url="{{ purchaseData.checkPath }}">
<div class="text-center">
<a href="#" class="btn btn-primary btn-lg w-100 justify-content-center" data-dismiss="modal" aria-label="{{ 'general.close'|trans({}, 'popup') }}">
{{ 'general.close'|trans({}, 'popup') }}
</a>
</div>
</div>
{% endif %}
</div>
</div>
</div>
{% endif %}
{% endapply %}