Commit bbd72ed2 authored by Patrick's avatar Patrick

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

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