Hide/show unavailable articles via js.
This commit is contained in:
parent
84610cc9a5
commit
036bc10282
5 changed files with 25 additions and 15 deletions
|
@ -1,18 +1,11 @@
|
||||||
class StockitController < ApplicationController
|
class StockitController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
unless params[:show_not_available] == "1"
|
|
||||||
@stock_articles = StockArticle.without_deleted.available.all(
|
|
||||||
:include => [:supplier, :article_category],
|
|
||||||
:order => 'suppliers.name, article_categories.name, articles.name'
|
|
||||||
)
|
|
||||||
else
|
|
||||||
@stock_articles = StockArticle.without_deleted.all(
|
@stock_articles = StockArticle.without_deleted.all(
|
||||||
:include => [:supplier, :article_category],
|
:include => [:supplier, :article_category],
|
||||||
:order => 'suppliers.name, article_categories.name, articles.name'
|
:order => 'suppliers.name, article_categories.name, articles.name'
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@stock_article = StockArticle.new
|
@stock_article = StockArticle.new
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
- title "Lagerübersicht: #{StockArticle.available.count} Artikel im Lager"
|
- title "Lagerübersicht: #{StockArticle.available.count} Artikel im Lager"
|
||||||
|
|
||||||
|
.menu
|
||||||
|
- form_tag do
|
||||||
|
%ul
|
||||||
|
%li
|
||||||
|
Ansichtsoptionen
|
||||||
|
%ul
|
||||||
|
%li= link_to_function "Nicht verfügbare Artikel zeigen/verstecken", |
|
||||||
|
"$$('tr.unavailable').invoke('toggleClassName', 'hidden');", :style => "width:15em" |
|
||||||
|
|
||||||
|
|
||||||
%div{:style => "padding:0 0 0.5em 0.7em;margin-bottom:2em"}
|
%div{:style => "padding:0 0 0.5em 0.7em;margin-bottom:2em"}
|
||||||
%span{:style => "float:left"}
|
%span{:style => "float:left"}
|
||||||
- form_tag do
|
- form_tag do
|
||||||
|
@ -20,11 +30,6 @@
|
||||||
%b= link_to "Inventur anlegen", new_stock_taking_path
|
%b= link_to "Inventur anlegen", new_stock_taking_path
|
||||||
|
|
|
|
||||||
= link_to "Inventurübersicht", stock_takings_path
|
= link_to "Inventurübersicht", stock_takings_path
|
||||||
|
|
|
||||||
- unless params[:show_not_available] == "1"
|
|
||||||
= link_to "Zeige auch nicht verfügbare Lagerartikel", stock_articles_path(:show_not_available => 1)
|
|
||||||
- else
|
|
||||||
= link_to "Verstecke nicht verfügbare Artikel", stock_articles_path
|
|
||||||
|
|
||||||
#articles{:style => "clear:both;margin-top:1em"}
|
#articles{:style => "clear:both;margin-top:1em"}
|
||||||
%table.list
|
%table.list
|
||||||
|
@ -42,7 +47,10 @@
|
||||||
%th
|
%th
|
||||||
%tbody
|
%tbody
|
||||||
- for article in @stock_articles
|
- for article in @stock_articles
|
||||||
%tr{:class => cycle("even", "odd")}
|
- class_name = cycle :even, :odd
|
||||||
|
- class_name += " unavailable hidden" if article.quantity_available <= 0
|
||||||
|
- class_name += " supplier_#{article.supplier.id}"
|
||||||
|
%tr{:class => class_name}
|
||||||
%td=h article.name
|
%td=h article.name
|
||||||
%td= article.quantity
|
%td= article.quantity
|
||||||
%td= article.quantity - article.quantity_available
|
%td= article.quantity - article.quantity_available
|
||||||
|
|
|
@ -88,6 +88,9 @@ span.click-me {
|
||||||
color: grey;
|
color: grey;
|
||||||
font-size: 0.9em; }
|
font-size: 0.9em; }
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none; }
|
||||||
|
|
||||||
#login {
|
#login {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
width: 27em;
|
width: 27em;
|
||||||
|
|
|
@ -88,6 +88,9 @@ span.click-me {
|
||||||
color: grey;
|
color: grey;
|
||||||
font-size: 0.9em; }
|
font-size: 0.9em; }
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none; }
|
||||||
|
|
||||||
#login {
|
#login {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
width: 27em;
|
width: 27em;
|
||||||
|
|
|
@ -98,6 +98,9 @@ span.click-me
|
||||||
color: grey
|
color: grey
|
||||||
font-size: 0.9em
|
font-size: 0.9em
|
||||||
|
|
||||||
|
.hidden
|
||||||
|
display: none
|
||||||
|
|
||||||
// ********************************* loginpage
|
// ********************************* loginpage
|
||||||
#login
|
#login
|
||||||
:margin auto
|
:margin auto
|
||||||
|
|
Loading…
Reference in a new issue