Refactoring of delivery-workflow. Added ability to add stock_changes after creating a delivery.
This commit is contained in:
parent
43fc7b06f8
commit
a8e35bd421
7 changed files with 66 additions and 101 deletions
48
app/views/deliveries/_form.html.haml
Normal file
48
app/views/deliveries/_form.html.haml
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
.left_column
|
||||
- form_for([@supplier,@delivery]) do |f|
|
||||
.box_title
|
||||
%h2 Lieferung anlegen
|
||||
.column_content
|
||||
= f.error_messages
|
||||
= f.hidden_field :supplier_id
|
||||
%p
|
||||
%b= f.label :delivered_on
|
||||
= f.date_select :delivered_on
|
||||
%h2 Lagerartikel des Lieferanten
|
||||
#stock_changes
|
||||
- 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'
|
||||
Entfernen
|
||||
= stock_change_form.check_box :_delete
|
||||
%p
|
||||
= remote_link_to "Lagerartikel hinzufügen", :url => {:action => 'add_stock_change', :supplier_id => @supplier.id}
|
||||
%p
|
||||
= f.submit "Lieferung speichern"
|
||||
|
||||
.right_column{:style => "width:35em;"}
|
||||
.box_title
|
||||
%h2 Neuen Lagerartikel anlegen
|
||||
.column_content
|
||||
%p
|
||||
:javascript
|
||||
function fillNewStockArticle(text, li) {
|
||||
new Ajax.Updater('stock_article_form', '/deliveries/fill_new_stock_article_form', {
|
||||
method: 'get',
|
||||
parameters: {article_id: li.id}
|
||||
});
|
||||
}
|
||||
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} |
|
||||
%hr/
|
||||
#stock_article_form
|
||||
= render :partial => 'stock_article_form', :locals => {:stock_article => @supplier.stock_articles.build}
|
||||
|
||||
%p{:style => "clear:both"}
|
||||
= link_to 'Zurück', supplier_deliveries_path(@supplier)
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
%p
|
||||
- fields_for "delivery[stock_change_attributes][]", stock_change do |form|
|
||||
= form.hidden_field :stock_article_id
|
||||
- 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'
|
||||
- article = stock_change.stock_article
|
||||
%b= article.name
|
||||
= "(#{number_to_currency(article.price)} / #{article.unit})"
|
||||
= link_to_function "entfernen", "$(this).up('p').remove()"
|
||||
|
|
|
|||
|
|
@ -1,41 +1,3 @@
|
|||
- title "Lieferung bearbeiten"
|
||||
|
||||
%p
|
||||
%b Lieferantin:
|
||||
= @supplier.name
|
||||
%p
|
||||
%b Rechnungsbetrag:
|
||||
= link_to_invoice(@delivery)
|
||||
|
||||
- form_for([@supplier,@delivery]) do |f|
|
||||
= f.error_messages
|
||||
= f.hidden_field :supplier_id
|
||||
%p
|
||||
%b Geliefert am:
|
||||
= f.date_select :delivered_on
|
||||
|
||||
%h2 Artikel
|
||||
%i Um die Mengen anzupassen einfach auf die Anzahl klicken.
|
||||
#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.click-me{: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)
|
||||
|
||||
= render :partial => 'form'
|
||||
|
|
@ -1,42 +1,3 @@
|
|||
- title "Neue Lieferung von #{@supplier.name}"
|
||||
|
||||
.left_column
|
||||
- form_for([@supplier,@delivery]) do |f|
|
||||
.box_title
|
||||
%h2 Lieferung anlegen
|
||||
.column_content
|
||||
= f.error_messages
|
||||
= f.hidden_field :supplier_id
|
||||
%p
|
||||
%b= f.label :delivered_on
|
||||
= f.date_select :delivered_on
|
||||
%h2 Lagerartikel des Lieferanten
|
||||
#stock_changes
|
||||
= render :partial => 'stock_change', :collection => @delivery.stock_changes
|
||||
%p
|
||||
= f.submit "Lieferung anlegen"
|
||||
|
||||
.right_column{:style => "width:35em;"}
|
||||
.box_title
|
||||
%h2 Neuen Lagerartikel anlegen
|
||||
.column_content
|
||||
%p
|
||||
:javascript
|
||||
function fillNewStockArticle(text, li) {
|
||||
new Ajax.Updater('stock_article_form', '/deliveries/fill_new_stock_article_form', {
|
||||
method: 'get',
|
||||
parameters: {article_id: li.id}
|
||||
});
|
||||
}
|
||||
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} |
|
||||
%hr/
|
||||
#stock_article_form
|
||||
= render :partial => 'stock_article_form', :locals => {:stock_article => @supplier.stock_articles.build}
|
||||
|
||||
%p{:style => "clear:both"}
|
||||
= link_to 'Zurück', supplier_deliveries_path(@supplier)
|
||||
= render :partial => 'form'
|
||||
Loading…
Add table
Add a link
Reference in a new issue