<% content_for :head do %>
  <%= stylesheet_link_tag "front/cart" %>
<% end %>

<h2 class="main_t">ショッピングカート</h2>
<div id="cart">
<!-- ショッピングカート -->
  <%= image_tag("cart/route03.gif", :width => "583", :height => "31", :alt => "ご購入の流れ", :class => "route") %>
  <p class="tb_t">ご入力内容のご確認</p>
  <p class="m_btm">下記ご注文内容で送信してもよろしいでしょうか？<br />
  よろしければ、一番下の「ご注文完了ページへ」ボタンをクリックしてください。</p>

  <table class="tb1 cntr">
    <tr>
      <th width="90">商品画像</th>
      <th width="265">商品名</th>
      <th width="90">単価(税込み)</th>
      <th width="90">個数</th>
      <th width="90">計</th>
    </tr>
    <% @order_details.each_with_index do | detail, i | %>
    <tr>
      <td><%= link_to_product_image(detail.product, :small) %></td>
      <td><%=h detail.product_name %></td>
      <td><%= number_with_delimiter detail.price %>円</td>
      <td><%= number_with_delimiter detail.quantity %>個</td>
      <td><%= number_with_delimiter detail.subtotal %>円</td>
    </tr>
    <% end %>
    <tr>
      <td colspan="4" class="t_right">小計（税込み価格）</td>
      <td><%= number_with_delimiter @order_delivery.subtotal %>円</td>
    </tr>
    <tr>
      <td colspan="4" class="t_right">送料</td>
      <td><%= number_with_delimiter @order_delivery.deliv_fee %>円</td>
    </tr>
    <tr>
      <td colspan="4" class="t_right">手数料</td>
      <td><%= number_with_delimiter @order_delivery.charge %>円</td>
    </tr>
  </table>

  <table class="tb1 total2">
    <tr>
      <th>総計</th>
      <td><%= number_with_delimiter @order_delivery.total %>円</td>
    </tr>
  </table>

  <% if @login_customer %>

   <table class="tb1 point_tb">
    <tr>
     <th>ご注文前のポイント</th>
     <td width="90"><%= number_with_delimiter(@login_customer.point.to_i) %>Pt</td>
    </tr>
    <tr>
     <th>ご使用ポイント</th>
     <td>-<%= number_with_delimiter(@order_delivery.use_point.to_i) %>Pt</td>
    </tr>
    <tr>
     <th>今回加算されるポイント</th>
     <td>+<%= number_with_delimiter(@cart_point.to_i) %>Pt</td>
    </tr>
    <tr>
     <th>ご注文完了後のポイント</th>
     <td><%= number_with_delimiter(@point_after_operation.to_i) %>Pt</td>
    </tr>
   </table>
  <% end %>

  <table class="tb1 total2">
    <tr>
      <th>支払金額</th>
      <td width="90"><%= number_with_delimiter @order_delivery.payment_total %>円</td>
    </tr>
  </table>
<% if @not_login_customer%>
  <!-- 顧客情報 -->
  <p class="tb_t">お客様情報</p>
  <table class="tb2">
    <tr>
      <th width="130">お名前</th>
      <td>
        <%=h @order_delivery.family_name %>
        <%=h @order_delivery.first_name %>
      </td>
    </tr>
    <tr>
      <th>お名前（フリガナ）</th>
      <td>
        <%=h @order_delivery.family_name_kana %>
        <%=h @order_delivery.first_name_kana %>
      </td>
    </tr>
    <tr>
      <th>郵便番号</th>
      <td>〒<%=h @order_delivery.zipcode01 %>-<%=h @order_delivery.zipcode02 %></td>
    </tr>
    <tr>
      <th>住所</th>
      <td>
        <%=h @order_delivery.prefecture.name %>
        <%=h @order_delivery.address_city %>
        <%=h @order_delivery.address_detail %>
      </td>
    </tr>
    <tr>
      <th>電話番号</th>
      <td><%=h @order_delivery.tel01 %>-<%=h @order_delivery.tel02 %>-<%=h @order_delivery.tel03 %></td>
    </tr>
    <tr>
      <th>ファックス番号</th>
      <td><%=h @order_delivery.fax01 %>-<%=h @order_delivery.fax02 %>-<%=h @order_delivery.fax03 %></td>
    </tr>
    <tr>
      <th>性別</th>
      <td><%=h @order_delivery.sex_name %></td>
    </tr>
    <tr>
      <th>メールアドレス</th>
      <td><%=h @order_delivery.email %></td>
    </tr>
    <tr>
      <th>生年月日</th>
      <td><%=h @order_delivery.birthday %></td>
    </tr>
    <tr>
      <th>職業</th>
      <td><%=h @order_delivery.occupation && @order_delivery.occupation.name %></td>
    </tr>
  </table>
<% end %>
  <!-- お届け先 -->
  <p class="tb_t">お届け先</p>
  <table class="tb2">
    <tr>
      <th width="130">お名前</th>
      <td>
        <%=h @order_delivery.deliv_family_name %>
        <%=h @order_delivery.deliv_first_name %>
      </td>
    </tr>
    <tr>
      <th>お名前（フリガナ）</th>
      <td>
        <%=h @order_delivery.deliv_family_name_kana %>
        <%=h @order_delivery.deliv_first_name_kana %>
      </td>
    </tr>
    <tr>
      <th>郵便番号</th>
      <td>〒<%=h @order_delivery.deliv_zipcode01 %>-<%=h @order_delivery.deliv_zipcode02 %></td>
    </tr>
    <tr>
      <th>住所</th>
      <td>
        <%=h @order_delivery.deliv_pref_name %>
        <%=h @order_delivery.deliv_address_city %>
        <%=h @order_delivery.deliv_address_detail %>
      </td>
    </tr>
    <tr>
      <th>電話番号</th>
      <td><%=h @order_delivery.deliv_tel01 %>-<%=h @order_delivery.deliv_tel02 %>-<%=h @order_delivery.deliv_tel03 %></td>
    </tr>
  </table>

  <p class="tb_t">お支払方法・お届け時間</p>
  <table class="tb2">
    <tr>
      <th width="130">お支払方法</th>
      <td><%=h @order_delivery.payment.name %></td>
    </tr>
    <tr>
      <th>お届け時間</th>
      <td><%=h @order_delivery.delivery_time_name %></td>
    </tr>
  </table>
  <% form_tag :action => @next do %>
      <%= render :partial=>'order_delivery_hiddens' %>
	  <%= hidden_field_tag "point_after_operation", @point_after_operation %>
      <div class="cart_btn">
       <%=hidden_field :order_delivery,:use_point%>
       <%=hidden_field :order_delivery,:payment_id%>
       <%=hidden_field :order_delivery,:delivery_time_id%>
	   <%=hidden_field_tag "back"%>
	   <%= image_submit_tag '/images/cart/cart_btn03.gif', {:onClick => "this.form.action='/cart/purchase'; this.form.submit();document.getElementById('back').value=1",:width=>'135', :height=>'28', :alt=>'戻る', :class=>'hoverImg'} %>
       <%= image_submit_tag '/images/cart/cart_btn04.gif', :width=>'135', :height=>'28', :alt=>'注文を確定する', :class=>'hoverImg' %>
      </div>
  <% end %>
</div><!-- /cart -->
