<% title "Alle Artikel von #{@supplier.name} bearbeiten" %>

<div class="single_column" style="width:100%">
  <div id="change_supplier">
    <%= select_tag :switch_supplier,
                   options_for_select( Supplier.all.collect {|s| [s.name, edit_all_supplier_articles_url(s)] },
                                       edit_all_supplier_articles_url(@supplier)),
                   'data-redirect-to' => true,
                   :style => "font-size: 0.9em;margin-left:1em;" %>
  </div>
  <div class="box_title">
    <h2></h2>
  </div>
  <div class="box column_content">
    <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(update_all_supplier_articles_path(@supplier)) do %>
        <table id="articles_table" class="list">
          <thead>
          <tr>
            <th><acronym title="verfügbar">verf.</acronym></th>
            <th>Name</th>
            <th>Einheit</th>
            <th><acronym title="Netto!">Preis</acronym></th>
            <th><acronym title="Gebindegröße">GebGr</acronym></th>
            <th>Best.Nr.</th>
            <th>Notiz</th>
            <th>Kategorie</th>
            <th>MwSt.</th>
            <th>Pfand</th>
          </tr>
          <tbody>
          <% 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 '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 />
        <%= submit_tag 'Alle Artikel aktualisieren'%> | <%= link_to 'Abbrechen', supplier_articles_path(@supplier) %>
    <% end %>
  </div>
</div>