<%= render :partial => "submenu" %>

<div id="main"><!-- メイン -->

<h2>規格分類登録</h2>

<p><%= link_to "規格管理に戻る", admin_styles_path %></p>
<br />
<ul>
  <% Style.find(:all, :conditions=> ["retailer_id = ? ", session[:admin_user].retailer_id]).each do | style | %>
    <li>
      <%= style.id.to_s != params[:style_id].to_s ?  link_to(h(style.name), :style_id => style.id) : h(style.name)%><br>
    </li>
  <% end %>
</ul>
<br />
<div class="btn_t">
  <input type="button" class="btn_s" value="新規登録" onclick="location.href='/admin/style_categories?style_id=<%=h params[:style_id] %>'">
</div>
<br />
<%=h flash[:notice] %>
<%=h flash[:error] %>
<%= render :partial => "form" %>
<br />
<table class="data2" cellspacing="1">
  <tr>
    <th>カテゴリ名</th>
    <th>編集</th>
    <th>削除</th>
  </tr>
  <% @style_categories && @style_categories.each_with_index do | record, idx | %>
  <tr>
    <td><%=h record.name %></td>
    <td class="t_center"><%= link_to "編集", { :action => "index", :id => record.id, :style_id => params[:style_id]} %></td>
    <td class="t_center">
     <% if record.has_product? %>
      <span title="関連する商品が存在するため削除できません">-</span>
     <% else %>
       <%= link_to "削除", admin_style_category_path(record.id, :style_id=>params[:style_id]), :confirm => "本当に削除しますか？", :method=>"delete" %>
     <% end %>
    </td>
  </tr>
<% end %>
</table>

</div><!-- /メイン -->
