ui update for packages display

This commit is contained in:
wvengen 2014-01-03 12:42:36 +01:00
parent 4c9e84ecc6
commit 9219d099c8
5 changed files with 29 additions and 16 deletions

View File

@ -55,6 +55,12 @@ body {
@mainRedColor: #ED0606; @mainRedColor: #ED0606;
@articleUsedColor: green;
@articleUnusedColor: red;
@articleUnavailColor: #999;
@articleUpdatedColor: #468847;
.logo { .logo {
margin: 10px 0 0 30px; margin: 10px 0 0 30px;
float: left; float: left;
@ -135,10 +141,10 @@ table {
// ordering // ordering
.used { .used {
color: green; color: @articleUsedColor;
} }
.unused { .unused {
color: red; color: @articleUnusedColor;
} }
#order-footer, .article-info { #order-footer, .article-info {
@ -202,11 +208,11 @@ tr.order-article:hover .article-info {
// ********* Articles // ********* Articles
tr.just-updated { tr.just-updated {
color: #468847; color: @articleUpdatedColor;
} }
tr.unavailable { tr.unavailable {
color: #999; color: @articleUnavailColor;
} }
// articles edit all // articles edit all
@ -276,9 +282,11 @@ i.package {
padding-left: 20px; padding-left: 20px;
font-style: normal; font-style: normal;
} }
.package { @packageDim: 35%;
color: #999; .package { color: tint(@textColor, @packageDim); }
} .used .package { color: tint(@articleUsedColor, @packageDim); }
.unused .package { color: tint(@articleUnusedColor, @packageDim); }
.unavailable .package { color: @articleUnavailColor; }
.input-nano { .input-nano {
width: 30px; width: 30px;

View File

@ -28,6 +28,7 @@ module OrdersHelper
# can be article or article_price # can be article or article_price
def pkg_helper(article, icon=true) def pkg_helper(article, icon=true)
return nil if article.unit_quantity == 1
if icon if icon
"<i class='package'> &times; #{article.unit_quantity}</i>".html_safe "<i class='package'> &times; #{article.unit_quantity}</i>".html_safe
else else
@ -35,9 +36,11 @@ module OrdersHelper
end end
end end
def article_price_change_hint(order_article) def article_price_change_hint(order_article, gross=false)
return nil if order_article.article.price == order_article.article_price.price return nil if order_article.article.price == order_article.article_price.price
"<i class='icon icon-asterisk' title='#{j t('.old_price', default: 'Old price')}: #{number_to_currency order_article.article.price}'></i>".html_safe title = "#{t('.old_price')}: #{number_to_currency order_article.article.price}"
title += " / #{number_to_currency order_article.article.gross_price}" if gross
"<i class='icon-asterisk' title='#{j title}'></i>".html_safe
end end
def receive_input_field(form) def receive_input_field(form)

View File

@ -4,7 +4,7 @@
%th= sort_link_helper Article.model_name.human, "name" %th= sort_link_helper Article.model_name.human, "name"
%th= sort_link_helper Article.human_attribute_name(:order_number_short), "order_number" %th= sort_link_helper Article.human_attribute_name(:order_number_short), "order_number"
%th= t('.amount') %th= t('.amount')
%th= heading_helper Article, :units %th= heading_helper Article, :unit
%th= t('.net') %th= t('.net')
%th= t('.gross') %th= t('.gross')
%th= heading_helper Article, :tax %th= heading_helper Article, :tax

View File

@ -3,10 +3,10 @@
%td= order_article.article.order_number %td= order_article.article.order_number
%td{title: units_history_line(order_article)} %td{title: units_history_line(order_article)}
= order_article.units = order_article.units
%i.package pkg = pkg_helper order_article.article_price
- if s=order_article.ordered_quantities_different_from_group_orders? - if s=order_article.ordered_quantities_different_from_group_orders?
%span{:style => "color:red;font-weight: bold"}= s %span{:style => "color:red;font-weight: bold"}= s
%td #{order_article.price.unit_quantity} &times; #{order_article.article.unit} %td #{order_article.article.unit}
%td %td
= number_to_currency(order_article.price.price, :unit => "") = number_to_currency(order_article.price.price, :unit => "")
:plain :plain

View File

@ -2,7 +2,7 @@
%thead %thead
%tr %tr
%th= heading_helper Article, :name %th= heading_helper Article, :name
%th= heading_helper Article, :units %th= heading_helper Article, :unit
%th= t '.prices' %th= t '.prices'
- if order.stockit? - if order.stockit?
%th= t '.units_ordered' %th= t '.units_ordered'
@ -27,8 +27,10 @@
- cssclass = (units > 0 ? 'used' : (order_article.quantity > 0 ? 'unused' : 'unavailable')) - cssclass = (units > 0 ? 'used' : (order_article.quantity > 0 ? 'unused' : 'unavailable'))
%tr{:class => cycle('even', 'odd', :name => 'articles') + ' ' + cssclass} %tr{:class => cycle('even', 'odd', :name => 'articles') + ' ' + cssclass}
%td=h order_article.article.name %td=h order_article.article.name
%td #{unit_quantity} &times; #{order_article.article.unit} %td= order_article.article.unit
%td= "#{number_to_currency(net_price)} / #{number_to_currency(gross_price)}" %td
= "#{number_to_currency(net_price)} / #{number_to_currency(gross_price)}"
= article_price_change_hint(order_article, gross: true)
- if order.stockit? - if order.stockit?
%td= units %td= units
- else - else
@ -38,7 +40,7 @@
%td= "#{order_article.quantity}" %td= "#{order_article.quantity}"
%td{title: units_history_line(order_article)} %td{title: units_history_line(order_article)}
= units = units
%i.package pkg = pkg_helper order_article.price
%p %p
= t '.prices_sum' = t '.prices_sum'
= "#{number_to_currency(total_net)} / #{number_to_currency(total_gross)}" = "#{number_to_currency(total_net)} / #{number_to_currency(total_gross)}"