Add new gift card to orderposition relationship (#3291)

This commit is contained in:
Raphael Michel
2023-05-09 09:54:46 +02:00
committed by GitHub
parent 996621c028
commit 6fac1aeb62
26 changed files with 477 additions and 64 deletions

View File

@@ -369,6 +369,20 @@
{% endif %}
<div class="clearfix"></div>
</div>
{% for gc in line.owned_gift_cards.all %}
<div class="cart-row-giftcard">
<span class="fa fa-credit-card" aria-hidden="true"></span>
<strong>{% trans "Gift card" %}</strong>
<code>{{ gc.secret }}</code>
<strong>{% trans "Current value:" %}</strong>
{{ gc.value|money:gc.currency }}
<a href="{% if position_page and line.addon_to %}{% eventurl event "presale:event.order.position.giftcard" secret=line.addon_to.web_secret order=order.code pk=gc.pk position=line.addon_to.positionid %}{% elif position_page %}{% eventurl event "presale:event.order.position.giftcard" secret=line.web_secret order=order.code pk=gc.pk position=line.positionid %}{% else %}{% eventurl event "presale:event.order.giftcard" secret=order.secret order=order.code pk=gc.pk %}{% endif %}"
class="btn btn-default btn-sm">
<span class="fa fa-eye" aria-hidden="true"></span>
{% trans "Details" %}
</a>
</div>
{% endfor %}
{% endfor %}
{% for fee in cart.fees %}
<div class="row cart-row">

View File

@@ -0,0 +1,29 @@
{% load i18n %}
{% load money %}
<table class="panel-body table">
<thead>
<tr>
<th>{% trans "Date" %}</th>
<th>{% trans "Order" %}</th>
<th class="text-right">{% trans "Value" %}</th>
</tr>
</thead>
<tbody>
{% for t in transactions %}
<tr>
<td>{{ t.datetime|date:"SHORT_DATETIME_FORMAT" }}</td>
<td>
{% if t.order %}
{{ t.order.full_code }}
{% else %}
<em>{% if t.text %}{{ t.text }}{% else %}{% trans "Manual transaction" %}{% endif %}</em>
{% endif %}
</td>
<td class="text-right">
{{ t.value|money:giftcard.currency }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% include "pretixcontrol/pagination.html" %}

View File

@@ -0,0 +1,24 @@
{% extends "pretixpresale/event/base.html" %}
{% load i18n %}
{% load money %}
{% load eventurl %}
{% load l10n %}
{% load rich_text %}
{% block title %}{% trans "Gift card" %}{% endblock %}
{% block content %}
<h2>
{% blocktrans trimmed with code=giftcard.secret %}
Gift card: {{ code }}
{% endblocktrans %}
<a href="{% eventurl request.event "presale:event.order" secret=order.secret order=order.code %}"
class="btn btn-default btn-sm btn-link">
<span class="fa fa-caret-left"></span>
{% trans "Back" %}
</a>
</h2>
<p>
<strong>{% trans "Current value:" %} {{ giftcard.value|money:giftcard.currency }}</strong>
</p>
<h3>{% trans "Transaction history" %}</h3>
{% include "pretixpresale/event/fragment_giftcard_history.html" %}
{% endblock %}

View File

@@ -0,0 +1,24 @@
{% extends "pretixpresale/event/base.html" %}
{% load i18n %}
{% load money %}
{% load eventurl %}
{% load l10n %}
{% load rich_text %}
{% block title %}{% trans "Gift card" %}{% endblock %}
{% block content %}
<h2>
{% blocktrans trimmed with code=giftcard.secret %}
Gift card: {{ code }}
{% endblocktrans %}
<a href="{% eventurl request.event "presale:event.order.position" secret=position.web_secret order=order.code position=position.positionid %}"
class="btn btn-default btn-sm btn-link">
<span class="fa fa-caret-left"></span>
{% trans "Back" %}
</a>
</h2>
<p>
<strong>{% trans "Current value:" %} {{ giftcard.value|money:giftcard.currency }}</strong>
</p>
<h3>{% trans "Transaction history" %}</h3>
{% include "pretixpresale/event/fragment_giftcard_history.html" %}
{% endblock %}