Commit a49d9850 authored by Skia's avatar Skia
Browse files

Pimp the counter click view

parent 7797f87d
Pipeline #132 failed with stage
in 1 minute and 57 seconds
...@@ -160,6 +160,15 @@ tbody>tr:hover { ...@@ -160,6 +160,15 @@ tbody>tr:hover {
float: right; float: right;
padding: 10px; padding: 10px;
} }
#products {
width: 90%;
margin: 0px auto;
overflow: auto;
}
#bar_ui {
float: left;
min-width: 57%;
}
#user_info_container { #user_info_container {
} }
#user_info { #user_info {
...@@ -277,3 +286,19 @@ label { ...@@ -277,3 +286,19 @@ label {
#user_edit img { #user_edit img {
width: 100px; width: 100px;
} }
.form_button {
width: 150px;
height: 100px;
padding: 2px;
display: inline-block;
font-size: 0.8em;
}
.form_button strong {
font-weight: bold;
font-size: 1.2em;
}
.form_button button {
width: 100%;
height: 100%;
vertical-align: middle;
}
...@@ -3,15 +3,15 @@ ...@@ -3,15 +3,15 @@
{% macro add_product(id, content) %} {% macro add_product(id, content) %}
<form method="post" action="{{ url('counter:click', counter_id=counter.id, user_id=customer.user.id) }}" class="inline" style="display:inline"> <form method="post" action="{{ url('counter:click', counter_id=counter.id, user_id=customer.user.id) }}" class="form_button">
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="action" value="add_product"> <input type="hidden" name="action" value="add_product">
<button type="submit" name="product_id" value="{{ id }}"> {{ content }} </button> <button type="submit" name="product_id" value="{{ id }}"> {{ content|safe }} </button>
</form> </form>
{% endmacro %} {% endmacro %}
{% macro del_product(id, content) %} {% macro del_product(id, content) %}
<form method="post" action="{{ url('counter:click', counter_id=counter.id, user_id=customer.user.id) }}" class="inline" style="display:inline"> <form method="post" action="{{ url('counter:click', counter_id=counter.id, user_id=customer.user.id) }}" class="form_button">
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="action" value="del_product"> <input type="hidden" name="action" value="del_product">
<button type="submit" name="product_id" value="{{ id }}"> {{ content }} </button> <button type="submit" name="product_id" value="{{ id }}"> {{ content }} </button>
...@@ -30,68 +30,72 @@ ...@@ -30,68 +30,72 @@
{{ user_mini_profile(customer.user) }} {{ user_mini_profile(customer.user) }}
<p>{% trans %}Amount: {% endtrans %}{{ customer.amount }}</p> <p>{% trans %}Amount: {% endtrans %}{{ customer.amount }}</p>
</div> </div>
{% if counter.type == 'BAR' %} <div id="bar_ui">
<div>
<h5>{% trans %}Refilling{% endtrans %}</h5>
<form method="post" action="{{ url('counter:click', counter_id=counter.id, user_id=customer.user.id) }}">
{% csrf_token %}
{{ refill_form.as_p() }}
<input type="hidden" name="action" value="refill">
<input type="submit" value="{% trans %}Go{% endtrans %}" />
</form>
</div>
{% endif %}
<div>
<h5>{% trans %}Selling{% endtrans %}</h5> <h5>{% trans %}Selling{% endtrans %}</h5>
{% if request.session['too_young'] %} <div>
<p><strong>{% trans %}Too young for that product{% endtrans %}</strong></p> {% if request.session['too_young'] %}
{% endif %} <p><strong>{% trans %}Too young for that product{% endtrans %}</strong></p>
{% if request.session['not_allowed'] %} {% endif %}
<p><strong>{% trans %}Not allowed for that product{% endtrans %}</strong></p> {% if request.session['not_allowed'] %}
{% endif %} <p><strong>{% trans %}Not allowed for that product{% endtrans %}</strong></p>
{% if request.session['not_enough'] %}
<p><strong>{% trans %}Not enough money{% endtrans %}</strong></p>
{% endif %}
<form method="post" action="{{ url('counter:click', counter_id=counter.id, user_id=customer.user.id) }}">
{% csrf_token %}
<input type="hidden" name="action" value="code">
<input type="input" name="code" value="" autofocus id="code_field"/>
<input type="submit" value="{% trans %}Go{% endtrans %}" />
</form>
<p>{% trans %}Basket: {% endtrans %}</p>
<ul>
{% for id,infos in request.session['basket']|dictsort %}
{% set product = counter.products.filter(id=id).first() %}
{% set s = infos['qty'] * infos['price'] / 100 %}
<li>{{ del_product(id, '-') }} {{ infos['qty'] + infos['bonus_qty'] }} {{ add_product(id, '+') }}
{{ product.name }}: {{ "%0.2f"|format(s) }}
{% if infos['bonus_qty'] %}
P
{% endif %} {% endif %}
</li> {% if request.session['not_enough'] %}
{% endfor %} <p><strong>{% trans %}Not enough money{% endtrans %}</strong></p>
</ul> {% endif %}
<p><strong>{% trans %}Total: {% endtrans %}{{ "%0.2f"|format(basket_total) }}</strong></p> <form method="post" action="{{ url('counter:click', counter_id=counter.id, user_id=customer.user.id) }}">
<form method="post" action="{{ url('counter:click', counter_id=counter.id, user_id=customer.user.id) }}"> {% csrf_token %}
{% csrf_token %} <input type="hidden" name="action" value="code">
<input type="hidden" name="action" value="finish"> <input type="input" name="code" value="" autofocus id="code_field"/>
<input type="submit" value="{% trans %}Finish{% endtrans %}" /> <input type="submit" value="{% trans %}Go{% endtrans %}" />
</form> </form>
<form method="post" action="{{ url('counter:click', counter_id=counter.id, user_id=customer.user.id) }}"> <p>{% trans %}Basket: {% endtrans %}</p>
{% csrf_token %} <ul>
<input type="hidden" name="action" value="cancel"> {% for id,infos in request.session['basket']|dictsort %}
<input type="submit" value="{% trans %}Cancel{% endtrans %}" /> {% set product = counter.products.filter(id=id).first() %}
</form> {% set s = infos['qty'] * infos['price'] / 100 %}
<div><strong>{% trans %}Products: {% endtrans %}</strong> <li>{{ del_product(id, '-') }} {{ infos['qty'] + infos['bonus_qty'] }} {{ add_product(id, '+') }}
{% for t in categories %} {{ product.name }}: {{ "%0.2f"|format(s) }}
{% if counter.products.filter(product_type=t).exists() %} {% if infos['bonus_qty'] %}
<h5>{{ t }}</h5> P
{% for p in counter.products.filter(product_type=t).all() %} {% endif %}
{{ add_product(p.id, p.name) }} </li>
{% endfor %} {% endfor %}
</ul>
<p><strong>{% trans %}Total: {% endtrans %}{{ "%0.2f"|format(basket_total) }}</strong></p>
<form method="post" action="{{ url('counter:click', counter_id=counter.id, user_id=customer.user.id) }}">
{% csrf_token %}
<input type="hidden" name="action" value="finish">
<input type="submit" value="{% trans %}Finish{% endtrans %}" />
</form>
<form method="post" action="{{ url('counter:click', counter_id=counter.id, user_id=customer.user.id) }}">
{% csrf_token %}
<input type="hidden" name="action" value="cancel">
<input type="submit" value="{% trans %}Cancel{% endtrans %}" />
</form>
</div>
{% if counter.type == 'BAR' %}
<h5>{% trans %}Refilling{% endtrans %}</h5>
<div>
<form method="post" action="{{ url('counter:click', counter_id=counter.id, user_id=customer.user.id) }}">
{% csrf_token %}
{{ refill_form.as_p() }}
<input type="hidden" name="action" value="refill">
<input type="submit" value="{% trans %}Go{% endtrans %}" />
</form>
</div>
{% endif %} {% endif %}
{% endfor %} </div>
<div id="products">
{% for t in categories -%}
{%- if counter.products.filter(product_type=t).exists() -%}
<h5>{{ t }}</h5>
<div id="cat_{{ t }}">
{% for p in counter.products.filter(product_type=t).all() -%}
{{ add_product(p.id, "<strong>%s</strong><hr>%s €<br>%s" % (p.name, p.selling_price, p.code)) }}
{%- endfor %}
</div> </div>
{%- endif -%}
{%- endfor %}
</div> </div>
{% endblock %} {% endblock %}
...@@ -101,13 +105,13 @@ ...@@ -101,13 +105,13 @@
<script> <script>
$( function() { $( function() {
var products = [ var products = [
{% for p in counter.products.all() %} {% for p in counter.products.all() -%}
{ {
value: "{{ p.code }}", value: "{{ p.code }}",
label: "{{ p.name }}", label: "{{ p.name }}",
tags: "{{ p.code }} {{ p.name }}", tags: "{{ p.code }} {{ p.name }}",
}, },
{% endfor %} {%- endfor %}
]; ];
var quantity = ""; var quantity = "";
var search = ""; var search = "";
...@@ -133,6 +137,14 @@ $( function() { ...@@ -133,6 +137,14 @@ $( function() {
}, },
}); });
}); });
$( function() {
$("#bar_ui").accordion({
heightStyle: "content",
});
$("#products").accordion({
heightStyle: "content",
});
});
</script> </script>
{% endblock %} {% endblock %}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment