finish group_orders i18n + controller

This commit is contained in:
wvengen 2013-02-09 02:01:31 +01:00
parent 28c66642f5
commit 8d899581bd
9 changed files with 196 additions and 98 deletions

View file

@ -8,29 +8,29 @@
setStockit(#{@order.stockit?});
});
- title "Bestellen", false
- title t('.title'), false
.row-fluid
.well.pull-left
%h2= @order.name
%dl.dl-horizontal
- unless @order.note.blank?
%dt Notiz
%dt= t '.note'
%dd= @order.note
%dt Erstellt von
%dt= t '.created_by'
%dd= link_to_user_message_if_valid(@order.created_by)
%dt Ende
%dt= t '.ending'
%dd= format_time(@order.ends)
- unless @order.stockit? or @order.supplier.min_order_quantity.blank?
%dt Mindestbestellmenge
%dt= t '.min_quantity'
%dd= @order.supplier.min_order_quantity
%dt Gesamtbestellmenge bisher:
%dt= t '.sum_amount'
%dd= number_to_currency @order.sum
%dt Zuletzt bestellt
%dt= t '.last_update'
%dd
= @group_order.updated_by.nick if @group_order.updated_by
(#{format_time(@group_order.updated_on)})
%dt Guthaben
%dt= t '.funds'
%dd= number_to_currency(@ordering_data[:available_funds])
.well.pull-right
@ -44,18 +44,18 @@
%table.table.table-hover
%thead
%tr
%th Name
%th= t '.name'
%th{style: "width:13px;"}
%th{style: "width:4.5em;"} Preis
%th{style: "width:4.5em;"} Einheit
%th{style: "width:4.5em;"}= t '.price'
%th{style: "width:4.5em;"}= t '.unit'
- unless @order.stockit?
%th{style: "width:70px;"} Fehlende Einheiten
%th#col_required Menge
%th#col_tolerance Toleranz
%th{style: "width:70px;"}= t '.unit_missing'
%th#col_required= t '.amount'
%th#col_tolerance= t '.tolerance'
- else
%th(style="width:20px") Verfügbar
%th#col_required Menge
%th{style: "width:15px;"} Summe
%th(style="width:20px")= t '.available'
%th#col_required= t '.amount'
%th{style: "width:15px;"}= t '.sum'
%tbody
- @order.articles_grouped_by_category.each do |category, order_articles|
%tr.article-category
@ -98,42 +98,42 @@
.article-info
.article-name= order_article.article.name
.pull-right
Volle Gebinde:
= t('.units_full') + ':'
%span{id: "units_#{order_article.id}"}= order_article.units_to_order
%br/
Gesamt-Einheiten:
= t('.units_total') + ':'
%span{id: "q_total_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:quantity] + @ordering_data[:order_articles][order_article.id][:others_quantity]
%br/
Gesamt-Toleranz:
= t('.total_tolerance') + ':'
%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
Hersteller: #{order_article.article.manufacturer}
#{t '.manufacturer'}: #{order_article.article.manufacturer}
%br/
Gebinde: #{@order.stockit? ? order_article.article.quantity_available : @ordering_data[:order_articles][order_article.id][:unit]} * #{h order_article.article.unit}
#{t '.units'}: #{@order.stockit? ? order_article.article.quantity_available : @ordering_data[:order_articles][order_article.id][:unit]} * #{h order_article.article.unit}
%br/
Notiz: #{order_article.article.note}
#{t '.note'}: #{order_article.article.note}
%br/
#order-footer
#info-box
#total-sum
%table
%tr
%td Gesamtbetrag:
%td= t('.total_sum_amount') + ':'
%td.currency
%span#total_price= @group_order.price
%tr
%td Verfügbares Guthaben:
%td= t('.available_funds') + ':'
%td.currency= number_to_currency(@ordering_data[:available_funds])
%tr
%td Neuer Kontostand:
%td= t('.new_funds') + ':'
%td.currency
%strong
%span#new_balance= @ordering_data[:available_funds] - @group_order.price
#order-button
= submit_tag( "Bestellung speichern", id: 'submit_button', class: 'btn btn-primary' )
oder #{link_to "abbrechen", group_orders_path}
= submit_tag( t('.action_save'), id: 'submit_button', class: 'btn btn-primary' )
oder #{link_to t('.cancel'), group_orders_path}
%input#total_balance{name: "total_balance", type: "hidden", value: @ordergroup.account_balance - @group_order.price}/
%input{name: "version", type: "hidden", value: @version}/
%input{name: "version", type: "hidden", value: @version}/

View file

@ -1,9 +1,9 @@
%table.table.table-striped
%thead
%tr
%th Lieferantin
%th Ende
%th Summe
%th= t '.supplier'
%th= t '.ending'
%th= t '.sum'
%tbody
- for order in orders
- group_order = order.group_order(@ordergroup) # Get GroupOrder if possible
@ -13,4 +13,4 @@
%td= format_time(order.ends)
%td.numeric= group_order ? number_to_currency(group_order.price) : "--"
- if pagination
= pagination_links_remote @closed_orders
= pagination_links_remote @closed_orders

View file

@ -1,9 +1,9 @@
- orders = Order.open.reject{ |order| order == current_order }
- unless orders.empty?
%h2 Laufende Bestellungen
%h2= t '.title'
%ul.unstyled
- orders.each do |order|
%li
= link_to_ordering(order, 'data-confirm_switch_order' => true)
- if order.ends
noch #{time_ago_in_words(order.ends)}
= t '.remaining', remaining: time_ago_in_words(order.ends)

View file

@ -1,14 +1,13 @@
- title "Bestellungen der #{@ordergroup.name}"
- title t('.title', group: @ordergroup.name)
%p
Siehe hier alle
= link_to "laufenden Bestellungen.", group_orders_path
= t('.desc', link: link_to(t('.open_orders'), group_orders_path)).html_safe
.row-fluid
.span6
%h2 beendet/nicht abgerechnet
%h2= t '.title_open'
= render :partial => "orders", :locals => {:orders => Order.finished_not_closed, :pagination => false}
.span6
%h2 abgerechnet
%h2= t '.title_closed'
#closed_orders
= render :partial => "orders", :locals => {:orders => @closed_orders, :pagination => true}

View file

@ -1,21 +1,21 @@
- title "Bestellüberblick", false
- title t('.title'), false
- content_for :sidebar do
.well.well-small
// Ordergroups Account Balance
%h2 Guthaben
%h2= t '.funds.title'
%table.table.table-striped
%tr
%td Kontostand:
%td= t('.funds.account_balance') + ':'
%td.numeric{:style => "width:5em"}= number_to_currency(@ordergroup.account_balance)
%tr
%td - laufende Bestellungen:
%td= '- ' + t('.funds.open_orders') + ':'
%td.numeric= number_to_currency(@ordergroup.value_of_open_orders)
%tr
%td= "- nicht abgerechnete Bestellungen:"
%td= '- ' + t('.funds.finished_orders') + ':'
%td.numeric= number_to_currency(@ordergroup.value_of_finished_orders)
%tr
%th verfügbares Guthaben:
%th= t('.funds.available_funds') + ':'
%th.numeric= number_to_currency(@ordergroup.get_available_funds)
= render :partial => "shared/open_orders", :locals => {:ordergroup => @ordergroup}
@ -23,17 +23,17 @@
// finished orders
- unless Order.finished.empty?
%section
%h2 Nicht abgerechnete Bestellungen
%h2= t '.finished_orders.title'
= render :partial => "orders", :locals => {:orders => Order.finished_not_closed, :pagination => false}
- if @ordergroup.value_of_finished_orders > 0
%p
Gesamtsumme:
= t('.finished_orders.total_sum') + ':'
%b= number_to_currency(@ordergroup.value_of_finished_orders)
// closed orders
- unless Order.closed.empty?
%section
%h2 Abgerechnete Bestellungen
%h2= t '.closed_orders.title'
= render :partial => "orders", :locals => {:orders => Order.closed.all(:limit => 5), :pagination => false}
%br/
= link_to "mehr...", archive_group_orders_path
= link_to t('.closed_orders.more'), archive_group_orders_path

View file

@ -6,20 +6,20 @@
- form_tag(:action => 'saveOrder', :id => @order) do
.single_column{:style => "clear:both;margin-bottom:7em;"}
.box_title
%h2 Artikel
%h2= t '.title'
.column_content
%table#order.list
%thead
%tr
%th Name
%th= t 'group_orders.form.name'
%th{:style => "width:13px;"}
%th{:style => "width:4.5em;"} Preis
%th{:style => "width:4.5em;"} Einheit
%th{:style => "width:70px;"} Fehlende Einheiten
%th#col_required Menge
%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 Toleranz
%th{:style => "width:15px;"} Summe
%th#col_tolerance= t 'group_orders.form.tolerance'
%th{:style => "width:15px;"}= t 'group_orders.form.sum'
%tbody
- total = 0
- i = 0
@ -68,21 +68,21 @@
.article-info
%h3= order_article.article.name
.right
Volle Gebinde:
= t('group_orders.form.units_full') + ':'
%span{:id => "units_#{i}"}= order_article.units_to_order
%br/
Gesamt-Einheiten:
= t('group_orders.form.total_units') + ':'
%span{:id => "q_total_#{i}"}= @quantity[i] + @others_quantity[i]
%br/
Gesamt-Toleranz:
= t('group_orders.form.total_tolerance') + ':'
%span{:id => "t_total_#{i}"}= @tolerance[i] + @others_tolerance[i]
%br/
.left
Hersteller: #{order_article.article.manufacturer}
#{t 'group_orders.form.manufacturer'}: #{order_article.article.manufacturer}
%br/
Gebinde: #{@order.stockit? ? order_article.article.quantity_available : @unit[i]} * #{h order_article.article.unit}
#{t 'group_orders.form.units'}: #{@order.stockit? ? order_article.article.quantity_available : @unit[i]} * #{h order_article.article.unit}
%br/
Notiz: #{order_article.article.note}
#{t 'group_orders.form.note'}: #{order_article.article.note}
%br/
- i = i + 1
= render "order_footer", :total => total
= render "order_footer", :total => total

View file

@ -4,48 +4,49 @@
$('tr.ignored').hide();
});
- title "Dein Bestellergebnis für #{@order.name}"
- title t('.title', order: @order.name)
.well
// Order summary
%dl.dl-horizontal
%dt Lieferantin
%dt= t '.supplier'
%dd= @order.name
%dt Notiz
%dt= t '.note'
%dd= @order.note
%dt Ende
%dt= t '.ending'
%dd= format_time(@order.ends)
%dt Bestellsumme
%dt= t '.order_sum'
%dd
- if @group_order
= number_to_currency(@group_order.price)
- else
Du hast nicht bestellt.
= t '.not_ordered'
- if @order.closed?
%p Abgerechnet von #{@order.updated_by.nick}
= link_to "Kommentare lesen/schreiben", "#comments"
%p= t '.closed_by', user: @order.updated_by.nick
= link_to t('.comment'), "#comments"
// Article box
%section
%h2 Artikelübersicht
%h2= t '.articles.title'
.column_content#result
- if @group_order
%p.pull-right= link_to "Zeige/Verstecke nicht bestellte Artikel", '#', 'data-toggle-this' => 'tr.ignored'
%p= link_to("Bestellung anpassen", edit_group_order_path(@group_order, order_id: @order.id), class: 'btn btn-primary') if @order.open?
%p.pull-right= link_to t('.articles.show_hide'), '#', 'data-toggle-this' => 'tr.ignored'
%p= link_to(t('.articles.edit_order'), edit_group_order_path(@group_order, order_id: @order.id), class: 'btn btn-primary') if @order.open?
%table.table.table-hover
%thead
%tr
%th{style: "width:40%"} Name
%th Gebinde
%th Einzelpreis
%th{style: "width:40%"}= t '.articles.name'
%th= t '.articles.units'
%th= t '.articles.unit_price'
%th
%abbr{title: "Menge + Toleranz"} Bestellt
%abbr{title: t('.articles.ordered_title')}= t '.articles.ordered'
%th
%abbr{title: "Unter Berücksichtigung der derzeitigen Bestellungen aller Gruppen"}
%abbr{title: t('.articles.order_nopen_title')}
- if @order.open?
Zu
Erhalten
%th Gesamtpreis
= t '.articles.order_open'
- else
= t '.articles.order_not_open'
%th= t '.articles.total_price'
%tbody
- total = 0 #set counter for order-sum
- for category_name, order_articles in @order.articles_grouped_by_category
@ -73,20 +74,20 @@
%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"} Summe
%th{colspan: "5"}= t '.articles.sum'
%th= number_to_currency(total)
%br/
= link_to_top
- else
- if @order.open?
Du hast noch nicht bestellt.
= link_to "Das ist Deine Chance!", action: "order", id: @order
= t '.articles.not_ordered_msg'
= link_to t('.articles.order_now'), action: "order", id: @order
- else
Die Bestellung is leider schon zu Ende. Beim nächsten mal früher aufstehen...
= t '.articles.order_closed_msg'
// Comments box
%section
%h2 Kommentare
%h2= t '.comments.title'
#comments
= render 'shared/comments', comments: @order.comments
#new_comment= render 'order_comments/form', order_comment: @order.comments.build(user: current_user)