Compare commits

..

No commits in common. "e6a7e0c974c379bc7b2ce7dbdae052c9c480b88f" and "175c3b2c5a07b66a319f8bcc519c1aede5eeac48" have entirely different histories.

6 changed files with 6 additions and 59 deletions

View File

@ -1,7 +0,0 @@
@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;
}

View File

@ -35,20 +35,10 @@
<form method="post" class="card-text">
{% csrf_token %}
{% bootstrap_form form %}
<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>
<div class="text-center">{% 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.
<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>
<p>No invoice has been created for this event, and you are not listed as the the instructor.</p>
{% endif %}
</div>
</div>

View File

@ -26,11 +26,6 @@
{% 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>
@ -55,7 +50,7 @@
<div class="vr d-none d-md-block m-4 p-0"></div>
<div class="col-12 col-md-4">
<div>
<h3>From:</h3>
<h3>Remit to:</h3>
<div>{{ event.instructor.member.account_name }}</div>
<div>{{ event.instructor.member.address_street }}</div>
<div>
@ -64,7 +59,6 @@
{{ event.instructor.member.address_postal_code }}
</div>
<div>{{ event.instructor.member.email }}</div>
<div>{{ event.instructor.member.phone }}</div>
</div>
</div>
</div>

View File

@ -9,15 +9,11 @@
<!-- 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>

View File

@ -35,11 +35,6 @@ 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(),

View File

@ -36,7 +36,6 @@ 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
@ -359,7 +358,9 @@ class EventDetailView(
invoice = EventInvoice(
uuid=invoice_uuid,
event=event,
date_submitted=pdf_context["now"],
# NOTE: this needs to be resolved before the object is
# saved, so cannot use the Now() db function
date_submitted=timezone.now(),
amount=event.total_due_to_instructor,
)
# removed), currently used in event_invoice_admin.dj.html.
@ -381,28 +382,6 @@ 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"