dashboard: link to view order page
This commit is contained in:
parent
a5a29aff5c
commit
de9453fa24
2 changed files with 14 additions and 3 deletions
|
@ -16,6 +16,17 @@ module GroupOrdersHelper
|
||||||
link_to order.name, path, options
|
link_to order.name, path, options
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def link_to_ordering_price(order, options = {})
|
||||||
|
if group_order = order.group_order(current_user.ordergroup)
|
||||||
|
price = group_order.price
|
||||||
|
path = group_order_path(group_order)
|
||||||
|
else
|
||||||
|
price = 0
|
||||||
|
path = new_group_order_path(:order_id => order.id)
|
||||||
|
end
|
||||||
|
link_to number_to_currency(price), path, options
|
||||||
|
end
|
||||||
|
|
||||||
# Return css class names for order result table
|
# Return css class names for order result table
|
||||||
|
|
||||||
def order_article_class_name(quantity, tolerance, result)
|
def order_article_class_name(quantity, tolerance, result)
|
||||||
|
@ -36,4 +47,4 @@ module GroupOrdersHelper
|
||||||
|
|
||||||
{group_order_article: goa, quantity: quantity, tolerance: tolerance, result: result, sub_total: sub_total}
|
{group_order_article: goa, quantity: quantity, tolerance: tolerance, result: result, sub_total: sub_total}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
%th= t '.supplier'
|
%th= t '.supplier'
|
||||||
%th= t '.ending'
|
%th= t '.ending'
|
||||||
%th= t '.who_ordered'
|
%th= t '.who_ordered'
|
||||||
%th= t '.total'
|
%th.numeric= t '.total'
|
||||||
%tbody
|
%tbody
|
||||||
- total = 0
|
- total = 0
|
||||||
- Order.open.each do |order|
|
- Order.open.each do |order|
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
- if group_order = order.group_order(ordergroup)
|
- if group_order = order.group_order(ordergroup)
|
||||||
- total += group_order.price
|
- total += group_order.price
|
||||||
%td= "#{group_order.updated_by.nick} (#{format_time(group_order.updated_on)})"
|
%td= "#{group_order.updated_by.nick} (#{format_time(group_order.updated_on)})"
|
||||||
%td.numeric= number_to_currency(group_order.price)
|
%td.numeric= link_to_ordering_price(order)
|
||||||
- else
|
- else
|
||||||
%td{:colspan => 2}
|
%td{:colspan => 2}
|
||||||
- if total > 0
|
- if total > 0
|
||||||
|
|
Loading…
Reference in a new issue