{% load i18n static sass_tags sekizai_tags %}{% spaceless %}

{% if stylesheet_url %}{% addtoblock "css" %}<link href="{{ stylesheet_url }}" rel="stylesheet" type="text/css" />{% endaddtoblock %}{% endif %}
{% include "shop/djng-form.html" %}

{% addtoblock "js" %}<script src="{% static 'shop/js/purchase-button.js' %}" type="text/javascript"></script>{% endaddtoblock %}
{% add_data "ng-requires" "django.shop.purchase-button" %}

<div class="alert alert-danger" ng-show="purchasingErrorMessage" role="alert" ng-cloak>
	<a class="close" ng-click="purchasingErrorMessage=null" uib-tooltip="{% trans 'Dismiss' %}">×</a>{% verbatim %}{{ purchasingErrorMessage }}{% endverbatim %}
</div>

{% with instance_css_classes=instance.css_classes instance_inline_styles=instance.inline_styles disable_invalid=instance.glossary.disable_invalid %}
<button ng-click="do(spinner()).then(prepare()).then(update()).then(purchaseNow('{% url 'shop:checkout-purchase' %}')).catch(scrollToRejected()).finally(restore())"{% if disable_invalid %} ng-disabled="isDisabled()"{% endif %}{% if instance_css_classes %} class="{{ instance_css_classes }}"{% endif %}{% if instance_inline_styles %} style="{{ instance_inline_styles }}"{% endif %}>
	{{ icon_left }}{{ instance.content }}{{ icon_right }}
</button>
{% endwith %}

{% endspaceless %}
