add search to balancing page (PR #651)
(cherry picked from commit 2039da54b2077a6befccb409ef02a3172bcba237)
This commit is contained in:
parent
e9be38b3e9
commit
ef545e978e
2 changed files with 37 additions and 5 deletions
|
@ -1,8 +1,34 @@
|
||||||
|
- content_for :javascript do
|
||||||
|
:javascript
|
||||||
|
$(function() {
|
||||||
|
// create List for search-feature (using list.js, http://listjs.com)
|
||||||
|
var listjsResetPlugin = ['reset', {highlightClass: 'btn-primary'}];
|
||||||
|
var listjsDelayPlugin = ['delay', {delayedSearchTime: 500}];
|
||||||
|
new List(document.body, {
|
||||||
|
valueNames: ['name'],
|
||||||
|
engine: 'unlist',
|
||||||
|
plugins: [listjsResetPlugin, listjsDelayPlugin],
|
||||||
|
// make large pages work too (as we don't have paging - articles may disappear!)
|
||||||
|
page: 10000,
|
||||||
|
indexAsync: true
|
||||||
|
});
|
||||||
|
$('input').keydown(function(event){
|
||||||
|
if(event.keyCode == 13) {
|
||||||
|
event.preventDefault();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%table.ordered-articles.table.table-striped
|
%table.ordered-articles.table.table-striped
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%th= sort_link_helper Article.model_name.human, "name"
|
%th
|
||||||
%th= sort_link_helper Article.human_attribute_name(:order_number_short), "order_number"
|
.input-append
|
||||||
|
= text_field_tag :article, params[:article], placeholder: (heading_helper Article, :name), class: 'delayed-search resettable search-query'
|
||||||
|
%th= heading_helper Article, :order_number
|
||||||
%th= t('.amount')
|
%th= t('.amount')
|
||||||
%th= heading_helper Article, :unit
|
%th= heading_helper Article, :unit
|
||||||
%th= t('.net')
|
%th= t('.net')
|
||||||
|
@ -12,6 +38,12 @@
|
||||||
%th{:colspan => "2"}
|
%th{:colspan => "2"}
|
||||||
= link_to t('.add_article'), new_order_order_article_path(@order), remote: true,
|
= link_to t('.add_article'), new_order_order_article_path(@order), remote: true,
|
||||||
class: 'btn btn-small' unless @order.closed?
|
class: 'btn btn-small' unless @order.closed?
|
||||||
%tbody#result_table
|
%tbody.list#result_table
|
||||||
- for order_article in @articles
|
- for order_article in @articles.select { |oa| oa.units > 0 }
|
||||||
|
= render :partial => "order_article_result", :locals => {:order_article => order_article}
|
||||||
|
|
||||||
|
%tr
|
||||||
|
%td{ colspan: 10 } The following were not ordered
|
||||||
|
|
||||||
|
- for order_article in @articles.select { |oa| oa.units == 0 }
|
||||||
= render :partial => "order_article_result", :locals => {:order_article => order_article}
|
= render :partial => "order_article_result", :locals => {:order_article => order_article}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
%td.closed
|
%td.closed.name
|
||||||
= link_to order_article.article.name, '#', 'data-toggle-this' => "#group_order_articles_#{order_article.id}"
|
= link_to order_article.article.name, '#', 'data-toggle-this' => "#group_order_articles_#{order_article.id}"
|
||||||
%td= order_article.article.order_number
|
%td= order_article.article.order_number
|
||||||
%td{title: units_history_line(order_article, :plain => true)}
|
%td{title: units_history_line(order_article, :plain => true)}
|
||||||
|
|
Loading…
Reference in a new issue