<commit_before>{% extends 'brambling/event/__base.html' %}

{% load floppyforms zenaida %}

{% block javascripts %}
	{{ block.super }}

	<script type='text/javascript'>
		var discountReload = true;
	</script>
	{% include 'brambling/event/_use_discount_js.html' %}
{% endblock %}

{% block main %}
	<div class='panel panel-primary'>
		<header class='panel-heading'>
			<div class='panel-title'>Items {% if cart %}{% include "brambling/event/_expiry_countdown.html" with expiry_time=cart.expires right=1 only %}{% endif%}</div>
		</header>
		<table class='table table-striped'>
			<thead>
				<tr>
					<th>Name</th>
					<th>Type</th>
					<th>Timestamp</th>
					<th>Status</th>
					<th class='text-right'>Amount ({{ event.currency }})</th>
				</tr>
			</thead>
			<tbody>
				{% for item in personitems %}
					<tr{% if item.status == item.UNPAID %} class='danger'{% endif %}>
						<td>{{ item.item_option.item.name }} ({{ item.item_option.name }})</td>
						<td>{{ item.item_option.item.get_category_display }}</td>
						<td class='text-muted'>{{ item.added|date:"n/j/Y H:i:s" }}</td>
						<td>{{ item.get_status_display }}</td>
						<td class='text-right'>{{ item.item_option.price }}</td>
					</tr>
				{% endfor %}
				<tr class='danger text-danger'>
					<th>Total cost</th>
					<td></td>
					<td></td>
					<td></td>
					<th class='text-right'>{{ total_cost|format_money:event.currency }}</th>
				</tr>
			</tbody>
		</table>
	</div>
	<div class='panel panel-primary'>
		<header class='panel-heading'>
			<div class='row'>
				<div class='panel-title col-xs-8'>Discounts</div>
				<form id='discount-form' class='panel-heading-form col-xs-4' action='{% url "brambling_event_use_discount" slug=event.slug %}' method='post'>
					<div class='input-group'>
						{% form discount_form using %}
							{% formfield discount_form.discount with placeholder="Code" autocomplete="off" %}
						{% endform %}
						<span class='input-group-btn'>
							<button class='btn btn-default' type='submit'><span class='glyphicon glyphicon-plus'></span></button>
						</span>
					</div>
				</form>
			</div>
		</header>
		<table class='table'>
			<thead>
				<tr>
					<th>Name</th>
					<th>Code</th>
					<th></th>
					<th class='text-right'>Amount ({{ event.currency }})</th>
				</tr>
			</thead>
			<tbody>
				{% for discount in discounts %}
					{% cycle 0 1 as stripe silent %}
					<tr{% if stripe %} class='active'{% endif %}>
						<th>{{ discount.discount.name }}</th>
						<td>{{ discount.discount.code }}</td>
						<td class='text-muted'>{{ discount.timestamp|date:"n/j/Y H:i:s" }}</td>
						<td></td>
					</tr>
					{% for item, amount in discount.items %}
						<tr{% if stripe %} class='active'{% endif %}>
							<td></td>
							<th>{% if forloop.first %}Applied to:{% endif %}</th>
							<td>{{ item.item_option.item.name }} ({{ item.item_option.name }})</td>
							<td class='text-right'>{{ amount|format_money:event.currency }}</td>
						</tr>
					{% endfor %}
				{% endfor %}
				<tr class='success text-success'>
					<th>Total savings</th>
					<td></td>
					<td></td>
					<th class='text-right'>{{ total_savings|format_money:event.currency }}</th>
				</tr>
			</tbody>
		</table>
	</div>
	<div class='panel panel-primary'>
		<header class='panel-heading'>
			<div class='panel-title'>Payments</div>
		</header>
		<table class='table table-striped'>
			<thead>
				<tr>
					<th>Timestamp</th>
					<th>Method</th>
					<th class='text-right'>Amount ({{ event.currency }})</th>
				</tr>
			</thead>
			<tbody>
				{% for payment in payments %}
					<tr>
						<td>{{ payment.timestamp|date:"n/j/Y H:i:s" }}</td>
						<td>{{ payment.card }}</td>
						<td class='text-right'>{{ payment.amount|format_money:event.currency }}</td>
					</tr>
				{% endfor %}
				<tr class='success text-success'>
					<th>Total payments</th>
					<td></td>
					<th class='text-right'>{{ total_payments|format_money:event.currency }}</th>
				</tr>
			</tbody>
		</table>
	</div>

	<div class='panel panel-primary'>
		<table class='table'>
			<tbody>
				<tr{% if balance < 0 %} class='success text-success'{% elif balance > 0 %} class='danger text-danger'{% endif %}>
					<th>Balance</th>
					<td class='text-right'>{% if balance < 0 %}Owed {% elif balance > 0 %}Owe {% endif %}<strong>{{ balance|absolute_value|format_money:event.currency }}</strong></td>
				</tr>
			</tbody>
		</table>
	</div>

	{% if form %}
		<form novalidate action="" method="post">
			{% csrf_token %}

			{% form form %}

			<button type="submit" class="btn btn-primary"{% if cart and not cart.is_finalized %} disabled{% endif %}>{% if balance > 0 %}Pay now ({{ balance|format_money:event.currency }}){% else %}Confirm cart purchases{% endif %}</button>
			<a class='btn btn-default' href='{% url "brambling_user_card_add" %}?next_url={{ request.path }}'><span class='glyphicon glyphicon-plus'></span> Add a card</a>
		</form><commit_msg>Added collapsing to records page.<commit_after>{% extends 'brambling/event/__base.html' %}

{% load floppyforms zenaida %}

{% block javascripts %}
	{{ block.super }}

	<script type='text/javascript'>
		var discountReload = true;
	</script>
	{% include 'brambling/event/_use_discount_js.html' %}
{% endblock %}

{% block main %}
	<div class='panel panel-primary'>
		<header class='panel-heading'>
			<div class='panel-title'><a href='#items-collapse' data-toggle='collapse'>Items {% if personitems %}<span class='caret'></span>{% endif %}
			</a> {% if cart %}<span class='pull-right'>{% include "brambling/event/_expiry_countdown.html" with expiry_time=cart.expires only %}{% endif%}</div>
		</header>
		<div class='collapse table-collapse-wrapper' id='items-collapse'>
			<table class='table table-striped'>
				<thead>
					<tr>
						<th>Name</th>
						<th>Type</th>
						<th>Timestamp</th>
						<th>Status</th>
						<th class='text-right'>Amount ({{ event.currency }})</th>
					</tr>
				</thead>
				<tbody>
					{% for item in personitems %}
						<tr{% if item.status == item.UNPAID %} class='danger'{% endif %}>
							<td>{{ item.item_option.item.name }} ({{ item.item_option.name }})</td>
							<td>{{ item.item_option.item.get_category_display }}</td>
							<td class='text-muted'>{{ item.added|date:"n/j/Y H:i:s" }}</td>
							<td>{{ item.get_status_display }}</td>
							<td class='text-right'>{{ item.item_option.price }}</td>
						</tr>
					{% endfor %}
				</tbody>
			</table>
		</div>
		<ul class='list-group'>
			<li class='list-group-item list-group-item-danger'><strong>Total cost</strong><strong class='pull-right'>{{ total_cost|format_money:event.currency }}</strong></li>
		</ul>
	</div>
	<div class='panel panel-primary'>
		<header class='panel-heading'>
			<div class='row'>
				<div class='panel-title col-xs-8'><a href='#discounts-collapse' data-toggle='collapse'>Discounts {% if discounts %}<span class='caret'></span>{% endif %}</a></div>
				<form id='discount-form' class='panel-heading-form col-xs-4' action='{% url "brambling_event_use_discount" slug=event.slug %}' method='post'>
					<div class='input-group'>
						{% form discount_form using %}
							{% formfield discount_form.discount with placeholder="Code" autocomplete="off" %}
						{% endform %}
						<span class='input-group-btn'>
							<button class='btn btn-default' type='submit'><span class='glyphicon glyphicon-plus'></span></button>
						</span>
					</div>
				</form>
			</div>
		</header>
		<div class='collapse table-collapse-wrapper' id='discounts-collapse'>
			<table class='table'>
				<thead>
					<tr>
						<th>Name</th>
						<th>Code</th>
						<th></th>
						<th class='text-right'>Amount ({{ event.currency }})</th>
					</tr>
				</thead>
				<tbody>
					{% for discount in discounts %}
						{% cycle 0 1 as stripe silent %}
						<tr{% if stripe %} class='active'{% endif %}>
							<th>{{ discount.discount.name }}</th>
							<td>{{ discount.discount.code }}</td>
							<td class='text-muted'>{{ discount.timestamp|date:"n/j/Y H:i:s" }}</td>
							<td></td>
						</tr>
						{% for item, amount in discount.items %}
							<tr{% if stripe %} class='active'{% endif %}>
								<td></td>
								<th>{% if forloop.first %}Applied to:{% endif %}</th>
								<td>{{ item.item_option.item.name }} ({{ item.item_option.name }})</td>
								<td class='text-right'>{{ amount|format_money:event.currency }}</td>
							</tr>
						{% endfor %}
					{% endfor %}
				</tbody>
			</table>
		</div>
		<ul class='list-group'>
			<li class='list-group-item list-group-item-success'><strong>Total savings</strong><strong class='pull-right'>{{ total_savings|format_money:event.currency }}</strong></li>
		</ul>
	</div>
	<div class='panel panel-primary'>
		<header class='panel-heading'>
			<div class='panel-title'><a href='#payments-collapse' data-toggle='collapse'>Payments {% if payments %}<span class='caret'></span>{% endif %}
			</a></div>
		</header>
		<div class='collapse table-collapse-wrapper' id='payments-collapse'>
			<table class='table table-striped'>
				<thead>
					<tr>
						<th>Timestamp</th>
						<th>Method</th>
						<th class='text-right'>Amount ({{ event.currency }})</th>
					</tr>
				</thead>
				<tbody>
					{% for payment in payments %}
						<tr>
							<td>{{ payment.timestamp|date:"n/j/Y H:i:s" }}</td>
							<td>{{ payment.card }}</td>
							<td class='text-right'>{{ payment.amount|format_money:event.currency }}</td>
						</tr>
					{% endfor %}
				</tbody>
			</table>
		</div>
		<ul class='list-group'>
			<li class='list-group-item list-group-item-success'><strong>Total payments</strong><strong class='pull-right'>{{ total_payments|format_money:event.currency }}</strong></li>
		</ul>
	</div>

	<div class='panel panel-primary'>
		<table class='table'>
			<tbody>
				<tr{% if balance < 0 %} class='success text-success'{% elif balance > 0 %} class='danger text-danger'{% endif %}>
					<th>Balance</th>
					<td class='text-right'>{% if balance < 0 %}Owed {% elif balance > 0 %}Owe {% endif %}<strong>{{ balance|absolute_value|format_money:event.currency }}</strong></td>
				</tr>
			</tbody>
		</table>
	</div>

	{% if form %}
		<form novalidate action="" method="post">
			{% csrf_token %}

			{% form form %}

			<button type="submit" class="btn btn-primary"{% if cart and not cart.is_finalized %} disabled{% endif %}>{% if balance > 0 %}Pay now ({{ balance|format_money:event.currency }}){% else %}Confirm cart purchases{% endif %}</button>
			<a class='btn btn-default' href='{% url "brambling_user_card_add" %}?next_url={{ request.path }}'><span class='glyphicon glyphicon-plus'></span> Add a card</a>
		</form>
{'fraction_non_alphanumeric': 0.21133245630520578, 'fraction_numerical': 0.0017853786882165007, 'mean_word_length': 3.314146736927442, 'pattern_counts': {'":': 0, '<': 364, '<?xml version=': 0, '>': 366, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1208705', 'n_tokens_mistral': 4771, 'n_tokens_neox': 3638, 'n_words': 771}