Files
PyRIGS/RIGS/templates/event_print_page.xml
Tom Price a01e351e89 Markdown (#214)
* Add basic markdown support site wide

* Improved MD support.

Add some styling for images in MD

Add support for the bastardisation of the MD html for RML.

* Add processing for <ul> in RML

* Add OL processing to RML

* Fix a bug with squares appearing around the last page number

* Remove rml formatting in event_detail

* Improve handling of code blocks in RML

* Add MD to rigboard

Reduce MD title sizes as they were offensively large

* Add parsing of markdown when editing event items

* Improved list handling in RML

* Add tests for markdown support.

Focuses mainly on RML as that's where it will break

* Add indications of where MD support is enabled as per comment by @samozzy in #178.

Isn't quite a full description, but for the most part this should be enough for the people who know how to use it see where they can use it.

* Add failing test for markdown processing none

* Fix for failing test in e0d56e

* Add failing test for using single line breaks as per comment on #214

* Enable line break extension for single breaks in paragraphs by new lines.

Pass tests in ef3de607c3

* Enable GH flavour linebreaks in JS rendered markdown

* Made RML bullets pretty :)

* Added WYSIWYG editor. Works for notes & description, fails miserably for items :(

* Fixed for event items. Will probably fail tests because selenium can't type in simpleMDE :(

* FIX: Re-enable markdown on paperwork

Strikethrough is broken in all sorts of places for whatever reason

* FEAT: Markdown support on asset comments

* FIX: Prevent js injection through markdown fields

* Initial fixes

* Basic dark theme for simplemde

* Swap to locally delivered SimpleMDE

* Region for selenium testing of SimpleMDE

Bleh, Javascript all around

* Tests passing!

Fixed not using region for item modal, and overflow error on paperwork with really long description. Looks junk but I'm not really bothered

* Pep8 fixes

* Fallback for null HCapatcha sitekey

I.e. when we're on a branch

* Fix item description print being broken

* Actually fix sitekey problem

* Fixes for using markdown in asset comments

* Properly initialise markdown on asset comments

Co-authored-by: David Taylor <david@taylorhq.com>
Co-authored-by: FreneticScribbler <aj@aronajones.com>
2021-12-22 21:22:15 +00:00

360 lines
12 KiB
XML

{% load markdown_tags %}
{% load filters %}
<setNextFrame name="main"/>
<nextFrame/>
<blockTable style="headLayout" colWidths="330,165">
<tr>
<td>
<h1><b>N{{ object.pk|stringformat:"05d" }}:</b> '{{ object.name }}'<small></small></h1>
<para style="style.event_description">
<b>{{object.start_date|date:"D jS N Y"}}</b>
</para>
<keepInFrame maxHeight="500" onOverflow="shrink">
{{ object.description|default_if_none:""|markdown:"rml" }}
</keepInFrame>
</td>
<td>
{% if invoice %}
<para style="page-head">INVOICE</para>
<spacer length="10"/>
<blockTable style="eventDetails" colWidths="100,175">
<tr>
<td><para style="head_titles">Invoice Number</para></td>
<td>
<para style="head_numbers">{{ invoice.pk|stringformat:"05d" }}</para>
</td>
</tr>
<tr>
<td><para style="head_titles">Invoice Date</para></td>
<td>
<para style="head_numbers">{{ invoice.invoice_date|date:"d/m/Y" }}</para>
</td>
</tr>
{% if not object.internal %}
<tr>
<td><para style="head_titles">PO</para></td>
<td><para style="head_numbers">{{ object.purchase_order }}</para></td>
</tr>
{% endif %}
</blockTable>
{% elif quote %}
<para style="page-head">QUOTE</para>
<spacer length="10"/>
<blockTable style="eventDetails" colWidths="100,175">
<tr>
<td><para style="head_titles">Quote Date</para></td>
<td>
<para style="head_numbers">{% now "d/m/Y" %}</para>
</td>
</tr>
</blockTable>
{% elif receipt %}
<para style="page-head">CONFIRMATION</para>
{% endif %}
</td>
</tr>
</blockTable>
<spacer length="15"/>
<blockTable style="eventSpecifics" colWidths="165,165,165">
<tr>
<td leftPadding="0">
<h2>Hirer</h2>
<h3>{{ object.person.name }}</h3>
<h3>{{ object.organisation.name|default_if_none:"" }}</h3>
{% if invoice %}
<keepInFrame>
{% if object.organisation.address %}
<para style="specific_description">{{ object.organisation.address|default_if_none:""|linebreaksxml }}</para>
{% elif object.person.address %}
<para style="specific_description">{{ object.person.address|default_if_none:""|linebreaksxml }}</para>
{% endif %}
</keepInFrame>
{% endif %}
<keepInFrame>
{% if object.person.phone %}
<para style="specific_description">{{ object.person.phone }}</para>
{% elif object.organisation.phone %}
<para style="specific_description">{{ object.organisation.phone }}</para>
{% endif %}
</keepInFrame>
<keepInFrame>
{% if invoice %}
{% if object.organisation.email %}
<para style="specific_description">{{ object.organisation.email }}</para>
{% elif object.person.email %}
<para style="specific_description">{{ object.person.email }}</para>
{% endif %}
{% else %}
{% if object.person.email %}
<para style="specific_description">{{ object.person.email }}</para>
{% elif object.organisation.email %}
<para style="specific_description">{{ object.organisation.email }}</para>
{% endif %}
{% endif %}
</keepInFrame>
</td>
<td>
<h2>Venue</h2>
<h3>{{ object.venue.name }}</h3>
{% if not invoice %}
<keepInFrame>
<para style="specific_description">{{ object.venue.address|default_if_none:""|linebreaksxml }}</para>
</keepInFrame>
{% endif %}
</td>
<td rightPadding="0">
<h2>Timings</h2>
<blockTable style="eventDetails" colWidths="55,75">
<tr>
<td leftPadding="0" topPadding="0"><h3>Start</h3></td>
<td>
<para style="times">{{ object.start_time|time:"H:i" }}
{{ object.start_date|date:"d/m/Y" }}
</para>
</td>
</tr>
<tr>
<td leftPadding="0"><h3>End</h3></td>
<td>
<para style="times">{{ object.end_time|default_if_none:""|time:"H:i" }}
{{ object.end_date|date:"d/m/Y" }}
</para>
</td>
</tr>
{% if object.access_at and not invoice%}
<tr>
<td leftPadding="0"><h3>Access</h3></td>
<td>
<para style="times">{{ object.access_at|time:"H:i" }}
{{ object.access_at|date:"d/m/Y" }}
</para>
</td>
</tr>
{% endif %}
</blockTable>
</td>
</tr>
</blockTable>
<spacer length="15"/>
<setNextTemplate name="Main"/>
<blockTable style="itemTable" colWidths="300,80,35,80">
<tr>
{# Bold tags need to be in a para in order to render in reportlab #}
<td>
<para>
<b>Item</b>
</para>
</td>
<td>
<para>
<b>Price</b>
</para>
</td>
<td>
<para>
<b>Qty</b>
</para>
</td>
<td>
<para>
<b>Sub-total</b>
</para>
</td>
</tr>
{% for item in object.items.all %}
<tr>
<td>
<para>{{ item.name }}
{% if item.description %}
</para>
<para style="item_description">
{{ item.description|markdown:"rml" }}
</para>
<para>
{% endif %}
</para>
</td>
<td>£{{ item.cost|floatformat:2 }}</td>
<td>{{ item.quantity }}</td>
<td>£{{ item.total_cost|floatformat:2 }}</td>
</tr>
{% endfor %}
</blockTable>
<keepTogether>
<blockTable style="totalTable" colWidths="300,115,80">
{% if object.vat > 0 %}
<tr>
<td>{% if quote %}VAT Registration Number: 170734807</td>
<td>Total (ex. VAT){% endif %}</td>
<td>£ {{ object.sum_total|floatformat:2 }}</td>
</tr>
{% endif %}
<tr>
<td>
{% if quote %}
<para>
This quote is valid for 30 days unless otherwise arranged.
</para>
{% endif %}
</td>
{% if object.vat > 0 %}
<td>VAT @ {{ object.vat_rate.as_percent|floatformat:2 }}%</td>
<td>£{{ object.vat|floatformat:2 }}</td>
{% endif %}
</tr>
<tr>
<td>
{% if quote %}
<para>
<b>The full hire fee is payable at least 10 days before the event.</b>
</para>
{% endif %}
</td>
{% if invoice %}
<td>Total</td>
<td>£{{ object.total|floatformat:2 }}</td>
{% else %}
<td>
<para>
<b>Total</b>
</para>
</td>
<td>
<para>
<b>£{{ object.total|floatformat:2 }}</b>
</para>
</td>
{% endif %}
</tr>
</blockTable>
</keepTogether>
{% if invoice %}
<spacer length="15"/>
<keepTogether>
<h2>Payments</h2>
<blockTable style="itemTable" colWidths="300,115,80">
<tr>
<td>
<para>
<b>Method</b>
</para>
</td>
<td>
<para>
<b>Date</b>
</para>
</td>
<td>
<para>
<b>Amount</b>
</para>
</td>
</tr>
{% for payment in object.invoice.payment_set.all %}
<tr>
<td>{{ payment.get_method_display }}</td>
<td>{{ payment.date }}</td>
<td>£{{ payment.amount|floatformat:2 }}</td>
</tr>
{% endfor %}
</blockTable>
<blockTable style="totalTable" colWidths="300,115,80">
<tr>
<td></td>
<td>Payment Total</td>
<td>£{{ object.invoice.payment_total|floatformat:2 }}</td>
</tr>
<tr>
<td></td>
<td>
<para>
<b>Balance</b> {% if object.vat > 0 %}(ex. VAT){% endif %}
</para>
</td>
<td>
<para>
<b>£{{ object.invoice.balance|floatformat:2 }}</b>
</para>
</td>
</tr>
</blockTable>
</keepTogether>
{% endif %}
<keepTogether>
<blockTable style="infoTable">>
{% if quote %}
<tr><td><spacer length="15" /></td></tr>
<tr>
<td>
{% if object.internal %}
<para>Bookings will
<b>not</b>
be confirmed until the event is authorised online.
</para>
{% else %}
<para>Bookings will
<b>not</b>
be confirmed until we have received written confirmation and a Purchase Order.
</para>
{% endif %}
</td>
</tr>
<tr>
<td>General Enquires and 24 Hour Emergency Contact: 0115 84 68720</td>
</tr>
{% elif object.vat > 0 %}
<tr>
<td>
<para>VAT Registration Number: 170734807</para>
</td>
</tr>
{% endif %}
<tr><td><spacer length="15" /></td></tr>
<tr>
<td>
{% if object.internal and object.authorised %}
<para>
Event authorised online by {{ object.authorisation.name }} ({{ object.authorisation.email }}) at
{{ object.authorisation.last_edited_at }}.
</para>
<blockTable colWidths="165,165,165">
<tr>
<td><para><b>University ID</b></para></td>
<td><para><b>Account Code</b></para></td>
<td><para><b>Authorised Amount</b></para></td>
</tr>
<tr>
<td>{{ object.authorisation.uni_id }}</td>
<td>{{ object.authorisation.account_code }}</td>
<td>£ {{ object.authorisation.amount|floatformat:2 }}</td>
</tr>
</blockTable>
{% endif %}
</td>
</tr>
</blockTable>
</keepTogether>
<namedString id="lastPage"><pageNumber/></namedString>