cleanup articles sorted in groups

This commit is contained in:
wvengen 2014-01-21 11:55:26 +01:00
parent e88810e4a7
commit f9d2c20aaa
5 changed files with 45 additions and 25 deletions

View file

@ -104,7 +104,7 @@ table {
content: ' \25B2'; content: ' \25B2';
} }
tr.article-category { tr.list-heading {
background-color: #efefef; background-color: #efefef;
td:first-child { td:first-child {
text-align: left; text-align: left;
@ -126,6 +126,10 @@ table {
} }
} }
.center, td.center, th.center {
text-align: center;
}
// Tasks .. // Tasks ..
.accepted { .accepted {
color: #468847; color: #468847;
@ -238,6 +242,18 @@ tr.unavailable {
min-width: 3.5em; min-width: 3.5em;
} }
// small cells with just a 'x' or '='
td.symbol, th.symbol {
padding-left: 0;
padding-right: 0;
text-align: center;
}
.symbol { color: tint(@textColor, @nonessentialDim); }
.used .symbol { color: tint(@articleUsedColor, @nonessentialDim); }
.unused .symbol { color: tint(@articleUnusedColor, @nonessentialDim); }
.unavailable .symbol { color: @articleUnavailColor; }
// ********* Tweaks & fixes // ********* Tweaks & fixes
// Fix bootstrap dropdown menu on mobile // Fix bootstrap dropdown menu on mobile

View file

@ -78,14 +78,17 @@ module ApplicationHelper
# When the 'short' option is true, abbreviations will be used: # When the 'short' option is true, abbreviations will be used:
# When there is a non-empty model attribute 'foo', it looks for # When there is a non-empty model attribute 'foo', it looks for
# the model attribute translation 'foo_short' and use that as # the model attribute translation 'foo_short' and use that as
# heading, with an abbreviation title of 'foo'. # heading, with an abbreviation title of 'foo'. If a translation
# 'foo_desc' is present, that is used instead, but that can be
# be overridden by the option 'desc'.
# Other options are passed through to I18n. # Other options are passed through to I18n.
def heading_helper(model, attribute, options = {}) def heading_helper(model, attribute, options = {})
i18nopts = options.select {|a| !['short'].include?(a) }.merge({count: 2}) i18nopts = options.select {|a| !['short', 'desc'].include?(a) }.merge({count: 2})
s = model.human_attribute_name(attribute, i18nopts) s = model.human_attribute_name(attribute, i18nopts)
if options[:short] if options[:short]
desc = (options[:desc] or model.human_attribute_name("#{attribute}_desc".to_sym, options.merge({fallback: true, default: '', count: 2})))
sshort = model.human_attribute_name("#{attribute}_short".to_sym, options.merge({fallback: true, default: '', count: 2})) sshort = model.human_attribute_name("#{attribute}_short".to_sym, options.merge({fallback: true, default: '', count: 2}))
s = raw "<abbr title='#{s}'>#{sshort}</abbr>" unless sshort.blank? s = raw "<abbr title='#{desc or s}'>#{sshort}</abbr>" unless sshort.blank?
end end
s s
end end

View file

@ -2,21 +2,19 @@
%thead.list-heading %thead.list-heading
%tr %tr
%th{:style => "width:40%"}= heading_helper Article, :name %th{:style => "width:40%"}= heading_helper Article, :name
%th
%acronym{:title => t('shared.articles.ordered_desc')}= t 'shared.articles.ordered'
%th
%acronym{:title => t('shared.articles.received_desc')}= t 'shared.articles.received'
%th
%acronym{:title => t('.fc_price_desc')}= t '.fc_price'
%th
%acronym{:title => t('.unit_quantity_desc')}= t '.unit_quantity'
%th= heading_helper Article, :unit %th= heading_helper Article, :unit
%th.center
%acronym{:title => t('shared.articles.ordered_desc')}= t 'shared.articles.ordered'
%th.center{colspan: 2}
%acronym{:title => t('shared.articles.received_desc')}= t 'shared.articles.received'
%th{colspan: 2}= heading_helper Article, :fc_price, short: true
%th= t '.price' %th= t '.price'
%th= #heading_helper Article, :unit_quantity, short: true
- for group_order in order.group_orders.ordered - for group_order in order.group_orders.ordered
%tbody %tbody
%tr %tr.list-heading
%th{:colspan => "7"} %th{:colspan => "9"}
%h4.name= group_order.ordergroup.name %h4.name= group_order.ordergroup.name
- total = 0 - total = 0
- for goa in group_order.group_order_articles.ordered.all(:include => :order_article) - for goa in group_order.group_order_articles.ordered.all(:include => :order_article)
@ -25,16 +23,19 @@
- total += subTotal - total += subTotal
%tr{:class => [cycle('even', 'odd', :name => 'articles'), if goa.result == 0 then 'unavailable' end]} %tr{:class => [cycle('even', 'odd', :name => 'articles'), if goa.result == 0 then 'unavailable' end]}
%td.name{:style => "width:40%"}=h goa.order_article.article.name %td.name{:style => "width:40%"}=h goa.order_article.article.name
%td= "#{goa.quantity} + #{goa.tolerance}"
%td
%b= goa.result
%td= number_to_currency(fc_price)
%td= goa.order_article.price.unit_quantity
%td= goa.order_article.article.unit %td= goa.order_article.article.unit
%td.center= "#{goa.quantity} + #{goa.tolerance}"
%td.center
%b= goa.result
%td.symbol &times;
%td= number_to_currency(fc_price)
%td.symbol =
%td= number_to_currency(subTotal) %td= number_to_currency(subTotal)
%td= pkg_helper goa.order_article.price
%tr{:class => cycle('even', 'odd', :name => 'articles')} %tr{:class => cycle('even', 'odd', :name => 'articles')}
%th{:colspan => "6"} Summe %th{:colspan => "7"}= t '.price_sum'
%th= number_to_currency(total) %th= number_to_currency(total)
%th
%tr %tr
%th(colspan="7") %th(colspan="9")
- reset_cycle("articles") - reset_cycle("articles")

View file

@ -7,6 +7,7 @@ de:
availability_short: verf. availability_short: verf.
deposit: Pfand deposit: Pfand
fc_price: Endpreis fc_price: Endpreis
fc_price_desc: Preis incl. MwSt, Pfand und Foodcoop-Aufschlag
fc_price_short: FC-Preis fc_price_short: FC-Preis
fc_share: FoodCoop-Aufschlag fc_share: FoodCoop-Aufschlag
fc_share_short: FC-Aufschlag fc_share_short: FC-Aufschlag
@ -1285,9 +1286,8 @@ de:
ordergroup: Bestellgruppe ordergroup: Bestellgruppe
price: Gesamtpreis price: Gesamtpreis
articles_by_groups: articles_by_groups:
fc_price: FC-Preis
fc_price_desc: Preis incl. MwSt, Pfand und Foodcoop-Aufschlag
price: Gesamtpreis price: Gesamtpreis
price_sum: Summe
unit_quantity: GebGr unit_quantity: GebGr
unit_quantity_desc: Gebindegröße unit_quantity_desc: Gebindegröße
group: group:

View file

@ -7,6 +7,7 @@ en:
availability_short: avail. availability_short: avail.
deposit: Deposit deposit: Deposit
fc_price: FoodCoop price fc_price: FoodCoop price
fc_price_desc: Price including taxes, deposit and Foodcoop-charge
fc_price_short: FC price fc_price_short: FC price
fc_share: FoodCoop margin fc_share: FoodCoop margin
fc_share_short: FC margin fc_share_short: FC margin
@ -1297,9 +1298,8 @@ en:
ordergroup: Ordergroup ordergroup: Ordergroup
price: Total price price: Total price
articles_by_groups: articles_by_groups:
fc_price: FC-Price
fc_price_desc: Price including taxes, deposit and Foodcoop-charge
price: Total price price: Total price
price_sum: Sum
unit_quantity: Lot quantity unit_quantity: Lot quantity
unit_quantity_desc: How many units per lot. unit_quantity_desc: How many units per lot.
group: group: