mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-11 04:19:25 +00:00
Add cash register summaries
This commit is contained in:
27
counter/templates/counter/cash_register_summary.jinja
Normal file
27
counter/templates/counter/cash_register_summary.jinja
Normal file
@ -0,0 +1,27 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block title %}
|
||||
{% trans obj=object %}Edit {{ obj }}{% endtrans %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>{% trans %}Make a cash register summary{% endtrans %}</h2>
|
||||
<form action="" method="post" id="cash_summary_form">
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
<p>
|
||||
{% if field.name[:5] == "check" and field.name[8:] == "value" %}
|
||||
{% set name = field.name[:7] + "_quantity" %}
|
||||
{{ field.errors }}<label for="{{ field.name }}">{{ field.label }}</label> {{ field }}
|
||||
{{ form[name].errors }}<label for="{{ form[name].name }}">{{ form[name].label }}</label> {{ form[name] }}
|
||||
{% elif field.name[:5] != "check" %}
|
||||
{{ field.errors }}<label for="{{ field.name }}">{{ field.label }}</label> {{ field }}
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endfor %}
|
||||
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
@ -2,16 +2,16 @@
|
||||
{% from "core/macros.jinja" import user_mini_profile %}
|
||||
|
||||
|
||||
{% macro add_product(id, content) %}
|
||||
<form method="post" action="{{ url('counter:click', counter_id=counter.id, user_id=customer.user.id) }}" class="form_button">
|
||||
{% macro add_product(id, content, class="") %}
|
||||
<form method="post" action="{{ url('counter:click', counter_id=counter.id, user_id=customer.user.id) }}" class="{{ class }}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="action" value="add_product">
|
||||
<button type="submit" name="product_id" value="{{ id }}"> {{ content|safe }} </button>
|
||||
</form>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro del_product(id, content) %}
|
||||
<form method="post" action="{{ url('counter:click', counter_id=counter.id, user_id=customer.user.id) }}" class="form_button">
|
||||
{% macro del_product(id, content, class="") %}
|
||||
<form method="post" action="{{ url('counter:click', counter_id=counter.id, user_id=customer.user.id) }}" class="{{ class }}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="action" value="del_product">
|
||||
<button type="submit" name="product_id" value="{{ id }}"> {{ content }} </button>
|
||||
@ -53,7 +53,7 @@
|
||||
{% 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, '+') }}
|
||||
<li>{{ del_product(id, '-', "inline") }} {{ infos['qty'] + infos['bonus_qty'] }} {{ add_product(id, '+', "inline") }}
|
||||
{{ product.name }}: {{ "%0.2f"|format(s) }} €
|
||||
{% if infos['bonus_qty'] %}
|
||||
P
|
||||
@ -105,7 +105,7 @@
|
||||
{% set file = static('core/img/na.gif') %}
|
||||
{% endif %}
|
||||
{% set prod = '<strong>%s</strong><hr><img src="%s" /><span>%s €<br>%s</span>' % (p.name, file, p.selling_price, p.code) %}
|
||||
{{ add_product(p.id, prod) }}
|
||||
{{ add_product(p.id, prod, "form_button") }}
|
||||
{%- endfor %}
|
||||
</div>
|
||||
{%- endif -%}
|
||||
|
@ -1,19 +0,0 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block title %}
|
||||
{% trans obj=object %}Edit {{ obj }}{% endtrans %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>{% trans obj=object %}Edit {{ obj }}{% endtrans %}</h2>
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
<p>{{ form.sellers.errors }}<label for="{{ form.sellers.name }}">{{ form.sellers.label }}</label> {{ form.sellers }}</p>
|
||||
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
|
||||
<p>{{ form.products.errors }}<label for="{{ form.products.name }}">{{ form.products.label }}</label> {{ form.products }}</p>
|
||||
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
@ -39,13 +39,14 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if counter.type == 'BAR' %}
|
||||
{% if barmen %}
|
||||
<p><a href="{{ url('counter:cash_summary', counter_id=counter.id) }}">{% trans %}Make a cash register summary{% endtrans %}</a></p>
|
||||
{% endif %}
|
||||
<div>
|
||||
<h3>{% trans %}Barman: {% endtrans %}</h3>
|
||||
<ul>
|
||||
{% for b in barmen %}
|
||||
<li>{{ barman_logout_link(b) }}</li>
|
||||
<p>{{ barman_logout_link(b) }}</p>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<form method="post" action="{{ url('counter:login', counter_id=counter.id) }}">
|
||||
{% csrf_token %}
|
||||
{{ login_form.as_p() }}
|
||||
|
Reference in New Issue
Block a user