Commit bbd72ed2 authored by Patrick's avatar Patrick
Browse files

Nicer order form if user may not order or the anonymous may not see the products

parent 644f5052
{% extends 'base.html' %}
{% load cms_tags sekizai_tags i18n l10n thumbnail filer_tags filer_image_tags %}
{% block base_content %}
<div class="container-repanier">
<div class="container">
<div class="container-repanier">
<div class="container">
{% if is_anonymous %}
<div class="row">
<div class="panel panel-danger">
......@@ -12,8 +12,7 @@
</div>
</div>
</div>
{% else %} {# is_anonymous#}
<span id="may_not_order" class="display_none">
{% elif not may_order%}
<div class="row">
<div class="panel panel-danger">
<div class="panel-heading">
......@@ -21,7 +20,7 @@
</div>
</div>
</div>
</span>
{% else %} {# not is_anonymous and may_order#}
<div class="row">
<div class="panel panel-default">
{% if permanence.offer_description and permanence.offer_description.strip %}
......@@ -62,12 +61,13 @@
<span id="span_btn_confirm_order"></span>
{% endif %}
{% endif %}
{% endif %} {# is_anonymous#}
{% endif %} {# not is_anonymous and may_order#}
{% if not is_anonymous or display_anonymous_order_form %}
<div class="row">
<nav class="col-xs-12 col-sm-3 hidden-xs bs-docs-sidebar">
<div class="fixed">
<form id="search_form" class="form-horizontal navbar-form" role="search" method="get">
{# {% csrf_token %}#}
{% csrf_token %}
<div class="input-group">
{% if q != None %}
<input type="search" autosave="repanier" class="form-control" value="{{ q }}" name="q">
......@@ -281,8 +281,9 @@
{# Other qty modal ends#}
</div>
</div>
</div>
</div>
{% endif %} {# not is_anonymous or display_anonymous_order_form #}
</div>
</div>
{% endblock %}
{% block footer %}
<div class="visible-xs">
......@@ -473,9 +474,7 @@
async: true,
success: function (result) {
$.each(result, function (key, val) {
if(val.id == '#may_not_order') {
$("#may_not_order").show();
} else if(val.id == '#communication') {
if(val.id == '#communication') {
$('#communicationModalLabel').html('{% trans "Personnal communication" %}');
$('#communicationDetails').html(val.html);
$('#communicationModal').modal('show')
......
......@@ -89,7 +89,7 @@ class OrderView(ListView):
if self.permanence.status == PERMANENCE_OPENED:
context['display_all_product_button'] = "Ok"
context['delivery_id'] = self.delivery_id
from repanier.apps import REPANIER_SETTINGS_DISPLAY_PRODUCER_ON_ORDER_FORM
from repanier.apps import REPANIER_SETTINGS_DISPLAY_PRODUCER_ON_ORDER_FORM, REPANIER_SETTINGS_DISPLAY_ANONYMOUS_ORDER_FORM
if REPANIER_SETTINGS_DISPLAY_PRODUCER_ON_ORDER_FORM:
producer_set = Producer.objects.filter(permanence=self.permanence.id).only("id", "short_profile_name")
else:
......@@ -143,6 +143,7 @@ class OrderView(ListView):
context['q'] = self.q
context['is_anonymous'] = self.is_anonymous
context['may_order'] = self.may_order
context['display_anonymous_order_form'] = REPANIER_SETTINGS_DISPLAY_ANONYMOUS_ORDER_FORM
return context
def get_queryset(self):
......
......@@ -160,9 +160,6 @@ def order_init_ajax(request):
{'permanence_boards': permanence_boards, 'count_activity': count_activity})
option_dict = {'id': "#communication", 'html': html}
to_json.append(option_dict)
else:
option_dict = {'id': "#may_not_order", 'html': '1'}
to_json.append(option_dict)
else:
customer = None
my_basket(False, REPANIER_MONEY_ZERO, to_json)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment