Commit 7889f00f authored by Patrick's avatar Patrick

Order UI improvement on smartphone and feed back

parent fb993e85
......@@ -97,7 +97,7 @@ if DJANGO_SETTINGS_DEBUG:
# Activate ManifestStaticFilesStorage also when in debug mode
STATICFILES_STORAGE = 'repanier.big_blind_static.BigBlindManifestStaticFilesStorage'
else:
# Be carefull from CMS 4.3.2 you must patch ManifestStaticFilesStorage with django
# Be carefull from CMS 4.3.2 you must patch ManifestStaticFilesStorage
# STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
STATICFILES_STORAGE = 'repanier.big_blind_static.BigBlindManifestStaticFilesStorage'
# STATICFILES_DIRS = (
......
......@@ -215,12 +215,13 @@ class ProducerDataForm(forms.ModelForm):
instance.permanence_set = Permanence.objects.filter(producers=instance.pk).exclude(
status=PERMANENCE_PLANNED).order_by('?')
instance.permanence_set.add(*self.cleaned_data['permanences'])
# The previous save is called with "commit=False" or we need to update the producer
# The previous save is called with "commit=False"
# But we need to update the producer
# to recalculate the products prices. So a call to self.instance.save() is required
self.instance.save()
for product in Product.objects.filter(producer_id=instance.id).order_by('?'):
product.save()
update_offer_item(producer_id=instance.id)
# self.instance.save()
# for product in Product.objects.filter(producer_id=instance.id).order_by('?'):
# product.save()
# update_offer_item(producer_id=instance.id)
return instance
......
......@@ -152,10 +152,9 @@ class PermanenceMenu(Menu):
return nodes
def append_permanence(self, is_anonymous, permanence, nodes, master_id, submenu_id):
path = reverse('order_view', args=(permanence.id,))
if not is_anonymous and permanence.status > PERMANENCE_OPENED:
path = reverse('basket_view', args=(permanence.id,))
else:
path = reverse('order_view', args=(permanence.id,))
path = path + "?is_basket=yes"
submenu_id += 1
node = NavigationNode(
permanence.get_permanence_customer_display(),
......
......@@ -135,6 +135,30 @@ class Item(TranslatableModel):
offer_price = self.get_unit_price()
return offer_price
def set_from(self, source):
self.is_active = source.is_active
self.picture2 = source.picture2
self.reference = source.reference
self.department_for_customer_id = source.department_for_customer_id
self.producer_id = source.producer_id
self.order_unit = source.order_unit
self.wrapped = source.wrapped
self.order_average_weight = source.order_average_weight
self.placement = source.placement
self.vat_level = source.vat_level
self.customer_unit_price = source.customer_unit_price
self.customer_vat = source.customer_vat
self.producer_unit_price = source.producer_unit_price
self.producer_vat = source.producer_vat
self.unit_deposit = source.unit_deposit
self.limit_order_quantity_to_stock= source.limit_order_quantity_to_stock
self.stock = source.stock
self.customer_minimum_order_quantity = source.customer_minimum_order_quantity
self.customer_increment_order_quantity = source.customer_increment_order_quantity
self.customer_alert_order_quantity = source.customer_alert_order_quantity
self.producer_order_by_quantity = source.producer_order_by_quantity
self.is_box = source.is_box
def recalculate_prices(self, producer_price_are_wo_vat, is_resale_price_fixed, price_list_multiplier):
getcontext().rounding = ROUND_HALF_UP
vat = DICT_VAT[self.vat_level]
......
......@@ -85,7 +85,6 @@ class Permanence(TranslatableModel):
help_text=_(
'This message is send by mail to all customers having bought something when closing the permanence.'),
blank=True, default=EMPTY_STRING),
cache_part_d=HTMLField(configuration='CKEDITOR_SETTINGS_MODEL2', blank=True, default=EMPTY_STRING)
)
status = models.CharField(
......
......@@ -9,10 +9,10 @@ from django.core import urlresolvers
# from django.core.validators import MinLengthValidator
from django.core.validators import MinValueValidator
from django.db import models
from django.db.models import Q
# from django.db.models import Q
from django.db.models import Sum
from django.utils import timezone
from django.db.models.signals import pre_save
from django.db.models.signals import pre_save, post_save
from django.dispatch import receiver
from django.utils.encoding import python_2_unicode_compatible
from django.utils.formats import number_format
......@@ -22,8 +22,10 @@ from django.utils.translation import ugettext_lazy as _
import bankaccount
import invoice
import offeritem
import product
from repanier.const import *
from repanier.fields.RepanierMoneyField import ModelMoneyField, RepanierMoney
from repanier.tools import update_offer_item
@python_2_unicode_compatible
......@@ -351,12 +353,12 @@ def producer_pre_save(sender, **kwargs):
if producer.email3:
producer.email3 = producer.email3.lower()
if producer.producer_pre_opening:
# Important to make difference between the stock of the group and the stock of the producer
# Used to make difference between the stock of the group and the stock of the producer
producer.manage_replenishment = False
producer.manage_production = True
producer.is_resale_price_fixed = False
elif producer.manage_replenishment:
# Important to compute ProducerInvoice.total_price_with_tax
# Needed to compute ProducerInvoice.total_price_with_tax
producer.invoice_by_basket = False
if producer.price_list_multiplier <= DECIMAL_ZERO:
producer.price_list_multiplier = DECIMAL_ONE
......@@ -364,3 +366,10 @@ def producer_pre_save(sender, **kwargs):
producer.uuid = uuid.uuid4()
if producer.bank_account is not None and len(producer.bank_account.strip()) == 0:
producer.bank_account = None
@receiver(post_save, sender=Producer)
def producer_post_save(sender, **kwargs):
producer = kwargs["instance"]
for a_product in product.Product.objects.filter(producer_id=producer.id).order_by('?'):
a_product.save()
update_offer_item(producer_id=producer.id)
\ No newline at end of file
......@@ -115,8 +115,11 @@ def product_pre_save(sender, **kwargs):
# No VAT on those products
product.vat_level = VAT_100
product.recalculate_prices(producer.producer_price_are_wo_vat, producer.is_resale_price_fixed,
producer.price_list_multiplier)
product.recalculate_prices(
producer.producer_price_are_wo_vat,
producer.is_resale_price_fixed,
producer.price_list_multiplier
)
if producer.producer_pre_opening or producer.manage_production:
product.producer_order_by_quantity = DECIMAL_ZERO
......
......@@ -7,6 +7,11 @@ body {
/* Margin bottom by footer height */
margin-bottom: 60px;
}
@media screen and (min-width:768px) and (max-width: 979px) {
body {
padding-top: 60px;
}
}
.footer {
position: absolute;
bottom: 0;
......@@ -14,6 +19,7 @@ body {
/* Set the fixed height of the footer here */
height: 60px;
/* background-color: #f5f5f5; */
text-align: center;
}
/* sidebar */
......@@ -109,13 +115,13 @@ code {
max-height: 100% !important;
width: 90%;
position: fixed;
z-index: 1;
z-index: 1100;
top: 0;
left: 0;
background-color: #111;
background-color: #4d4d4f;
overflow-x: hidden;
transition: 0.5s;
padding-top: 60px;
padding-top: 15px;
}
.sidenav a {
......@@ -125,6 +131,7 @@ code {
display: block;
transition: 0.3s;
white-space: normal !important;
font-size: 18px;
}
.sidenav a:hover, .offcanvas a:focus{
......@@ -134,15 +141,15 @@ code {
.sidenav .closebtn {
position: absolute;
top: 0;
right: 25px;
font-size: 36px;
margin-left: 50px;
right: 20px;
/*font-size: 36px;*/
/*margin-left: 50px;*/
}
@media screen and (max-height: 450px) {
.navbar-collapse {padding-top: 15px;}
.navbar-collapse a {font-size: 18px;}
}
/*@media screen and (max-height: 450px) {*/
/*.sidenav {padding-top: 15px;}*/
/*.sidenav a {font-size: 18px;}*/
/*}*/
}
a.skip_link{
......@@ -153,19 +160,33 @@ a.skip_link{
.white, .white a {
color: #fff;
}
.container-bootstrap {
margin-top: 65px;
}
.container-repanier {
margin: 75px 0 0;
padding: 15px 15px 0;
}
.container-info {
margin: 75px 0 -75px 0;
padding: 15px 15px 0;
@media only screen and (min-width:768px) {
.container-bootstrap {
margin-top: 65px;
}
.container-repanier {
margin: 75px 0 0;
}
.container-info {
margin: 75px 0 -75px 0;
}
.container-menu {
padding: 0 15px 0;
}
}
.container-menu {
padding: 0 15px 0;
@media only screen and (max-width:767px) {
.container-bootstrap {
margin-top: 36px;
}
.container-repanier {
margin: 46px 0 0;
}
.container-info {
margin: 46px 0 -46px 0;
}
.container-menu {
}
}
/* django-angular : style.css */
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
......@@ -218,4 +239,122 @@ ul.djng-field-errors li.valid::before {
.checkbox + ul.djng-field-errors,
.checkbox + ul.djng-field-errors + ul.djng-field-errors {
display: none;
}
\ No newline at end of file
}
/* https://codepen.io/msaetre/pen/Ekyaz */
.icon-cart {
width: 48px;
height: 48px;
position: relative;
overflow: hidden;
/*margin-left: 25px;*/
/*margin-bottom: 25px;*/
margin-top: -10px;
}
.icon-cart .cart-line-1 {
width: 15%;
height: 7%;
position: absolute;
left: 8%;
top: 25%;
-webkit-transform: rotate(5deg);
-moz-transform: rotate(5deg);
-ms-transform: rotate(5deg);
transform: rotate(5deg);
border-bottom-left-radius: 35%;
}
.icon-cart .cart-line-2 {
width: 35%;
height: 7%;
position: absolute;
left: 6%;
top: 40%;
-webkit-transform: rotate(80deg);
-moz-transform: rotate(80deg);
-ms-transform: rotate(80deg);
transform: rotate(80deg);
}
.icon-cart .cart-line-2:before {
content: "";
width: 120%;
height: 100%;
position: absolute;
left: 45%;
top: -280%;
-webkit-transform: rotate(-80deg);
-moz-transform: rotate(-80deg);
-ms-transform: rotate(-80deg);
transform: rotate(-80deg);
background-color: inherit;
}
.icon-cart .cart-line-2:after {
content: "";
width: 70%;
height: 100%;
position: absolute;
left: 59%;
top: -670%;
background-color: inherit;
-webkit-transform: rotate(40deg);
-moz-transform: rotate(40deg);
-ms-transform: rotate(40deg);
transform: rotate(40deg);
border-top-left-radius: 50%;
border-bottom-left-radius: 25%;
}
.icon-cart .cart-line-3 {
width: 30%;
height: 7%;
position: absolute;
left: 33%;
top: 45%;
}
.icon-cart .cart-line-3:after {
content: "";
width: 124%;
height: 100%;
position: absolute;
top: -150%;
left: -5%;
background-color: inherit;
}
.icon-cart .cart-wheel {
width: 12%;
height: 12%;
border-radius: 100%;
position: absolute;
left: 28%;
bottom: 20%;
}
.icon-cart .cart-wheel:after {
content: "";
width: 100%;
height: 100%;
background-color: inherit;
border-radius: 100%;
position: absolute;
left: 200%;
bottom: 0;
}
/* Bootstrap : Let's align right the cart button on small devices */
.navbar-header{
width:100%;
}
.navbar-group-name {
margin-left: 10px;
color: #fff;
}
/* Bootstrap : Wordwrap button */
.btn{
white-space:normal !important;
word-wrap: break-word;
word-break: normal;
overflow-wrap: break-word;
}
......@@ -58,15 +58,15 @@ def generate_invoice(permanence, payment_date):
if permanence_partially_invoiced:
# Move the producers not invoiced into a new permanence
producers_to_keep = list(Producer.objects.filter(
producer_invoice__permanence_id=permanence.id,
producer_invoice__invoice_sort_order__isnull=True,
producer_invoice__to_be_paid=True).only('id').order_by('?'))
producerinvoice__permanence_id=permanence.id,
producerinvoice__invoice_sort_order__isnull=True,
producerinvoice__to_be_paid=True).only('id').order_by('?'))
permanence.producers.clear()
permanence.producers.add(*producers_to_keep)
producers_to_move = list(Producer.objects.filter(
producer_invoice__permanence_id=permanence.id,
producer_invoice__invoice_sort_order__isnull=True,
producer_invoice__to_be_paid=False).only('id').order_by('?'))
producerinvoice__permanence_id=permanence.id,
producerinvoice__invoice_sort_order__isnull=True,
producerinvoice__to_be_paid=False).only('id').order_by('?'))
new_permanence = permanence.create_child(PERMANENCE_SEND)
new_permanence.producers.add(*producers_to_move)
ProducerInvoice.objects.filter(
......
......@@ -58,23 +58,29 @@
{% cms_toolbar %}
{% spaceless %}
{# <!-- Header and Nav --> #}
<div class="navbar navbar-default navbar-fixed-top navbar-custom" role="navigation">
<div class="container-menu">
<div class="navbar-header">
<p class="navbar-text visible-xs-inline-block">{% repanier_group_name %}</p>
<button type="button" class="navbar-toggle" onclick="openNav()">
{% repanier_group_name as group_name %}
<nav class="navbar-default navbar-fixed-top navbar-custom" role="navigation">
<div class="navbar-header visible-xs-inline-block">
<a href="#" class="btn btn-default" onclick="openNav()">
<span class="sr-only">{% trans "Toggle navigation" %}</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="glyphicon glyphicon-list"></span>
</a>
{% if is_anonymous or not permanence_id %}
<span class="navbar-group-name"><small>{{ group_name | truncatechars:25 }}</small></span>
{% else %}
<span id="link_to_order_or_filter_view"></span>
<a href="{% url "order_view" permanence_id %}?is_basket=yes" class="btn btn-info pull-right" style="margin-right: 10px;">
<span id="prepared_amount_visible_xs"></span>
</a>
{% endif %}
</div>
<div id="mySidenav" class="sidenav collapse navbar-collapse">
<div class="container-menu">
<div id="mySideNav" class="sidenav collapse navbar-collapse">
{# <!-- Left Nav Section --> #}
<a href="javascript:void(0)" class="visible-xs-inline-block closebtn" onclick="closeNav()">&times;</a>
<ul class="nav navbar-nav navbar-left">
<li>
<a href="{% repanier_home %}"><span class="glyphicon glyphicon glyphicon-home"></span></a>
<button type="button" class="visible-xs-inline-block pull-right closebtn" onclick="closeNav()">&times;</button>
</li>
</ul>
<ul class="nav navbar-nav">
......@@ -82,7 +88,7 @@
</ul>
{# <!-- Right Nav Section --> #}
<ul class="nav navbar-nav navbar-right">
{% repanier_user permanence_id=permanence.id delivery_id=delivery.id %}
{% repanier_user permanence_id=permanence_id %}
{% repanier_display_languages as display_languages %}
{% if display_languages %}
<li class="dropdown">
......@@ -95,14 +101,14 @@
</ul>
</div>
</div>
</div>
</nav>
{% addtoblock "js" %}{% spaceless %}
<script type="text/javascript">
function openNav() {
$("#mySidenav").show()
$("#mySideNav").show()
}
function closeNav() {
$("#mySidenav").hide()
$("#mySideNav").hide()
}
</script>
{% endspaceless %}{% endaddtoblock %}
......
......@@ -60,23 +60,21 @@
{# {% cms_toolbar %}#}
{% spaceless %}
{# <!-- Header and Nav --> #}
<div class="navbar navbar-default navbar-fixed-top navbar-custom" role="navigation">
<div class="container-menu">
<div class="navbar-header">
<p class="navbar-text visible-xs-inline-block">{% repanier_group_name %}</p>
<button type="button" class="navbar-toggle" onclick="openNav()">
<nav class="navbar-default navbar-fixed-top navbar-custom" role="navigation">
<div class="navbar-header visible-xs-inline-block">
<a href="#" class="btn btn-default" onclick="openNav()">
<span class="sr-only">{% trans "Toggle navigation" %}</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="glyphicon glyphicon-list"></span>
</a>
<span class="navbar-group-name"><small>{{ group_name | truncatechars:25 }}</small></span>
</div>
<div id="mySidenav" class="sidenav collapse navbar-collapse">
<div class="container-menu">
<div id="mySideNav" class="sidenav collapse navbar-collapse">
{# <!-- Left Nav Section --> #}
<a href="javascript:void(0)" class="visible-xs-inline-block closebtn" onclick="closeNav()">&times;</a>
<ul class="nav navbar-nav navbar-left">
<li>
<a href="{% repanier_home %}"><span class="glyphicon glyphicon glyphicon-home"></span></a>
<button type="button" class="visible-xs-inline-block pull-right closebtn" onclick="closeNav()">&times;</button>
</li>
</ul>
<ul class="nav navbar-nav">
......@@ -84,7 +82,7 @@
</ul>
{# <!-- Right Nav Section --> #}
<ul class="nav navbar-nav navbar-right">
{% repanier_user permanence_id=permanence.id delivery_id=delivery.id %}
{% repanier_user permanence_id=0 %}
{% repanier_display_languages as display_languages %}
{% if display_languages %}
<li class="dropdown">
......@@ -97,14 +95,14 @@
</ul>
</div>
</div>
</div>
</nav>
{% addtoblock "js" %}{% spaceless %}
<script type="text/javascript">
function openNav() {
$("#mySidenav").show()
$("#mySideNav").show()
}
function closeNav() {
$("#mySidenav").hide()
$("#mySideNav").hide()
}
</script>
{% endspaceless %}{% endaddtoblock %}
......@@ -115,7 +113,7 @@
<div class="container">
<p class="text-muted">
{% block footer %}
{% static_placeholder 'footer' or %}{% trans "Contact" %} : coordi@repanier.be<span class="hidden-xs"> | {% trans "Participer" %} : <a href="https://github.com/pcolmant/repanier">github</a></span>{% endstatic_placeholder %}
{% static_placeholder 'footer' or %}{% trans "Contact" %} : coordi@repanier.be<span class="hidden-xs"> | {% trans "Participer" %} : <a href="https://github.com/pcolmant/repanier">github</a></span>{% endstatic_placeholder %}
{% endblock %}
</p>
</div>
......
{% load cms_tags sekizai_tags i18n l10n %}
{% if producer_set %}
<div class="btn-group dropup">
<button type="button" class="btn btn-default" data-toggle="dropdown">
&nbsp;&nbsp;&nbsp;&nbsp;{% trans " P " %}&nbsp;&nbsp;&nbsp;&nbsp;
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="?">{% trans "All producers" %}</a></li>
{% for producer in producer_set %}
<li><a href="?producer={{ producer.id }}">{{ producer.short_profile_name }}</a></li>
{% endfor %}
</ul>
</div>
{% endif %}
{% if departementforcustomer_set %}
<div class="btn-group dropup">
<button type="button" class="btn btn-default" data-toggle="dropdown">
&nbsp;&nbsp;&nbsp;&nbsp;{% trans " D " %}&nbsp;&nbsp;&nbsp;&nbsp;
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="?">{% trans "All departments" %}</a></li>
{% for departementforcustomer in departementforcustomer_set %}
{% ifchanged departementforcustomer.parent %}
<li>
<a href="?departementforcustomer={{ departementforcustomer.parent.id }}">{{ departementforcustomer.parent.short_name }}</a>
</li>
{% endifchanged %}
{% endfor %}
</ul>
</div>
{% endif %}
{% extends 'cms_page.html' %}
{% load cms_tags sekizai_tags i18n l10n %}
{% block sub_content %}
<div class="col-xs-12">
<nav class="bs-docs-sidebar">
<div class="fixed">
{# q : {{ q }}<br/>#}
{# producer_id : {{ producer_id }}<br/>#}
{# departementforcustomer_id : {{ departementforcustomer_id }}<br/>#}
{# box_id : {{ box_id }}<br/>#}
{# is_like : {{ is_like }}{% if is_like %} is_like==True{% endif %}<br/>#}
{# is_basket : {{ is_basket }}<br/>#}
{# is_box : {{ is_box }}<br/>#}
<form action="{% url "order_view" permanence_id %}" id="search_form" class="form-horizontal navbar-form" role="search" method="get">
{% csrf_token %}
<div class="input-group">
{% if q != None %}
<input type="search" autosave="repanier" class="form-control" value="{{ q }}" name="q">
{% else %}
<input type="search" autosave="repanier" class="form-control" placeholder="{% trans "Search" %}"
name="q">
{% endif %}
<div class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
<input type="hidden" name="producer" value="{{ producer_id }}">
<input type="hidden" name="departementforcustomer" value="{{ departementforcustomer_id }}">
<input type="hidden" name="box" value="{{ box_id }}">
<input type="hidden" name="is_like" value="{{ is_like }}">
<input type="hidden" name="is_basket" value="{{ is_basket }}">
</form>
<br/>
<ul class="nav nav-stacked" id="sidebar">
<li>
<a href="{% url "order_view" permanence_id %}?{% if not is_like %}is_like=yes{% endif %}{% if q %}&q={{ q }}{% endif %}{% if is_basket %}&is_basket=yes{% endif %}" {% if is_like %}class="bs-docs-sidebar-active"{% endif %}>{% trans "My likes" %} <span class="glyphicon glyphicon-heart"></span></a>
</li>
{% if box_set %}
{% for box in box_set.all %}
<li><a href="{% url "order_view" permanence_id %}?box={{ box.id|unlocalize }}{% if q %}&q={{ q }}{% endif %}{% if is_like %}&is_like=yes{% endif %}{% if is_basket %}&is_basket=yes{% endif %}"
{% if box.id == box_id|add:0 %}class="bs-docs-sidebar-active"{% endif %}>{{ box.long_name | truncatechars:20 }} 📦{# <span class="glyphicon glyphicon-gift"></span> #}</a>
{% endfor %}
{% endif %}
{% if producer_set %}
<li>
<a href="{% url "order_view" permanence_id %}?departementforcustomer={{ departementforcustomer_id }}{% if q %}&q={{ q }}{% endif %}{% if is_like %}&is_like=yes{% endif %}{% if is_basket %}&is_basket=yes{% endif %}"
{% if producer_id == "all" %}class="bs-docs-sidebar-active"{% endif %}>{% trans "All producers" %}</a>
<ul class="nav nav-stacked">
{% for producer in producer_set.all %}
<li><a href="{% url "order_view" permanence_id %}?producer={{ producer.id|unlocalize }}&departementforcustomer={{ departementforcustomer_id }}{% if q %}&q={{ q }}{% endif %}{% if is_like %}&is_like=yes{% endif %}{% if is_basket %}&is_basket=yes{% endif %}"
{% if producer.id == producer_id|add:0 %}class="bs-docs-sidebar-active"{% endif %}>{{ producer.short_profile_name | truncatechars:15 }}&nbsp;<span id="order_procent{{ producer.id|unlocalize }}" class="badge"></span><span id="order_closed{{ producer.id|unlocalize }}" class="text-warning"></span></a>
</li>
{% endfor %}
</ul>
</li>
{% else %}{% if not departementforcustomer_set %}{% if is_like or is_basket or is_box or q %}
<li>
<a href="{% url "order_view" permanence_id %}">{% trans "All products" %}</a>
</li>
{% endif %}{% endif %}{% endif %}
{% if departementforcustomer_set %}
<li>
<a href="{% url "order_view" permanence_id %}?producer={{ producer_id }}{% if q %}&q={{ q }}{% endif %}{% if is_like %}&is_like=yes{% endif %}{% if is_basket %}&is_basket=yes{% endif %}"
{% if departementforcustomer_id == "all" %}class="bs-docs-sidebar-active"{% endif %}>{% trans "All departments" %}</a>
<ul class="nav nav-stacked">
{% for departementforcustomer in departementforcustomer_set.all %}
{% if departementforcustomer.level > 0 %}
{% ifchanged departementforcustomer.parent_id %}
{% if departementforcustomer.parent.level == 0 %}</ul>{% endif %}
<li><a href="{% url "order_view" permanence_id %}?producer={{ producer_id }}&departementforcustomer={{ departementforcustomer.parent_id|unlocalize }}{% if q %}&q={{ q }}{% endif %}{% if is_like %}&is_like=yes{% endif %}{% if is_basket %}&is_basket=yes{% endif %}"
{% if departementforcustomer.parent_id == departementforcustomer_id|add:0 %}class="bs-docs-sidebar-active"{% endif %}>{{ departementforcustomer.parent.short_name }}</a>
</li>
{% if departementforcustomer.parent.level == 0 %}<ul class="nav nav-stacked">{% endif %}
{% endifchanged %}
<li>
<a href="{% url "order_view" permanence_id %}?producer={{ producer_id }}&departementforcustomer={{ departementforcustomer.id|unlocalize }}{% if q %}&q={{ q }}{% endif %}{% if is_like %}&is_like=yes{% endif %}{% if is_basket %}&is_basket=yes{% endif %}"
{% if departementforcustomer.id == departementforcustomer_id|add:0 %}class="bs-docs-sidebar-active"{% endif %}>{{ departementforcustomer.short_name }}</a>
</li>
{% else %}
</ul><li>
<a href="{% url "order_view" permanence_id %}?producer={{ producer_id }}&departementforcustomer={{ departementforcustomer.id|unlocalize }}{% if q %}&q={{ q }}{% endif %}{% if is_like %}&is_like=yes{% endif %}{% if is_basket %}&is_basket=yes{% endif %}"
{% if departementforcustomer.id == departementforcustomer_id|add:0 %}class="bs-docs-sidebar-active"{% endif %}>{{ departementforcustomer.short_name }}</a>
</li><ul class="nav nav-stacked">
{% endif %}
{% endfor %}
</ul>
</li>
{% endif %}
</ul>
</div>
</nav>
</div>
{% if not is_anonymous %}
{% addtoblock "lastjs" %}
<script type="text/javascript">
$(document).ready(function () {
$("#link_to_order_or_filter_view").html('<a href="{% url "order_view" permanence_id %}?producer={{ producer_id }}&departementforcustomer={{ departementforcustomer_id }}&box={{ box_id }}{% if q %}&q={{ q }}{% endif %}{% if is_like %}&is_like=yes{% endif %}{% if is_basket %}&is_basket=yes{% endif %}" class="btn btn-default" style="margin-left: 10px;"><span class="glyphicon glyphicon-eye-close" aria-hidden="true"></span></a>');
var lien = '{% url "my_cart_amount_ajax" permanence_id %}';
$.ajax({
url: lien,
cache: false,
dataType: 'json',
async: true,
success: function (result) {
$.each(result, function (key, val) {
$(val.id).each(function( index ) { $( this ).html(val.html)});
});
}
});
$("#li_my_basket").show();
});
</script>
{% endaddtoblock %}
{% endif %}
{% endblock %}
This diff is collapsed.
......@@ -33,8 +33,6 @@ def repanier_user(context, *args, **kwargs):
request = context["request"]
user = request.user
if user.is_authenticated:
p_permanence_id = sint(kwargs.get('permanence_id', -1))
p_delivery_id = sint(kwargs.get('delivery_id', -1))
nodes = ["""
<li id="li_my_name" class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> %s %s<b class="caret"></b></a>
......@@ -62,7 +60,7 @@ def repanier_user(context, *args, **kwargs):
reverse('my_profile_view'),
_('My profile')
))
if REPANIER_SETTINGS_INVOICE and not request.user.is_staff:
if REPANIER_SETTINGS_INVOICE:
last_customer_invoice = CustomerInvoice.objects.filter(
customer__user_id=request.user.id,
invoice_sort_order__isnull=False) \
......@@ -88,16 +86,12 @@ def repanier_user(context, *args, **kwargs):