Adds working deposit and purchases.

- Switch to bootstrap.
 - Still no balance checking or form feedback messages.
This commit is contained in:
nikolark committed 2012-02-22 05:22:04 +01:00
1 parent ce8190c870
commit fc400dffd4
36 files changed
+9233 -812

No files matched your search

+14 -12
View File
@@ -3,31 +3,33 @@
<head>
<title>{%block title%}BBS{%endblock%}</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="/static/gaute/stylesheets/screen.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="/static/gaute/stylesheets/print.css" type="text/css" media="print">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="{{ STATIC_URL }}gaute/stylesheets/screen.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="{{ STATIC_URL }}gaute/stylesheets/print.css" type="text/css" media="print">
<!--[if lt IE 8]>
<link rel="stylesheet" href="/static/gaute/stylesheets/ie.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="{{ STATIC_URL }}gaute/stylesheets/ie.css" type="text/css" media="screen, projection">
<![endif]-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script>
<script src="/static/js/register.js"></script>
{%block headinc %}
{%endblock%}
</head>
<body class="bp three-col">
<body>
<header id="header">
{%block header%}
{% include "nav.html" %}
{%endblock%}
</header>
<div id="container">
<div id="container" class="container-fluid">
{%block content%}
{%endblock%}
</div>
<div id="footer">
{%block footer %}
<img src="/static/DNSlogo.png" />
{%endblock%}
<div id="footer" class="row-fluid span12">
{%block footer %}
<img src="{{ STATIC_URL }}gaute/img/edb_brick.png" />
{%endblock%}
</div>
</div>
<script type="text/javascript" src="{{ STATIC_URL }}js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/bootstrap-collapse.js"></script>
{%block tailinc %}
{%endblock%}
</body>
+21
View File
@@ -0,0 +1,21 @@
{% extends "base.html" %}
{% block header %}
{% include "nav.html" with active="deposit" %}
{% endblock %}
{% block content %}
<section id="deposit" class="row-fluid">
<div class="span12">
<form id="order" method="post" class="form-stacked" autocomplete="off">
{% csrf_token %}
<fieldset>
{{form}}
</fieldset>
<div class="form-actions">
  <button type="submit" class="btn btn-large btn-primary" name="submit_order">Sett inn</button>
  <a href="{% url register %}" class="btn">Avbryt</a>
</div>
</form>
</div>
</section>
{% endblock %}
+6 -2
View File
@@ -1,8 +1,12 @@
{% extends "base.html" %}
{%block header%}
<h1>Biceps Bar System</h1>
{% include "nav.html" with active="home" %}
{%endblock%}
{%block content%}
<a href="/register/">Kasse</a>
<div class="row-fluid">
<section class="span4">
<h1>Biceps Bar System</h1>
</section>
</div>
{%endblock%}
+25
View File
@@ -0,0 +1,25 @@
<nav class="navbar">
<div class="navbar-inner">
<div class="container">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a href="/" class="brand">Biceps Bar System - BBS</a>
<div class="nav-collapse">
<ul class="nav">
{% if active %}
<li class="{% if active = "register" %}active{% endif %}"><a href="/register"><i class="icon-home icon-white"></i> Kjøp drikke</a></li>
<li class="{% if active = "deposit" %}active{% endif %}"><a href="/deposit">Sett inn penger</a></li>
<li class="{% if active = "remove_purchase" %}active{% endif %}"><a href="#"> Fjern kjøp</a></li>
{% if request.user.is_superuser %}
<li><a href="/admin">Administrasjon</a></li>
{% endif %}
{% endif %}
</ul>
</div>
</div>
</div>
</nav>
+72 -44
View File
@@ -1,51 +1,79 @@
{% extends "base.html" %}
{% block header %}
<h1>Biceps Bar System</h1>
<nav>
<ul>
<li><a href="{% url main.views.logout %}">Logout</a></li>
</ul>
</nav>
{% include "nav.html" with active="register" %}
{% endblock %}
{% block content %}
<section id="register">
<form id="order" method="post">
{% csrf_token %}
<section id="customer">
<h2>Velg kunde</h2>
<input type="hidden" name="customer" value="" />
<ul>
{% for user in users %}
<li class="customer">
{% if user.get_profile.image %}
  <img class="profile" src="{{ user.get_profile.image.url }}" /><br />
{% else %}
  <img class="profile" src="/static/gaute/images/unknown.png" /><br />
{% endif %}
<span class="name">{{ user }}</span> ({{ user.get_profile.balance }})</li>
{% endfor %}
</ul>
</section>
<section id="products">
<h2>Velg antall</h2>
<ul>
{% for product in products %}
<li id="form-{{forloop.counter0}}" class="product"><input type="hidden" name="form-{{ forloop.counter0 }}-product" value="{{product.id }}" />
<input type="text" id="form-{{ forloop.counter0 }}-amount" name="form-{{ forloop.counter0 }}-amount" value="0" size="2" />
{% if product.image %}
<img class="product" src="{{ product.image.url }}" /><br />
{% else %}
<img class="product" src="/static/gaute/images/product.png" /><br />
{% endif %}
{{ product.name }}
</li>
{% endfor %}
</ul>
</section>
<section id="total"><h3>Totalt</h3><span class="total_text"></span></section>
  <input type="reset" id="reset" value="Start på nytt" />
  <input type="submit" id="submit_order" name="submit_order" value="Kjøp" />
</form>
<section id="register" class="row-fluid">
<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">
<div class="span12">
<h2>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>
{% if users %}
<ul class="well">
{% for user in users %}
<li class="customer">
{% if user.get_profile.image %}
  <img class="profile" src="{{ user.get_profile.image.url }}" /><br />
{% else %}
  <img class="profile" src="{{ STATIC_URL }}gaute/img/unknown.png" /><br />
{% endif %}
<span class="name">{{ user }}</span> ({{ user.get_profile.balance }})
<span class="id" style="display:none;">{{ user.id }}</span>
</li>
</li>
{% endfor %}
</ul>
{%else%}
<div class="alert alert-error">Ingen har positiv saldo i BBS.</div>
{%endif%}
</div>
</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="text" 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 }}" />
{% 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/register.js"></script>
{% endblock %}