Fixed stockit.
This commit is contained in:
parent
27c719d8da
commit
8f7e21b918
10 changed files with 132 additions and 136 deletions
|
@ -1,6 +1,10 @@
|
||||||
class StockTakingsController < ApplicationController
|
class StockTakingsController < ApplicationController
|
||||||
inherit_resources
|
inherit_resources
|
||||||
|
|
||||||
|
def index
|
||||||
|
@stock_takings = StockTaking.order('date DESC').page(params[:page]).per(@per_page)
|
||||||
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@stock_taking = StockTaking.new
|
@stock_taking = StockTaking.new
|
||||||
StockArticle.all.each { |a| @stock_taking.stock_changes.build(:stock_article => a) }
|
StockArticle.all.each { |a| @stock_taking.stock_changes.build(:stock_article => a) }
|
||||||
|
@ -48,6 +52,4 @@ class StockTakingsController < ApplicationController
|
||||||
page.visual_effect :DropOut, "stock_change_#{stock_change.id}"
|
page.visual_effect :DropOut, "stock_change_#{stock_change.id}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,2 +1,7 @@
|
||||||
module StockitHelper
|
module StockitHelper
|
||||||
|
def stock_article_classes(article)
|
||||||
|
class_names = []
|
||||||
|
class_names << "unavailable" if article.quantity_available <= 0
|
||||||
|
class_names.join(" ")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- simple_form_for stock_article, add_stock_article_stock_takings_path, :remote => true do |f|
|
- simple_form_for stock_article, url: add_stock_article_stock_takings_path, remote: true do |f|
|
||||||
= f.association :supplier
|
= f.association :supplier
|
||||||
= f.input :name
|
= f.input :name
|
||||||
= f.input :unit
|
= f.input :unit
|
||||||
|
|
19
app/views/stock_takings/_stock_takings.html.haml
Normal file
19
app/views/stock_takings/_stock_takings.html.haml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
- if StockTaking.count > 20
|
||||||
|
= items_per_page
|
||||||
|
= pagination_links_remote @stock_takings
|
||||||
|
|
||||||
|
%table.table.table-striped
|
||||||
|
%thead
|
||||||
|
%tr
|
||||||
|
%th Datum
|
||||||
|
%th Notiz
|
||||||
|
%th
|
||||||
|
%tbody
|
||||||
|
- for stock_taking in @stock_takings
|
||||||
|
%tr
|
||||||
|
%td= link_to format_date(stock_taking.date), stock_taking
|
||||||
|
%td= truncate stock_taking.note
|
||||||
|
%td
|
||||||
|
= link_to 'Bearbeiten', edit_stock_taking_path(stock_taking), class: 'btn btn-mini'
|
||||||
|
= link_to 'Löschen', stock_taking, :confirm => 'Are you sure?', :method => :delete,
|
||||||
|
class: 'btn btn-mini btn-danger'
|
|
@ -1,25 +1,9 @@
|
||||||
- title "Inventurübersicht"
|
- title "Inventurübersicht"
|
||||||
|
|
||||||
%p
|
.well.well-small
|
||||||
= link_to "Neue Inventur anlegen", new_stock_taking_path
|
.btn-group
|
||||||
|
|
= link_to "Neue Inventur anlegen", new_stock_taking_path, class: 'btn'
|
||||||
= link_to "Lager", stock_articles_path
|
|
||||||
|
|
||||||
%table.list{:style => "width:50em"}
|
#StockTakingsTable= render 'stock_takings'
|
||||||
%thead
|
|
||||||
%tr
|
|
||||||
%th Datum
|
|
||||||
%th Notiz
|
|
||||||
%th
|
|
||||||
%th
|
|
||||||
%th
|
|
||||||
%tbody
|
|
||||||
- for stock_taking in @stock_takings
|
|
||||||
%tr
|
|
||||||
%td= link_to format_date(stock_taking.date), stock_taking
|
|
||||||
%td= truncate stock_taking.note
|
|
||||||
%td= link_to 'Anzeigen', stock_taking
|
|
||||||
%td= link_to 'Bearbeiten', edit_stock_taking_path(stock_taking)
|
|
||||||
%td= link_to 'Löschen', stock_taking, :confirm => 'Are you sure?', :method => :delete
|
|
||||||
|
|
||||||
|
|
||||||
|
|
1
app/views/stock_takings/index.js.haml
Normal file
1
app/views/stock_takings/index.js.haml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
$('#StockTakingsTable').html('#{escape_javascript(render('stock_takings'))}');
|
|
@ -1,31 +1,24 @@
|
||||||
- title "Neue Inventur anlegen"
|
- title "Neue Inventur anlegen"
|
||||||
|
|
||||||
.left_column{:style => "width:50%;"}
|
- content_for :sidebar do
|
||||||
= simple_form_for(@stock_taking) do |f|
|
|
||||||
.box_title
|
|
||||||
%h2 Inventur anlegen
|
|
||||||
.column_content
|
|
||||||
= f.input :date
|
|
||||||
= f.input :note, :input_html => {:size => "28x7", :value => "#{@current_user.nick}: ..."}
|
|
||||||
%h2 Lagerartikel
|
|
||||||
%p
|
%p
|
||||||
%i
|
%i
|
||||||
Bitte trage hier alle gezählten Abweichungen vom
|
Bitte trage hier alle gezählten Abweichungen vom
|
||||||
= link_to "vorläufigen Lagerbestand", stock_articles_path
|
= link_to "vorläufigen Lagerbestand", stock_articles_path
|
||||||
ein. Bei Schwund benutze einfach ein Minus vor der Zahl.
|
ein. Bei Schwund benutze einfach ein Minus vor der Zahl.
|
||||||
|
%p
|
||||||
|
Einen neuen Lagerartikel musst Du vorher
|
||||||
|
= link_to "anlegen", new_stock_article_path
|
||||||
|
bevor Du Ihn hier verwenden kannst.
|
||||||
|
|
||||||
|
|
||||||
|
= simple_form_for(@stock_taking) do |f|
|
||||||
|
= f.input :date, as: :date_picker
|
||||||
|
= f.input :note, :input_html => {:size => "28x7", :value => "#{@current_user.nick}: ..."}
|
||||||
|
%h2 Lagerartikel
|
||||||
|
|
||||||
#stock_changes
|
#stock_changes
|
||||||
= render :partial => 'stock_change', :collection => @stock_taking.stock_changes
|
= render :partial => 'stock_change', :collection => @stock_taking.stock_changes
|
||||||
= f.submit
|
.form-actions
|
||||||
|
= f.submit class: 'btn'
|
||||||
= link_to "oder abbrechen", stock_takings_path
|
= link_to "oder abbrechen", stock_takings_path
|
||||||
|
|
||||||
.right_column{:style => "width:45%;"}
|
|
||||||
.box_title
|
|
||||||
%h2 Neuen Lagerartikel anlegen
|
|
||||||
.column_content
|
|
||||||
%p
|
|
||||||
// FIx this!
|
|
||||||
Suche nach Artikeln aus dem allen Katalogen:
|
|
||||||
= text_field_tag :article_name
|
|
||||||
%hr/
|
|
||||||
#stock_article_form
|
|
||||||
= render :partial => 'stock_article_form', :locals => {:stock_article => StockArticle.new}
|
|
|
@ -1,29 +1,27 @@
|
||||||
- title "Inventur anzeigen"
|
- title "Inventur anzeigen"
|
||||||
|
|
||||||
%p
|
.well.well-small
|
||||||
Datum:
|
%dl.dl-horizontal
|
||||||
= format_date @stock_taking.date
|
%dt Datum
|
||||||
%p
|
%dd= format_date @stock_taking.date
|
||||||
Notiz:
|
%dt Notiz
|
||||||
= simple_format @stock_taking.note
|
%dd= simple_format @stock_taking.note
|
||||||
|
|
||||||
%h2 Artikel
|
%table.table.table-striped
|
||||||
%table.list{:style => "width:30em"}
|
|
||||||
%tr
|
%tr
|
||||||
%th Artikel
|
%th Artikel
|
||||||
%th Lieferantin
|
%th Lieferantin
|
||||||
%th Einheit
|
%th Einheit
|
||||||
%th Menge
|
%th Menge
|
||||||
- for stock_change in @stock_taking.stock_changes.all :include => :stock_article
|
- for stock_change in @stock_taking.stock_changes.all
|
||||||
%tr
|
%tr
|
||||||
%td= stock_change.stock_article.name
|
%td= stock_change.stock_article.name
|
||||||
%td= stock_change.stock_article.supplier.name
|
%td= stock_change.stock_article.supplier.name
|
||||||
%td= stock_change.stock_article.unit
|
%td= stock_change.stock_article.unit
|
||||||
%td= stock_change.quantity
|
%td= stock_change.quantity
|
||||||
|
|
||||||
%br/
|
.btn-group
|
||||||
= link_to "Bearbeiten", edit_stock_taking_path(@stock_taking)
|
= link_to "Bearbeiten", edit_stock_taking_path(@stock_taking), class: 'btn'
|
||||||
|
|
= link_to "Inventurübersicht", stock_takings_path, class: 'btn'
|
||||||
= link_to "Inventurübersicht", stock_takings_path
|
= link_to "Löschen", @stock_taking, :method => :delete, :confirm => "Willst Du wirklich die Inventur löschen?",
|
||||||
|
|
class: 'btn btn-danger'
|
||||||
= link_to "Löschen", @stock_taking, :method => :delete, :confirm => "Willst Du wirklich die Inventur löschen?"
|
|
|
@ -1,4 +1,4 @@
|
||||||
- simple_form_for stock_article, :validate => true do |f|
|
= simple_form_for stock_article, :validate => true do |f|
|
||||||
= f.association :supplier
|
= f.association :supplier
|
||||||
= f.input :name
|
= f.input :name
|
||||||
= f.input :unit
|
= f.input :unit
|
||||||
|
@ -12,5 +12,6 @@
|
||||||
= f.input :price, :input_html => {:disabled => 'disabled'},
|
= f.input :price, :input_html => {:disabled => 'disabled'},
|
||||||
:hint => "Um Chaos zu vermeiden können bis auf weiteres die Preise von angelegten Lagerartikeln nicht mehr verändert werden."
|
:hint => "Um Chaos zu vermeiden können bis auf weiteres die Preise von angelegten Lagerartikeln nicht mehr verändert werden."
|
||||||
= f.association :article_category
|
= f.association :article_category
|
||||||
= f.submit
|
.form-actions
|
||||||
|
= f.submit class: 'btn'
|
||||||
= link_to "oder abbrechen", stock_articles_path
|
= link_to "oder abbrechen", stock_articles_path
|
|
@ -1,41 +1,36 @@
|
||||||
- title "Lagerübersicht: #{StockArticle.available.count} Artikel im Lager"
|
- title "Lager (#{StockArticle.available.count})"
|
||||||
- content_for :head do
|
- content_for :javascript do
|
||||||
:javascript
|
:javascript
|
||||||
$(function() {
|
$(function() {
|
||||||
$('tr.unavailable').hide();
|
$('tr.unavailable').hide();
|
||||||
})
|
})
|
||||||
.menu
|
|
||||||
- form_tag do
|
.well.well-small
|
||||||
%ul
|
.btn-toolbar
|
||||||
%li
|
.btn-group.pull-right
|
||||||
|
= link_to '#', data: {toggle: 'dropdown'}, class: 'btn dropdown-toggle' do
|
||||||
Ansichtsoptionen
|
Ansichtsoptionen
|
||||||
%ul
|
%span.caret
|
||||||
%li= link_to "Nicht verfügbare Artikel zeigen/verstecken", "#", 'data-toggle-this' => 'tr.unavailable',
|
%ul.dropdown-menu
|
||||||
:style => "width:15em"
|
%li= link_to "Nicht verfügbare Artikel zeigen/verstecken", "#", 'data-toggle-this' => 'tr.unavailable', tabindex: -1
|
||||||
|
|
||||||
|
.btn-group
|
||||||
|
= link_to "Neuen Lagerartikel anlegen", new_stock_article_path, class: 'btn btn-primary'
|
||||||
|
= link_to_if @current_user.role_orders?, "Lagerbestellung online stellen", new_order_path(supplier_id: 0),
|
||||||
|
class: 'btn'
|
||||||
|
= link_to "Inventur anlegen", new_stock_taking_path, class: 'btn'
|
||||||
|
= link_to "Inventurübersicht", stock_takings_path, class: 'btn'
|
||||||
|
|
||||||
|
.btn-group
|
||||||
|
= link_to '#', data: {toggle: 'dropdown'}, class: 'btn dropdown-toggle' do
|
||||||
|
Neue Lieferung ..
|
||||||
|
%span.caret
|
||||||
|
%ul.dropdown-menu
|
||||||
|
- Supplier.all.each do |supplier|
|
||||||
|
%li= link_to supplier.name, new_supplier_delivery_path(supplier), tabindex: -1
|
||||||
|
|
||||||
|
|
||||||
%div{:style => "padding:0 0 0.5em 0.7em;margin-bottom:2em"}
|
%table.table.table-hover#articles
|
||||||
%span{:style => "float:left"}
|
|
||||||
- form_tag do
|
|
||||||
Neue Lieferung anlegen für:
|
|
||||||
= select_tag :new_delivery,
|
|
||||||
options_for_select([[" -- Lieferantin wählen --", ""]] + Supplier.all.map {|s| [ s.name, new_supplier_delivery_url(s)]}),
|
|
||||||
'data-redirect-to' => true, :style => "font-size: 0.9em;margin-left:1em;"
|
|
||||||
|
|
||||||
.single_column{:style => 'width:100%; clear:both'}
|
|
||||||
.box_title
|
|
||||||
.column_content
|
|
||||||
#actions
|
|
||||||
%b= link_to "Neuen Lagerartikel anlegen", new_stock_article_path
|
|
||||||
|
|
|
||||||
= link_to_if @current_user.role_orders?, "Lagerbestellung online stellen", {:controller => 'orders', :action => 'new', :supplier_id => 0}
|
|
||||||
|
|
|
||||||
%b= link_to "Inventur anlegen", new_stock_taking_path
|
|
||||||
|
|
|
||||||
= link_to "Inventurübersicht", stock_takings_path
|
|
||||||
|
|
||||||
#articles{:style => "clear:both;margin-top:1em"}
|
|
||||||
%table.list
|
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%th Artikel
|
%th Artikel
|
||||||
|
@ -50,10 +45,7 @@
|
||||||
%th
|
%th
|
||||||
%tbody
|
%tbody
|
||||||
- for article in @stock_articles
|
- for article in @stock_articles
|
||||||
- class_name = cycle :even, :odd
|
%tr{:class => stock_article_classes(article)}
|
||||||
- class_name += " unavailable" 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
|
||||||
|
@ -64,9 +56,10 @@
|
||||||
%td= link_to article.supplier.name, article.supplier
|
%td= link_to article.supplier.name, article.supplier
|
||||||
%td= article.article_category.name
|
%td= article.article_category.name
|
||||||
%td
|
%td
|
||||||
= link_to icon(:edit), edit_stock_article_path(article)
|
= link_to "Bearbeiten", edit_stock_article_path(article), class: 'btn btn-mini'
|
||||||
= link_to icon(:delete), article, :method => :delete, :confirm => "Bist Du sicher?"
|
= link_to "Löschen", article, :method => :delete, :confirm => "Bist Du sicher?",
|
||||||
%p
|
class: 'btn btn-mini btn-danger'
|
||||||
|
%p
|
||||||
Aktueller Lagerwert:
|
Aktueller Lagerwert:
|
||||||
= number_to_currency StockArticle.stock_value
|
= number_to_currency StockArticle.stock_value
|
||||||
|
|
|
|
||||||
|
|
Loading…
Reference in a new issue