Refactoring of articles and article_categories. articles are now a nested resource of supplier.
This commit is contained in:
parent
b38025869a
commit
936e6ef69a
36 changed files with 597 additions and 589 deletions
|
|
@ -1,27 +1,32 @@
|
|||
<td>
|
||||
<%= check_box_tag 'selected_articles[]', @article.id.to_s, false, {:id => "checkbox_#{@article.id.to_s}", :onclick => "checkRow('#{@article.id.to_s}')"} %>
|
||||
<%= check_box_tag 'selected_articles[]', @article.id.to_s, false,
|
||||
{:id => "checkbox_#{@article.id.to_s}", :onclick => "checkRow('#{@article.id.to_s}')"} %>
|
||||
</td>
|
||||
<td><%=h @article.name %></td>
|
||||
<td><%= @article.origin %></td>
|
||||
<td><%=h truncate(@article.article_category.name, 11) if @article.article_category%></td>
|
||||
<td><%=h @article.unit %></td>
|
||||
<td><%=h truncate(@article.note, 15) %></td>
|
||||
<td><%= @article.unit_quantity %></td>
|
||||
<td><%=h @article.name -%></td>
|
||||
<td><%= @article.origin -%></td>
|
||||
<td><%=h truncate(@article.article_category.name, :length => 11) if @article.article_category -%></td>
|
||||
<td><%=h @article.unit -%></td>
|
||||
<td><%=h truncate(@article.note, :length => 11) -%></td>
|
||||
<td><%= @article.unit_quantity -%></td>
|
||||
<td class="currency">
|
||||
<acronym title="zuletzt geändert: <%= format_date(@article.updated_at) %>
|
||||
| Brutto: <%= number_to_currency(@article.gross_price) %>">
|
||||
<%= number_to_currency(@article.net_price) %>
|
||||
<acronym title="zuletzt geändert: <%= format_date(@article.updated_at) -%>
|
||||
| Brutto: <%= number_to_currency(@article.gross_price) -%>">
|
||||
<%= number_to_currency(@article.net_price) -%>
|
||||
</acronym>
|
||||
</td>
|
||||
<td><%= number_to_percentage(@article.tax) if @article.tax != 0 %></td>
|
||||
<td><%= number_to_currency(@article.deposit) if @article.deposit != 0 %></td>
|
||||
<td><%= link_to_remote(image_tag('b_edit.png', :size => "16x16", :border => 0, :alt => 'Artikel ändern', :onclick => "checkRow('#{@article.id.to_s}')"),
|
||||
:url => {:action => 'editArticle', :id => @article },
|
||||
:before => "Element.show('loader')",
|
||||
:success => "Element.hide('loader')") %>
|
||||
<%= link_to_remote(image_tag('b_drop.png', :size => "16x16", :border => 0, :alt => 'Artikel löschen', :onclick => "checkRow('#{@article.id.to_s}')"),
|
||||
:url => { :action => 'destroyArticle', :id => @article },
|
||||
:confirm => 'Bist du sicher?',
|
||||
:before => "Element.show('loader')",
|
||||
:success => "Element.hide('loader')")%></td>
|
||||
<td><%= number_to_percentage(@article.tax) if @article.tax != 0 -%></td>
|
||||
<td><%= number_to_currency(@article.deposit) if @article.deposit != 0 -%></td>
|
||||
<td>
|
||||
<%= link_to_remote icon(:edit, :onclick => "checkRow('#{@article.id.to_s}')"),
|
||||
:url => edit_supplier_article_path(@supplier, @article),
|
||||
:method => :get,
|
||||
:before => "Element.show('loader')",
|
||||
:success => "Element.hide('loader')" %>
|
||||
<%= link_to_remote icon(:delete, :onclick => "checkRow('#{@article.id.to_s}')"),
|
||||
:url => [@supplier, @article],
|
||||
:method => :delete,
|
||||
:confirm => 'Bist du sicher?',
|
||||
:before => "Element.show('loader')",
|
||||
:success => "Element.hide('loader')" %>
|
||||
</td>
|
||||
|
||||
|
|
@ -16,14 +16,14 @@
|
|||
%tr
|
||||
%th
|
||||
%th[sort_td_class_helper "name"]
|
||||
= sort_link_helper _("Name"), "name", @supplier.id
|
||||
= sort_link_helper _("Name"), "name"
|
||||
%th
|
||||
%th[sort_td_class_helper "category"]
|
||||
= sort_link_helper _("Category"), "category", @supplier.id
|
||||
= sort_link_helper _("Category"), "category"
|
||||
%th[sort_td_class_helper "unit"]
|
||||
= sort_link_helper _("Unit"), "unit", @supplier.id
|
||||
= sort_link_helper _("Unit"), "unit"
|
||||
%th[sort_td_class_helper "note"]
|
||||
= sort_link_helper _("Note"), "note", @supplier.id
|
||||
= sort_link_helper _("Note"), "note"
|
||||
%th{:style => "width: 4em;"}=_ 'UnitQu'
|
||||
%th{:style => "width: 4em;"}=_ 'Price'
|
||||
%th{:style => "width: 3.5em;"}=_ 'Tax'
|
||||
|
|
@ -34,20 +34,19 @@
|
|||
|
||||
- if @total > 0
|
||||
- for @article in @articles
|
||||
%tr{ :class => cycle('even','odd') + (!@article.availability ? ' unavailable' : '') + ((@article.recently_updated && @article.availability) ? " just_updated" : ""), |
|
||||
:id => @article.id, :onclick => "checkRow('#{@article.id.to_s}')"} |
|
||||
%tr{ :class => cycle('even','odd') + row_classes(@article), :id => @article.id, :onclick => "checkRow('#{@article.id.to_s}')"}
|
||||
= render :partial => 'article_row'
|
||||
%tfoot
|
||||
%tr
|
||||
%td{:colspan => '10'}
|
||||
%input{:type => 'checkbox', :name => 'checkall', :onclick => 'checkUncheckAll(this)'}/
|
||||
%td{:colspan => '11'}
|
||||
= check_box_tag :checkall, 1, false, :onclick => 'checkUncheckAll(this)'
|
||||
%select{:name => "selected_action"}
|
||||
%option{:value => '', :selected => 'selected'} Aktion wählen ...
|
||||
%option{:value => "destroy", :onclick => "if (confirm('Willst Du wirklich alle gewählten Artikel löschen?')) { formSubmit(); }; return false;"} Artikel löschen
|
||||
%option{:value => "setNotAvailable", :onclick => 'formSubmit();'} Artikel sind nicht mehr verfügbar
|
||||
%option{:value => "setAvailable", :onclick => 'formSubmit();'} Artikel sind verfügbar
|
||||
|
||||
= hidden_field_tag 'supplier', @supplier.id
|
||||
= hidden_field_tag 'supplier_id', @supplier.id
|
||||
%p
|
||||
= pagination_links_remote @articles, :params => {:sort => params[:sort]}
|
||||
|
||||
|
|
@ -3,12 +3,5 @@
|
|||
= @article.name
|
||||
zuletzt aktualisiert am:
|
||||
= format_time(@article.updated_at)
|
||||
|
||||
- form_remote_tag :url => { :action => 'updateArticle', :id => @article}, :html => {:id => "edit"}, |
|
||||
:before => "Element.show('loader')", :success => "Element.hide('loader')" do |form| |
|
||||
|
||||
= render :partial => "form"
|
||||
|
||||
= submit_tag "Speichern"
|
||||
|
|
||||
= link_to_function "Abbrechen", "Element.hide('edit_article')"
|
||||
|
||||
= render :partial => "form"
|
||||
|
|
|
|||
45
app/views/articles/_form.html.haml
Normal file
45
app/views/articles/_form.html.haml
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
- remote_form_for [@supplier, @article], :before => "Element.show('loader')", |
|
||||
:success => "Element.hide('loader')" do |form| |
|
||||
|
||||
= form.error_messages
|
||||
%p
|
||||
%b Verfügbar?
|
||||
= form.check_box :availability
|
||||
%table{ :style => "width: 20em"}
|
||||
%tr
|
||||
%th Name
|
||||
%th Herkunft
|
||||
%th Hersteller
|
||||
%th Einheit
|
||||
%th Notiz
|
||||
%th kategorie
|
||||
%tbody
|
||||
%tr
|
||||
%td= form.text_field :name, :size => 15
|
||||
%td= form.text_field :origin, :size => 5
|
||||
%td= form.text_field :manufacturer, :size => 8
|
||||
%td= form.text_field :unit, :size => 5
|
||||
%td= form.text_field :note, :size => 15
|
||||
%td= form.select :article_category_id, ArticleCategory.find(:all, :order => 'name').collect {|a| [ a.name, a.id ] }
|
||||
%br/
|
||||
%table{ :style=>"width:35em"}
|
||||
%tr
|
||||
%th Nettopreis
|
||||
%th Gebindegröße
|
||||
%th Bestellnummer
|
||||
%th MwSt
|
||||
%th Pfand
|
||||
%tbody
|
||||
%tr
|
||||
%td= form.text_field :net_price, :size => 5
|
||||
%td= form.text_field :unit_quantity, :size => 5
|
||||
%td= form.text_field :order_number, :size => 10
|
||||
%td= form.text_field :tax, :size => 5
|
||||
%td= form.text_field :deposit, :size => 5
|
||||
|
||||
= form.hidden_field :shared_updated_on
|
||||
= form.hidden_field :supplier_id
|
||||
|
||||
= submit_tag "Speichern"
|
||||
|
|
||||
= link_to_function "Abbrechen", "Element.hide('edit_article')"
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
<%= error_messages_for 'article' %>
|
||||
<!--[form:article]-->
|
||||
<p>
|
||||
<b>Verfügbar?</b> <label for="article_availability"><%= check_box 'article', 'availability' %></label>
|
||||
</p>
|
||||
<table style="width: 20em">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Herkunft</th>
|
||||
<th>Herstellerin</th>
|
||||
<th>Einheit</th>
|
||||
<th>Notiz</th>
|
||||
<th>Kategorie</th>
|
||||
</tr>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="article_name"><%= text_field 'article', 'name', :size => 15 %></label>
|
||||
</td>
|
||||
<td>
|
||||
<label for="article_origin"><%= text_field 'article', 'origin', :size => 5 %></label>
|
||||
</td>
|
||||
<td>
|
||||
<label for="article_manufacturer"><%= text_field 'article', 'manufacturer', :size => 8 %></label>
|
||||
</td>
|
||||
<td>
|
||||
<label for="article_unit"><%= text_field 'article', 'unit', :size => 5 %></label>
|
||||
</td>
|
||||
<td>
|
||||
<label for="article_note"><%= text_field 'article', 'note', :size => 15 %></label>
|
||||
</td>
|
||||
<td>
|
||||
<label for="article_article_category"><%= select('article', 'article_category_id', ArticleCategory.find(:all, :order => 'name').collect {|a| [ a.name, a.id ] }) %></label>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br />
|
||||
|
||||
<table style="width:35em">
|
||||
<tr>
|
||||
<th>netto Preis</th>
|
||||
<th>Gebindegröße</th>
|
||||
<th>Artikelnummer</th>
|
||||
<th>Steuer</th>
|
||||
<th>Pfand</th>
|
||||
</tr>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><label for="article_net_price">
|
||||
<%= text_field 'article', 'net_price', :size => 5%></label></td>
|
||||
|
||||
<td><label for="article_unit_quantity">
|
||||
<%= text_field 'article', 'unit_quantity', :size => 5%></label></td>
|
||||
|
||||
<td><label for="article_order_number">
|
||||
<%= text_field 'article', 'order_number', :size => 10%></label></td>
|
||||
|
||||
<td><label for="article_tax">
|
||||
<%= text_field 'article', 'tax', :size => 5%></label></td>
|
||||
|
||||
<td><label for="article_deposit">
|
||||
<%= text_field 'article', 'deposit', :size => 5%></label></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= hidden_field 'article', 'shared_updated_on' %>
|
||||
<%= hidden_field 'article', 'supplier_id' %>
|
||||
<!--[eoform:article]-->
|
||||
|
|
@ -21,5 +21,7 @@
|
|||
%td= number_to_currency(article.price)
|
||||
%td= article.unit
|
||||
%td= article.unit_quantity
|
||||
%td= link_to_remote 'importieren', :url => {:action => 'new_import', :id => article, :supplier_id => @supplier.id}
|
||||
%td= link_to_remote 'importieren', |
|
||||
:url => import_supplier_articles_path(@supplier, :shared_article_id => article.id), |
|
||||
:method => :get |
|
||||
|
||||
|
|
@ -1,5 +1,2 @@
|
|||
%h3 Neuer Artikel
|
||||
- form_remote_tag :url => { :action => 'createArticle'} do
|
||||
= render :partial => 'articles/form'
|
||||
= submit_tag "Speichern"
|
||||
= link_to_function('Abbrechen', 'Element.hide("edit_article")')
|
||||
= render :partial => 'form'
|
||||
|
|
@ -1,25 +1,26 @@
|
|||
<h1>Alle Artikel von <%= @supplier.name %> bearbeiten</h1>
|
||||
|
||||
<div class="single_column" style="width:100%">
|
||||
<div id="change_supplier">
|
||||
<% form_tag do -%>
|
||||
<%= select_tag :switch_supplier,
|
||||
options_for_select( Supplier.all.collect {|s| [s.name, url_for(edit_all_supplier_articles_path(s))] },
|
||||
url_for(edit_all_supplier_articles_path(@supplier)) ),
|
||||
:onchange => "redirectTo(this)",
|
||||
:style => "font-size: 0.9em;margin-left:1em;" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="box_title">
|
||||
<h2>
|
||||
<div id="change_supplier">
|
||||
<% form_tag do -%>
|
||||
<select onchange="redirectTo(this)" style="font-size: 0.9em;margin-left:1em;">
|
||||
<%= options_for_select(Supplier.find(:all).collect {|s| [ s.name, url_for(:action => "edit_all", :id => s)] }, url_for(:action => "edit_all", :id => @supplier.id)) %>
|
||||
</select>
|
||||
<% end %>
|
||||
</div>
|
||||
</h2>
|
||||
<h2></h2>
|
||||
</div>
|
||||
<div class="box column_content">
|
||||
<div id="links"><%= link_to 'zurück zur Liste', :action => 'list', :id => @supplier.id %></div>
|
||||
<div id="links"><%= link_to 'zurück zur Liste', supplier_articles_path(@supplier) -%></div>
|
||||
<p>
|
||||
<i>
|
||||
Pflichtfelder sind: Name, Einheit, (netto) Preis und Bestellnummer.
|
||||
</i>
|
||||
</p>
|
||||
<% form_tag(:action => 'update_all', :id => @supplier) do %>
|
||||
<% form_tag(update_all_supplier_articles_path(@supplier)) do %>
|
||||
<table id="articles_table" class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
@ -35,27 +36,29 @@
|
|||
<th>Pfand</th>
|
||||
</tr>
|
||||
<tbody>
|
||||
<% @supplier.articles.find(:all, :order => 'article_categories.name, articles.name', :include => [:article_category]).each do |@article| %>
|
||||
<tr class="<%= cycle('even', 'odd') %>"<%= ' style="background-color: yellow"' if @failedArticle == @article %>>
|
||||
<td colspan="2"><label for="article_availability"><%= check_box 'article[]', 'availability' %></label>
|
||||
<label for="article_name"><%= text_field( 'article[]', 'name', :size => 0) %></label></td>
|
||||
<td><label for="article_unit"><%= text_field 'article[]', 'unit', :size => 5 %></label></td>
|
||||
<td><label for="article_net_price"><%= text_field 'article[]', 'net_price', :size => 4 %></label></td>
|
||||
<td><label for="article_unit_quantity"><%= text_field 'article[]', 'unit_quantity', :size => 4 %></label></td>
|
||||
<td><label for="article_order_number"><%= text_field 'article[]', 'order_number', :size => 6 %></label></td>
|
||||
<td><label for="article_note"><%= text_field 'article[]', 'note', :size => 15 %></label></td>
|
||||
<td><label for="article_article_category"><%= select('article[]', 'article_category_id', ArticleCategory.find(:all).collect {|a| [ a.name, a.id ] }, { :include_blank => true })%></label></td>
|
||||
<td><label for="article_tax"><%= text_field 'article[]', 'tax', :size => 4 %></label></td>
|
||||
<td><label for="article_deposit"><%= text_field 'article[]', 'deposit', :size => 4 %></label></td>
|
||||
<% for article in @articles %>
|
||||
<% fields_for 'articles[]', article do |form| %>
|
||||
<tr class="<%= cycle('even', 'odd') %>"<%= ' style="background-color: yellow"' if @failedArticle == article %>>
|
||||
<td colspan="2">
|
||||
<%= form.check_box 'availability' -%>
|
||||
<%= form.text_field 'name', :size => 0 -%>
|
||||
</td>
|
||||
<td><%= form.text_field 'unit', :size => 5 -%></td>
|
||||
<td><%= form.text_field 'net_price', :size => 4 -%></td>
|
||||
<td><%= form.text_field 'unit_quantity', :size => 4 -%></td>
|
||||
<td><%= form.text_field 'order_number', :size => 6 -%></td>
|
||||
<td><%= form.text_field 'note', :size => 15 -%></td>
|
||||
<td><%= form.select 'article_category_id', ArticleCategory.find(:all).collect {|a| [ a.name, a.id ] }, { :include_blank => true } -%></td>
|
||||
<td><%= form.text_field 'tax', :size => 4 -%></td>
|
||||
<td><%= form.text_field 'deposit', :size => 4 -%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!--[eoform:article]-->
|
||||
</tbody>
|
||||
</table><br />
|
||||
<i>Achtung, alle Artikel werden aktualisiert!</i><br />
|
||||
<%= hidden_field 'supplier', 'id' %>
|
||||
<%= submit_tag 'Alle aktualisieren'%>
|
||||
| <%= link_to 'Abbrechen', :action => 'list', :id => @supplier.id %>
|
||||
<%= submit_tag 'Alle Artikel aktualisieren'%> | <%= link_to 'Abbrechen', supplier_articles_path(@supplier) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,29 +1,73 @@
|
|||
%h1 Manage die Artikeldatenbank
|
||||
.left_column{:style => "width:44%"}
|
||||
.box_title
|
||||
%h2 Artikel anzeigen
|
||||
.column_content
|
||||
%p
|
||||
%i
|
||||
Hier kannst du Artikel anzeigen, ändern und neue erstellen
|
||||
%br/
|
||||
Wähle einen Lieferanten:
|
||||
%ul
|
||||
- @suppliers.each do |supplier|
|
||||
%li
|
||||
%b= link_to supplier.name, :action => "list", :id => supplier.id
|
||||
(
|
||||
= supplier.articles.count
|
||||
Artikel )
|
||||
%hr/
|
||||
%p
|
||||
%i
|
||||
hier kannst du neue Artikel aus einer csv-Datei in die Datenbank
|
||||
= link_to 'hochladen', :action => 'upload_articles'
|
||||
- title "Artikel von #{@supplier.name}"
|
||||
|
||||
.right_column{:style => "width:53%"}
|
||||
.box_title
|
||||
%h2 Artikelkategorien
|
||||
.column_content#categories
|
||||
#category_form.box.edit_form{:style => "display:none;margin-bottom:1em;"}
|
||||
#category_list= render :partial => 'article_categories/list'
|
||||
// import menu
|
||||
- unless @supplier.shared_supplier.nil?
|
||||
.menu{:style => 'width: 14em'}
|
||||
%ul
|
||||
%li
|
||||
=_ 'External database'
|
||||
%ul
|
||||
%li= link_to_function _('search/import'), "Element.toggle('import')"
|
||||
%li= link_to _('sync'), sync_supplier_articles_path(@supplier), :method => :post
|
||||
|
||||
|
||||
#change_supplier{:style => "padding:0 0 0.5em 0.7em;"}
|
||||
%span{:style => "float:left"}
|
||||
=_ 'Change supplier:'
|
||||
- form_tag do
|
||||
= select_tag :switch_supplier, |
|
||||
options_for_select( Supplier.all.collect {|s| [s.name, url_for(supplier_articles_path(s))] }, |
|
||||
url_for(supplier_articles_path(@supplier)) ), |
|
||||
:onchange => "redirectTo(this)", |
|
||||
:style => "font-size: 0.9em;margin-left:1em;" |
|
||||
|
||||
- unless @supplier.shared_supplier.nil?
|
||||
#import.single_column{:style => "display:none; clear:both"}
|
||||
.box_title
|
||||
%h2=_ 'Import articles'
|
||||
.column_content
|
||||
#search{:style => "padding-bottom:3em"}
|
||||
- form_remote_tag :url => shared_supplier_articles_path(@supplier), |
|
||||
:before => "Element.show('loader')", :success => "Element.hide('loader')", |
|
||||
:method => :get do |
|
||||
= text_field_tag :import_query, params['import_query'], :size => 10
|
||||
= submit_tag _('Search articles')
|
||||
- if @supplier.shared_supplier.lists
|
||||
=_ "Search in following lists: "
|
||||
- @supplier.shared_supplier.lists.each do |token, name|
|
||||
= check_box_tag "lists[#{token}]", "1", true
|
||||
= name
|
||||
|
|
||||
=_ "only regional:"
|
||||
= check_box_tag "regional", "1", false
|
||||
#search_results
|
||||
// "import_search_results" will be rendered
|
||||
= link_to_function _('Close'), "Element.hide('import')"
|
||||
|
||||
.single_column{:style => 'width:100%; clear:both'}
|
||||
.box_title
|
||||
.column_content
|
||||
#links
|
||||
%b= link_to_remote _('New article'), :url => new_supplier_article_path(@supplier), :before => "Element.show('loader')", :success => "Element.hide('loader')", :method => :get
|
||||
|
|
||||
= link_to _('Edit all'), edit_all_supplier_articles_path(@supplier)
|
||||
|
|
||||
= link_to _('Upload articles'), upload_supplier_articles_path(@supplier)
|
||||
|
|
||||
= link_to_if @current_user.role_orders?, _('Create order'), {:controller => 'orders', :action => 'new', :id => @supplier }
|
||||
|
||||
#article_filter
|
||||
#article_search_form{:style=>"display:inline;"}
|
||||
- form_remote_tag :url => supplier_articles_path(@supplier), |
|
||||
:before => "Element.show('loader')", :success => "Element.hide('loader')", |
|
||||
:method => :get do |
|
||||
%label{:for => 'article_name'}=_ "Search in article name: "
|
||||
= text_field_tag("query", params['query'], :size => 10 )
|
||||
= submit_tag _('Search')
|
||||
|
||||
%form{ :action => url_for(update_selected_supplier_articles_path(@supplier)), :method => "post", :id => "articlesInListForm" }
|
||||
#table= render :partial => 'articles'
|
||||
|
||||
%br/
|
||||
= link_to _('Back'), :action => 'index'
|
||||
#edit_article{:style => "display:none"}
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
%h1
|
||||
=_ 'Articles from'
|
||||
= @supplier.name
|
||||
|
||||
// import menu
|
||||
- unless @supplier.shared_supplier.nil?
|
||||
.menu{:style => 'width: 14em'}
|
||||
%ul
|
||||
%li
|
||||
=_ 'External database'
|
||||
%ul
|
||||
%li= link_to_function _('search/import'), "Element.toggle('import')"
|
||||
%li= link_to _('sync'), :action => 'sync_articles', :id => @supplier
|
||||
|
||||
|
||||
#change_supplier{:style => "padding:0 0 0.5em 0.7em;"}
|
||||
%span{:style => "float:left"}
|
||||
=_ 'Change supplier:'
|
||||
- form_tag do
|
||||
%select{:onchange => "redirectTo(this)", :style => "font-size: 0.9em;margin-left:1em;"}
|
||||
= options_for_select(@suppliers.collect {|s| [ s.name, url_for(:action => "list", :id => s)] }, url_for(:action => "list", :id => @supplier.id))
|
||||
|
||||
- unless @supplier.shared_supplier.nil?
|
||||
#import.single_column{:style => "display:none; clear:both"}
|
||||
.box_title
|
||||
%h2=_ 'Import articles'
|
||||
.column_content
|
||||
#search{:style => "padding-bottom:3em"}
|
||||
- form_remote_tag :url => {:action => "list_shared_articles", :id => @supplier}, :before => "Element.show('loader')", :success => "Element.hide('loader')" do
|
||||
= text_field_tag :import_query, params['import_query'], :size => 10
|
||||
= submit_tag _('Search articles')
|
||||
- if @supplier.shared_supplier.lists
|
||||
=_ "Search in following lists: "
|
||||
- @supplier.shared_supplier.lists.each do |token, name|
|
||||
= check_box_tag "lists[#{token}]", "1", true
|
||||
= name
|
||||
|
|
||||
=_ "only regional:"
|
||||
= check_box_tag "regional", "1", false
|
||||
#search_results
|
||||
// "import_search_results" will be rendered
|
||||
= link_to_function _('Close'), "Element.hide('import')"
|
||||
|
||||
.single_column{:style => 'width:100%; clear:both'}
|
||||
.box_title
|
||||
.column_content
|
||||
#links
|
||||
%b= link_to_remote( _('New article'), :url => {:action => 'newArticle', :supplier => @supplier}, :before => "Element.show('loader')", :success => "Element.hide('loader')")
|
||||
|
|
||||
= link_to _('Edit all'), :action => 'edit_all', :id => @supplier
|
||||
|
|
||||
= link_to _('Upload articles'), :action => 'upload_articles'
|
||||
|
|
||||
= link_to_if @current_user.role_orders?, _('Create order'), {:controller => 'orders', :action => 'new', :id => @supplier }
|
||||
|
||||
#article_filter
|
||||
#article_search_form{:style=>"display:inline;"}
|
||||
- form_remote_tag :url => {:action => "list", :id => @supplier}, :before => "Element.show('loader')", :success => "Element.hide('loader')" do
|
||||
%label{:for => 'article_name'}=_ "Search in article name: "
|
||||
= text_field_tag("query", params['query'], :size => 10 )
|
||||
= submit_tag _('Search')
|
||||
|
||||
%form{ :method => 'post', :action => url_for(:action => 'update_selected_articles', :only_path => true), :id => 'articlesInListForm'}
|
||||
#table
|
||||
= render :partial => 'list'
|
||||
%br/
|
||||
= link_to _('Back'), :action => 'index'
|
||||
#edit_article{:style => "display:none"}
|
||||
|
||||
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
%h1=_ "Upload Articles"
|
||||
%p
|
||||
%i
|
||||
=_ "Please check the parsed articles and choose a supplier at the end of page."
|
||||
%br/
|
||||
=_ "At the moment there is now checking of dublicate articles."
|
||||
|
||||
- form_tag(:action => 'create_articles_from_file') do
|
||||
%table.list
|
||||
%tr
|
||||
%th=_ "Number"
|
||||
%th=_ "Name"
|
||||
%th=_ "Note"
|
||||
%th=_ "Manufacturer"
|
||||
%th=_ "Origin"
|
||||
%th=_ "Unit"
|
||||
%th=_ "Net price"
|
||||
%th=_ "Tax"
|
||||
%th=_ "Deposit"
|
||||
%th=_ "Unit quantity"
|
||||
%th=_ "Category"
|
||||
- for @article in @articles
|
||||
%tr{:class => cycle('even', 'odd')}
|
||||
%td= text_field 'article[]', 'order_number', :size => 6
|
||||
%td= text_field 'article[]', 'name', :size => 0
|
||||
%td= text_field 'article[]', 'note', :size => 15
|
||||
%td= text_field 'article[]', 'manufacturer', :size => 6
|
||||
%td= text_field 'article[]', 'origin', :size => 6
|
||||
%td= text_field 'article[]', 'unit', :size => 5
|
||||
%td= text_field 'article[]', 'net_price', :size => 4
|
||||
%td= text_field 'article[]', 'tax', :size => 4
|
||||
%td= text_field 'article[]', 'deposit', :size => 4
|
||||
%td= text_field 'article[]', 'unit_quantity', :size => 4
|
||||
%td= select('article[]', 'article_category_id', ArticleCategory.find(:all).collect {|a| [ a.name, a.id ] })
|
||||
%p
|
||||
=_ "Choose a supplier:"
|
||||
= select('supplier', 'id', Supplier.find(:all).collect {|s| [ s.name, s.id ] }, :selected => nil)
|
||||
= submit_tag _("Save articles")
|
||||
%p= link_to _("Back"), :action => 'upload_articles'
|
||||
|
||||
40
app/views/articles/parse_upload.html.haml
Normal file
40
app/views/articles/parse_upload.html.haml
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
- title "#{@supplier.name} / Artikel hochladen"
|
||||
%p
|
||||
%i
|
||||
=_ "Please check the parsed articles and choose a supplier at the end of page."
|
||||
%br/
|
||||
=_ "At the moment there is no checking of dublicate articles."
|
||||
|
||||
- form_tag(create_from_upload_supplier_articles_path(@supplier)) do
|
||||
%table
|
||||
%tr
|
||||
%th=_ "Number"
|
||||
%th=_ "Name"
|
||||
%th=_ "Note"
|
||||
%th=_ "Manufacturer"
|
||||
%th=_ "Origin"
|
||||
%th=_ "Unit"
|
||||
%th=_ "Net price"
|
||||
%th=_ "Tax"
|
||||
%th=_ "Deposit"
|
||||
%th=_ "Unit quantity"
|
||||
%th=_ "Category"
|
||||
- for article in @articles
|
||||
- fields_for "articles[]", article do |form|
|
||||
%tr{:class => cycle('even', 'odd')}
|
||||
%td= form.text_field 'order_number', :size => 6
|
||||
%td= form.text_field 'name', :size => 0
|
||||
%td= form.text_field 'note', :size => 15
|
||||
%td= form.text_field 'manufacturer', :size => 6
|
||||
%td= form.text_field 'origin', :size => 6
|
||||
%td= form.text_field 'unit', :size => 5
|
||||
%td= form.text_field 'net_price', :size => 4
|
||||
%td= form.text_field 'tax', :size => 4
|
||||
%td= form.text_field 'deposit', :size => 4
|
||||
%td= form.text_field 'unit_quantity', :size => 4
|
||||
%td= form.select 'article_category_id', ArticleCategory.find(:all).collect {|a| [ a.name, a.id ] }
|
||||
%p
|
||||
= submit_tag "Save new Articles for #{@supplier.name}"
|
||||
|
|
||||
= link_to _("Back"), upload_supplier_articles_path(@supplier)
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
%h1 Artikel mit externer Datenbank synchronisieren
|
||||
|
||||
- form_tag :action => 'update_all', :id => @supplier, :sync => "1" do
|
||||
- form_tag update_all_supplier_articles_path(@supplier, :sync => "1") do
|
||||
%h2 Auslisten ...
|
||||
%p
|
||||
- unless @outlisted_articles.empty?
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
%h1=_ "Upload articles"
|
||||
- title "#{@supplier.name} / Artikel hochladen"
|
||||
%p
|
||||
%i
|
||||
=_ 'The file-type must be "csv" (textfile). Use a semicolon (";") to seperate the fields and double quotes ("Bananas...") for the text.'
|
||||
|
|
@ -13,6 +13,6 @@
|
|||
_("Scale quantity"), _("Scale price"), _("Category")].join(" | ") |
|
||||
|
||||
#uploadArticles.uploadForm
|
||||
- form_for(:articles, :url => {:action => 'parse_articles'}, :html => { :multipart => true }) do |form|
|
||||
- form_for(:articles, :url => parse_upload_supplier_articles_path(@supplier), :html => { :multipart => true }) do |form|
|
||||
%p= form.file_field("file")
|
||||
%p= submit_tag _("Upload articles")
|
||||
Loading…
Add table
Add a link
Reference in a new issue