Improved delivery creating/updating prozess.
This commit is contained in:
parent
16346e3529
commit
83e741c1af
3 changed files with 12 additions and 10 deletions
|
@ -22,7 +22,6 @@ class DeliveriesController < ApplicationController
|
|||
|
||||
def new
|
||||
@delivery = @supplier.deliveries.build
|
||||
@delivery.stock_changes.build(:stock_article => @supplier.stock_articles.first)
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
|
@ -35,7 +34,7 @@ class DeliveriesController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
if @delivery.save
|
||||
flash[:notice] = 'Delivery was successfully created.'
|
||||
flash[:notice] = 'Lieferung wurde erstellt. Bitte nicht vergessen die Rechnung anzulegen!'
|
||||
format.html { redirect_to([@supplier,@delivery]) }
|
||||
format.xml { render :xml => @delivery, :status => :created, :location => @delivery }
|
||||
else
|
||||
|
@ -54,7 +53,7 @@ class DeliveriesController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
if @delivery.update_attributes(params[:delivery])
|
||||
flash[:notice] = 'Delivery was successfully updated.'
|
||||
flash[:notice] = 'Lieferung wurde aktualisiert.'
|
||||
format.html { redirect_to([@supplier,@delivery]) }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
|
@ -68,6 +67,7 @@ class DeliveriesController < ApplicationController
|
|||
@delivery = Delivery.find(params[:id])
|
||||
@delivery.destroy
|
||||
|
||||
flash[:notice] = "Lieferung wurde gelöscht."
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(supplier_deliveries_url(@supplier)) }
|
||||
format.xml { head :ok }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.left_column
|
||||
.left_column(style="width:55%")
|
||||
- form_for([@supplier,@delivery]) do |f|
|
||||
.box_title
|
||||
%h2 Lieferung anlegen
|
||||
|
@ -12,10 +12,10 @@
|
|||
= 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
|
||||
= stock_change_form.hidden_field :_delete
|
||||
= link_to_function "Artikel aus Lieferung entfernen", "$(this).previous('input').value = 1; $(this).up('p').hide();"
|
||||
%p
|
||||
= remote_link_to "Lagerartikel hinzufügen", :url => {:action => 'add_stock_change', :supplier_id => @supplier.id}
|
||||
= remote_link_to "Lagerartikel der Lieferung hinzufügen", :url => {:action => 'add_stock_change', :supplier_id => @supplier.id}
|
||||
%hr/
|
||||
%p
|
||||
%b= f.label :delivered_on, "Lieferdatum"
|
||||
|
@ -23,11 +23,13 @@
|
|||
%p
|
||||
%b= f.label :note, "Notiz"
|
||||
%br/
|
||||
= f.text_area :note, :size => "35x8"
|
||||
= f.text_area :note, :size => "35x4"
|
||||
%p
|
||||
= f.submit "Lieferung speichern"
|
||||
oder
|
||||
= link_to "Abbrechen", supplier_deliveries_path(@supplier)
|
||||
|
||||
.right_column{:style => "width:35em;"}
|
||||
.right_column{:style => "width:35%;"}
|
||||
.box_title
|
||||
%h2 Neuen Lagerartikel anlegen
|
||||
.column_content
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
= form.select :stock_article_id, stock_articles_for_select(supplier)
|
||||
Menge
|
||||
= form.text_field :quantity, :size => 5, :autocomplete => 'off'
|
||||
= link_to_function "entfernen", "$(this).up('p').remove()"
|
||||
= link_to_function "Artikel aus Lieferung entfernen", "$(this).up('p').remove()"
|
||||
|
|
Loading…
Reference in a new issue