Compare commits
2 Commits
175c3b2c5a
...
e6a7e0c974
Author | SHA1 | Date | |
---|---|---|---|
e6a7e0c974 | |||
ae1116fea8 |
@ -0,0 +1,7 @@
|
||||
@page {
|
||||
background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' width='75' height='75' viewBox='0 0 75 75'><text style='font-size:13px;fill:lightgrey' x='-49' y='58' id='text1' transform='rotate(-45)'>PREVIEW</text></svg>");
|
||||
}
|
||||
|
||||
body, table * {
|
||||
background: transparent !important;
|
||||
}
|
@ -35,10 +35,20 @@
|
||||
<form method="post" class="card-text">
|
||||
{% csrf_token %}
|
||||
{% bootstrap_form form %}
|
||||
<div class="text-center">{% bootstrap_button button_type="submit" content="Submit Invoice" %}</div>
|
||||
<div class="text-center">
|
||||
{% url "membershipworks:event-invoice-pdf-preview" event.eid as pdf_preview_link %}
|
||||
{% bootstrap_button button_class="btn-warning" href=pdf_preview_link content="Preview PDF" %}
|
||||
{% bootstrap_button button_type="submit" content="Submit Invoice" %}
|
||||
</div>
|
||||
</form>
|
||||
{% else %}
|
||||
<p>No invoice has been created for this event, and you are not listed as the the instructor.</p>
|
||||
<p>
|
||||
No invoice has been created for this event, and you are not listed as the the instructor.
|
||||
<div class="text-center">
|
||||
{% url "membershipworks:event-invoice-pdf-preview" event.eid as pdf_preview_link %}
|
||||
{% bootstrap_button button_class="btn-warning" href=pdf_preview_link content="Preview PDF" %}
|
||||
</div>
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -26,6 +26,11 @@
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</p>
|
||||
{% if now is not None %}
|
||||
<p>
|
||||
<b>Invoice Date:</b> {{ now|date }}
|
||||
</p>
|
||||
{% endif %}
|
||||
<p>
|
||||
<b>Attendees:</b> {{ event.details.cnt }}/{{ event.details.cap }}
|
||||
</p>
|
||||
@ -50,7 +55,7 @@
|
||||
<div class="vr d-none d-md-block m-4 p-0"></div>
|
||||
<div class="col-12 col-md-4">
|
||||
<div>
|
||||
<h3>Remit to:</h3>
|
||||
<h3>From:</h3>
|
||||
<div>{{ event.instructor.member.account_name }}</div>
|
||||
<div>{{ event.instructor.member.address_street }}</div>
|
||||
<div>
|
||||
@ -59,6 +64,7 @@
|
||||
{{ event.instructor.member.address_postal_code }}
|
||||
</div>
|
||||
<div>{{ event.instructor.member.email }}</div>
|
||||
<div>{{ event.instructor.member.phone }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -9,11 +9,15 @@
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="{% static 'bootstrap.min.css' %}" rel="stylesheet">
|
||||
<link rel="stylesheet" href="{% static "membershipworks/css/event_invoice_pdf.css" %}" media="print">
|
||||
{% if preview %}
|
||||
<link rel="stylesheet" href="{% static "membershipworks/css/event_invoice_pdf_preview.css" %}" media="print">
|
||||
{% endif %}
|
||||
<title>Event Invoice for {{ event.details.ttl|nh3 }}</title>
|
||||
</head>
|
||||
|
||||
<body style="font-size: 10pt;">
|
||||
<header>
|
||||
<h3>Bill To:</h3>
|
||||
<div>TwinState MakerSpaces, Inc.</div>
|
||||
<div>PO Box 100</div>
|
||||
<div>Lebanon, NH 03766-0100</div>
|
||||
|
@ -35,6 +35,11 @@ urlpatterns = [
|
||||
views.UserEventView.as_view(),
|
||||
name="user-events",
|
||||
),
|
||||
path(
|
||||
"event/<eid>_preview.pdf",
|
||||
views.EventInvoicePDFPreviewView.as_view(),
|
||||
name="event-invoice-pdf-preview",
|
||||
),
|
||||
path(
|
||||
"event/<eid>",
|
||||
views.EventDetailView.as_view(),
|
||||
|
@ -36,6 +36,7 @@ from django_mysql.models import GroupConcat
|
||||
from django_sendfile import sendfile
|
||||
from django_tables2 import A, SingleTableMixin
|
||||
from django_tables2.export.views import ExportMixin
|
||||
from django_weasyprint import WeasyTemplateResponseMixin
|
||||
from django_weasyprint.utils import django_url_fetcher
|
||||
|
||||
from membershipworks.membershipworks_api import MembershipWorks
|
||||
@ -358,9 +359,7 @@ class EventDetailView(
|
||||
invoice = EventInvoice(
|
||||
uuid=invoice_uuid,
|
||||
event=event,
|
||||
# NOTE: this needs to be resolved before the object is
|
||||
# saved, so cannot use the Now() db function
|
||||
date_submitted=timezone.now(),
|
||||
date_submitted=pdf_context["now"],
|
||||
amount=event.total_due_to_instructor,
|
||||
)
|
||||
# removed), currently used in event_invoice_admin.dj.html.
|
||||
@ -382,6 +381,28 @@ class EventDetailView(
|
||||
return super().form_valid(form)
|
||||
|
||||
|
||||
class EventInvoicePDFPreviewView(WeasyTemplateResponseMixin, EventDetailView):
|
||||
template_name = "membershipworks/event_invoice_pdf.dj.html"
|
||||
pdf_attachment = False
|
||||
|
||||
def display_instructor_version(self):
|
||||
return True
|
||||
|
||||
def get_pdf_filename(self):
|
||||
return f"event-invoice_{self.object.pk}.pdf"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context.update(
|
||||
{
|
||||
"now": timezone.now(),
|
||||
"invoice_uuid": "00000000-0000-0000-0000-000000000000",
|
||||
"preview": True,
|
||||
}
|
||||
)
|
||||
return context
|
||||
|
||||
|
||||
class EventInvoicePDFView(AccessMixin, BaseDetailView):
|
||||
model = EventInvoice
|
||||
pk_url_kwarg = "uuid"
|
||||
|
Loading…
Reference in New Issue
Block a user