Refactored stockit, delivery an stock_takings.
This commit is contained in:
parent
d4715fef4b
commit
fc1d130113
20 changed files with 145 additions and 296 deletions
|
|
@ -1,52 +1,49 @@
|
|||
.left_column(style="width:55%")
|
||||
- form_for([@supplier,@delivery]) do |f|
|
||||
- content_for :head do
|
||||
:javascript
|
||||
$(function() {
|
||||
$('.destroy_stock_change').live('click', function() {
|
||||
$(this).prev('input').val('1').parent().hide();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.remove_new_stock_change').live('click', function() {
|
||||
$(this).parent().remove();
|
||||
return false;
|
||||
})
|
||||
});
|
||||
|
||||
.left_column(style="width:50%")
|
||||
= simple_form_for [@supplier,@delivery], :validate => true do |f|
|
||||
.box_title
|
||||
%h2 Lieferung anlegen
|
||||
.column_content
|
||||
= f.error_messages
|
||||
= f.hidden_field :supplier_id
|
||||
%b Lagerartikel des Lieferanten
|
||||
#stock_changes
|
||||
- f.fields_for :stock_changes do |stock_change_form|
|
||||
= 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'
|
||||
= stock_change_form.hidden_field :_delete
|
||||
= link_to_function "Artikel aus Lieferung entfernen", "$(this).previous('input').value = 1; $(this).up('p').hide();"
|
||||
= stock_change_form.hidden_field :_destroy
|
||||
= link_to "Artikel aus Lieferung entfernen", "#", :class => 'destroy_stock_change'
|
||||
%p
|
||||
= remote_link_to "Lagerartikel der Lieferung hinzufügen", :url => {:action => 'add_stock_change', :supplier_id => @supplier.id}
|
||||
= link_to "Lagerartikel der Lieferung hinzufügen", {:action => 'add_stock_change', :supplier_id => @supplier.id}, :remote => true
|
||||
%hr/
|
||||
%p
|
||||
%b= f.label :delivered_on, "Lieferdatum"
|
||||
= f.date_select :delivered_on
|
||||
%p
|
||||
%b= f.label :note, "Notiz"
|
||||
%br/
|
||||
= f.text_area :note, :size => "35x4"
|
||||
%p
|
||||
= f.submit "Lieferung speichern"
|
||||
oder
|
||||
= link_to "Abbrechen", supplier_deliveries_path(@supplier)
|
||||
= f.input :delivered_on
|
||||
= f.input :note, :input_html => {:size => '35x4'}
|
||||
= f.submit
|
||||
|
||||
.right_column{:style => "width:35%;"}
|
||||
.right_column{:style => "width:45%;"}
|
||||
.box_title
|
||||
%h2 Neuen Lagerartikel anlegen
|
||||
.column_content
|
||||
%p
|
||||
:javascript
|
||||
function fillNewStockArticle(text, li) {
|
||||
new Ajax.Updater('stock_article_form', '#{url_for(:controller => "deliveries", :action => "fill_new_stock_article_form")}', {
|
||||
method: 'get',
|
||||
parameters: {article_id: li.id}
|
||||
});
|
||||
}
|
||||
//TODO: Fix this!!
|
||||
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} |
|
||||
= text_field_tag 'article_name'
|
||||
%hr/
|
||||
#stock_article_form
|
||||
= render :partial => 'stock_article_form', :locals => {:stock_article => @supplier.stock_articles.build}
|
||||
|
|
|
|||
|
|
@ -1,33 +1,11 @@
|
|||
- remote_form_for stock_article, :url => add_stock_article_supplier_deliveries_path(@supplier) do |form|
|
||||
= form.error_messages
|
||||
= form.hidden_field :supplier_id
|
||||
|
||||
%p
|
||||
Name
|
||||
%br/
|
||||
= form.text_field :name
|
||||
%p
|
||||
Einheit
|
||||
%br/
|
||||
= form.text_field :unit
|
||||
%p
|
||||
Notiz
|
||||
%br/
|
||||
= form.text_field :note
|
||||
%p
|
||||
Preis
|
||||
%br/
|
||||
= form.text_field :price
|
||||
%p
|
||||
MwSt
|
||||
%br/
|
||||
= form.text_field :tax, :value => (stock_article.tax || 7.0)
|
||||
%p
|
||||
Pfand
|
||||
%br/
|
||||
= form.text_field :deposit
|
||||
%p
|
||||
Kategorie:
|
||||
= form.select :article_category_id, ArticleCategory.all(:order => 'name').collect { |c| [c.name, c.id] }
|
||||
%p
|
||||
= submit_tag "Lagerartikel speichern"
|
||||
= simple_form_for stock_article, 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
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
%p
|
||||
- fields_for "delivery[new_stock_changes][]", stock_change do |form|
|
||||
= 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'
|
||||
= link_to_function "Artikel aus Lieferung entfernen", "$(this).up('p').remove()"
|
||||
= link_to "Artikel aus Lieferung entfernen", "#", :class => 'remove_new_stock_change'
|
||||
|
|
|
|||
1
app/views/deliveries/add_stock_change.js.erb
Normal file
1
app/views/deliveries/add_stock_change.js.erb
Normal file
|
|
@ -0,0 +1 @@
|
|||
$('#stock_changes').append('<%= escape_javascript(render(:partial => 'stock_change', :locals => {:stock_change => StockChange.new, :supplier => @supplier})) %>');
|
||||
Loading…
Add table
Add a link
Reference in a new issue