Fix StockArticle creation during delivery; small cleanups

This commit is contained in:
Julius 2013-06-11 13:10:18 +02:00
parent ad29a238f2
commit e28f3eda65
10 changed files with 66 additions and 44 deletions

View file

@ -12,6 +12,11 @@
})
});
.well.well-small
.btn-toolbar
.btn-group
= link_to t('.new_stock_article'), new_stock_article_supplier_deliveries_path(@supplier), remote: true, class: 'btn btn-primary'
= simple_form_for [@supplier, @delivery], validate: true do |f|
= f.hidden_field :supplier_id
#stock_changes
@ -23,23 +28,10 @@
= stock_change_form.hidden_field :_destroy
= link_to t('.remove_article'), "#", class: 'destroy_stock_change'
%p
= link_to t('.add_article'), {action: 'add_stock_change', supplier_id: @supplier.id}, remote: true
%p
%small= t('.note_new_article', new_link: link_to(t('.note_new_article_link'), new_stock_article_path)).html_safe
= link_to t('.add_article'), {action: 'add_stock_change', supplier_id: @supplier.id}, remote: true, class: 'btn btn-small'
%hr/
= f.input :delivered_on, as: :date_picker
= f.input :note, input_html: {size: '35x4'}
.form-actions
= f.submit class: 'btn btn-primary'
= link_to t('ui.or_cancel'), supplier_deliveries_path(@supplier)
/
TODO: Fix this!!
.span6
%h2= t '.new_article.title'
%p
= t('.new_article.search', supplier: @supplier.name).html_safe + ': '
= text_field_tag 'article_name'
%hr/
#stock_article_form
= render 'stock_article_form', stock_article: @supplier.stock_articles.build

View file

@ -1,11 +1,19 @@
= simple_form_for stock_article, url: add_stock_article_supplier_deliveries_path(@supplier), remote: true,
validate: true do |f|
= simple_form_for stock_article, url: add_stock_article_supplier_deliveries_path(supplier), remote: true, validate: true do |f|
= f.hidden_field :supplier_id
= f.input :name
= f.input :unit
= f.input :note
= f.input :price
= f.input :tax
= f.input :deposit
= f.association :article_category
= f.submit class: 'btn'
.modal-header
= link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'}
%h3= t '.title'
.modal-body
= f.input :name
= f.input :unit
= f.input :note
- if stock_article.new_record?
= f.input :price
= f.input :tax
= f.input :deposit
- else
= f.input :price, :input_html => {:disabled => 'disabled'}, :hint => t('.form.price_hint')
= f.association :article_category
.modal-footer
= link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'}
= f.submit class: 'btn btn-primary'

View file

@ -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 t('.remove_article'), "#", :class => 'remove_new_stock_change'
= link_to t('.remove_article'), "#", :class => 'remove_new_stock_change btn btn-small'

View file

@ -0,0 +1,3 @@
$('div.container-fluid').prepend('#{j(render(:partial => 'shared/alert_success', :locals => {:alert_message => t('.notice', :name => @stock_article.name)}))}');
$('#modalContainer').modal('hide');

View file

@ -0,0 +1,2 @@
$('#modalContainer').html('#{j(render(:partial => "stock_article_form", :locals => {:stock_article => @stock_article, :supplier => @supplier}))}');
$('#modalContainer').modal();