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)

View file

@ -26,21 +26,24 @@
.column_content
- if (@template_orders && !@template_orders.empty?)
%p
%label{:for => 'template'}=_ "Use article selection from"
%label{:for => 'template'} Benutze Artikelauswahl von
%select{:name => "template_id", :onchange => "useTemplate(this[this.selectedIndex].value)"}
%option{:value => "-1", :selected => "selected"}=_ "Choose an order..."
%option{:value => "-1", :selected => "selected"} Bestellung auswählen...
- i = -1
- for order in @template_orders
%option{:value => (i += 1)}= "#{h(order.name)} bis #{order.ends.strftime('%d. %b')}"
%table.list
%tr
%th= check_box_tag 'checkall', "1", false, { :onclick => "checkUncheckAll(this)" }
%th=_ "Name"
%th=_ "Note"
%th=_ "Origin"
%th=_ "Manufacturer"
%th=_ "Unit quantity"
%th=_ "Price"
%th Name
%th Notiz
- if @order.stockit?
%th Verfügbar
- else
%th Herkunft
%th Hersteller
%th Gebinde
%th Preis (netto/FC)
- for category_name, articles in @order.articles_for_ordering
%tr{:style => "background-color:#EFEFEF"}
%td
@ -54,9 +57,12 @@
%td= check_box_tag "order[article_ids][]", article.id, included, { :id => "checkbox_#{article.id}", :onclick => "checkRow('#{article.id}')" }
%td=h article.name
%td=h truncate article.note, :length => 25
%td=h truncate article.origin, :length => 15
%td=h truncate article.manufacturer, :length => 15
%td= "#{article.unit_quantity} x #{article.unit}"
- if @order.stockit?
%td= "#{article.quantity_available} * #{article.unit}"
- else
%td=h truncate article.origin, :length => 15
%td=h truncate article.manufacturer, :length => 15
%td= "#{article.unit_quantity} x #{article.unit}"
%td= "#{number_to_currency(article.price)} / #{number_to_currency(article.fc_price)}"
%tr
%td{:colspan => "6"}

View file

@ -14,7 +14,8 @@
%thead
%tr
%th Artikel
%th Menge
%th im Lager
%th davon bestellt
%th Einheit
%th Preis
%th Lieferant
@ -24,6 +25,7 @@
%tr{:class => cycle("even", "odd")}
%td=h article.name
%td= article.quantity
%td= article.quantity - article.quantity_available
%td= article.unit
%td= article.price
%td= link_to article.supplier.name, article.supplier