Class: DeliveriesController
Instance Method Summary
collapse
current
Methods included from PathHelper
#finance_group_transactions_path
Instance Method Details
#add_stock_change ⇒ Object
52
53
54
55
56
|
# File 'app/controllers/deliveries_controller.rb', line 52
def add_stock_change
@stock_change = StockChange.new
@stock_change.stock_article = StockArticle.find(params[:stock_article_id])
render layout: false
end
|
#create ⇒ Object
22
23
24
25
26
27
28
29
30
31
|
# File 'app/controllers/deliveries_controller.rb', line 22
def create
@delivery = Delivery.new(params[:delivery])
if @delivery.save
flash[:notice] = I18n.t('deliveries.create.notice')
redirect_to [@supplier, @delivery]
else
render action: 'new'
end
end
|
#destroy ⇒ Object
44
45
46
47
48
49
50
|
# File 'app/controllers/deliveries_controller.rb', line 44
def destroy
@delivery = Delivery.find(params[:id])
@delivery.destroy
flash[:notice] = I18n.t('deliveries.destroy.notice')
redirect_to supplier_deliveries_url(@supplier)
end
|
#edit ⇒ Object
18
19
20
|
# File 'app/controllers/deliveries_controller.rb', line 18
def edit
@delivery = Delivery.find(params[:id])
end
|
#form_on_stock_article_create ⇒ Object
See publish/subscribe design pattern in /doc.
58
59
60
61
62
|
# File 'app/controllers/deliveries_controller.rb', line 58
def form_on_stock_article_create @stock_article = StockArticle.find(params[:id])
render layout: false
end
|
#form_on_stock_article_update ⇒ Object
See publish/subscribe design pattern in /doc.
64
65
66
67
68
|
# File 'app/controllers/deliveries_controller.rb', line 64
def form_on_stock_article_update @stock_article = StockArticle.find(params[:id])
render layout: false
end
|
#index ⇒ Object
4
5
6
|
# File 'app/controllers/deliveries_controller.rb', line 4
def index
@deliveries = @supplier.deliveries.order('date DESC')
end
|
#new ⇒ Object
13
14
15
16
|
# File 'app/controllers/deliveries_controller.rb', line 13
def new
@delivery = @supplier.deliveries.build
@delivery.date = Date.today end
|
#show ⇒ Object
8
9
10
11
|
# File 'app/controllers/deliveries_controller.rb', line 8
def show
@delivery = Delivery.find(params[:id])
@stock_changes = @delivery.stock_changes.includes(:stock_article).order('articles.name ASC')
end
|
#update ⇒ Object
33
34
35
36
37
38
39
40
41
42
|
# File 'app/controllers/deliveries_controller.rb', line 33
def update
@delivery = Delivery.find(params[:id])
if @delivery.update(params[:delivery])
flash[:notice] = I18n.t('deliveries.update.notice')
redirect_to [@supplier, @delivery]
else
render action: 'edit'
end
end
|