Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
AE UTBM
Sith
Commits
1c97c8a7
Commit
1c97c8a7
authored
Oct 16, 2016
by
Sli
Browse files
Swag dropdown on user account + autofocus for refillings on counters
parent
132bae72
Pipeline
#301
failed with stage
in 4 minutes and 6 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
core/templates/core/user_account.jinja
View file @
1c97c8a7
{%
extends
"core/base.jinja"
%}
{%
extends
"core/base.jinja"
%}
{%
macro
monthly
(
obj
)
%}
{%
macro
monthly
(
obj
)
%}
<table>
<div>
<thead>
<table>
<tr>
<thead>
<td>
{%
trans
%}
Year
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Month
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Total
{%
endtrans
%}
</td>
</tr>
</thead>
<tbody>
{%
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
)
%}
<tr>
<tr>
<td>
<a
href=
"
{{
link
}}
"
>
{{
tuple
[
1
]
.
year
}}
</a>
</td>
<td>
{%
trans
%}
Year
{%
endtrans
%}
</td>
<td>
<a
href=
"
{{
link
}}
"
>
{{
tuple
[
1
]
|
date
(
"E"
)
}}
</a>
</td>
<td>
{%
trans
%}
Month
{%
endtrans
%}
</td>
<td>
<a
href=
"
{{
link
}}
"
>
{{
tuple
[
0
]
}}
€
</a>
</td>
<td>
{%
trans
%}
Total
{%
endtrans
%}
</td>
</tr>
</tr>
{%
endif
%}
</thead>
<tbody>
{%
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
)
%}
<tr>
<td><a
href=
"
{{
link
}}
"
>
{{
tuple
[
1
]
.
year
}}
</a></td>
<td><a
href=
"
{{
link
}}
"
>
{{
tuple
[
1
]
|
date
(
"E"
)
}}
</a></td>
<td><a
href=
"
{{
link
}}
"
>
{{
tuple
[
0
]
}}
€
</a></td>
</tr>
{%
endif
%}
{%
endfor
%}
{%
endfor
%}
{%
endfor
%}
{%
endfor
%}
</tbody>
</t
body
>
</t
able
>
</
table
>
</
div
>
{%
endmacro
%}
{%
endmacro
%}
{%
block
title
%}
{%
block
title
%}
...
@@ -34,30 +36,42 @@
...
@@ -34,30 +36,42 @@
{%
if
customer
%}
{%
if
customer
%}
<h3>
{%
trans
%}
User account
{%
endtrans
%}
</h3>
<h3>
{%
trans
%}
User account
{%
endtrans
%}
</h3>
<p>
{%
trans
%}
Amount:
{%
endtrans
%}{{
customer.amount
}}
€
</p>
<p>
{%
trans
%}
Amount:
{%
endtrans
%}{{
customer.amount
}}
€
</p>
<div
id=
"drop"
>
{%
if
customer.refillings.exists
()
%}
{%
if
customer.refillings.exists
()
%}
<h4>
{%
trans
%}
Refillings
{%
endtrans
%}
</h4>
{%
if
customer.buyings.exists
()
%}
{{
monthly
(
refilling_month
)
}}
<h5>
{%
trans
%}
Account buyings
{%
endtrans
%}
</h5>
{%
endif
%}
{{
monthly
(
buyings_month
)
}}
{%
if
customer.buyings.exists
()
%}
{%
endif
%}
<h4>
{%
trans
%}
Account buyings
{%
endtrans
%}
</h4>
<h5>
{%
trans
%}
Refillings
{%
endtrans
%}
</h5>
{{
monthly
(
buyings_month
)
}}
{{
monthly
(
refilling_month
)
}}
{%
endif
%}
{%
endif
%}
{%
if
customer.user.invoices.exists
()
%}
{%
if
customer.user.invoices.exists
()
%}
<h4>
{%
trans
%}
Eboutic invoices
{%
endtrans
%}
</h4>
<h5>
{%
trans
%}
Eboutic invoices
{%
endtrans
%}
</h5>
{{
monthly
(
invoices_month
)
}}
{{
monthly
(
invoices_month
)
}}
{%
endif
%}
{%
endif
%}
{%
if
etickets
%}
{%
if
etickets
%}
<h4>
{%
trans
%}
Etickets
{%
endtrans
%}
</h4>
<h4>
{%
trans
%}
Etickets
{%
endtrans
%}
</h4>
<ul>
<div>
{%
for
s
in
etickets
%}
<ul>
<li><a
href=
"
{{
url
(
'counter:eticket_pdf'
,
selling_id
=
s.id
)
}}
"
>
{{
s.quantity
}}
x
{{
s.product.eticket
}}
</a></li>
{%
for
s
in
etickets
%}
{%
endfor
%}
<li><a
href=
"
{{
url
(
'counter:eticket_pdf'
,
selling_id
=
s.id
)
}}
"
>
{{
s.quantity
}}
x
{{
s.product.eticket
}}
</a></li>
</ul>
{%
endfor
%}
{%
endif
%}
</ul>
</div>
{%
endif
%}
</div>
{%
else
%}
{%
else
%}
<p>
{%
trans
%}
User has no account
{%
endtrans
%}
</p>
<p>
{%
trans
%}
User has no account
{%
endtrans
%}
</p>
{%
endif
%}
{%
endif
%}
{%
endblock
%}
{%
endblock
%}
{%
block
script
%}
{{
super
()
}}
<script>
$
(
function
(){
$
(
"
#drop
"
).
accordion
();
});
</script>
{%
endblock
%}
core/templates/core/user_account_detail.jinja
View file @
1c97c8a7
...
@@ -9,62 +9,62 @@
...
@@ -9,62 +9,62 @@
<h3>
{%
trans
%}
User account
{%
endtrans
%}
</h3>
<h3>
{%
trans
%}
User account
{%
endtrans
%}
</h3>
<p>
{%
trans
%}
Amount:
{%
endtrans
%}{{
customer.amount
}}
€
</p>
<p>
{%
trans
%}
Amount:
{%
endtrans
%}{{
customer.amount
}}
€
</p>
<p><a
href=
"
{{
url
(
'core:user_account'
,
user_id
=
profile.id
)
}}
"
>
{%
trans
%}
Back
{%
endtrans
%}
</a></p>
<p><a
href=
"
{{
url
(
'core:user_account'
,
user_id
=
profile.id
)
}}
"
>
{%
trans
%}
Back
{%
endtrans
%}
</a></p>
{%
if
customer.
refill
ings.exists
()
%}
{%
if
customer.
buy
ings.exists
()
%}
<h4>
{%
trans
%}
Refill
ings
{%
endtrans
%}
</h4>
<h4>
{%
trans
%}
Account buy
ings
{%
endtrans
%}
</h4>
<table>
<table>
<thead>
<thead>
<tr>
<tr>
<td>
{%
trans
%}
Date
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Date
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Counter
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Counter
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Barman
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Barman
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Amount
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Label
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Quantity
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Total
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Payment method
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Payment method
{%
endtrans
%}
</td>
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody>
{%
for
i
in
customer.
refill
ings.order_by
(
'-date'
)
.
filter
(
{%
for
i
in
customer.
buy
ings.order_by
(
'-date'
)
.
all
()
.
filter
(
date__year
=
year
,
date__month
=
month
)
%}
date__year
=
year
,
date__month
=
month
)
%}
<tr>
<tr>
<td>
{{
i.date
|
localtime
|
date
(
DATETIME_FORMAT
)
}}
-
{{
i.date
|
localtime
|
time
(
DATETIME_FORMAT
)
}}
</td>
<td>
{{
i.date
|
localtime
|
date
(
DATETIME_FORMAT
)
}}
-
{{
i.date
|
localtime
|
time
(
DATETIME_FORMAT
)
}}
</td>
<td>
{{
i.counter
}}
</td>
<td>
{{
i.counter
}}
</td>
<td><a
href=
"
{{
i.operator.get_absolute_url
()
}}
"
>
{{
i.operator.get_display_name
()
}}
</a></td>
<td><a
href=
"
{{
i.seller.get_absolute_url
()
}}
"
>
{{
i.seller.get_display_name
()
}}
</a></td>
<td>
{{
i.amount
}}
€
</td>
<td>
{{
i.label
}}
</td>
<td>
{{
i.quantity
}}
</td>
<td>
{{
i.quantity
*
i.unit_price
}}
€
</td>
<td>
{{
i.get_payment_method_display
()
}}
</td>
<td>
{{
i.get_payment_method_display
()
}}
</td>
{%
if
i.is_owned_by
(
user
)
%}
{%
if
i.is_owned_by
(
user
)
%}
<td><a
href=
"
{{
url
(
'counter:
refi
lling_delete'
,
refi
lling_id
=
i.id
)
}}
"
>
Delete
</a></td>
<td><a
href=
"
{{
url
(
'counter:
se
lling_delete'
,
se
lling_id
=
i.id
)
}}
"
>
{%
trans
%}
Delete
{%
endtrans
%}
</a></td>
{%
endif
%}
{%
endif
%}
</tr>
</tr>
{%
endfor
%}
{%
endfor
%}
</tbody>
</tbody>
</table>
</table>
{%
endif
%}
{%
endif
%}
{%
if
customer.
buy
ings.exists
()
%}
{%
if
customer.
refill
ings.exists
()
%}
<h4>
{%
trans
%}
Account buy
ings
{%
endtrans
%}
</h4>
<h4>
{%
trans
%}
Refill
ings
{%
endtrans
%}
</h4>
<table>
<table>
<thead>
<thead>
<tr>
<tr>
<td>
{%
trans
%}
Date
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Date
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Counter
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Counter
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Barman
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Barman
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Label
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Amount
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Quantity
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Total
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Payment method
{%
endtrans
%}
</td>
<td>
{%
trans
%}
Payment method
{%
endtrans
%}
</td>
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody>
{%
for
i
in
customer.
buy
ings.order_by
(
'-date'
)
.
all
()
.
filter
(
{%
for
i
in
customer.
refill
ings.order_by
(
'-date'
)
.
filter
(
date__year
=
year
,
date__month
=
month
)
%}
date__year
=
year
,
date__month
=
month
)
%}
<tr>
<tr>
<td>
{{
i.date
|
localtime
|
date
(
DATETIME_FORMAT
)
}}
-
{{
i.date
|
localtime
|
time
(
DATETIME_FORMAT
)
}}
</td>
<td>
{{
i.date
|
localtime
|
date
(
DATETIME_FORMAT
)
}}
-
{{
i.date
|
localtime
|
time
(
DATETIME_FORMAT
)
}}
</td>
<td>
{{
i.counter
}}
</td>
<td>
{{
i.counter
}}
</td>
<td><a
href=
"
{{
i.seller.get_absolute_url
()
}}
"
>
{{
i.seller.get_display_name
()
}}
</a></td>
<td><a
href=
"
{{
i.operator.get_absolute_url
()
}}
"
>
{{
i.operator.get_display_name
()
}}
</a></td>
<td>
{{
i.label
}}
</td>
<td>
{{
i.amount
}}
€
</td>
<td>
{{
i.quantity
}}
</td>
<td>
{{
i.quantity
*
i.unit_price
}}
€
</td>
<td>
{{
i.get_payment_method_display
()
}}
</td>
<td>
{{
i.get_payment_method_display
()
}}
</td>
{%
if
i.is_owned_by
(
user
)
%}
{%
if
i.is_owned_by
(
user
)
%}
<td><a
href=
"
{{
url
(
'counter:
se
lling_delete'
,
se
lling_id
=
i.id
)
}}
"
>
{%
trans
%}
Delete
{%
endtrans
%}
</a></td>
<td><a
href=
"
{{
url
(
'counter:
refi
lling_delete'
,
refi
lling_id
=
i.id
)
}}
"
>
Delete
</a></td>
{%
endif
%}
{%
endif
%}
</tr>
</tr>
{%
endfor
%}
{%
endfor
%}
...
...
counter/templates/counter/counter_click.jinja
View file @
1c97c8a7
...
@@ -51,7 +51,7 @@
...
@@ -51,7 +51,7 @@
<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=
"code"
>
<input
type=
"input"
name=
"code"
value=
""
autofocus
id=
"code_field"
/>
<input
type=
"input"
name=
"code"
value=
""
autofocus
class=
"focus"
id=
"code_field"
/>
<input
type=
"submit"
value=
"
{%
trans
%}
Go
{%
endtrans
%}
"
/>
<input
type=
"submit"
value=
"
{%
trans
%}
Go
{%
endtrans
%}
"
/>
</form>
</form>
<p>
{%
trans
%}
Basket:
{%
endtrans
%}
</p>
<p>
{%
trans
%}
Basket:
{%
endtrans
%}
</p>
...
@@ -174,6 +174,9 @@ $( function() {
...
@@ -174,6 +174,9 @@ $( function() {
$
(
function
()
{
$
(
function
()
{
$
(
"
#bar_ui
"
).
accordion
({
$
(
"
#bar_ui
"
).
accordion
({
heightStyle
:
"
content
"
,
heightStyle
:
"
content
"
,
activate
:
function
(
event
,
ui
){
$
(
"
.focus
"
).
focus
();
}
});
});
$
(
"
#products
"
).
tabs
();
$
(
"
#products
"
).
tabs
();
});
});
...
...
counter/views.py
View file @
1c97c8a7
...
@@ -63,6 +63,9 @@ class RefillForm(forms.ModelForm):
...
@@ -63,6 +63,9 @@ class RefillForm(forms.ModelForm):
class
Meta
:
class
Meta
:
model
=
Refilling
model
=
Refilling
fields
=
[
'amount'
,
'payment_method'
,
'bank'
]
fields
=
[
'amount'
,
'payment_method'
,
'bank'
]
widgets
=
{
'amount'
:
forms
.
NumberInput
(
attrs
=
{
'class'
:
'focus'
},)
}
class
CounterTabsMixin
(
TabedViewMixin
):
class
CounterTabsMixin
(
TabedViewMixin
):
def
get_tabs_title
(
self
):
def
get_tabs_title
(
self
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment