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
|
*.sqlite3
|
||||||
__pycache__
|
__pycache__
|
||||||
|
|
||||||
|
@ -77,11 +77,11 @@
|
|||||||
<input type="hidden" name="expense" id="expense_input">
|
<input type="hidden" name="expense" id="expense_input">
|
||||||
</div>
|
</div>
|
||||||
<div class="ui accordion">
|
<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>
|
<i class="dropdown icon"></i>
|
||||||
Expense comments
|
Expense comments
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="{% if revision.expense_comments %}active {% endif %}content">
|
||||||
<div class="ui inline grid field">
|
<div class="ui inline grid field">
|
||||||
<label class="three wide column">Comments</label>
|
<label class="three wide column">Comments</label>
|
||||||
<textarea class="eleven wide column" rows="2" name="expense_comments">{{ revision.expense_comments }}</textarea>
|
<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 divider"></div>
|
||||||
<div class="ui error message"></div>
|
<div class="ui error message"></div>
|
||||||
<input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
|
<input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
|
||||||
<input class="ui primary button" type="submit" value="Save">
|
<input class="ui primary button" type="submit" name='submit' value="Save">
|
||||||
<input class="ui button" type="submit" value="Save and continue editing">
|
<input class="ui button" type="submit" name='submit' value="Save and continue editing">
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
@ -186,7 +186,7 @@
|
|||||||
$(args.grid._body).find('.totalrow').remove();
|
$(args.grid._body).find('.totalrow').remove();
|
||||||
|
|
||||||
if (totalIWT > 0) {
|
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">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 jsgrid-align-right"></td>').text('($' + totalIWT.toFixed(2) + ')'));
|
||||||
totalrow.append($('<td class="jsgrid-cell"></td>'));
|
totalrow.append($('<td class="jsgrid-cell"></td>'));
|
||||||
@ -208,7 +208,7 @@
|
|||||||
|
|
||||||
$(args.grid._body).find('.totalrow').remove();
|
$(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">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 jsgrid-align-right"></td>').text('$' + (total * 0.05).toFixed(2)));
|
||||||
totalrow.append($('<td class="jsgrid-cell"></td>'));
|
totalrow.append($('<td class="jsgrid-cell"></td>'));
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
<i class="dropdown icon"></i>
|
<i class="dropdown icon"></i>
|
||||||
Revenue comments
|
Revenue comments
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="active content">
|
||||||
{{ revision.revenue_comments }}
|
{{ revision.revenue_comments }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -98,7 +98,7 @@
|
|||||||
<i class="dropdown icon"></i>
|
<i class="dropdown icon"></i>
|
||||||
Expense comments
|
Expense comments
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="active content">
|
||||||
{{ revision.expense_comments }}
|
{{ revision.expense_comments }}
|
||||||
</div>
|
</div>
|
||||||
</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">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jsgrid@1.5.3/dist/jsgrid-theme.min.css" integrity="sha256-0rD7ZUV4NLK6VtGhEim14ZUZGC45Kcikjdcr4N03ddA=" crossorigin="anonymous">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
/* Fix the CSS */
|
||||||
|
|
||||||
.ui.mydefinition.table > tbody > tr > td:first-child:not(.ignored) {
|
.ui.mydefinition.table > tbody > tr > td:first-child:not(.ignored) {
|
||||||
background: rgba(0,0,0,.03);
|
background: rgba(0,0,0,.03);
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: rgba(0,0,0,.95);
|
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>
|
</style>
|
||||||
{% endblock %}
|
{% 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 src="https://cdn.jsdelivr.net/npm/jsgrid@1.5.3/dist/jsgrid.min.js" integrity="sha256-lzjMTpg04xOdI+MJdjBst98bVI6qHToLyVodu3EywFU=" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
$('.ui.accordion').accordion();
|
||||||
|
|
||||||
function recalcRevTotal(args) {
|
function recalcRevTotal(args) {
|
||||||
//console.log(args);
|
//console.log(args);
|
||||||
var total = 0;
|
var total = 0;
|
||||||
@ -193,7 +207,7 @@
|
|||||||
$(args.grid._body).find('.totalrow').remove();
|
$(args.grid._body).find('.totalrow').remove();
|
||||||
|
|
||||||
if (totalIWT > 0) {
|
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">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) + ')'));
|
totalrow.append($('<td class="jsgrid-cell jsgrid-align-right"></td>').text('($' + totalIWT.toFixed(2) + ')'));
|
||||||
$(args.grid._body).find('tr:last').after(totalrow);
|
$(args.grid._body).find('tr:last').after(totalrow);
|
||||||
@ -213,7 +227,7 @@
|
|||||||
|
|
||||||
$(args.grid._body).find('.totalrow').remove();
|
$(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">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)));
|
totalrow.append($('<td class="jsgrid-cell jsgrid-align-right"></td>').text('$' + (total * 0.05).toFixed(2)));
|
||||||
$(args.grid._body).find('tr:last').after(totalrow);
|
$(args.grid._body).find('tr:last').after(totalrow);
|
||||||
|
@ -114,7 +114,10 @@ def budget_new(request):
|
|||||||
revision.time = timezone.now()
|
revision.time = timezone.now()
|
||||||
revision = revision_from_form(budget, revision, request.POST)
|
revision = revision_from_form(budget, revision, request.POST)
|
||||||
|
|
||||||
|
if request.POST['submit'] == 'Submit':
|
||||||
return redirect(reverse('budget_view', kwargs={'id': budget.id}))
|
return redirect(reverse('budget_view', kwargs={'id': budget.id}))
|
||||||
|
else:
|
||||||
|
return redirect(reverse('budget_edit', kwargs={'id': budget.id}))
|
||||||
else:
|
else:
|
||||||
budget = models.Budget()
|
budget = models.Budget()
|
||||||
revision = models.BudgetRevision()
|
revision = models.BudgetRevision()
|
||||||
@ -140,7 +143,10 @@ def budget_edit(request, id):
|
|||||||
revision.time = timezone.now()
|
revision.time = timezone.now()
|
||||||
revision = revision_from_form(budget, revision, request.POST)
|
revision = revision_from_form(budget, revision, request.POST)
|
||||||
|
|
||||||
|
if request.POST['submit'] == 'Submit':
|
||||||
return redirect(reverse('budget_view', kwargs={'id': budget.id}))
|
return redirect(reverse('budget_view', kwargs={'id': budget.id}))
|
||||||
|
else:
|
||||||
|
return redirect(reverse('budget_edit', kwargs={'id': budget.id}))
|
||||||
else:
|
else:
|
||||||
budget = models.Budget.objects.get(id=id)
|
budget = models.Budget.objects.get(id=id)
|
||||||
revision = budget.budgetrevision_set.reverse()[0]
|
revision = budget.budgetrevision_set.reverse()[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user