Improved the creation/updating of deliveries.

This commit is contained in:
Benjamin Meichsner 2009-02-10 20:06:08 +01:00
parent 67743cd014
commit cd9636a650
7 changed files with 93 additions and 43 deletions

View file

@ -1,16 +0,0 @@
- form_for([@supplier,@delivery]) do |f|
= f.error_messages
= f.hidden_field :supplier_id
%p
%b= f.label :delivered_on
= f.date_select :delivered_on
%h2 Artikel
#stock_changes
= yield
%br/
= add_article_link
%p
= f.submit "Speichern"
= link_to 'Zurück', supplier_deliveries_path(@supplier)

View file

@ -1,8 +1,6 @@
- remote_form_for stock_article, :url => add_stock_article_supplier_deliveries_path(@supplier) do |form|
= form.error_messages
%p
remote_link_to "Artikel aus dem Katalog wählen"...
%p
= form.label :name
%br/

View file

@ -4,13 +4,34 @@
%b Lieferant:
= @supplier.name
- render :layout => 'form' do
%table{:style => "width:40em"}
- for stock_change in @delivery.stock_changes
%tr[stock_change]
%td= stock_change.article.name
%td= stock_change.quantity
%td
= link_to_remote "Artikel entfernen", |
:url => drop_stock_change_supplier_delivery_path(@supplier, @delivery, :stock_change_id => stock_change), |
:method => :post |
- form_for([@supplier,@delivery]) do |f|
= f.error_messages
= f.hidden_field :supplier_id
%p
%b= f.label :delivered_on
= f.date_select :delivered_on
%h2 Artikel
#stock_changes
%table.list{:style => "width:40em"}
%tr
%th Name
%th Menge
%th
- for stock_change in @delivery.stock_changes
%tr[stock_change]
%td= stock_change.stock_article.name
%td
%span{:id => stock_change.id, :style => "width:5em"}= stock_change.quantity
= javascript_tag "new Ajax.InPlaceEditor('#{stock_change.id}', |
'/deliveries/in_place_edit_for_stock_quantity', |
{size: 5, });" |
%td
= link_to_remote "Artikel entfernen", |
:url => drop_stock_change_supplier_delivery_path(@supplier, @delivery, :stock_change_id => stock_change), |
:method => :post |
%p
= f.submit "Speichern"
= link_to 'Zurück', supplier_deliveries_path(@supplier)

View file

@ -20,8 +20,21 @@
.box_title
%h2 Neuen Lagerartikel anlegen
.column_content
%p
:javascript
function fillNewStockArticle(text, li) {
new Ajax.Updater('new_stock_article', '/deliveries/fill_new_stock_article_form', {
method: 'get',
parameters: {article_id: li.id}
});
}
Suche nach Artikeln aus dem Katalog:
= text_field_with_auto_complete :article, :name, {}, |
{:url => {:action => 'auto_complete_for_article_name', :supplier_id => @supplier.id}, |
:after_update_element => 'fillNewStockArticle'} |
%hr/
#new_stock_article
= render :partial => 'new_stock_article', :locals => {:stock_article => @supplier.stock_articles.build}
%p{:style => "clear:both"}
= link_to 'Zurück', supplier_deliveries_path(@supplier)
= link_to 'Zurück', supplier_deliveries_path(@supplier)