Allow to modify answers for pending orders

This commit is contained in:
Raphael Michel
2015-03-14 13:32:56 +01:00
parent a0b9e9a5f9
commit 197fbbd180
13 changed files with 252 additions and 101 deletions

View File

@@ -12,16 +12,16 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#cp{{ form.cartpos.identity }}"
<a data-toggle="collapse" href="#cp{{ form.pos.identity }}"
data-parent="#questions_accordion">
<strong>{{ form.cartpos.item }}</strong>
{% if form.cartpos.variation %}
{{ form.cartpos.variation }}
<strong>{{ form.pos.item }}</strong>
{% if form.pos.variation %}
{{ form.pos.variation }}
{% endif %}
</a>
</h4>
</div>
<div id="cp{{ form.cartpos.identity }}"
<div id="cp{{ form.pos.identity }}"
class="panel-collapse collapse {% if forloop.counter0 == 0 %}in{% endif %}">
<div class="panel-body">
{% bootstrap_form form layout="horizontal" %}

View File

@@ -1,7 +1,7 @@
{% load i18n %}
{% for line in cart.positions %}
<div class="row-fluid cart-row">
<div class="{% if line.has_questions %}col-md-9 col-xs-6{% else %}col-md-4 col-xs-6{% endif %}">
<div class="col-md-4 col-xs-6">
<strong>{{ line.item }}</strong>
{% if line.variation %}
{{ line.variation }}
@@ -17,41 +17,40 @@
<dd>{% if q.answer %}{{ q.answer }}{% else %}<em>{% trans "not answered" %}</em>{% endif %}</dd>
{% endfor %}
</dl>
{% else %}
</div>
<div class="col-md-3 col-xs-6 price">
{{ event.currency }} {{ line.price|floatformat:2 }}
</div>
<div class="col-md-2 col-xs-6 count">
{% if editable %}
<form action="{% url "presale:event.cart.remove" event=event.slug organizer=event.organizer.slug %}"
method="post">
{% csrf_token %}
{% if line.variation %}
<input type="hidden" name="variation_{{ line.item.identity }}_{{ line.variation.identity }}"
value="1" />
{% else %}
<input type="hidden" name="item_{{ line.item.identity }}"
value="1" />
{% endif %}
<button class="btn btn-mini btn-link"><i class="fa fa-minus"></i></button>
</form>
{% endif %}
{{ line.count }}
{% if editable %}
<form action="{% url "presale:event.cart.add" event=event.slug organizer=event.organizer.slug %}"
{% endif %}
</div>
<div class="col-md-3 col-xs-6 price">
{{ event.currency }} {{ line.price|floatformat:2 }}
</div>
<div class="col-md-2 col-xs-6 count">
{% if editable %}
<form action="{% url "presale:event.cart.remove" event=event.slug organizer=event.organizer.slug %}"
method="post">
{% csrf_token %}
{% if line.variation %}
<input type="hidden" name="variation_{{ line.item.identity }}_{{ line.variation.identity }}"
{% csrf_token %}
{% if line.variation %}
<input type="hidden" name="variation_{{ line.item.identity }}_{{ line.variation.identity }}"
value="1" />
{% else %}
<input type="hidden" name="item_{{ line.item.identity }}"
value="1" />
{% else %}
<input type="hidden" name="item_{{ line.item.identity }}"
value="1" />
{% endif %}
<button class="btn btn-mini btn-link"><i class="fa fa-plus"></i></button>
</form>
{% endif %}
<button class="btn btn-mini btn-link"><i class="fa fa-minus"></i></button>
</form>
{% endif %}
{{ line.count }}
{% if editable %}
<form action="{% url "presale:event.cart.add" event=event.slug organizer=event.organizer.slug %}"
method="post">
{% csrf_token %}
{% if line.variation %}
<input type="hidden" name="variation_{{ line.item.identity }}_{{ line.variation.identity }}"
value="1" />
{% else %}
<input type="hidden" name="item_{{ line.item.identity }}"
value="1" />
{% endif %}
<button class="btn btn-mini btn-link"><i class="fa fa-plus"></i></button>
</form>
{% endif %}
</div>
<div class="col-md-3 col-xs-6 price">

View File

@@ -36,6 +36,13 @@
{% endif %}
<div class="panel panel-primary cart">
<div class="panel-heading">
{% if order.can_modify_answers %}
<div class="pull-right">
<a href="{% url "presale:event.order.modify" organizer=request.event.organizer.slug event=request.event.slug order=order.code %}">
{% trans "Change answers" %}
</a>
</div>
{% endif %}
<h3 class="panel-title">
{% trans "Ordered items" %}
</h3>

View File

@@ -0,0 +1,51 @@
{% extends "pretixpresale/event/base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% block title %}{% trans "Modify order" %}{% endblock %}
{% block content %}
<h2>
{% blocktrans trimmed with code=order.code %}
Modify order: {{ code }}
{% endblocktrans %}
</h2>
<form class="form-horizontal" method="post">
{% csrf_token %}
<div class="panel-group" id="questions_accordion">
{% for form in forms %}
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#cp{{ form.pos.identity }}"
data-parent="#questions_accordion">
<strong>{{ form.pos.item }}</strong>
{% if form.pos.variation %}
{{ form.pos.variation }}
{% endif %}
</a>
</h4>
</div>
<div id="cp{{ form.pos.identity }}"
class="panel-collapse collapse {% if forloop.counter0 == 0 %}in{% endif %}">
<div class="panel-body">
{% bootstrap_form form layout="horizontal" %}
</div>
</div>
</div>
{% endfor %}
</div>
<div class="row checkout-button-row">
<div class="col-md-4">
<a class="btn btn-block btn-default btn-lg"
href="{{ view.get_index_url }}">
{% trans "Revert changes" %}
</a>
</div>
<div class="col-md-4 col-md-offset-4">
<button class="btn btn-block btn-primary btn-lg" type="submit">
{% trans "Save changes" %}
</button>
</div>
<div class="clearfix"></div>
</div>
</form>
{% endblock %}