Improvements to budget interface
This commit is contained in:
parent
b85b2e0765
commit
4339f568f9
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,4 @@
|
||||
venv
|
||||
venv*
|
||||
*.sqlite3
|
||||
__pycache__
|
||||
|
||||
|
@ -77,11 +77,11 @@
|
||||
<input type="hidden" name="expense" id="expense_input">
|
||||
</div>
|
||||
<div class="ui accordion">
|
||||
<div class="{% if revision.revenue_comments %}active {% endif %}title">
|
||||
<div class="{% if revision.expense_comments %}active {% endif %}title">
|
||||
<i class="dropdown icon"></i>
|
||||
Expense comments
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="{% if revision.expense_comments %}active {% endif %}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>
|
||||
@ -91,8 +91,8 @@
|
||||
<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">
|
||||
<input class="ui primary button" type="submit" name='submit' value="Save">
|
||||
<input class="ui button" type="submit" name='submit' value="Save and continue editing">
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
@ -186,7 +186,7 @@
|
||||
$(args.grid._body).find('.totalrow').remove();
|
||||
|
||||
if (totalIWT > 0) {
|
||||
var totalrow = $('<tr class="jsgrid-row totalrow" style="font-weight: bold;"></tr>');
|
||||
var totalrow = $('<tr class="jsgrid-row totalrow" style="font-style: italic;"></tr>');
|
||||
totalrow.append($('<td class="jsgrid-cell">Less IWT fees:</td>').prop('colspan', args.grid.fields.length - 2));
|
||||
totalrow.append($('<td class="jsgrid-cell jsgrid-align-right"></td>').text('($' + totalIWT.toFixed(2) + ')'));
|
||||
totalrow.append($('<td class="jsgrid-cell"></td>'));
|
||||
@ -208,7 +208,7 @@
|
||||
|
||||
$(args.grid._body).find('.totalrow').remove();
|
||||
|
||||
var totalrow = $('<tr class="jsgrid-row totalrow" style="font-weight: bold;"></tr>');
|
||||
var totalrow = $('<tr class="jsgrid-row totalrow" style="font-style: italic;"></tr>');
|
||||
totalrow.append($('<td class="jsgrid-cell">Plus emergency fund:</td>').prop('colspan', args.grid.fields.length - 2));
|
||||
totalrow.append($('<td class="jsgrid-cell jsgrid-align-right"></td>').text('$' + (total * 0.05).toFixed(2)));
|
||||
totalrow.append($('<td class="jsgrid-cell"></td>'));
|
||||
|
@ -81,7 +81,7 @@
|
||||
<i class="dropdown icon"></i>
|
||||
Revenue comments
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="active content">
|
||||
{{ revision.revenue_comments }}
|
||||
</div>
|
||||
</div>
|
||||
@ -98,7 +98,7 @@
|
||||
<i class="dropdown icon"></i>
|
||||
Expense comments
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="active content">
|
||||
{{ revision.expense_comments }}
|
||||
</div>
|
||||
</div>
|
||||
@ -165,11 +165,23 @@
|
||||
<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 %}
|
||||
|
||||
@ -179,6 +191,8 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/jsgrid@1.5.3/dist/jsgrid.min.js" integrity="sha256-lzjMTpg04xOdI+MJdjBst98bVI6qHToLyVodu3EywFU=" crossorigin="anonymous"></script>
|
||||
|
||||
<script>
|
||||
$('.ui.accordion').accordion();
|
||||
|
||||
function recalcRevTotal(args) {
|
||||
//console.log(args);
|
||||
var total = 0;
|
||||
@ -193,7 +207,7 @@
|
||||
$(args.grid._body).find('.totalrow').remove();
|
||||
|
||||
if (totalIWT > 0) {
|
||||
var totalrow = $('<tr class="jsgrid-row totalrow" style="font-weight: bold;"></tr>');
|
||||
var totalrow = $('<tr class="jsgrid-row totalrow" style="font-style: italic;"></tr>');
|
||||
totalrow.append($('<td class="jsgrid-cell">Less IWT fees:</td>').prop('colspan', args.grid.fields.length - 1));
|
||||
totalrow.append($('<td class="jsgrid-cell jsgrid-align-right"></td>').text('($' + totalIWT.toFixed(2) + ')'));
|
||||
$(args.grid._body).find('tr:last').after(totalrow);
|
||||
@ -213,7 +227,7 @@
|
||||
|
||||
$(args.grid._body).find('.totalrow').remove();
|
||||
|
||||
var totalrow = $('<tr class="jsgrid-row totalrow" style="font-weight: bold;"></tr>');
|
||||
var totalrow = $('<tr class="jsgrid-row totalrow" style="font-style: italic;"></tr>');
|
||||
totalrow.append($('<td class="jsgrid-cell">Plus emergency fund:</td>').prop('colspan', args.grid.fields.length - 1));
|
||||
totalrow.append($('<td class="jsgrid-cell jsgrid-align-right"></td>').text('$' + (total * 0.05).toFixed(2)));
|
||||
$(args.grid._body).find('tr:last').after(totalrow);
|
||||
|
@ -114,7 +114,10 @@ def budget_new(request):
|
||||
revision.time = timezone.now()
|
||||
revision = revision_from_form(budget, revision, request.POST)
|
||||
|
||||
return redirect(reverse('budget_view', kwargs={'id': budget.id}))
|
||||
if request.POST['submit'] == 'Submit':
|
||||
return redirect(reverse('budget_view', kwargs={'id': budget.id}))
|
||||
else:
|
||||
return redirect(reverse('budget_edit', kwargs={'id': budget.id}))
|
||||
else:
|
||||
budget = models.Budget()
|
||||
revision = models.BudgetRevision()
|
||||
@ -140,7 +143,10 @@ def budget_edit(request, id):
|
||||
revision.time = timezone.now()
|
||||
revision = revision_from_form(budget, revision, request.POST)
|
||||
|
||||
return redirect(reverse('budget_view', kwargs={'id': budget.id}))
|
||||
if request.POST['submit'] == 'Submit':
|
||||
return redirect(reverse('budget_view', kwargs={'id': budget.id}))
|
||||
else:
|
||||
return redirect(reverse('budget_edit', kwargs={'id': budget.id}))
|
||||
else:
|
||||
budget = models.Budget.objects.get(id=id)
|
||||
revision = budget.budgetrevision_set.reverse()[0]
|
||||
|
Loading…
Reference in New Issue
Block a user