From fc3d47d220e349e917461733110829a3d42e8c5b Mon Sep 17 00:00:00 2001 From: Anton Date: Thu, 21 Apr 2022 12:11:38 +0200 Subject: [PATCH] Highlight negative value in consumption modal [SCI-6741] --- app/assets/javascripts/my_modules/stock.js | 2 +- .../repositories/_consume_stock_modal_content.html.erb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/my_modules/stock.js b/app/assets/javascripts/my_modules/stock.js index 2b689ceef..f15d67e73 100644 --- a/app/assets/javascripts/my_modules/stock.js +++ b/app/assets/javascripts/my_modules/stock.js @@ -35,7 +35,7 @@ var MyModuleStockConsumption = (function() { let finalValue = initialValue - ($(this).val() || 0) + initialStock; $('.stock-final-container .value') .text(formatDecimalValue(String(finalValue), $('#stock_consumption').data('decimals'))); - $('.stock-final-container').toggleClass('error', finalValue <= 0); + $('.stock-final-container').toggleClass('negative', finalValue <= 0); $(this).closest('.sci-input-container').toggleClass('error', this.value === ''); $('.update-consumption-button').attr('disabled', $(this).val() === ''); }); diff --git a/app/views/my_modules/repositories/_consume_stock_modal_content.html.erb b/app/views/my_modules/repositories/_consume_stock_modal_content.html.erb index ac2d6949f..392ffa075 100644 --- a/app/views/my_modules/repositories/_consume_stock_modal_content.html.erb +++ b/app/views/my_modules/repositories/_consume_stock_modal_content.html.erb @@ -34,7 +34,7 @@
-
+
<%= t('repository_stock_values.manage_modal.current_stock') %> <%= @stock_value.formatted_value %> <%= @stock_value.repository_stock_unit_item&.data %> @@ -42,7 +42,7 @@
-
+
<%= t('repository_stock_values.manage_modal.new_stock') %> - <%= @stock_value.repository_stock_unit_item&.data %>