Files
bbs/templates/register.html
T
2012-03-26 02:46:25 +02:00

95 lines
4.9 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends "base.html" %}
{% load gravatar %}
{% block header %}
{% include "nav.html" with active="register" %}
{% endblock %}
{% block content %}
<section id="register" class="row-fluid">
{% if messages %}
<section class="row-fluid">
<div class="span4">
{% for message in messages %}
<div {% if message.tags %}class="alert alert-{{ message.tags }}"{% endif %}>{{ message }}<a class="close" data-dismiss="alert">×</a></div>
{% endfor %}
</div>
</section>
{% endif %}
<form id="order" method="post" autocomplete="off">
<fieldset>
{% csrf_token %}
<!-- Formset validation fields -->
<input type="hidden" name="form-TOTAL_FORMS" value="{{ products|length }}" id="id_form-TOTAL_FORMS" />
<input type="hidden" name="form-INITIAL_FORMS" value="{{ products|length }}" id="id_form-INITIAL_FORMS" />
<input type="hidden" name="form-MAX_NUM_FORMS" id="id_form-MAX_NUM_FORMS" />
<section id="customer" class="row-fluid">
{% if users %}
<div class="span12">
<h2 title="Sortert etter hvem som kjøpte noe sist.">Hvem kjøper?</h2>
<!-- Typeahead customer field -->
<input name="customer_name" id="id_customer_typeahead" value="" data-provide="typeahead" data-source="{{users_js}}" />
<!-- Actual customer select field (hidden) -->
<div style="display:none;">{{orderform.customer }}</div>
<ul class="well">
{% for user in users %}
<li class="customer">
{% if user.get_profile.image %}
  <img class="profile" src="{{ user.get_profile.image }}" alt="Profile picture" /><br />
{% else %}
  <img class="profile" src="{% gravatar_for_user user 50 %}" alt="Profile picture" /><br />
{% endif %}
<span class="name">{{ user.first_name }} {{ user.last_name|slice:":1"}}</span><br />
<span class="balance">{{ user.get_profile.balance }}</span>
<span class="id" style="display:none;">{{ user.id }}</span>
</li>
{% endfor %}
</ul>
</div>
{%else%}
<div class="span3">
<h2>Hvem kjøper?</h2>
<div class="alert alert-error">Ingen har positiv saldo i BBS.</div><a href="{% url deposit %}" class="btn">Sett inn penger</a>
</div>
{%endif%}
</section>
<section id="products" class="row-fluid">
<div class="span12">
<h2>Kjøper hva?</h2>
<ul class="well">
{% for product in products %}
<li id="form-{{forloop.counter0}}" class="product"><input type="hidden" name="form-{{ forloop.counter0 }}-product" value="{{product.id }}" />
<input type="hidden" id="form-{{ forloop.counter0 }}-amount" name="form-{{ forloop.counter0 }}-amount" value="0" class="span2" size="2" />
<input type="hidden" name="form-{{ forloop.counter0 }}-unit_price" value="{{product.sale_price_int }}" />
<span class="qty">0</span>
{% if product.image %}
<img class="product" src="{{ product.image.url }}" /><br />
{% else %}
<img class="product" src="{{ STATIC_URL }}gaute/img/product.png" /><br />
{% endif %}
<span class="name">{{ product.name }}</span> - <span class="sale_price_int">{{product.sale_price_int|floatformat:0}}</span>
</li>
{% endfor %}
</ul>
</div>
</section>
<section id="total" class="row-fluid">
<div class="span2">
<h2>Totalt: <span class="total_text"></span></h2>
</div>
</section>
</fieldset>
<div class="form-actions">
  <button type="submit" class="btn btn-large btn-primary" name="submit_order">Kjøp</button>
  <button type="reset" class="btn">Start på nytt</button>
</div>
</form>
</section>
{% endblock %}
{% block tailinc %}
<script src="{{ STATIC_URL }}js/bootstrap-typeahead.js"></script>
<script src="{{ STATIC_URL }}js/bootstrap-tooltip.js"></script>
<script src="{{ STATIC_URL }}js/register.js"></script>
{% endblock %}