Allow specifying the responsible committee for a budget
This commit is contained in:
parent
2b976fd19e
commit
5cbb872c8e
@ -33,6 +33,11 @@ PROMO_LOGO_URL = 'https://placehold.it/2000x500'
|
||||
PROMO_LOGO_LINK = 'https://example.com'
|
||||
PROMO_GROUPS_MANDATORY = ['All Years']
|
||||
|
||||
AVAILABLE_APPROVERS = [
|
||||
# Tuples (committee name, description)
|
||||
('Committee', 'Management Committee'),
|
||||
]
|
||||
|
||||
TICKETING_FEE_PROPORTION = 0.0175 # Previous default was (1-1/1.01884)
|
||||
TICKETING_FEE_FIXED = 0.30 # Previous default was 0.8133/1.01884
|
||||
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
{#
|
||||
Society Self-Service
|
||||
Copyright © 2018-2019 Yingtong Li (RunasSudo)
|
||||
Copyright © 2018-2023 Yingtong Li (RunasSudo)
|
||||
Copyright © 2023 MUMUS Inc.
|
||||
|
||||
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
|
||||
@ -78,6 +79,16 @@
|
||||
<label class="three wide column">Contributors <span data-tooltip="To share this budget with other contributors, enter their email addresses, one per line"><i class="grey question circle icon"></i></span></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 required inline grid field">
|
||||
<label class="three wide column">Responsible committee</label>
|
||||
<div class="eleven wide column" style="padding-left: 0; padding-right: 0;">
|
||||
<select class="ui dropdown" name="approver">
|
||||
{% for approver in settings.AVAILABLE_APPROVERS %}
|
||||
<option value="{{ approver[0] }}"{% if approver[0] == revision.approver %} selected{% endif %}>{{ approver[1] }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui divider"></div>
|
||||
<div class="ui inline grid field">
|
||||
<label class="three wide column">Comments</label>
|
||||
@ -139,6 +150,14 @@
|
||||
<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">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/dragula@3.7.2/dist/dragula.min.css" integrity="sha256-iVhQxXOykHeL03K08zkxBGxDCLCuzRGGiTYf2FL6mLY=" crossorigin="anonymous">
|
||||
|
||||
<style type="text/css">
|
||||
/* Make dropdowns match form style */
|
||||
.ui.form .column .ui.dropdown {
|
||||
padding: 1rem;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block script %}
|
||||
@ -175,6 +194,7 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
$('.ui.dropdown').dropdown();
|
||||
|
||||
$('#expense_no_emergency_fund').change(function() {
|
||||
if ($('#expense_no_emergency_fund').prop('checked')) {
|
||||
|
@ -113,6 +113,10 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Responsible committee</td>
|
||||
<td>{{ dict(settings.AVAILABLE_APPROVERS)[revision.approver] }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Comments</td>
|
||||
<td>{{ revision.comments|markdown }}</td>
|
||||
|
@ -66,6 +66,7 @@ class BudgetRevision(models.Model):
|
||||
|
||||
author = models.ForeignKey(User, on_delete=models.PROTECT, related_name='+')
|
||||
time = models.DateTimeField()
|
||||
approver = models.CharField(max_length=100)
|
||||
|
||||
event_dt = models.DateTimeField(null=True)
|
||||
event_attendees = models.CharField(max_length=20, null=True)
|
||||
|
@ -148,6 +148,11 @@ def revision_from_form(budget, revision, form):
|
||||
else:
|
||||
contributors = []
|
||||
|
||||
if form['approver'] in dict(settings.AVAILABLE_APPROVERS):
|
||||
revision.approver = form['approver']
|
||||
else:
|
||||
errors.append('Responsible committee is invalid')
|
||||
|
||||
revision.comments = form['comments']
|
||||
revision.revenue = json.loads(form['revenue'])
|
||||
revision.revenue_comments = form['revenue_comments']
|
||||
|
Loading…
Reference in New Issue
Block a user