complete show order i18n
Conflicts: app/helpers/orders_helper.rb
This commit is contained in:
parent
42d622d1b2
commit
5b6d1a66a6
3 changed files with 56 additions and 29 deletions
|
@ -79,4 +79,23 @@ module OrdersHelper
|
||||||
|
|
||||||
input_html.html_safe
|
input_html.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def ordergroup_count(order)
|
||||||
|
group_orders = order.group_orders.includes(:ordergroup)
|
||||||
|
txt = "#{group_orders.count} #{Ordergroup.model_name.human count: group_orders.count}"
|
||||||
|
if group_orders.count == 0
|
||||||
|
return txt
|
||||||
|
else
|
||||||
|
desc = group_orders.all.map {|g| g.ordergroup.name}.join(', ')
|
||||||
|
content_tag(:abbr, txt, title: desc).html_safe
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def supplier_link(order_or_supplier)
|
||||||
|
if order_or_supplier.kind_of?(Order) and order_or_supplier.stockit?
|
||||||
|
link_to(order_or_supplier.name, stock_articles_path).html_safe
|
||||||
|
else
|
||||||
|
link_to(@order.supplier.name, supplier_path(@order.supplier)).html_safe
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,37 +1,20 @@
|
||||||
- title t('.title', name: @order.name)
|
- title t('.title', name: @order.name)
|
||||||
|
|
||||||
- content_for :javascript do
|
|
||||||
:javascript
|
|
||||||
function activate_search(view, placeholder) {
|
|
||||||
new List(document.body, {
|
|
||||||
valueNames: ['name'],
|
|
||||||
engine: 'unlist',
|
|
||||||
plugins: [
|
|
||||||
['reset', {highlightClass: 'btn-primary'}],
|
|
||||||
['delay', {delayedSearchTime: 500}],
|
|
||||||
],
|
|
||||||
// make large pages work too (as we don't have paging)
|
|
||||||
page: 10000,
|
|
||||||
indexAsync: true
|
|
||||||
});
|
|
||||||
$('#query').attr('placeholder', placeholder);
|
|
||||||
}
|
|
||||||
$(function() {
|
|
||||||
activate_search('default', '#{j t('.search_placeholder.default')}');
|
|
||||||
});
|
|
||||||
|
|
||||||
.well
|
.well
|
||||||
%button{type: "button", class: "close", data: {dismiss: 'alert'}}= t('ui.marks.close').html_safe
|
%button{type: "button", class: "close", data: {dismiss: 'alert'}}= t('ui.marks.close').html_safe
|
||||||
%p
|
%p
|
||||||
#{@order.state.capitalize} order from
|
= raw t '.description1',
|
||||||
#{link_to @order.supplier.name, supplier_path(@order.supplier)}
|
state: t("orders.state.#{@order.state}").capitalize,
|
||||||
created by #{show_user_link @order.created_by},
|
supplier: supplier_link(@order),
|
||||||
open from #{format_time @order.starts} until #{format_time @order.ends}.
|
who: show_user_link(@order.created_by),
|
||||||
|
starts: format_time(@order.starts),
|
||||||
|
ends: format_time(@order.ends)
|
||||||
%br
|
%br
|
||||||
%abbr{title: @order.group_orders.includes(:ordergroup).all.map {|g| g.ordergroup.name}.join(', ')}
|
= raw t '.description2',
|
||||||
#{@order.group_orders.count} #{Ordergroup.model_name.human count: @order.group_orders.count}
|
ordergroups: ordergroup_count(@order),
|
||||||
ordered #{@order.order_articles.ordered.count} articles with a total value of
|
article_count: @order.order_articles.ordered.count,
|
||||||
#{number_to_currency(@order.sum(:net))} / #{number_to_currency(@order.sum(:gross))} (net / gross).
|
net_sum: number_to_currency(@order.sum(:net)),
|
||||||
|
gross_sum: number_to_currency(@order.sum(:gross))
|
||||||
|
|
||||||
- if @note.present?
|
- if @note.present?
|
||||||
%p
|
%p
|
||||||
|
@ -98,3 +81,24 @@
|
||||||
= render partial: 'shared/comments', locals: { comments: @order.comments }
|
= render partial: 'shared/comments', locals: { comments: @order.comments }
|
||||||
#new_comment= render partial: 'order_comments/form', locals: { order_comment: @order.comments.build(user: current_user)}
|
#new_comment= render partial: 'order_comments/form', locals: { order_comment: @order.comments.build(user: current_user)}
|
||||||
= link_to_top
|
= link_to_top
|
||||||
|
|
||||||
|
|
||||||
|
- content_for :javascript do
|
||||||
|
:javascript
|
||||||
|
function activate_search(view, placeholder) {
|
||||||
|
new List(document.body, {
|
||||||
|
valueNames: ['name'],
|
||||||
|
engine: 'unlist',
|
||||||
|
plugins: [
|
||||||
|
['reset', {highlightClass: 'btn-primary'}],
|
||||||
|
['delay', {delayedSearchTime: 500}],
|
||||||
|
],
|
||||||
|
// make large pages work too (as we don't have paging)
|
||||||
|
page: 10000,
|
||||||
|
indexAsync: true
|
||||||
|
});
|
||||||
|
$('#query').attr('placeholder', placeholder);
|
||||||
|
}
|
||||||
|
$(function() {
|
||||||
|
activate_search('default', '#{j t('.search_placeholder.default')}');
|
||||||
|
});
|
||||||
|
|
|
@ -184,7 +184,9 @@ en:
|
||||||
order: Order
|
order: Order
|
||||||
order_article: Order article
|
order_article: Order article
|
||||||
order_comment: Order comment
|
order_comment: Order comment
|
||||||
ordergroup: Ordergroup
|
ordergroup:
|
||||||
|
one: Ordergroup
|
||||||
|
other: Ordergroups
|
||||||
stock_article: Stock article
|
stock_article: Stock article
|
||||||
stock_taking: Stock taking
|
stock_taking: Stock taking
|
||||||
supplier: Supplier
|
supplier: Supplier
|
||||||
|
@ -1169,6 +1171,8 @@ en:
|
||||||
confirm_end: ! 'Do you really want to close the order %{order}?
|
confirm_end: ! 'Do you really want to close the order %{order}?
|
||||||
|
|
||||||
There is no going back.'
|
There is no going back.'
|
||||||
|
description1: ! '%{state} order from %{supplier} created by %{who}, open from %{starts} until %{ends}.'
|
||||||
|
description2: ! '%{ordergroups} ordered %{article_count} articles, with a total value of %{net_sum} / %{gross_sum} (net / gross).'
|
||||||
download:
|
download:
|
||||||
article_pdf: Article PDF
|
article_pdf: Article PDF
|
||||||
download_file: Download file
|
download_file: Download file
|
||||||
|
|
Loading…
Reference in a new issue