From 92edac9f9f2258f9eba6822bab0353ed15078a50 Mon Sep 17 00:00:00 2001 From: Philipp Rothmann Date: Mon, 2 Oct 2023 23:01:43 +0200 Subject: [PATCH] add invalid funds message on grouporder page --- app/assets/javascripts/ordering.js | 10 ++++------ app/views/group_orders/_form.html.haml | 3 ++- config/locales/en.yml | 1 + 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/ordering.js b/app/assets/javascripts/ordering.js index a3dd1050d..2e6952a54 100644 --- a/app/assets/javascripts/ordering.js +++ b/app/assets/javascripts/ordering.js @@ -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') } } @@ -232,4 +228,6 @@ $(function() { }); updateButtons($(document)); + + $(document).ready(updateBalance); }); diff --git a/app/views/group_orders/_form.html.haml b/app/views/group_orders/_form.html.haml index 3ffd583ee..49a129704 100644 --- a/app/views/group_orders/_form.html.haml +++ b/app/views/group_orders/_form.html.haml @@ -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 diff --git a/config/locales/en.yml b/config/locales/en.yml index b4f41c5cd..79cf14179 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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...