diff --git a/app/assets/javascripts/my_modules/stock.js b/app/assets/javascripts/my_modules/stock.js index 031e68fdc..9efdf6a2e 100644 --- a/app/assets/javascripts/my_modules/stock.js +++ b/app/assets/javascripts/my_modules/stock.js @@ -1,4 +1,4 @@ -/* global SmartAnnotation I18n MyModuleRepositories */ +/* global SmartAnnotation I18n MyModuleRepositories GLOBAL_CONSTANTS */ var MyModuleStockConsumption = (function() { const CONSUMPTION_MODAL = '#consumeRepositoryStockValueModal'; const WARNING_MODAL = '#consumeRepositoryStockValueModalWarning'; @@ -32,6 +32,18 @@ var MyModuleStockConsumption = (function() { $(WARNING_MODAL).modal('hide'); }); + $(CONSUMPTION_MODAL + ' #comment').on('keyup change', function() { + $(this).closest('.sci-input-container').toggleClass( + 'error', + this.value.length > GLOBAL_CONSTANTS.NAME_MAX_LENGTH + ); + $('.update-consumption-button').attr( + 'disabled', + this.value.length > GLOBAL_CONSTANTS.NAME_MAX_LENGTH + ); + }); + + $('.update-consumption-button').on('click', function(event, skipValidation) { if (parseFloat($('.stock-final-container .value').text()) < 0 && !skipValidation) { event.preventDefault(); diff --git a/app/assets/javascripts/repositories/renderers/view_renderers.js b/app/assets/javascripts/repositories/renderers/view_renderers.js index 5d8aa487a..0acb7cff7 100644 --- a/app/assets/javascripts/repositories/renderers/view_renderers.js +++ b/app/assets/javascripts/repositories/renderers/view_renderers.js @@ -181,9 +181,9 @@ $.fn.dataTable.render.AssignedTasksValue = function(data) { return "
+