Refactored stockit, delivery an stock_takings.
This commit is contained in:
parent
d4715fef4b
commit
fc1d130113
20 changed files with 145 additions and 296 deletions
|
@ -92,11 +92,7 @@ class DeliveriesController < ApplicationController
|
|||
end
|
||||
|
||||
def add_stock_change
|
||||
|
||||
render :update do |page|
|
||||
page.insert_html :bottom, 'stock_changes', :partial => 'stock_change',
|
||||
:locals => {:stock_change => StockChange.new, :supplier => @supplier}
|
||||
end
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
def fill_new_stock_article_form
|
||||
|
|
|
@ -1,76 +1,17 @@
|
|||
class StockTakingsController < ApplicationController
|
||||
|
||||
def index
|
||||
@stock_takings = StockTaking.find(:all)
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @stock_takings }
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@stock_taking = StockTaking.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @stock_taking }
|
||||
end
|
||||
end
|
||||
inherit_resources
|
||||
|
||||
def new
|
||||
@stock_taking = StockTaking.new
|
||||
StockArticle.without_deleted.each { |a| @stock_taking.stock_changes.build(:stock_article => a) }
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @stock_taking }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
@stock_taking = StockTaking.find(params[:id])
|
||||
StockArticle.all.each { |a| @stock_taking.stock_changes.build(:stock_article => a) }
|
||||
end
|
||||
|
||||
def create
|
||||
@stock_taking = StockTaking.new(params[:stock_taking])
|
||||
|
||||
respond_to do |format|
|
||||
if @stock_taking.save
|
||||
flash[:notice] = 'StockTaking was successfully created.'
|
||||
format.html { redirect_to(@stock_taking) }
|
||||
format.xml { render :xml => @stock_taking, :status => :created, :location => @stock_taking }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @stock_taking.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
create!(:notice => "Inventur wurde erfolgreich angelegt.")
|
||||
end
|
||||
|
||||
def update
|
||||
@stock_taking = StockTaking.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @stock_taking.update_attributes(params[:stock_taking])
|
||||
flash[:notice] = 'StockTaking was successfully updated.'
|
||||
format.html { redirect_to(@stock_taking) }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @stock_taking.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@stock_taking = StockTaking.find(params[:id])
|
||||
@stock_taking.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(stock_takings_url) }
|
||||
format.xml { head :ok }
|
||||
end
|
||||
update!(:notice => "Inventur wurde aktualisiert.")
|
||||
end
|
||||
|
||||
def fill_new_stock_article_form
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
class StockitController < ApplicationController
|
||||
|
||||
def index
|
||||
@stock_articles = StockArticle.without_deleted.all(
|
||||
:include => [:supplier, :article_category],
|
||||
:order => 'suppliers.name, article_categories.name, articles.name'
|
||||
)
|
||||
@stock_articles = StockArticle.joins(:supplier, :article_category).
|
||||
order('suppliers.name, article_categories.name, articles.name')
|
||||
end
|
||||
|
||||
def new
|
||||
|
@ -14,8 +12,7 @@ class StockitController < ApplicationController
|
|||
def create
|
||||
@stock_article = StockArticle.new(params[:stock_article])
|
||||
if @stock_article.save
|
||||
flash[:notice] = "Lagerartikel wurde gespeichert."
|
||||
redirect_to stock_articles_path
|
||||
redirect_to stock_articles_path, :notice => "Lagerartikel wurde gespeichert."
|
||||
else
|
||||
render :action => 'new'
|
||||
end
|
||||
|
@ -28,8 +25,7 @@ class StockitController < ApplicationController
|
|||
def update
|
||||
@stock_article = StockArticle.find(params[:id])
|
||||
if @stock_article.update_attributes(params[:stock_article])
|
||||
flash[:notice] = "Lagerartikel wurde gespeichert."
|
||||
redirect_to stock_articles_path
|
||||
redirect_to stock_articles_path, :notice => "Lagerartikel wurde gespeichert."
|
||||
else
|
||||
render :action => 'edit'
|
||||
end
|
||||
|
@ -43,16 +39,10 @@ class StockitController < ApplicationController
|
|||
redirect_to stock_articles_path
|
||||
end
|
||||
|
||||
def auto_complete_for_article_name
|
||||
conditions = [ "LOWER(articles.name) LIKE ?", '%' + params[:article][:name].downcase + '%' ]
|
||||
|
||||
if params[:supplier_id]
|
||||
@supplier = Supplier.find(params[:supplier_id])
|
||||
@articles = @supplier.articles.without_deleted.all(:conditions => conditions, :limit => 8)
|
||||
else
|
||||
@articles = Article.without_deleted.not_in_stock.all(:conditions => conditions, :limit => 8)
|
||||
end
|
||||
render :partial => 'shared/auto_complete_articles'
|
||||
#TODO: Fix this!!
|
||||
def articles_search
|
||||
@articles = Article.not_in_stock.limit(8).where(:name.matches => params[:term])
|
||||
render :json => @articles.map(&:name)
|
||||
end
|
||||
|
||||
def fill_new_stock_article_form
|
||||
|
|
|
@ -10,7 +10,7 @@ module DeliveriesHelper
|
|||
end
|
||||
|
||||
def stock_articles_for_select(supplier)
|
||||
supplier.stock_articles.without_deleted.collect {|a| ["#{a.name} (#{number_to_currency a.price}/#{a.unit})", a.id] }
|
||||
supplier.stock_articles.map {|a| ["#{a.name} (#{number_to_currency a.price}/#{a.unit})", a.id] }
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
class StockArticle < Article
|
||||
acts_as_paranoid
|
||||
|
||||
has_many :stock_changes
|
||||
|
||||
scope :available, :conditions => "quantity > 0"
|
||||
|
|
|
@ -1,52 +1,49 @@
|
|||
.left_column(style="width:55%")
|
||||
- form_for([@supplier,@delivery]) do |f|
|
||||
- content_for :head do
|
||||
:javascript
|
||||
$(function() {
|
||||
$('.destroy_stock_change').live('click', function() {
|
||||
$(this).prev('input').val('1').parent().hide();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.remove_new_stock_change').live('click', function() {
|
||||
$(this).parent().remove();
|
||||
return false;
|
||||
})
|
||||
});
|
||||
|
||||
.left_column(style="width:50%")
|
||||
= simple_form_for [@supplier,@delivery], :validate => true do |f|
|
||||
.box_title
|
||||
%h2 Lieferung anlegen
|
||||
.column_content
|
||||
= f.error_messages
|
||||
= f.hidden_field :supplier_id
|
||||
%b Lagerartikel des Lieferanten
|
||||
#stock_changes
|
||||
- f.fields_for :stock_changes do |stock_change_form|
|
||||
= f.fields_for :stock_changes do |stock_change_form|
|
||||
%p
|
||||
= stock_change_form.select :stock_article_id, stock_articles_for_select(@supplier)
|
||||
Menge
|
||||
= stock_change_form.text_field :quantity, :size => 5, :autocomplete => 'off'
|
||||
= stock_change_form.hidden_field :_delete
|
||||
= link_to_function "Artikel aus Lieferung entfernen", "$(this).previous('input').value = 1; $(this).up('p').hide();"
|
||||
= stock_change_form.hidden_field :_destroy
|
||||
= link_to "Artikel aus Lieferung entfernen", "#", :class => 'destroy_stock_change'
|
||||
%p
|
||||
= remote_link_to "Lagerartikel der Lieferung hinzufügen", :url => {:action => 'add_stock_change', :supplier_id => @supplier.id}
|
||||
= link_to "Lagerartikel der Lieferung hinzufügen", {:action => 'add_stock_change', :supplier_id => @supplier.id}, :remote => true
|
||||
%hr/
|
||||
%p
|
||||
%b= f.label :delivered_on, "Lieferdatum"
|
||||
= f.date_select :delivered_on
|
||||
%p
|
||||
%b= f.label :note, "Notiz"
|
||||
%br/
|
||||
= f.text_area :note, :size => "35x4"
|
||||
%p
|
||||
= f.submit "Lieferung speichern"
|
||||
oder
|
||||
= link_to "Abbrechen", supplier_deliveries_path(@supplier)
|
||||
= f.input :delivered_on
|
||||
= f.input :note, :input_html => {:size => '35x4'}
|
||||
= f.submit
|
||||
|
||||
.right_column{:style => "width:35%;"}
|
||||
.right_column{:style => "width:45%;"}
|
||||
.box_title
|
||||
%h2 Neuen Lagerartikel anlegen
|
||||
.column_content
|
||||
%p
|
||||
:javascript
|
||||
function fillNewStockArticle(text, li) {
|
||||
new Ajax.Updater('stock_article_form', '#{url_for(:controller => "deliveries", :action => "fill_new_stock_article_form")}', {
|
||||
method: 'get',
|
||||
parameters: {article_id: li.id}
|
||||
});
|
||||
}
|
||||
//TODO: Fix this!!
|
||||
Suche nach Artikeln aus dem
|
||||
%i= @supplier.name
|
||||
Katalog:
|
||||
= text_field_with_auto_complete :article, :name, {}, |
|
||||
{:url => {:controller => 'stockit', :action => 'auto_complete_for_article_name', :supplier_id => @supplier.id}, |
|
||||
:after_update_element => 'fillNewStockArticle', :method => :get} |
|
||||
= text_field_tag 'article_name'
|
||||
%hr/
|
||||
#stock_article_form
|
||||
= render :partial => 'stock_article_form', :locals => {:stock_article => @supplier.stock_articles.build}
|
||||
|
|
|
@ -1,33 +1,11 @@
|
|||
- remote_form_for stock_article, :url => add_stock_article_supplier_deliveries_path(@supplier) do |form|
|
||||
= form.error_messages
|
||||
= form.hidden_field :supplier_id
|
||||
|
||||
%p
|
||||
Name
|
||||
%br/
|
||||
= form.text_field :name
|
||||
%p
|
||||
Einheit
|
||||
%br/
|
||||
= form.text_field :unit
|
||||
%p
|
||||
Notiz
|
||||
%br/
|
||||
= form.text_field :note
|
||||
%p
|
||||
Preis
|
||||
%br/
|
||||
= form.text_field :price
|
||||
%p
|
||||
MwSt
|
||||
%br/
|
||||
= form.text_field :tax, :value => (stock_article.tax || 7.0)
|
||||
%p
|
||||
Pfand
|
||||
%br/
|
||||
= form.text_field :deposit
|
||||
%p
|
||||
Kategorie:
|
||||
= form.select :article_category_id, ArticleCategory.all(:order => 'name').collect { |c| [c.name, c.id] }
|
||||
%p
|
||||
= submit_tag "Lagerartikel speichern"
|
||||
= simple_form_for stock_article, add_stock_article_supplier_deliveries_path(@supplier), :remote => true,
|
||||
:validate => true do |f|
|
||||
= f.hidden_field :supplier_id
|
||||
= f.input :name
|
||||
= f.input :unit
|
||||
= f.input :note
|
||||
= f.input :price
|
||||
= f.input :tax
|
||||
= f.input :deposit
|
||||
= f.association :article_category
|
||||
= f.submit
|
|
@ -1,6 +1,6 @@
|
|||
%p
|
||||
- fields_for "delivery[new_stock_changes][]", stock_change do |form|
|
||||
= fields_for "delivery[new_stock_changes][]", stock_change do |form|
|
||||
= form.select :stock_article_id, stock_articles_for_select(supplier)
|
||||
Menge
|
||||
= form.text_field :quantity, :size => 5, :autocomplete => 'off'
|
||||
= link_to_function "Artikel aus Lieferung entfernen", "$(this).up('p').remove()"
|
||||
= link_to "Artikel aus Lieferung entfernen", "#", :class => 'remove_new_stock_change'
|
||||
|
|
1
app/views/deliveries/add_stock_change.js.erb
Normal file
1
app/views/deliveries/add_stock_change.js.erb
Normal file
|
@ -0,0 +1 @@
|
|||
$('#stock_changes').append('<%= escape_javascript(render(:partial => 'stock_change', :locals => {:stock_change => StockChange.new, :supplier => @supplier})) %>');
|
|
@ -1,35 +1,10 @@
|
|||
- remote_form_for stock_article, :url => add_stock_article_stock_takings_path do |form|
|
||||
= form.error_messages
|
||||
%p
|
||||
Lieferantin
|
||||
%br/
|
||||
= form.select :supplier_id, Supplier.without_deleted(:order => 'name').collect{ |s| [s.name, s.id] }
|
||||
%p
|
||||
Name
|
||||
%br/
|
||||
= form.text_field :name
|
||||
%p
|
||||
Einheit
|
||||
%br/
|
||||
= form.text_field :unit
|
||||
%p
|
||||
Notiz
|
||||
%br/
|
||||
= form.text_field :note
|
||||
%p
|
||||
Nettopreis
|
||||
%br/
|
||||
= form.text_field :price
|
||||
%p
|
||||
MwSt
|
||||
%br/
|
||||
= form.text_field :tax, :value => (stock_article.tax || 7.0)
|
||||
%p
|
||||
Pfand
|
||||
%br/
|
||||
= form.text_field :deposit
|
||||
%p
|
||||
Kategorie:
|
||||
= form.select :article_category_id, ArticleCategory.all(:order => 'name').collect { |c| [c.name, c.id] }
|
||||
%p
|
||||
= submit_tag "Lagerartikel hinzufügen"
|
||||
- simple_form_for stock_article, add_stock_article_stock_takings_path, :remote => true do |f|
|
||||
= f.association :supplier
|
||||
= f.input :name
|
||||
= f.input :unit
|
||||
= f.input :note
|
||||
= f.input :price
|
||||
= f.input :tax
|
||||
= f.input :deposit
|
||||
= f.association :article_category
|
||||
= f.submit
|
|
@ -1,9 +1,7 @@
|
|||
%p
|
||||
- fields_for "stock_taking[stock_change_attributes][]", stock_change do |form|
|
||||
- article = stock_change.stock_article
|
||||
|
||||
= simple_fields_for "stock_taking[stock_change_attributes][]", stock_change do |form|
|
||||
= form.hidden_field :stock_article_id
|
||||
= "Menge (#{article.quantity_available})"
|
||||
= "Menge (#{stock_change.stock_article.quantity_available})"
|
||||
= form.text_field :quantity, :size => 5, :autocomplete => 'off'
|
||||
%b=h truncate(article.name)
|
||||
= "(#{number_to_currency(article.price)} / #{article.unit})"
|
||||
%b=h truncate(stock_change.stock_article.name)
|
||||
= "(#{number_to_currency(stock_change.stock_article.price)} / #{stock_change.stock_article.unit})"
|
||||
|
|
|
@ -1,16 +1,7 @@
|
|||
- title "Inventur bearbeiten"
|
||||
|
||||
- form_for(@stock_taking) do |f|
|
||||
= f.error_messages
|
||||
%p
|
||||
%b Datum
|
||||
%br/
|
||||
= f.date_select :date
|
||||
%p
|
||||
%b Notiz
|
||||
%br/
|
||||
= f.text_area :note, :size => "28x7"
|
||||
%p
|
||||
= f.submit "Invenur speichern"
|
||||
|
|
||||
= link_to "Abbrechen", stock_takings_path
|
||||
- simple_form_for(@stock_taking) do |f|
|
||||
= f.input :date
|
||||
= f.input :note
|
||||
= f.submit
|
||||
= link_to "oder abbrechen", stock_takings_path
|
|
@ -1,7 +1,7 @@
|
|||
- title "Inventurübersicht"
|
||||
|
||||
%p
|
||||
= link_to "Neue Iniventur anlegen", new_stock_taking_path
|
||||
= link_to "Neue Inventur anlegen", new_stock_taking_path
|
||||
|
|
||||
= link_to "Lager", stock_articles_path
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
|||
- for stock_taking in @stock_takings
|
||||
%tr
|
||||
%td= link_to format_date(stock_taking.date), stock_taking
|
||||
%td=h truncate stock_taking.note
|
||||
%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,19 +1,12 @@
|
|||
- title "Neue Inventur anlegen"
|
||||
|
||||
.left_column{:style => "width:40em;"}
|
||||
- form_for(@stock_taking) do |f|
|
||||
.left_column{:style => "width:50%;"}
|
||||
= simple_form_for(@stock_taking) do |f|
|
||||
.box_title
|
||||
%h2 Inventur anlegen
|
||||
.column_content
|
||||
= f.error_messages
|
||||
%p
|
||||
%b Datum
|
||||
%br/
|
||||
= f.date_select :date
|
||||
%p
|
||||
%b Notiz
|
||||
%br/
|
||||
= f.text_area :note, :size => "28x7", :value => "#{@current_user.nick}: ..."
|
||||
= f.input :date
|
||||
= f.input :note, :input_html => {:size => "28x7", :value => "#{@current_user.nick}: ..."}
|
||||
%h2 Lagerartikel
|
||||
%p
|
||||
%i
|
||||
|
@ -21,28 +14,18 @@
|
|||
= link_to "vorläufigen Lagerbestand", stock_articles_path
|
||||
ein. Bei Schwund benutze einfach ein Minus vor der Zahl.
|
||||
#stock_changes
|
||||
= render :partial => 'stock_change', :collection => @stock_taking.stock_changes
|
||||
%p
|
||||
= f.submit "Inventur anlegen"
|
||||
|
|
||||
= link_to "Abbrechen", stock_takings_path
|
||||
= render :partial => 'stock_change', :collection => @stock_taking.stock_changes
|
||||
= f.submit
|
||||
= link_to "oder abbrechen", stock_takings_path
|
||||
|
||||
.right_column{:style => "width:30em;"}
|
||||
.right_column{:style => "width:45%;"}
|
||||
.box_title
|
||||
%h2 Neuen Lagerartikel anlegen
|
||||
.column_content
|
||||
%p
|
||||
:javascript
|
||||
function fillNewStockArticle(text, li) {
|
||||
new Ajax.Updater('stock_article_form', '/stock_takings/fill_new_stock_article_form', {
|
||||
method: 'get',
|
||||
parameters: {article_id: li.id}
|
||||
});
|
||||
}
|
||||
// FIx this!
|
||||
Suche nach Artikeln aus dem allen Katalogen:
|
||||
= text_field_with_auto_complete :article, :name, {}, |
|
||||
{:url => {:controller => 'stockit', :action => 'auto_complete_for_article_name' }, |
|
||||
:after_update_element => 'fillNewStockArticle', :method => :get} |
|
||||
= text_field_tag :article_name
|
||||
%hr/
|
||||
#stock_article_form
|
||||
= render :partial => 'stock_article_form', :locals => {:stock_article => StockArticle.new}
|
|
@ -1,44 +1,16 @@
|
|||
- form_for stock_article do |form|
|
||||
= form.error_messages
|
||||
%p
|
||||
Lieferantin
|
||||
%br/
|
||||
= form.select :supplier_id, Supplier.without_deleted(:order => 'name').collect{ |s| [s.name, s.id] }
|
||||
%p
|
||||
Name
|
||||
%br/
|
||||
= form.text_field :name
|
||||
%p
|
||||
Einheit
|
||||
%br/
|
||||
= form.text_field :unit
|
||||
%p
|
||||
Notiz
|
||||
%br/
|
||||
= form.text_field :note
|
||||
- simple_form_for stock_article, :validate => true do |f|
|
||||
= f.association :supplier
|
||||
= f.input :name
|
||||
= f.input :unit
|
||||
= f.input :note
|
||||
|
||||
- if stock_article.new_record?
|
||||
%p
|
||||
Nettopreis
|
||||
%br/
|
||||
= form.text_field :price
|
||||
%p
|
||||
MwSt
|
||||
%br/
|
||||
= form.text_field :tax, :value => (stock_article.tax || 7.0)
|
||||
%p
|
||||
Pfand
|
||||
%br/
|
||||
= form.text_field :deposit
|
||||
= f.input :price
|
||||
= f.input :tax
|
||||
= f.input :deposit
|
||||
- else
|
||||
%p
|
||||
Preis:
|
||||
%br/
|
||||
Um Chaos zu vermeiden können bis auf weiteres die Preise von angelegten
|
||||
Lagerartikeln nicht mehr verändert werden.
|
||||
%p
|
||||
Kategorie:
|
||||
= form.select :article_category_id, ArticleCategory.all(:order => 'name').collect { |c| [c.name, c.id] }
|
||||
%p
|
||||
= submit_tag "Lagerartikel speichern"
|
||||
|
|
||||
= link_to "Abbrechen", stock_articles_path
|
||||
= 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."
|
||||
= f.association :article_category
|
||||
= f.submit
|
||||
= link_to "oder abbrechen", stock_articles_path
|
|
@ -1,23 +1,26 @@
|
|||
- title "Lagerübersicht: #{StockArticle.available.count} Artikel im Lager"
|
||||
|
||||
- content_for :head do
|
||||
:javascript
|
||||
$(function() {
|
||||
$('tr.unavailable').hide();
|
||||
})
|
||||
.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" |
|
||||
%li= link_to "Nicht verfügbare Artikel zeigen/verstecken", "#", 'data-toggle-this' => 'tr.unavailable',
|
||||
:style => "width:15em"
|
||||
|
||||
|
||||
%div{:style => "padding:0 0 0.5em 0.7em;margin-bottom:2em"}
|
||||
%span{:style => "float:left"}
|
||||
- form_tag do
|
||||
Neue Lieferung anlegen für:
|
||||
= select_tag :new_delivery, |
|
||||
options_for_select([[" -- Lieferantin wählen --", ""]] + |
|
||||
Supplier.without_deleted.collect {|s| [ s.name, url_for(new_supplier_delivery_path(s))] }), |
|
||||
:onchange => "redirectTo(this)", :style => "font-size: 0.9em;margin-left:1em;" |
|
||||
= 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
|
||||
|
@ -48,7 +51,7 @@
|
|||
%tbody
|
||||
- for article in @stock_articles
|
||||
- class_name = cycle :even, :odd
|
||||
- class_name += " unavailable hidden" if article.quantity_available <= 0
|
||||
- class_name += " unavailable" if article.quantity_available <= 0
|
||||
- class_name += " supplier_#{article.supplier.id}"
|
||||
%tr{:class => class_name}
|
||||
%td=h article.name
|
||||
|
|
|
@ -1,16 +1,20 @@
|
|||
- title "Neuen Lagerartikel anlegen"
|
||||
|
||||
:javascript
|
||||
function fillNewStockArticle(text, li) {
|
||||
new Ajax.Updater('stock_article_form', '/stockit/fill_new_stock_article_form', {
|
||||
parameters: {article_id: li.id}
|
||||
});
|
||||
}
|
||||
- content_for :head do
|
||||
:javascript
|
||||
$(function() {
|
||||
$('#article_search').autocomplete({
|
||||
source: '#{articles_search_stock_articles_path}',
|
||||
select: function(e, ui) {
|
||||
alert(ui.item.value);
|
||||
//location.href = '#{nil}' + ui.item.value;
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
%p
|
||||
Suche nach Artikeln aus allen Katalogen:
|
||||
= text_field_with_auto_complete :article, :name, {}, |
|
||||
{:url => {:action => 'auto_complete_for_article_name'}, |
|
||||
:after_update_element => 'fillNewStockArticle'} |
|
||||
= text_field_tag 'article_search'
|
||||
#stock_article_form
|
||||
= render :partial => 'form', :locals => {:stock_article => @stock_article}
|
|
@ -160,6 +160,9 @@ de:
|
|||
task: Aufgabe
|
||||
message: Nachricht
|
||||
article_category: Artikelkategorie
|
||||
stock_article: Lagerartikel
|
||||
delivery: Lieferung
|
||||
stock_taking: Inventur
|
||||
attributes:
|
||||
article:
|
||||
price: Nettopreis
|
||||
|
@ -210,6 +213,8 @@ de:
|
|||
description: 'Beschreibung'
|
||||
title: 'Titel'
|
||||
email: 'E-Mail'
|
||||
note: 'Notiz'
|
||||
date: 'Datum'
|
||||
workgroup:
|
||||
weekly_task: 'Monatlichen Job definieren?'
|
||||
weekday: 'Wochentag'
|
||||
|
@ -257,7 +262,12 @@ de:
|
|||
order_number: 'Bestellnummer'
|
||||
tax: 'MwSt'
|
||||
deposit: 'Pfand'
|
||||
stock_article:
|
||||
supplier: 'Lieferant'
|
||||
delivery:
|
||||
delivered_on: 'Lieferdatum'
|
||||
hints:
|
||||
tax: 'In Prozent, Standard sind 7,0'
|
||||
task:
|
||||
duration: 'Wie lange dauert die Aufgabe, 1-3 Stunden'
|
||||
required_users: 'Wieviel Benutzerinnen werden insgesamt benötigt?'
|
||||
|
@ -265,3 +275,5 @@ de:
|
|||
min_order_quantity: 'Die Mindestbestellmenge wird während der Bestellung angezeigt und soll motivieren'
|
||||
article:
|
||||
unit: 'z.B. KG oder 1L oder 500g'
|
||||
stock_article:
|
||||
supplier: ''
|
||||
|
|
|
@ -77,7 +77,7 @@ Foodsoft::Application.routes.draw do
|
|||
|
||||
resources :stock_articles, :to => 'stockit' do
|
||||
collection do
|
||||
get :auto_complete_for_article_name
|
||||
get :articles_search
|
||||
get :fill_new_stock_article_form
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,6 +7,12 @@ $(function() {
|
|||
return false;
|
||||
});
|
||||
|
||||
// Remove this item from DOM
|
||||
$('a[data-remove-this').click(function() {
|
||||
$($(this).data('remove-this')).remove();
|
||||
return false;
|
||||
});
|
||||
|
||||
// Check/Uncheck a single checkbox
|
||||
$('[data-check-this]').live('click', function() {
|
||||
var checkbox = $($(this).data('check-this'));
|
||||
|
|
Loading…
Reference in a new issue