Skip to content

Commit

Permalink
filter supplier for closed orders
Browse files Browse the repository at this point in the history
  • Loading branch information
mjavurek committed Mar 23, 2021
1 parent 69732cc commit fd674e9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
36 changes: 23 additions & 13 deletions app/views/finance/balancing/_orders.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
- unless @orders.empty?
- content_for :actionbar do
.btn-group
= link_to '#', data: {toggle: 'dropdown'}, class: 'btn dropdown-toggle' do
= t '.name'
%span.caret
%ul.dropdown-menu
%li= link_to t('.show_all'), "?"
- Supplier.undeleted.order(:name).each do |supplier|
%li= link_to supplier.name, "?" + {:supplier_id => supplier.id}.to_query
- if Order.finished.count > 20
= items_per_page
= pagination_links_remote @orders
Expand All @@ -12,18 +21,19 @@
%th
%tbody
- @orders.each do |order|
%tr{:class => cycle("even","odd", :name => "order")}
%td= link_to truncate(order.name), new_finance_order_path(order_id: order.id)
%td=h format_time(order.ends) unless order.ends.nil?
%td= order.closed? ? t('.cleared', amount: number_to_currency(order.foodcoop_result)) : t('.ended')
%td= show_user(order.updated_by)
%td
- unless order.closed?
- if current_user.role_orders?
- unless order.stockit?
= link_to t('orders.index.action_receive'), receive_order_path(order), class: 'btn btn-small'
- else
= link_to t('orders.index.action_receive'), '#', class: 'btn btn-small disabled'
= link_to t('.clear'), new_finance_order_path(order_id: order.id), class: 'btn btn-small btn-primary'
- if !params.has_key?(:supplier_id) || order.supplier.id.to_s == params[:supplier_id]
%tr{:class => cycle("even","odd", :name => "order")}
%td= link_to truncate(order.name), new_finance_order_path(order_id: order.id)
%td=h format_time(order.ends) unless order.ends.nil?
%td= order.closed? ? t('.cleared', amount: number_to_currency(order.foodcoop_result)) : t('.ended')
%td= show_user(order.updated_by)
%td
- unless order.closed?
- if current_user.role_orders?
- unless order.stockit?
= link_to t('orders.index.action_receive'), receive_order_path(order), class: 'btn btn-small'
- else
= link_to t('orders.index.action_receive'), '#', class: 'btn btn-small disabled'
= link_to t('.clear'), new_finance_order_path(order_id: order.id), class: 'btn btn-small btn-primary'
- else
%i= t('.no_closed_orders')
1 change: 1 addition & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,7 @@ de:
name: Lieferantin
no_closed_orders: Derzeit gibt es keine beendeten Bestellungen.
state: Status
show_all: (alle anzeigen)
summary:
changed: Daten wurden verändert!
duration: von %{starts} bis %{ends}
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ en:
name: Supplier
no_closed_orders: At the moment there are no closed orders.
state: State
show_all: (show all)
summary:
changed: Data was changed!
duration: From %{starts} till %{ends}
Expand Down

0 comments on commit fd674e9

Please sign in to comment.