Allow customising ticketing fee name

This commit is contained in:
Yingtong Li 2023-10-19 20:01:35 +11:00
parent d967a548a4
commit ec370b47cd
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
5 changed files with 11 additions and 3 deletions

View File

@ -39,6 +39,7 @@ AVAILABLE_APPROVERS = [
] ]
BUDGET_ENABLE_VOTING = True BUDGET_ENABLE_VOTING = True
TICKETING_FEE_NAME = 'Fee'
TICKETING_FEE_PROPORTION = 0.0175 # Previous default was (1-1/1.01884) TICKETING_FEE_PROPORTION = 0.0175 # Previous default was (1-1/1.01884)
TICKETING_FEE_FIXED = 0.30 # Previous default was 0.8133/1.01884 TICKETING_FEE_FIXED = 0.30 # Previous default was 0.8133/1.01884

View File

@ -255,6 +255,7 @@
} }
}); });
const ticketingFeeName = JSON.parse({{ import('json').dumps(import('json').dumps(settings.TICKETING_FEE_NAME))|safe }});
const ticketingFeeProportion = {{ settings.TICKETING_FEE_PROPORTION }}; const ticketingFeeProportion = {{ settings.TICKETING_FEE_PROPORTION }};
const ticketingFeeFixed = {{ settings.TICKETING_FEE_FIXED }}; const ticketingFeeFixed = {{ settings.TICKETING_FEE_FIXED }};
const editing = true; const editing = true;

View File

@ -2,7 +2,8 @@
{# {#
Society Self-Service Society Self-Service
Copyright © 2018–2020 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 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 it under the terms of the GNU Affero General Public License as published by
@ -156,9 +157,13 @@
<script src="{{ static('sstreasury/budget.js') }}"></script> <script src="{{ static('sstreasury/budget.js') }}"></script>
<script> <script>
const ticketingFeeName = JSON.parse({{ import('json').dumps(import('json').dumps(settings.TICKETING_FEE_NAME))|safe }});
const ticketingFeeProportion = {{ settings.TICKETING_FEE_PROPORTION }};
const ticketingFeeFixed = {{ settings.TICKETING_FEE_FIXED }};
const editing = false;
var revenue_data = JSON.parse({{ import('json').dumps(import('json').dumps(revision.revenue))|safe }}); 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 expense_data = JSON.parse({{ import('json').dumps(import('json').dumps(revision.expense))|safe }});
var editing = false;
makeGrid(); makeGrid();
print(); print();

View File

@ -502,6 +502,7 @@
<script src="{{ static('sstreasury/budget.js') }}"></script> <script src="{{ static('sstreasury/budget.js') }}"></script>
<script> <script>
const ticketingFeeName = JSON.parse({{ import('json').dumps(import('json').dumps(settings.TICKETING_FEE_NAME))|safe }});
const ticketingFeeProportion = {{ revision.ticketing_fee_proportion }}; const ticketingFeeProportion = {{ revision.ticketing_fee_proportion }};
const ticketingFeeFixed = {{ revision.ticketing_fee_fixed }}; const ticketingFeeFixed = {{ revision.ticketing_fee_fixed }};
const editing = false; const editing = false;

View File

@ -107,7 +107,7 @@ function makeGrid() {
{ name: 'Description', type: 'text', width: '50%', validate: 'required' }, { name: 'Description', type: 'text', width: '50%', validate: 'required' },
{ name: 'Unit price', type: 'float', width: '12.5%', validate: 'required', itemTemplate: function(value, item) { return '$' + value.toFixed(2); } }, { name: 'Unit price', type: 'float', width: '12.5%', validate: 'required', itemTemplate: function(value, item) { return '$' + value.toFixed(2); } },
{ name: 'Units', type: 'float', width: '12.5%', validate: 'required' }, { name: 'Units', type: 'float', width: '12.5%', validate: 'required' },
{ name: 'IWT', type: 'checkbox', width: '5%', insertTemplate: function() { var result = jsGrid.fields.checkbox.prototype.insertTemplate.call(this); result.prop('checked', true); return result; } }, { name: 'IWT', title: ticketingFeeName, type: 'checkbox', width: '5%', insertTemplate: function() { var result = jsGrid.fields.checkbox.prototype.insertTemplate.call(this); result.prop('checked', true); return result; } },
{ name: 'Total', align: 'right', width: '10%', itemTemplate: function(value, item) { return '$' + (item['Unit price'] * item['Units']).toFixed(2); } }, { name: 'Total', align: 'right', width: '10%', itemTemplate: function(value, item) { return '$' + (item['Unit price'] * item['Units']).toFixed(2); } },
]; ];
if (editing) { if (editing) {