From 089f48e85143c13647870701b8de37a4067a54de Mon Sep 17 00:00:00 2001 From: Mirko Javurek Date: Tue, 23 Mar 2021 09:26:12 +0100 Subject: [PATCH] filter supplier for closed orders --- app/views/finance/balancing/_orders.html.haml | 36 ++++++++++++------- config/locales/de.yml | 1 + config/locales/en.yml | 1 + 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/app/views/finance/balancing/_orders.html.haml b/app/views/finance/balancing/_orders.html.haml index 3f20d850e..ed7afcc50 100644 --- a/app/views/finance/balancing/_orders.html.haml +++ b/app/views/finance/balancing/_orders.html.haml @@ -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 @@ -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') diff --git a/config/locales/de.yml b/config/locales/de.yml index 8ba97ac79..dd1da43ae 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -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} diff --git a/config/locales/en.yml b/config/locales/en.yml index 334b1e58a..b6fe84698 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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}