society-self-service/sstreasury/jinja2/sstreasury/budget_print.html

167 lines
5.1 KiB
HTML

{% extends 'ssmain/base.html' %}
{#
Society Self-Service
Copyright © 2018–2020 Yingtong Li (RunasSudo)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
#}
{% block title %}{{ revision.name }}{% endblock %}
{% block content %}
<h1>{{ revision.name }}</h1>
<span class="ui header">Status: {{ revision.get_state_display() }}</span>
{% if not is_latest %}
<div class="ui warning message">
<p>You are printing an older version of this budget.</p>
</div>
{% endif %}
<table class="ui mydefinition table">
<tbody>
<tr>
<td class="two wide">ID</td>
<td class="fourteen wide">BU-{{ revision.budget.id }}</td>
</tr>
<tr>
<td>Title</td>
<td>{{ revision.name }}</td>
</tr>
<tr>
<td>Due date</td>
<td>{{ revision.date or '' }}</td>
</tr>
<tr>
<td>Event details</td>
<td>
{% if revision.event_dt %}{{ localtime(revision.event_dt) }}.{% endif %}
{% if revision.event_attendees %}{{ revision.event_attendees }} attendees.{% endif %}
{% if not revision.event_dt and not revision.event_attendees %}N/A{% endif %}
</td>
</tr>
<tr>
<td>Contributors</td>
<td>
<div class="ui list">
{% for contributor in revision.contributors.all() %}
<div class="item">
<i class="user circle icon"></i>
<div class="content"><a href="mailto:{{ contributor.email }}">
{% if contributor.first_name %}
{{ contributor.first_name }} {{ contributor.last_name }}
{% else %}
{{ contributor.email }}
{% endif %}
</a></div>
</div>
{% endfor %}
</div>
</td>
</tr>
<tr>
<td>Comments</td>
<td>{{ revision.comments|markdown }}</td>
</tr>
<tr>
<td>Revenue</td>
<td>
<div id="revenue_grid"></div>
{% if revision.revenue_comments %}
<div class="ui accordion">
<div class="active title">
<i class="dropdown icon"></i>
Revenue comments
</div>
<div class="active content">
{{ revision.revenue_comments|markdown }}
</div>
</div>
{% endif %}
</td>
</tr>
<tr>
<td>Expenses</td>
<td>
{% if revision.expense_no_emergency_fund %}
<p><input type="checkbox" id="expense_no_emergency_fund" disabled checked> No emergency fund required (please add a comment explaining why)</p>
{% endif %}
<div id="expense_grid"></div>
{% if revision.expense_comments %}
<div class="ui accordion">
<div class="active title">
<i class="dropdown icon"></i>
Expense comments
</div>
<div class="active content">
{{ revision.expense_comments|markdown }}
</div>
</div>
{% endif %}
</td>
</tr>
<tr>
<td>Total Profit (Loss)</td>
<td style="text-align: right; font-weight: bold; padding-right: 2.3em;">{{ '${:.2f}'.format(revision.get_revenue_total() - revision.get_expense_total()) if revision.get_revenue_total() >= revision.get_expense_total() else '(${:.2f})'.format(revision.get_expense_total() - revision.get_revenue_total()) }}</td>
</tr>
</tbody>
</table>
{% endblock %}
{% block head %}
{{ super() }}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jsgrid@1.5.3/dist/jsgrid.min.css" integrity="sha256-a/jNbtm7jpeKiXCShJ8YC+eNL9Abh7CBiYXHgaofUVs=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jsgrid@1.5.3/dist/jsgrid-theme.min.css" integrity="sha256-0rD7ZUV4NLK6VtGhEim14ZUZGC45Kcikjdcr4N03ddA=" crossorigin="anonymous">
<style>
/* Fix the CSS */
.ui.mydefinition.table > tbody > tr > td:first-child:not(.ignored) {
background: rgba(0,0,0,.03);
font-weight: 700;
color: rgba(0,0,0,.95);
}
.jsgrid-align-right, .jsgrid-align-right input, .jsgrid-align-right select, .jsgrid-align-right textarea {
text-align: right !important;
}
.jsgrid-cell {
padding: .5em !important;
}
.jsgrid-header-row .jsgrid-header-cell {
text-align: center !important;
}
</style>
{% endblock %}
{% block script %}
{{ super() }}
<script src="https://cdn.jsdelivr.net/npm/jsgrid@1.5.3/dist/jsgrid.min.js" integrity="sha256-lzjMTpg04xOdI+MJdjBst98bVI6qHToLyVodu3EywFU=" crossorigin="anonymous"></script>
<script src="{{ static('sstreasury/budget.js') }}"></script>
<script>
var revenue_data = JSON.parse({{ import('json').dumps(import('json').dumps(revision.revenue))|safe }});
var expense_data = JSON.parse({{ import('json').dumps(import('json').dumps(revision.expense))|safe }});
var editing = false;
makeGrid();
print();
</script>
{% endblock %}