add an invoice list view in backoffice in preparation for a CSV export of the same information

This commit is contained in:
Thomas Steen Rasmussen 2021-08-10 21:00:44 +02:00
parent 3e71a55a3a
commit b85a1c8565
5 changed files with 75 additions and 0 deletions

View file

@ -0,0 +1,34 @@
{% load bornhack %}
{% if invoice_list %}
<table class="table table-hover">
<thead>
<tr>
<th>Invoice #</th>
<th>Username</th>
<th>Email</th>
<th>Invoice Date</th>
<th>Paid</th>
<th>Order</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for invoice in invoice_list %}
<tr>
<td>{{ invoice.id }}</td>
<td>{{ invoice.user.username }}</td>
<td>{{ invoice.user.email }} DKK</td>
<td>{{ invoice.invoice_date }}</td>
<td>{{ invoice.paid|truefalseicon }}</td>
<td>{{ invoice.order }}</td>
<td>
n/a
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<h4>No invoices found.</h4>
{% endif %}

View file

@ -179,6 +179,10 @@
<h4 class="list-group-item-heading">Revenues</h4> <h4 class="list-group-item-heading">Revenues</h4>
<p class="list-group-item-text">Use this view to see and approve/reject revenues.</p> <p class="list-group-item-text">Use this view to see and approve/reject revenues.</p>
</a> </a>
<a href="{% url 'backoffice:invoice_list' camp_slug=camp.slug %}" class="list-group-item">
<h4 class="list-group-item-heading">Invoices</h4>
<p class="list-group-item-text">Use this view to see a list of invoices in the system.</p>
</a>
{% endif %} {% endif %}
{% if perms.camps.orgateam_permission or perms.camps.infoteam_permission or perms.camps.barteam_permission %} {% if perms.camps.orgateam_permission or perms.camps.infoteam_permission or perms.camps.barteam_permission %}

View file

@ -0,0 +1,17 @@
{% extends 'base.html' %}
{% load static %}
{% block title %}
Invoices | {{ block.super }}
{% endblock %}
{% block content %}
<h2>Invoices</h2>
<div class="lead">
This table shows all invoices in the system.
</div>
{% include 'includes/invoice_list_panel.html' %}
{% endblock content %}

View file

@ -57,6 +57,7 @@ from .views import (
FacilityTypeListView, FacilityTypeListView,
FacilityTypeUpdateView, FacilityTypeUpdateView,
FacilityUpdateView, FacilityUpdateView,
InvoiceListView,
IrcOverView, IrcOverView,
MerchandiseOrdersView, MerchandiseOrdersView,
MerchandiseToOrderView, MerchandiseToOrderView,
@ -663,6 +664,15 @@ urlpatterns = [
] ]
), ),
), ),
# invoices
path(
"invoices/",
include(
[
path("", InvoiceListView.as_view(), name="invoice_list"),
]
),
),
] ]
), ),
), ),

View file

@ -14,6 +14,7 @@ from django.views.generic.edit import CreateView, DeleteView, UpdateView
from camps.mixins import CampViewMixin from camps.mixins import CampViewMixin
from economy.models import Chain, Credebtor, Expense, Reimbursement, Revenue from economy.models import Chain, Credebtor, Expense, Reimbursement, Revenue
from shop.models import Invoice
from teams.models import Team from teams.models import Team
from ..mixins import EconomyTeamPermissionMixin from ..mixins import EconomyTeamPermissionMixin
@ -441,3 +442,12 @@ class RevenueDetailView(CampViewMixin, EconomyTeamPermissionMixin, UpdateView):
return redirect( return redirect(
reverse("backoffice:revenue_list", kwargs={"camp_slug": self.camp.slug}) reverse("backoffice:revenue_list", kwargs={"camp_slug": self.camp.slug})
) )
################################
# ORDERS & INVOICES
class InvoiceListView(CampViewMixin, EconomyTeamPermissionMixin, ListView):
model = Invoice
template_name = "invoice_list.html"