bornhack-website/src/shop/templates/product_detail.html

86 lines
1.9 KiB
HTML

{% extends 'shop_base.html' %}
{% load bootstrap3 %}
{% load commonmark %}
{% load shop_tags %}
{% block title %}
{{ product.name }} | {{ block.super }}
{% endblock %}
{% block shop_content %}
<div class="row">
<div class="col-sm-12 col-md-8">
<h2>{{ product.name }}</h2>
{{ product.description|trustedcommonmark }}
</div>
<div class="col-sm-12 col-md-4">
<h3>
<small>Price</small><br />
{{ product.price|currency }}<br />
</h3>
<hr />
{% if product.stock_amount and product.is_time_available %}
<h3>
<small>Availability</small><br />
{% if product.left_in_stock > 0 %}
<bold>{{ product.left_in_stock }}</bold> available<br />
{% else %}
<bold>Sold out.</bold><br />
{% endif %}
</h3>
<hr />
{% endif %}
{% if product.is_stock_available %}
<h3>{% if already_in_order %}Update order{% else %}Add to order{% endif %}</h3>
{% if already_in_order %}<p>You already have this product in your order.</p>{% endif %}
{% if user.is_authenticated %}
{% if product.is_available %}
<form method="POST">
{% csrf_token %}
{% bootstrap_form form %}
<button type="submit" class="btn btn-primary">
{% if already_in_order %}Update{% else %}Add{% endif %}
</button>
</form>
{% else %}
<p>
{% if product.is_old %}
This product is not available anymore.
{% elif product.is_upcoming %}
This product is available from
{{ product.available_in.lower|date:"Y-m-d H:i T" }}
{% endif %}
</p>
{% endif %}
{% else %}
<a href="{% url 'account_signup' %}?next={% url 'shop:product_detail' slug=product.slug %}">
Signup</a> or
<a href="{% url 'account_login' %}?next={% url 'shop:product_detail' slug=product.slug %}">
login</a>
to order this product
{% endif %}
{% endif %}
</div>
</div>
{% endblock %}