Forgot about credit notes.

This commit is contained in:
Víðir Valberg Guðmundsson 2019-03-26 21:39:44 +01:00
parent 0b2075425e
commit bda1d77275
4 changed files with 47 additions and 40 deletions

View file

@ -61,8 +61,9 @@
</li>
{% if user.creditnotes.exists %}
<li {% if view.active_menu == "credit_notes" %}class="active"{% endif %}>
<a href="{% url 'shop:creditnote_list' %}">
{% url 'shop:creditnote_list' as creditnote_list_url %}
<li {% if 'creditnotes' in request.path %}class="active"{% endif %}>
<a href="{{ creditnote_list_url }}">
Credit Notes
</a>
</li>

View file

@ -0,0 +1,43 @@
{% extends 'profile_base.html' %}
{% load bootstrap3 %}
{% load shop_tags %}
{% load bornhack %}
{% block profile_content %}
<div class="panel panel-default">
<div class="panel-heading">
<h4>Credit Notes</h4>
</div>
<div class="panel-body">
<table class="table table-hover">
<thead>
<tr>
<th>Credit Note ID</th>
<th>Text</th>
<th class="text-right">Amount</th>
<th>Paid?</th>
<th>PDF</th>
</tr>
</thead>
<tbody>
{% for creditnote in creditnotes %}
<tr>
<td>{{ creditnote.id }}</td>
<td>{{ creditnote.text }}</td>
<td class="text-right">{{ creditnote.amount|currency }}</td>
<td class="text-center">{{ creditnote.paid|truefalseicon }}</td>
<td>
{% if creditnote.pdf %}
{% url 'shop:download_creditnote' pk=creditnote.pk as creditnote_download_url %}
{% bootstrap_button "PDF" icon="save-file" href=creditnote_download_url button_class="btn-primary btn-xs" %}
{% else %}
N/A
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}

View file

@ -1,37 +0,0 @@
{% extends 'shop_base.html' %}
{% load bootstrap3 %}
{% load shop_tags %}
{% load bornhack %}
{% block shop_content %}
<h3>Credit Notes</h3>
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>Credit Note ID</th>
<th>Text</th>
<th class="text-right">Amount</th>
<th>Paid?</th>
<th>PDF</th>
</tr>
</thead>
<tbody>
{% for creditnote in creditnotes %}
<tr>
<td>{{ creditnote.id }}</td>
<td>{{ creditnote.text }}</td>
<td class="text-right">{{ creditnote.amount|currency }}</td>
<td class="text-center">{{ creditnote.paid|truefalseicon }}</td>
<td>
{% if creditnote.pdf %}
{% url 'shop:download_creditnote' pk=creditnote.pk as creditnote_download_url %}
{% bootstrap_button "PDF" icon="save-file" href=creditnote_download_url button_class="btn-primary btn-xs" %}
{% else %}
N/A
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

View file

@ -369,7 +369,7 @@ class DownloadInvoiceView(LoginRequiredMixin, EnsureUserOwnsOrderMixin, EnsurePa
class CreditNoteListView(LoginRequiredMixin, ListView):
model = CreditNote
template_name = "creditnote_list.html"
template_name = "shop/creditnote_list.html"
context_object_name = 'creditnotes'
def get_queryset(self):