Merge pull request #4042 from aignatov-bio/ai-sci-6741-stock-consumption-modal-highlight-negative-with-red

Highlight negative value in consumption modal [SCI-6741]
This commit is contained in:
aignatov-bio 2022-04-22 11:13:34 +02:00 committed by GitHub
commit bc80122df0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -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() === '');
});

View file

@ -34,7 +34,7 @@
<div class="row mt-3">
<div class="col-sm-12">
<div class="stock-update-view">
<div class="stock-initial-container">
<div class="stock-initial-container <%= 'negative' if @stock_value.amount < 0 %>">
<span class="subtitle"><%= t('repository_stock_values.manage_modal.current_stock') %></span>
<span class="value"><%= @stock_value.formatted_value %></span>
<span class="units"><%= @stock_value.repository_stock_unit_item&.data %></span>
@ -42,7 +42,7 @@
<div class="stock-arrow">
<i class="fas fa-arrow-right"></i>
</div>
<div class="stock-final-container">
<div class="stock-final-container ">
<span class="subtitle"><%= t('repository_stock_values.manage_modal.new_stock') %></span>
<span class="value">-</span>
<span class="units"><%= @stock_value.repository_stock_unit_item&.data %></span>