show articles ordered by members but not by foodcoop dimmed in receive
This commit is contained in:
parent
790a6b1972
commit
8913ad615c
3 changed files with 7 additions and 2 deletions
|
@ -12,7 +12,7 @@ class OrderArticle < ActiveRecord::Base
|
|||
validate :article_and_price_exist
|
||||
validates_uniqueness_of :article_id, scope: :order_id
|
||||
|
||||
_ordered_sql = "units_to_order > 0 OR units_billed > 0 OR units_received > 0"
|
||||
_ordered_sql = "units_to_order > 0 OR units_billed > 0 OR units_received > 0 OR order_articles.quantity > 0"
|
||||
scope :ordered, -> { where(_ordered_sql) }
|
||||
scope :ordered_or_member, -> { includes(:group_order_articles).where("#{_ordered_sql} OR group_order_articles.result > 0") }
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
-# NOTE: if you modify tiny details here you must also change them in `receive_on_order_article_update.js.erb`
|
||||
= fields_for 'order_articles', order_article, index: order_article.id do |form|
|
||||
%tr{id: "order_article_#{order_article.id}", class: "#{cycle('even', 'odd', name: 'articles')} order-article", valign: "top"}
|
||||
- cssclass = "order-article #{cycle('even', 'odd', name: 'articles')}"
|
||||
- cssclass += " unavailable" if (order_article.units_billed||order_article.units_to_order)==0 and order_article.units_received.nil?
|
||||
%tr{id: "order_article_#{order_article.id}", class: cssclass, valign: "top"}
|
||||
- order_title = []
|
||||
- order_title.append Article.human_attribute_name(:manufacturer)+': ' + order_article.article.manufacturer unless order_article.article.manufacturer.to_s.empty?
|
||||
- order_title.append Article.human_attribute_name(:note)+': ' + order_article.article.note unless order_article.article.note.to_s.empty?
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
}
|
||||
|
||||
$(input).closest('tr').find('.units_delta').html(html);
|
||||
|
||||
// un-dim row when received is nonzero
|
||||
$(input).closest('tr').toggleClass('unavailable', expected == 0 && html=='');
|
||||
}
|
||||
|
||||
$(document).on('change keyup', 'input[data-units-expected]', function() {
|
||||
|
|
Loading…
Reference in a new issue