Skip to content

Commit

Permalink
add invalid funds message on grouporder page
Browse files Browse the repository at this point in the history
  • Loading branch information
yksflip committed Oct 5, 2023
1 parent 2ef17ce commit 92edac9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 4 additions & 6 deletions app/assets/javascripts/ordering.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,12 @@ function updateBalance() {
$('#new_balance').html(I18n.l("currency", balance));
$('#total_balance').val(I18n.l("currency", balance));
// determine bgcolor and submit button state according to balance
var bgcolor = '';
if (balance < minimumBalance) {
bgcolor = '#FF0000';
$('#submit_button').attr('disabled', 'disabled')
$('#available_funds_error').css('display', 'block')
} else {
$('#submit_button').removeAttr('disabled')
}
// update bgcolor
for (i in itemTotal) {
$('#td_price_' + i).css('background-color', bgcolor);
$('#available_funds_error').css('display', 'none')
}
}

Expand Down Expand Up @@ -232,4 +228,6 @@ $(function() {
});

updateButtons($(document));

$(document).ready(updateBalance);
});
3 changes: 2 additions & 1 deletion app/views/group_orders/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
});

- title t('.title'), false

.alert.alert-error.alert-block#available_funds_error{style: ('display:none')}
= t '.invalid_funds'
.row-fluid
.well.pull-left
= close_button :alert
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,7 @@ en:
units: Units
units_full: Filled units
units_total: Total units
invalid_funds: Not enough available funds
index:
closed_orders:
more: more...
Expand Down

0 comments on commit 92edac9

Please sign in to comment.