finish ordergroups and orders i18n + controller

This commit is contained in:
wvengen 2013-02-08 01:52:20 +01:00
parent d818ea5d53
commit e06524ca37
14 changed files with 185 additions and 84 deletions

View file

@ -1,12 +1,12 @@
%table.table.table-hover
%thead
%tr
%th Name
%th Gebinde
%th Netto-/Bruttopreis
%th Bestellte Einheiten
%th= t '.name'
%th= t '.unit_quantity'
%th= t '.prices'
%th= t '.units_ordered'
- unless order.stockit?
%th Volle Gebinde
%th= t '.units_full'
- total_net, total_gross, counter = 0, 0, 0
%tbody
- order.articles_grouped_by_category.each do |category_name, order_articles|
@ -32,8 +32,8 @@
%td= "#{order_article.quantity} + #{order_article.tolerance}" if unit_quantity > 1
%td= units
%p
Summe (Netto/Brutto-Preise):
= t '.prices_sum'
= "#{number_to_currency(total_net)} / #{number_to_currency(total_gross)}"
%p
Bestellte Artikel.
= order.order_articles.ordered.count
= t '.article_count'
= order.order_articles.ordered.count

View file

@ -4,22 +4,22 @@
= f.input :starts, input_html: {class: 'input-small'}
= f.input :ends, input_html: {class: 'input-small'}
%h2 Artikel
%h2= t '.title'
- if @order.errors.has_key?(:articles)
.alert.alert-error
= @order.errors.get(:articles).join(" ")
%table.table.table-hover#articleList
%tr
%th= check_box_tag 'checkall', "1", false, { 'data-check-all' => '#articleList' }
%th Name
%th Notiz
%th= t '.name'
%th= t '.note'
- if @order.stockit?
%th Verfügbar
%th= t '.stockit'
- else
%th Herkunft
%th Hersteller
%th Gebinde
%th Preis (netto/FC)
%th= t '.origin'
%th= t '.supplier'
%th= t '.unit_quantity'
%th= t '.prices'
- for category_name, articles in @order.articles_for_ordering
%tr.article-category
%td
@ -44,11 +44,11 @@
%tr
%td
= check_box_tag 'checkall', "1", false, { 'data-check-all' => '#articleList' }
%td{:colspan => "6"} Alle auswählen
%td{:colspan => "6"}= t '.select_all'
- if (@template_orders && !@template_orders.empty?)
= render :partial => 'template_orders_script'
.form-actions
= f.submit class: 'btn'
= link_to "oder abbrechen", orders_path
= link_to t('.cancel'), orders_path

View file

@ -2,10 +2,10 @@
%table.table.table-striped
%thead
%tr
%th= sort_link_helper "Lieferantin", "supplier"
%th Start
%th= sort_link_helper "Ende", "ends"
%th Status
%th= sort_link_helper t('.supplier'), "supplier"
%th= t '.start'
%th= sort_link_helper t('.ending'), "ends"
%th= t '.status'
%th{:colspan => "2"}
%tbody
- @orders.each do |order|
@ -14,4 +14,4 @@
%td= format_time(order.starts)
%td= format_time(order.ends)
%td= t(order.state, scope: 'orders.state')
%td= link_to "Anzeigen", order, class: 'btn btn-small'
%td= link_to t('ui.show'), order, class: 'btn btn-small'

View file

@ -1,3 +1,3 @@
- title "Bestellung bearbeiten"
- title t('.title')
= render :partial => 'form'

View file

@ -1,23 +1,23 @@
- title "Bestellungen verwalten"
- title t('.title')
- content_for :actionbar do
.btn-group
= link_to '#', data: {toggle: 'dropdown'}, class: 'btn btn-primary dropdown-toggle' do
Neue Bestellung anlegen
= t '.new_order'
%span.caret
%ul.dropdown-menu
- Supplier.all.each do |supplier|
%li= link_to supplier.name, new_order_path(supplier_id: supplier.id), tabindex: -1
.well
%h2 Laufende Bestellungen
%h2= t '.open_orders'
- unless @open_orders.empty?
%table.table.table-striped
%thead
%tr
%th Lieferantin
%th Ende
%th Notiz
%th= t '.supplier'
%th= t '.ending'
%th= t '.note'
%th{colspan: "2"}
%tbody
- for order in @open_orders
@ -26,18 +26,18 @@
%td= order.name
%td= format_time(order.ends) unless order.ends.nil?
%td= truncate(order.note)
%td= link_to "Beenden", finish_order_path(order),
confirm: "Willst Du wirklich die Bestellung \"#{order.name}\" beenden? Es gibt kein zurück.",
method: :post, class: 'btn btn-small btn-success'
%td= link_to t('.action_end'), finish_order_path(order),
confirm: t('.confirm_end', order: order.name), method: :post,
class: 'btn btn-small btn-success'
%td
= link_to "Anzeigen", order, class: 'btn btn-small'
= link_to "Bearbeiten", edit_order_path(order), class: 'btn btn-small'
= link_to "Löschen", order, confirm: "Willst Du wirklich die Bestellung löschen?", method: :delete,
= link_to t('ui.show'), order, class: 'btn btn-small'
= link_to t('ui.edit'), edit_order_path(order), class: 'btn btn-small'
= link_to t('ui.delete'), order, confirm: t('.confirm_delete'), method: :delete,
class: 'btn btn-small btn-danger'
- else
Derzeit gibt es keine laufende Bestellungen.
= t '.no_open_orders'
%h2 Beendete Bestellungen
%h2= t '.ended_orders'
#orders_table
= render partial: 'orders'
= render partial: 'orders'

View file

@ -1,3 +1,3 @@
- title "Neue Bestellung anlegen"
- title t('.title')
= render 'form'

View file

@ -1,61 +1,62 @@
- title "Bestellung: #{@order.name}"
- title t('.title', name: @order.name)
- if @order.finished? and !@order.closed?
.alert.alert-warning Achtung, Bestellung wurde noch nicht abgerechnet.
.alert.alert-warning
= t '.warn_not_closed'
// Order summary
.well
%dl.dl-horizontal
%dt Lieferantin
%dt= t '.supplier'
%dd= @order.name
- if @note.present?
%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 Beginn
%dt= t '.begin'
%dd= format_time(@order.starts)
%dt Ende
%dt= t '.ending'
%dd= format_time(@order.ends)
%dt Gruppenbestellungen:
%dt= t '.group_orders'
%dd #{@order.group_orders.count} (#{@order.group_orders.includes(:ordergroup).all.map {|g| g.ordergroup.name}.join(', ')})
%dt Netto/Bruttosumme aller Artikel:
%dt= t '.amounts'
%dd= "#{number_to_currency(@order.sum(:net))} / #{number_to_currency(@order.sum(:gross))}"
%dt Bestellte Artikel:
%dt= t '.articles_ordered'
%dd= @order.order_articles.ordered.count
.form-actions
- if @order.open?
= link_to "Bearbeiten", edit_order_path(@order), class: 'btn'
= link_to 'Beenden!', finish_order_path(@order), method: :post, class: 'btn btn-success',
confirm: "Willst Du wirklich die Bestellung beenden?\nEs gibt kein zurück.."
= link_to t('ui.edit'), edit_order_path(@order), class: 'btn'
= link_to t('.action_end'), finish_order_path(@order), method: :post, class: 'btn btn-success',
confirm: t('.confirm_end')
- unless @order.closed?
= link_to "Löschen", @order, confirm: "Willst du wirklich die Bestellung löschen?", method: :delete,
= link_to t('ui.delete'), @order, confirm: t('.confirm_delete'), method: :delete,
class: 'btn btn-danger'
- unless @order.open?
%ul.nav.nav-pills
%li= update_articles_link(@order, "Artikelübersicht", :default)
%li= update_articles_link(@order, "Sortiert nach Gruppen", :groups)
%li= update_articles_link(@order, "Sortiert nach Artikeln", :articles)
%li= link_to 'Kommentare', '#comments'
%li= update_articles_link(@order, t('.articles'), :default)
%li= update_articles_link(@order, t('.sort_group'), :groups)
%li= update_articles_link(@order, t('.sort_article'), :articles)
%li= link_to t('.comments_link'), '#comments'
%li.dropdown
= link_to '#', class: 'dropdown-toggle', data: {toggle: 'dropdown'} do
Download
= t '.download.title'
%b.caret
%ul.dropdown-menu
%li= order_pdf(@order, :groups, "Gruppenpdf")
%li= order_pdf(@order, :articles, "Artikelpdf")
%li= order_pdf(@order, :matrix, "Matrix")
%li= order_pdf(@order, :fax, "Fax PDF")
%li= link_to "Fax Text", {action: 'text_fax_template', id: @order }, {title: "Download file"}
%li= order_pdf(@order, :groups, t('.group_pdf'))
%li= order_pdf(@order, :articles, t('.article_pdf'))
%li= order_pdf(@order, :matrix, t('.matrix_pdf'))
%li= order_pdf(@order, :fax, t('.fax_pdf'))
%li= link_to t('.fax_txt'), {action: 'text_fax_template', id: @order }, {title: t('.download_file')}
%section#articles_table
= render 'articles', order: @order
%h2 Kommentare
%h2= t '.comments.title'
#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)}
= link_to_top
= link_to_top