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

141 lines
5.0 KiB
HTML

{% extends 'sstreasury/base.html' %}
{#
Society Self-Service
Copyright © 2018 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 %}{% if request.resolver_match.url_name == 'budget_new' %}New{% else %}Edit{% endif %} budget{% endblock %}
{% block maincontent %}
<h1>{% if request.resolver_match.url_name == 'budget_new' %}New{% else %}Edit{% endif %} budget</h1>
<form class="ui form" method="POST">
<div class="ui disabled inline grid field">
<label class="three wide column">ID</label>
<input class="eleven wide column" type="text" name="id" value="{{ revision.budget.id if revision.budget.id != None else '' }}">
</div>
<div class="ui required inline grid field">
<label class="three wide column">Name</label>
<input class="eleven wide column" type="text" name="name" value="{{ revision.name }}">
</div>
<div class="ui inline grid field">
<label class="three wide column">Due date</label>
<div class="eleven wide column">
<div class="ui calendar" id="cal_date">
<div class="ui input left icon grid">
<i class="calendar icon" style="z-index: 999;"></i>
<input class="twelve wide column" type="text" name="date" value="{{ revision.date }}">
</div>
</div>
</div>
</div>
<div class="ui required inline grid field">
<label class="three wide column">Contributors</label>
<textarea class="eleven wide column" rows="2" name="contributors" style="font-family: Lato,'Helvetica Neue',Arial,Helvetica,sans-serif;">{{ contributors }}</textarea>
</div>
<div class="ui divider"></div>
<div class="ui inline grid field">
<label class="three wide column">Comments</label>
<textarea class="eleven wide column" rows="2" name="comments">{{ revision.comments }}</textarea>
</div>
<div class="ui divider"></div>
<div class="ui inline grid field">
<label class="three wide column">Revenue</label>
<textarea class="eleven wide column" rows="4" name="revenue">{{ revision.revenue }}</textarea>
</div>
<div class="ui accordion">
<div class="{% if revision.revenue_comments %}active {% endif %}title">
<i class="dropdown icon"></i>
Revenue comments
</div>
<div class="content">
<div class="ui inline grid field">
<label class="three wide column">Comments</label>
<textarea class="eleven wide column" rows="2" name="revenue_comments">{{ revision.revenue_comments }}</textarea>
</div>
</div>
</div>
<div class="ui divider"></div>
<div class="ui inline grid field">
<label class="three wide column">Expenses</label>
<textarea class="eleven wide column" rows="4" name="expense">{{ revision.expense }}</textarea>
</div>
<div class="ui accordion">
<div class="{% if revision.revenue_comments %}active {% endif %}title">
<i class="dropdown icon"></i>
Expense comments
</div>
<div class="content">
<div class="ui inline grid field">
<label class="three wide column">Comments</label>
<textarea class="eleven wide column" rows="2" name="expense_comments">{{ revision.expense_comments }}</textarea>
</div>
</div>
</div>
<div class="ui divider"></div>
<div class="ui error message"></div>
<input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
<input class="ui primary button" type="submit" value="Save">
<input class="ui button" type="submit" value="Save and continue editing">
</form>
{% endblock %}
{% block head %}
{{ super() }}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui-calendar@0.0.8/dist/calendar.min.css" integrity="sha256-KCHiPtYk/vfF5/6lDXpz5r5FuIYchVdai0fepwGft80=" crossorigin="anonymous">
<style type="text/css">
textarea {
font-family: Lato,'Helvetica Neue',Arial,Helvetica,sans-serif;
}
</style>
{% endblock %}
{% block script %}
{{ super() }}
<script src="https://cdn.jsdelivr.net/npm/semantic-ui-calendar@0.0.8/dist/calendar.min.js" integrity="sha256-Pnz4CK94A8tUiYWCfg/Ko25YZrHqOKeMS4JDXVTcVA0=" crossorigin="anonymous"></script>
<script>
function leftpad(n) {
if (n < 10)
return '0' + n;
return '' + n;
}
$('#cal_date').calendar({
type: 'date',
formatter: {
date: function(date, settings) {
return date.getFullYear() + '-' + leftpad(date.getMonth() + 1) + '-' + leftpad(date.getDate());
}
}
});
$('.ui.accordion').accordion();
$('.ui.form').form({
on: 'blur',
fields: {
name: 'empty',
contributors: 'empty'
}
});
</script>
{% endblock %}