Skip to content

Commit

Permalink
Merge pull request #2960 from aitbw/nebulab/fix-misleading-notification
Browse files Browse the repository at this point in the history
Disable 'count on hand' input when 'track inventory' option is set to false
  • Loading branch information
kennyadsl authored Nov 22, 2018
2 parents c10c6e9 + bdffc72 commit 17216cf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@ Spree.ready(function() {
$('.js-edit-stock-item').each(function() {
var $el = $(this);
var model = new Spree.Models.StockItem($el.data('stock-item'));
var trackInventory = $el.data('track-inventory');
new Spree.Views.Stock.EditStockItemRow({
el: $el,
stockLocationName: $el.data('stock-location-name'),
model: model
});

if (trackInventory === false) {
$('.js-edit-stock-item input').attr({
disabled: true,
class: 'with-tip',
title: '"Track inventory" option disabled for this variant'
});
}
});

$('.js-add-stock-item').each(function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
</colgroup>
<% variant.stock_items.each do |item| %>
<% if @stock_item_stock_locations.include?(item.stock_location) %>
<tr class="js-edit-stock-item stock-item-edit-row" data-variant-id="<%= variant.id %>" data-stock-item="<%= item.to_json %>" data-stock-location-name="<%= item.stock_location.name %>">
<tr class="js-edit-stock-item stock-item-edit-row" data-variant-id="<%= variant.id %>" data-stock-item="<%= item.to_json %>" data-stock-location-name="<%= item.stock_location.name %>" data-track-inventory="<%= variant.track_inventory %>">
<%# This is rendered in JS %>
</tr>
<% end %>
Expand Down

0 comments on commit 17216cf

Please sign in to comment.