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

<ol id="bread_list" class="m_btm"><li class="bread_top"><%= link_to "トップページ", :controller => :portal, :action => :show %></li><li><%= link_to "マイページ", :controller => :accounts, :action => :history_list %></li><li>お届け先一覧</li></ol>
<h2 class="main_t">マイページ</h2>
<div id="mypage" class="clearfix">
  <!-- マイメニュー -->
  <%= render :partial=> "user/navigation" %>
  <!-- お届け先設定 -->
  <div id="mypage_main">
    <h3><%= image_tag("mypage/mypage_t3.gif", :width => "535", :height => "44", :alt => "お届け先設定") %></h3>
    <div class="mypage_box">
      <div><%= flash[:notice] %></div>
      <div><%= flash[:error] %></div>
      <%= error_messages_for :delivery_address if @delivery_address %>
      <% if @delivery_addresses.count < 20 %>
        <p class="m_btm"><%= link_to @delivery_addresses.count == 0 ? '新しいお届け先の追加・変更' : '新しいお届け先を追加する', :action => :delivery_new %></p>
      <% end %>
      <% if @delivery_addresses.count == 0 %>
        <p class="m_btm">新しいお届け先はありません。</p>
      <% else %>
        <table class="tb2">
          <p class="tb_t">お届け先</p>
          <% @delivery_addresses.each_with_index do | address, i | %>
            <tr>
              <th><%= i+1 %></th>
              <td>お届け先住所</td>
              <td>
                〒<%= address.zipcode01 %>-<%= address.zipcode02 %><br />
                <%= address.prefecture.name %><%= address.address_city %><br /><%= address.address_detail %><br />
                <%= address.family_name %> <%= address.first_name %>
              </td>
              <td class="buttom">
                <%= link_to '変更', :action => :delivery_edit, :id => address.id %>
              </td>
              <td class="buttom">
                <%= link_to '削除', {:action => :delivery_destroy, :id => address.id}, :confirm => '本当に削除しますか？' %>
              </td>
            </tr>
          <% end %>
        </table>
      <% end %>
    </div>
    <div><%= image_tag("mypage/mypage_btm.gif", :width => "535", :height => "5", :alt => "") %></div>
  </div><!-- /mypage_main -->
</div><!-- /mypage -->
