simplify i18n and fix some small ui issues

This commit is contained in:
wvengen 2013-11-23 17:28:21 +01:00
parent 135e938d3d
commit 652a392b37
7 changed files with 58 additions and 165 deletions

View file

@ -27,22 +27,22 @@
%h2= @order.name
%dl.dl-horizontal
- unless @order.note.blank?
%dt= t '.note'
%dt= heading_helper Order, :note
%dd= @order.note
%dt= t '.created_by'
%dt= heading_helper Order, :created_by
%dd= show_user_link(@order.created_by)
%dt= t '.ending'
%dt= heading_helper Order, :ends
%dd= format_time(@order.ends)
- unless @order.stockit? or @order.supplier.min_order_quantity.blank?
%dt= t '.min_quantity'
%dt= heading_helper Supplier, :min_order_quantity, short: true
%dd= @order.supplier.min_order_quantity
%dt= t '.sum_amount'
%dd= number_to_currency @order.sum
%dt= t '.last_update'
%dt= heading_helper GroupOrder, :updated_by
%dd
= show_user(@group_order.updated_by) if @group_order.updated_by
(#{format_time(@group_order.updated_on)})
%dt= t '.funds'
%dt= heading_helper Ordergroup, :available_funds
%dd= number_to_currency(@ordering_data[:available_funds])
.well.pull-right
@ -65,20 +65,20 @@
%table.table.table-hover
%thead
%tr
%th= t '.name'
%th= heading_helper Article, :name
- if @order.stockit?
%th{style: 'width:120px'}= t '.supplier'
%th{style: 'width:120px'}= heading_helper StockArticle, :supplier
%th{style: "width:13px;"}
%th{style: "width:4.5em;"}= t '.price'
%th{style: "width:4.5em;"}= t '.unit'
%th{style: "width:4.5em;"}= heading_helper Article, :unit
- unless @order.stockit?
%th{style: "width:70px;"}= t '.unit_missing'
%th#col_required= t '.amount'
%th#col_tolerance= t '.tolerance'
%th{style: "width:70px;"}= heading_helper OrderArticle, :missing_units, short: true
%th#col_required= heading_helper GroupOrderArticle, :quantity
%th#col_tolerance= heading_helper GroupOrderArticle, :tolerance
- else
%th(style="width:20px")= t '.available'
%th#col_required= t '.amount'
%th{style: "width:15px;"}= t '.sum'
%th(style="width:20px")= heading_helper StockArticle, :available
%th#col_required= heading_helper GroupOrderArticle, :quantity
%th{style: "width:15px;"}= heading_helper GroupOrderArticle, :total_price
%tbody.list
- @order.articles_grouped_by_category.each do |category, order_articles|
%tr.list-heading.article-category
@ -132,11 +132,11 @@
%span{id: "t_total_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:tolerance] + @ordering_data[:order_articles][order_article.id][:others_tolerance]
%br/
.pull-left
#{t '.manufacturer'}: #{order_article.article.manufacturer}
#{heading_helper Article, :manufacturer}: #{order_article.article.manufacturer}
%br/
#{t '.units'}: #{@order.stockit? ? order_article.article.quantity_available : @ordering_data[:order_articles][order_article.id][:unit]} * #{h order_article.article.unit}
%br/
#{t '.note'}: #{order_article.article.note}
#{heading_helper Article, :note}: #{order_article.article.note}
%br/
#order-footer
#info-box
@ -147,7 +147,7 @@
%td.currency
%span#total_price= number_to_currency(@group_order.price)
%tr
%td= t('.available_funds') + ':'
%td= heading_helper(Ordergroup, :available_funds) + ':'
%td.currency= number_to_currency(@ordering_data[:available_funds])
%tr
%td= t('.new_funds') + ':'

View file

@ -1,9 +1,9 @@
%table.table.table-striped
%thead
%tr
%th= t '.supplier'
%th= t '.ending'
%th= t '.sum'
%th= heading_helper Order, :name
%th= heading_helper Order, :ends
%th= heading_helper GroupOrder, :price
%tbody
- for order in orders
- group_order = order.group_order(@ordergroup) # Get GroupOrder if possible

View file

@ -6,22 +6,22 @@
%h2= t '.funds.title'
%table.table.table-striped
%tr
%td= t('.funds.account_balance') + ':'
%td= heading_helper Ordergroup, :account_balance
%td.numeric{:style => "width:5em"}= number_to_currency(@ordergroup.account_balance)
%tr
%td= '- ' + t('.funds.open_orders') + ':'
%td= '- ' + t('.funds.open_orders')
%td.numeric= number_to_currency(@ordergroup.value_of_open_orders)
%tr
%td= '- ' + t('.funds.finished_orders') + ':'
%td= '- ' + t('.funds.finished_orders')
%td.numeric= number_to_currency(@ordergroup.value_of_finished_orders)
%tr
%th= t('.funds.available_funds') + ':'
%th= heading_helper Ordergroup, :available_funds
%th.numeric= number_to_currency(@ordergroup.get_available_funds)
= render :partial => "shared/open_orders", :locals => {:ordergroup => @ordergroup}
// finished orders
- unless Order.finished.empty?
- unless Order.finished_not_closed.empty?
%section
%h2= t '.finished_orders.title'
= render :partial => "orders", :locals => {:orders => Order.finished_not_closed, :pagination => false}

View file

@ -1,88 +0,0 @@
- content_for :head do
= render 'data'
= render :partial => 'order_head'
- form_tag(:action => 'saveOrder', :id => @order) do
.single_column{:style => "clear:both;margin-bottom:7em;"}
.box_title
%h2= t '.title'
.column_content
%table#order.list
%thead
%tr
%th= t 'group_orders.form.name'
%th{:style => "width:13px;"}
%th{:style => "width:4.5em;"}= t 'group_orders.form.price'
%th{:style => "width:4.5em;"}= t 'group_orders.form.unit'
%th{:style => "width:70px;"}= t 'group_orders.form.unit_missing'
%th#col_required= t 'group_orders.form.amount'
- if not @order.stockit?
%th#col_tolerance= t 'group_orders.form.tolerance'
%th{:style => "width:15px;"}= t 'group_orders.form.sum'
%tbody
- total = 0
- i = 0
- @articles_grouped_by_category.each do |category, order_articles|
%tr{:style => "background-color:#EFEFEF"}
%td{:style => "text-align:left"}
%b= h category
%td{:colspan => "9"}
- order_articles.each do |order_article|
- if FoodsoftConfig[:tolerance_is_costly]
- article_total = @price[i] * (@tolerance[i] + @quantity[i])
- else
- article_total = @price[i] * @quantity[i]
- total += article_total
%tr{:class => "#{cycle('even', 'odd', :name => 'articles')} order-article", :valign => "top"}
%td.name= order_article.article.name
%td= h order_article.article.origin
%td= number_to_currency(@price[i])
%td= order_article.article.unit
%td
%span{:id => "missing_units_#{i}"}
- if @order.stockit?
- order_article.article.quantity_available
- else
- missing_units = @unit[i] - (((@quantity[i] + @others_quantity[i]) % @unit[i]) + @tolerance[i] + @others_tolerance[i])
- missing_units < 0 ? 0 : missing_units
%td.quantity
%input{:id => "q_#{i}", :name => "ordered[#{order_article.id}][quantity]", :size => "2", :type => "hidden", :value => @quantity[i]}/
%span.used{:id => "q_used_#{i}"}= @used_quantity[i]
+
%span.unused{:id => "q_unused_#{i}"}= @quantity[i] - @used_quantity[i]
= button_to_function('+', "increaseQuantity(#{i})")
= button_to_function('-', "decreaseQuantity(#{i})")
- unless @order.stockit?
%td.tolerance
%input{:id => "t_#{i}", :name => "ordered[#{order_article.id}][tolerance]", :size => "2", :type => "hidden", :value => @tolerance[i]}/
- if (@unit[i] > 1)
%span.used{:id => "t_used_#{i}"}= @used_tolerance[i]
+
%span.unused{:id => "t_unused_#{i}"}= @tolerance[i] - @used_tolerance[i]
= button_to_function('+', "increaseTolerance(#{i})")
= button_to_function('-', "decreaseTolerance(#{i})")
%td{:id => "td_price_#{i}", :style => "text-align:right; padding-right:10px; width:4em"}
%span{:id => "price_#{i}_display"}= number_to_currency(article_total, :unit => "")
.article-info
%h3= order_article.article.name
.right
= t('group_orders.form.units_full') + ':'
%span{:id => "units_#{i}"}= order_article.units_to_order
%br/
= t('group_orders.form.total_units') + ':'
%span{:id => "q_total_#{i}"}= @quantity[i] + @others_quantity[i]
%br/
= t('group_orders.form.total_tolerance') + ':'
%span{:id => "t_total_#{i}"}= @tolerance[i] + @others_tolerance[i]
%br/
.left
#{t 'group_orders.form.manufacturer'}: #{order_article.article.manufacturer}
%br/
#{t 'group_orders.form.units'}: #{@order.stockit? ? order_article.article.quantity_available : @unit[i]} * #{h order_article.article.unit}
%br/
#{t 'group_orders.form.note'}: #{order_article.article.note}
%br/
- i = i + 1
= render "order_footer", :total => total

View file

@ -9,21 +9,22 @@
.well
// Order summary
%dl.dl-horizontal
%dt= t '.supplier'
%dt= heading_helper Order, :name
%dd= @order.name
%dt= t '.note'
%dt= heading_helper Order, :note
%dd= @order.note
%dt= t '.ending'
%dt= heading_helper Order, :ends
%dd= format_time(@order.ends)
%dt= t '.order_sum'
%dt= heading_helper GroupOrder, :price
%dd
- if @group_order
= number_to_currency(@group_order.price)
- else
= t '.not_ordered'
- if @order.closed?
%p= t '.closed_by', user: show_user(@order.updated_by)
= link_to t('.comment'), "#comments"
%dt= heading_helper Order, :closed_by
%dd= show_user_link @order.updated_by
%p= link_to t('.comment'), "#comments"
// Article box
%section
@ -35,8 +36,8 @@
%table.table.table-hover
%thead
%tr
%th{style: "width:40%"}= t '.articles.name'
%th= t '.articles.units'
%th{style: "width:40%"}= heading_helper Article, :name
%th= heading_helper Article, :units
%th= t '.articles.unit_price'
%th
%abbr{title: t('.articles.ordered_title')}= t '.articles.ordered'
@ -46,7 +47,7 @@
= t '.articles.order_open'
- else
= t '.articles.order_not_open'
%th= t '.articles.total_price'
%th= heading_helper GroupOrderArticle, :total_price
%tbody
- for category_name, order_articles in @order.articles_grouped_by_category
%tr.article-category
@ -61,7 +62,7 @@
%td{style: "width:40%"}
= oa.article.name
- unless oa.article.note.blank?
= image_tag("lamp_grey.png", {alt: "Notiz anzeigen", size: "15x16", border: "0", onmouseover: "$('note_#{oa.id}').show();", onmouseout: "$('note_#{oa.id}').hide();"})
= image_tag("lamp_grey.png", {alt: t('.articles.show_note'), size: "15x16", border: "0", onmouseover: "$('#note_#{oa.id}').show();", onmouseout: "$('#note_#{oa.id}').hide();"})
%td= "#{oa.price.unit_quantity} x #{oa.article.unit}"
%td= number_to_currency(oa.price.fc_price)
%td
@ -73,7 +74,7 @@
%tr{id: "note_#{oa.id}", class: "note even", style: "display:none"}
%td{colspan: "6"}=h oa.article.note
%tr{class: cycle('even', 'odd', name: 'articles')}
%th{colspan: "5"}= t '.articles.sum'
%th{colspan: "5"}= heading_helper GroupOrder, :price
%th= number_to_currency(@group_order.price)
%br/
= link_to_top