foodsoft/app/views/orders/show.html.haml
Patrick Gansterer 9c4d9d5c20 Add stock group order
This allows us to add additional items to an order, which do not belong
a specific user, but will be put into stock. The benefit of this change
is that we use the same order for ordergroups and stock.
2016-03-11 13:15:16 +01:00

94 lines
4 KiB
Text

- title t('.title', name: @order.name)
- if current_user.role_finance? || current_user.role_invoices?
- content_for :actionbar do
- if @order.invoice.present?
= link_to t('.show_invoice'), finance_invoice_path(@order.invoice), class: 'btn'
- elsif @order.closed?
= link_to t('.create_invoice'), new_finance_invoice_path(:order_id => @order, :supplier_id => @order.supplier),
class: 'btn'
.well
= close_button :alert
%p
= raw t '.description1',
state: t("orders.state.#{@order.state}").capitalize,
supplier: supplier_link(@order),
who: show_user_link(@order.created_by),
starts: format_time(@order.starts),
ends: format_time(@order.ends)
%br
= raw t '.description2',
ordergroups: ordergroup_count(@order),
article_count: @order.order_articles.ordered.count,
net_sum: number_to_currency(@order.sum(:net)),
gross_sum: number_to_currency(@order.sum(:gross))
- unless @order.comments.blank?
= link_to t('.comments_link'), '#comments'
- if @note.present?
%p
= heading_helper(Order, :note) + ': '
= @order.note
-# Proposing to remove this warning, since there is a valid period when the order is not settled yet.
-# Perhaps when the pickup day has been, or when the order isn't settled a week after it has been
-# closed, this message could be shown.
-#- if @order.finished? and !@order.closed?
.alert.alert-warning
= t '.warn_not_closed'
.well.well-small
.btn-toolbar
.form-search.pull-right
.input-append
= text_field_tag :query, params[:query], class: 'search-query delayed-search resettable'
%button.add-on.btn.reset-search{:type => :button, :title => t('.search_reset')}
%i.icon.icon-remove
.btn-toolbar
.btn-group.view_buttons
= update_articles_link @order, t('.articles'), :default, class: 'btn'
= update_articles_link @order, t('.sort_group'), :groups, class: 'btn'
= update_articles_link @order, t('.sort_article'), :articles, class: 'btn'
- unless @order.open?
.btn-group
= link_to '#', class: 'btn dropdown-toggle', data: {toggle: 'dropdown'} do
= t '.download.title'
%span.caret
%ul.dropdown-menu
%li= order_pdf(@order, :groups, t('.download.group_pdf'))
%li= order_pdf(@order, :articles, t('.download.article_pdf'))
%li= order_pdf(@order, :matrix, t('.download.matrix_pdf'))
%li= order_pdf(@order, :fax, t('.download.fax_pdf'))
- unless @order.stockit?
%li= link_to t('.download.fax_txt'), order_path(@order, format: :txt), {title: t('.download.download_file')}
%li= link_to t('.download.fax_csv'), order_path(@order, format: :csv), {title: t('.download.download_file')}
- if @order.open?
= link_to t('.action_end'), finish_order_path(@order), method: :post, class: 'btn btn-success',
data: {confirm: t('.confirm_end', order: @order.name)}
- if @order.stock_group_order
= link_to t('.stock_order'), edit_group_order_path(@order.stock_group_order, :order_id => @order.id), class: 'btn'
- else
= link_to t('.stock_order'), new_group_order_path(:order_id => @order.id, :stock_order => true), class: 'btn'
= link_to t('ui.edit'), edit_order_path(@order), class: 'btn'
- elsif not @order.closed? and not @order.stockit?
= receive_button @order
- unless @order.closed?
= link_to t('ui.delete'), @order, data: {confirm: t('.confirm_delete')}, method: :delete,
class: 'btn btn-danger'
%section#articles_table
= render @partial, order: @order
%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
= render 'show_js'
= render 'shared/articles_by/common', order: @order