mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 06:03:20 +00:00
counter: speed counter click interface and auto scroll
This commit is contained in:
parent
9181e77d55
commit
405b938e08
@ -23,7 +23,7 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h4>{{ counter }}</h4>
|
<h4 id="click_interface">{{ counter }}</h4>
|
||||||
|
|
||||||
<div id="user_info">
|
<div id="user_info">
|
||||||
<h5>{% trans %}Customer{% endtrans %}</h5>
|
<h5>{% trans %}Customer{% endtrans %}</h5>
|
||||||
@ -127,17 +127,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="products">
|
<div id="products">
|
||||||
<ul>
|
<ul>
|
||||||
{% for t in categories -%}
|
{% for category in categories.keys() -%}
|
||||||
{%- if counter.products.filter(product_type=t).exists() -%}
|
<li><a href="#cat_{{ category|slugify }}">{{ category }}</a></li>
|
||||||
<li><a href="#cat_{{ t|slugify }}">{{ t }}</a></li>
|
|
||||||
{%- endif -%}
|
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% for t in categories -%}
|
{% for category in categories.keys() -%}
|
||||||
{%- if counter.products.filter(product_type=t).exists() -%}
|
<div id="cat_{{ category|slugify }}">
|
||||||
<div id="cat_{{ t|slugify }}">
|
<h5>{{ category }}</h5>
|
||||||
<h5>{{ t }}</h5>
|
{% for p in categories[category] -%}
|
||||||
{% for p in counter.products.filter(product_type=t).all() -%}
|
|
||||||
{% set file = None %}
|
{% set file = None %}
|
||||||
{% if p.icon %}
|
{% if p.icon %}
|
||||||
{% set file = p.icon.url %}
|
{% set file = p.icon.url %}
|
||||||
@ -148,18 +145,20 @@
|
|||||||
{{ add_product(p.id, prod, "form_button") }}
|
{{ add_product(p.id, prod, "form_button") }}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
</div>
|
</div>
|
||||||
{%- endif -%}
|
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block script %}
|
{% block script %}
|
||||||
|
<script>
|
||||||
|
document.getElementById("click_interface").scrollIntoView();
|
||||||
|
</script>
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script>
|
<script>
|
||||||
$( function() {
|
$( function() {
|
||||||
var products = [
|
var products = [
|
||||||
{% for p in counter.products.all() -%}
|
{% for p in products -%}
|
||||||
{
|
{
|
||||||
value: "{{ p.code }}",
|
value: "{{ p.code }}",
|
||||||
label: "{{ p.name }}",
|
label: "{{ p.name }}",
|
||||||
@ -203,6 +202,3 @@ $( function() {
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -708,10 +708,16 @@ class CounterClick(CounterTabsMixin, CanViewMixin, DetailView):
|
|||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
""" Add customer to the context """
|
""" Add customer to the context """
|
||||||
kwargs = super(CounterClick, self).get_context_data(**kwargs)
|
kwargs = super(CounterClick, self).get_context_data(**kwargs)
|
||||||
|
kwargs["products"] = self.object.products.select_related("product_type")
|
||||||
|
kwargs["categories"] = {}
|
||||||
|
for product in kwargs["products"]:
|
||||||
|
if product.product_type:
|
||||||
|
kwargs["categories"].setdefault(product.product_type, []).append(
|
||||||
|
product
|
||||||
|
)
|
||||||
kwargs["customer"] = self.customer
|
kwargs["customer"] = self.customer
|
||||||
kwargs["basket_total"] = self.sum_basket(self.request)
|
kwargs["basket_total"] = self.sum_basket(self.request)
|
||||||
kwargs["refill_form"] = self.refill_form or RefillForm()
|
kwargs["refill_form"] = self.refill_form or RefillForm()
|
||||||
kwargs["categories"] = ProductType.objects.all()
|
|
||||||
kwargs["student_card_max_uid_size"] = StudentCard.UID_SIZE
|
kwargs["student_card_max_uid_size"] = StudentCard.UID_SIZE
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user