<%=h flash[:notice] %>
<%=h flash[:error] %>
<%= f.error_messages %>
<p class="req"><span class="pnt">※</span>は必須入力です</p>
<table class="data" cellspacing="1">
  <tr>
    <th>商品ID</th>
    <td>
      <%= h(@product.id) %>
    </td>
  </tr>
  <tr>
    <th>商品名<span class="pnt">※</span></th>
    <td>
      <%= confirm_tag :text_field, :product, :name, :class=>"data_m" %> (上限50文字)
    </td>
  </tr>
 <%if @system_supplier_use_flag%>
  <tr>
    <th>仕入先名<span class="pnt">※</span></th>
    <td><%suppliers = Supplier.list_by_retailer(session[:admin_user].retailer_id)%>
      <%= confirm_select(confirm_tag(:select, :product, :supplier_id, suppliers.map{|s| [s.name,s.id]}), @product.supplier.name, "product") %>
    </td>
  </tr>  
 <% end %>
 <%= hidden_field_tag "product[retailer_id]", session[:admin_user].retailer_id %>
 
  <tr>
    <th>カテゴリー名<span class="pnt">※</span></th>
    <td>
      <%= confirm_tag :category_select, :product, :category_id %>
    </td>
  </tr>
  <tr>
    <th>公開設定<span class="pnt">※</span></th>
    <td>
      <%= confirm_tag :select, :product, :permit, Product.permit_select %>
    </td>
  </tr>
  <tr>
    <th>商品ステータス</th>
    <td>
      <ul>
        <% Status.find(:all).each do | status | %>
          <% select_flg = @product_statuses.map{|p_s| p_s.status_id}.include?(status.id) %>
          <% select_flg = @old_product.product_statuses.map{|p_s| p_s.status_id}.include?(status.id) if params[:copy] %>
          <li><%= confirm_select((check_box_tag("product_status_ids[]", "#{status.id}",select_flg )+ h(status.name)), h(select_flg ? status.name : ""), "product") %></li>
        <% end %>
      </ul>
    </td>
  </tr>
  <tr>
    <th>価格</th>
    <td>
      <%= confirm_tag :text_field, :product, :price  %>円 (半角英数字で入力)
    </td>
  </tr>
  <tr>
    <th>配送日</th>
    <td>
      <%= confirm_select(confirm_tag(:select, :product, :delivery_dates, Product.delivery_dates_select), @product.delivery_dates_label, "product") %>
    </td>
  </tr>
  <tr>
    <th>入荷予定日</th>
    <td>
      <%= confirm_tag :date_select, :product, :arrival_expected_date, :use_month_numbers => true %>
    </td>
  </tr>
  <tr>
    <th>販売期間</th>
    <td>
      <%= confirm_tag :date_select, :product, :sale_start_at , :use_month_numbers => true%> ～
      <%= confirm_tag :date_select, :product, :sale_end_at , :use_month_numbers => true %>
    </td>
  </tr>
  <tr>
    <th>公開期間</th>
    <td>
      <%= confirm_tag :date_select, :product, :public_start_at , :use_month_numbers => true%> ～
      <%= confirm_tag :date_select, :product, :public_end_at , :use_month_numbers => true %>
    </td>
  </tr>
  <tr>
    <th>購入制限</th>
    <td>
      <%= confirm_select "#{text_field(:product, :sell_limit, :class=>"data_s")}個#{check_box(:product, :no_limit_flag, {:onchange => 'document.getElementById("record_sell_limit").value="";document.getElementById("record_sell_limit").disabled=document.getElementById("record_no_limit_flag").checked;'})}無制限",(@product.no_limit_flag ? "無制限"  : "#{@product.sell_limit}個"), "product" %>
    </td>
  </tr>
  <tr>
    <th>参照URL</th>
    <td>
      <%= confirm_tag :text_field, :product, :url, :class=>"data_m" %> (上限300文字)
    </td>
  </tr>
  <tr>
    <th>サイズ</th>
    <td>
      <%= confirm_tag :text_field, :product, :size_txt, :class=>"data_m" %>
    </td>
  </tr>
  <tr>
    <th>素材</th>
    <td>
      <%= confirm_tag :text_field, :product, :material, :class=>"data_m" %>
    </td>
  </tr>
  <tr>
    <th>原産国</th>
    <td>
      <%= confirm_tag :text_field, :product, :origin_country, :class=>"data_m" %>
    </td>
  </tr>
  <tr>
    <th>重さ</th>
    <td>
      <%= confirm_tag :text_field, :product, :weight, :class=>"data_m" %>
    </td>
  </tr>
  <tr>
    <th>入荷日</th>
    <td>
      <%= confirm_tag :text_field, :product, :arrival_date, :class=>"data_m" %>
    </td>
  </tr>
  <tr>
    <th>ポイント付与率</th>
    <td>
      <%= confirm_tag :text_field, :product, :point_granted_rate, :class=>"data_s" %>%
    </td>
  </tr>
  <tr>
    <th>その他</th>
    <td>
      <%= confirm_tag :text_area, :product, :other, :size => '60x10' %>
    </td>
  </tr>
  <tr>
    <th>検索ワード</th>
    <td>
      <%= confirm_tag :text_area, :product, :key_word, :size => '60x10' %><br />　
      (上限99999文字)
    </td>
  </tr>
  <tr>
    <th>一覧コメント <span class="pnt">※</span></th>
    <td>
      <%= confirm_tag :text_area, :product, :introduction, :size => '60x10' %><br />
      (上限99999文字)
    </td>
  </tr>
  <tr>
    <th>詳細コメント <span class="pnt">※</span></th>
    <td>
      <%= confirm_tag :text_area, :product, :description, :size => '60x10' %><br />
      (上限99999文字)
    </td>
  </tr>
  <tr>
    <th>一覧・メイン画像 <span class="pnt">※</span></th>
    <td>
      <%= confirm_tag :image_field, :product, :small_resource %><br />
      <%= confirm_tag :text_field, :product ,:small_resource_comment, :class=>"data_l" %>
    </td>
  </tr>
  <tr>
    <th>詳細・メイン画像 <span class="pnt">※</span></th>
    <td>
      <%= confirm_tag :image_field,  :product,:medium_resource %><br />
      <%= confirm_tag :text_field, :product ,:medium_resource_comment, :class=>"data_l" %>
    </td>
  </tr>
  <tr>
    <th>詳細・メイン拡大画像</th>
    <td>
      <%= confirm_tag :image_field,  :product,:large_resource%><br />
      <%= confirm_tag :text_field, :product ,:large_resource_comment, :class=>"data_l" %>
    </td>
  </tr>
  <tr>
    <th>フリー入力</th>
    <td>
      <%= confirm_tag :text_area, :product ,:free_comment, :size=>"60x10" %>
    </td>
  </tr>
  <tr>
    <td colspan="2">
      <p class="t_center"><input type="button" class="btn_s" value="サブ情報表示/非表示" onclick="$('sub_products').style.display = ($('sub_products').style.display == 'none') ? '' : 'none'; return false"></p>
    </td>
  </tr>
</table>
<table class="data" cellspacing="1" id="sub_products"style="display: none;">
  <% @sub_products.each do | sub_product | %>
    <%= render :partial => "sub_product", :locals => { :sub_product => sub_product,:product => @product} %>
  <% end %>
</table>
<%= hidden_field_tag "id", params[:id] %>
