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';
}
tr.article-category {
tr.list-heading {
background-color: #efefef;
td:first-child {
text-align: left;
@ -126,6 +126,10 @@ table {
}
}
.center, td.center, th.center {
text-align: center;
}
// Tasks ..
.accepted {
color: #468847;
@ -238,6 +242,18 @@ tr.unavailable {
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
// 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 there is a non-empty model attribute 'foo', it looks for
# 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.
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)
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}))
s = raw "<abbr title='#{s}'>#{sshort}</abbr>" unless sshort.blank?
s = raw "<abbr title='#{desc or s}'>#{sshort}</abbr>" unless sshort.blank?
end
s
end

View File

@ -2,21 +2,19 @@
%thead.list-heading
%tr
%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.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= #heading_helper Article, :unit_quantity, short: true
- for group_order in order.group_orders.ordered
%tbody
%tr
%th{:colspan => "7"}
%tr.list-heading
%th{:colspan => "9"}
%h4.name= group_order.ordergroup.name
- total = 0
- for goa in group_order.group_order_articles.ordered.all(:include => :order_article)
@ -25,16 +23,19 @@
- total += subTotal
%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= "#{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.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= pkg_helper goa.order_article.price
%tr{:class => cycle('even', 'odd', :name => 'articles')}
%th{:colspan => "6"} Summe
%th{:colspan => "7"}= t '.price_sum'
%th= number_to_currency(total)
%th
%tr
%th(colspan="7")
%th(colspan="9")
- reset_cycle("articles")

View File

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

View File

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