merge branch minimum_balance into master (closes #133)
This commit is contained in:
parent
d397132f7b
commit
33d3b9c466
3 changed files with 11 additions and 1 deletions
|
@ -10,6 +10,7 @@ var groupBalance = 0; // available group money
|
||||||
var currencySeparator = "."; // default decimal separator
|
var currencySeparator = "."; // default decimal separator
|
||||||
var currencyPrecision = 2; // default digits behind comma
|
var currencyPrecision = 2; // default digits behind comma
|
||||||
var currencyUnit = "€"; // default currency
|
var currencyUnit = "€"; // default currency
|
||||||
|
var minimumBalance = 0; // minimum group balance for the order to be succesful
|
||||||
var toleranceIsCostly = true; // default tolerance behaviour
|
var toleranceIsCostly = true; // default tolerance behaviour
|
||||||
var isStockit = false; // Wheter the order is from stock oder normal supplier
|
var isStockit = false; // Wheter the order is from stock oder normal supplier
|
||||||
|
|
||||||
|
@ -40,6 +41,10 @@ function setGroupBalance(amount) {
|
||||||
groupBalance = amount;
|
groupBalance = amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setMinimumBalance(amount) {
|
||||||
|
minimumBalance = amount;
|
||||||
|
}
|
||||||
|
|
||||||
function addData(orderArticleId, itemPrice, itemUnit, itemSubtotal, itemQuantityOthers, itemToleranceOthers, allocated, available) {
|
function addData(orderArticleId, itemPrice, itemUnit, itemSubtotal, itemQuantityOthers, itemToleranceOthers, allocated, available) {
|
||||||
var i = orderArticleId;
|
var i = orderArticleId;
|
||||||
price[i] = itemPrice;
|
price[i] = itemPrice;
|
||||||
|
@ -159,7 +164,7 @@ function updateBalance() {
|
||||||
$('#total_balance').val(asMoney(balance));
|
$('#total_balance').val(asMoney(balance));
|
||||||
// determine bgcolor and submit button state according to balance
|
// determine bgcolor and submit button state according to balance
|
||||||
var bgcolor = '';
|
var bgcolor = '';
|
||||||
if (balance < 0) {
|
if (balance < minimumBalance) {
|
||||||
bgcolor = '#FF0000';
|
bgcolor = '#FF0000';
|
||||||
$('#submit_button').attr('disabled', 'disabled')
|
$('#submit_button').attr('disabled', 'disabled')
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#{data_to_js(@ordering_data)}
|
#{data_to_js(@ordering_data)}
|
||||||
setGroupBalance(#{@ordering_data[:available_funds]});
|
setGroupBalance(#{@ordering_data[:available_funds]});
|
||||||
setCurrencyFormat("#{t('number.currency.format.separator')}", #{t('number.currency.format.precision')}, "#{t('number.currency.format.unit')}");
|
setCurrencyFormat("#{t('number.currency.format.separator')}", #{t('number.currency.format.precision')}, "#{t('number.currency.format.unit')}");
|
||||||
|
setMinimumBalance(#{FoodsoftConfig[:minimum_balance] or 0});
|
||||||
setToleranceBehaviour(#{FoodsoftConfig[:tolerance_is_costly]});
|
setToleranceBehaviour(#{FoodsoftConfig[:tolerance_is_costly]});
|
||||||
setStockit(#{@order.stockit?});
|
setStockit(#{@order.stockit?});
|
||||||
});
|
});
|
||||||
|
|
|
@ -48,6 +48,10 @@ default: &defaults
|
||||||
# Comment out this option to activate this restriction
|
# Comment out this option to activate this restriction
|
||||||
# stop_ordering_under: 75
|
# stop_ordering_under: 75
|
||||||
|
|
||||||
|
# ordergroups can only order when their balance is higher than or equal to this
|
||||||
|
# not fully enforced right now, since the check is only client-side
|
||||||
|
# minimum_balance: 0
|
||||||
|
|
||||||
# email address to be used as sender
|
# email address to be used as sender
|
||||||
email_sender: foodsoft@foodcoop.test
|
email_sender: foodsoft@foodcoop.test
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue