From 1c97c8a74fa350a42b0bc53b4408ad5f07112e35 Mon Sep 17 00:00:00 2001 From: klmp200 Date: Sun, 16 Oct 2016 02:47:21 +0200 Subject: [PATCH] Swag dropdown on user account + autofocus for refillings on counters --- core/templates/core/user_account.jinja | 92 +++++++++++-------- core/templates/core/user_account_detail.jinja | 58 ++++++------ counter/templates/counter/counter_click.jinja | 5 +- counter/views.py | 3 + 4 files changed, 89 insertions(+), 69 deletions(-) diff --git a/core/templates/core/user_account.jinja b/core/templates/core/user_account.jinja index 3b459fc1..1ecaa8d9 100644 --- a/core/templates/core/user_account.jinja +++ b/core/templates/core/user_account.jinja @@ -1,29 +1,31 @@ {% extends "core/base.jinja" %} {% macro monthly(obj) %} - - - - - - - - - - {% for array in obj %} - {% for tuple in array %} - {% if tuple[0] != 0 %} - {% set link=url('core:user_account_detail', user_id=profile.id, year=tuple[1].year, month=tuple[1].month) %} +
+
{% trans %}Year{% endtrans %}{% trans %}Month{% endtrans %}{% trans %}Total{% endtrans %}
+ - - - + + + - {% endif %} + + + {% for array in obj %} + {% for tuple in array %} + {% if tuple[0] != 0 %} + {% set link=url('core:user_account_detail', user_id=profile.id, year=tuple[1].year, month=tuple[1].month) %} + + + + + + {% endif %} + {% endfor %} {% endfor %} - {% endfor %} - -
{{ tuple[1].year }}{{ tuple[1]|date("E") }}{{ tuple[0] }} €{% trans %}Year{% endtrans %}{% trans %}Month{% endtrans %}{% trans %}Total{% endtrans %}
{{ tuple[1].year }}{{ tuple[1]|date("E") }}{{ tuple[0] }} €
+ + + {% endmacro %} {% block title %} @@ -34,30 +36,42 @@ {% if customer %}

{% trans %}User account{% endtrans %}

{% trans %}Amount: {% endtrans %}{{ customer.amount }} €

+
{% if customer.refillings.exists() %} -

{% trans %}Refillings{% endtrans %}

- {{ monthly(refilling_month) }} -{% endif %} -{% if customer.buyings.exists() %} -

{% trans %}Account buyings{% endtrans %}

- {{ monthly(buyings_month) }} -{% endif %} -{% if customer.user.invoices.exists() %} -

{% trans %}Eboutic invoices{% endtrans %}

- {{ monthly(invoices_month) }} -{% endif %} -{% if etickets %} -

{% trans %}Etickets{% endtrans %}

- -{% endif %} + {% if customer.buyings.exists() %} +
{% trans %}Account buyings{% endtrans %}
+ {{ monthly(buyings_month) }} + {% endif %} +
{% trans %}Refillings{% endtrans %}
+ {{ monthly(refilling_month) }} + {% endif %} + {% if customer.user.invoices.exists() %} +
{% trans %}Eboutic invoices{% endtrans %}
+ {{ monthly(invoices_month) }} + {% endif %} + {% if etickets %} +

{% trans %}Etickets{% endtrans %}

+
+ +
+ {% endif %} +
{% else %}

{% trans %}User has no account{% endtrans %}

{% endif %} {% endblock %} +{% block script %} +{{ super() }} + +{% endblock %} diff --git a/core/templates/core/user_account_detail.jinja b/core/templates/core/user_account_detail.jinja index 5c74579d..e73c346f 100644 --- a/core/templates/core/user_account_detail.jinja +++ b/core/templates/core/user_account_detail.jinja @@ -9,35 +9,6 @@

{% trans %}User account{% endtrans %}

{% trans %}Amount: {% endtrans %}{{ customer.amount }} €

{% trans %}Back{% endtrans %}

-{% if customer.refillings.exists() %} -

{% trans %}Refillings{% endtrans %}

- - - - - - - - - - - - {% for i in customer.refillings.order_by('-date').filter( - date__year=year, date__month=month) %} - - - - - - - {% if i.is_owned_by(user) %} - - {% endif %} - -{% endfor %} - -
{% trans %}Date{% endtrans %}{% trans %}Counter{% endtrans %}{% trans %}Barman{% endtrans %}{% trans %}Amount{% endtrans %}{% trans %}Payment method{% endtrans %}
{{ i.date|localtime|date(DATETIME_FORMAT) }} - {{ i.date|localtime|time(DATETIME_FORMAT) }}{{ i.counter }}{{ i.operator.get_display_name() }}{{ i.amount }} €{{ i.get_payment_method_display() }}Delete
-{% endif %} {% if customer.buyings.exists() %}

{% trans %}Account buyings{% endtrans %}

@@ -71,6 +42,35 @@
{% endif %} +{% if customer.refillings.exists() %} +

{% trans %}Refillings{% endtrans %}

+ + + + + + + + + + + + {% for i in customer.refillings.order_by('-date').filter( + date__year=year, date__month=month) %} + + + + + + + {% if i.is_owned_by(user) %} + + {% endif %} + +{% endfor %} + +
{% trans %}Date{% endtrans %}{% trans %}Counter{% endtrans %}{% trans %}Barman{% endtrans %}{% trans %}Amount{% endtrans %}{% trans %}Payment method{% endtrans %}
{{ i.date|localtime|date(DATETIME_FORMAT) }} - {{ i.date|localtime|time(DATETIME_FORMAT) }}{{ i.counter }}{{ i.operator.get_display_name() }}{{ i.amount }} €{{ i.get_payment_method_display() }}Delete
+{% endif %} {% if customer.user.invoices.exists() %}

{% trans %}Eboutic invoices{% endtrans %}

diff --git a/counter/templates/counter/counter_click.jinja b/counter/templates/counter/counter_click.jinja index a086aa6a..0026bf1c 100644 --- a/counter/templates/counter/counter_click.jinja +++ b/counter/templates/counter/counter_click.jinja @@ -51,7 +51,7 @@ {% csrf_token %} - +

{% trans %}Basket: {% endtrans %}

@@ -174,6 +174,9 @@ $( function() { $( function() { $("#bar_ui").accordion({ heightStyle: "content", + activate: function(event, ui){ + $(".focus").focus(); + } }); $("#products").tabs(); }); diff --git a/counter/views.py b/counter/views.py index d2d8bbfe..303c47ff 100644 --- a/counter/views.py +++ b/counter/views.py @@ -63,6 +63,9 @@ class RefillForm(forms.ModelForm): class Meta: model = Refilling fields = ['amount', 'payment_method', 'bank'] + widgets = { + 'amount': forms.NumberInput(attrs={'class':'focus'},) + } class CounterTabsMixin(TabedViewMixin): def get_tabs_title(self):