<div class="mypage">

  <section class="profile d-flex px-3 py-3">
    <!-- Desktop -->
    <div class="profile-img-box">
        <%=image_tag(current_user.image0, class: "profile-img visible-lg") if current_user.image0 != nil%>

       <!-- 디폴트 이미지 필요 -->
        <%=image_tag("default.png", class: "profile-img visible-lg") if current_user.image0 == nil%>

         <%#=image_tag(current_user.image0, class: "profile-img visible-lg") if current_user.image0 != nil%>
    </div>
    <!-- // Desktop -->
    <div class="mylog font-12 font-lg-14 my-auto justify-content-around">
      <!-- Desktop -->
      <div class="user-email-box visible-lg my-3 d-flex">
        <h4 class="font-30 user-email ml-3 mb-0">
          <%=current_user.email%>
        </h4>
        <a href="/userupdaters/<%= current_user.id %>/edit" class="d-block text-center mypage-edit font-14 ml-3 mt-1">개인정보 수정</a>
        <% if current_user.provider == nil || current_user.provider == "" %>
           <a href="/users/edit" class="d-block text-center mypage-edit font-14 ml-3 mt-1"> 비밀번호 수정 </a>
        <% end %>
      </div>
      <!-- // Desktop -->
      <div class="d-flex my-md-3" id="mypage-mylogbox">
        <div class="mylog-box mx-2 ml-md-3 mr-md-4 text-center">
          <p class="mb-0 font-weight-bold font-18 visible-xs"> <%= @ordered_product_count %>  </p>
          <p class="text-grey mb-2 font-weight-bold">인생법안
            <span class="font-18 ml-md-1 font-weight-bold visible-lg font-black"><%= @ordered_product_count %></span>
          </p>
        </div>
        <div class="mylog-box mx-2 mr-md-4 text-center">
          <p class="mb-0 font-weight-bold font-18 visible-xs"> <%= current_user.product_likes.where(status: true).count %>  </p>
          <p class="text-grey mb-2 font-weight-bold">관심법안
            <span class="font-18 ml-md-1 font-weight-bold visible-lg font-black"><%= current_user.product_likes.where(status: true).count %></span>
          </p>
        </div>
        <div class="mylog-box mx-2 text-center">
          <p class="mb-0 font-weight-bold font-18 visible-xs">0</p>
          <p class="text-grey mb-2 font-weight-bold">새로운 소식
          <span class="font-18 ml-md-1 font-weight-bold visible-lg font-black">0</span></p>

        </div>
      </div>
      <div class="d-flex justify-content-between">
        <a href="/userupdaters/<%= current_user.id%>/edit" class="mx-1 d-inline-block text-center mypage-edit font-14 visible-xs">개인정보 수정</a>
        <% if current_user.provider == nil || current_user.provider == "" %>
           <a href="/users/edit" class="mx-1 d-inline-block text-center mypage-edit font-14 visible-xs"> 비밀번호 수정 </a>
        <% end %>
      </div>

    </div>
    <%=image_tag(current_user.image0, class: "profile-img visible-xs") if current_user.image0 != nil%>

   <!-- 디폴트 이미지 필요 -->
    <%=image_tag("default.png", class: "profile-img visible-xs") if current_user.image0 == nil%>
  </section>
  <hr>
  <div class="container">
    <div class="row" id="my-product-row">
      <% current_user.product_orders.each do |product_order| %>
          <div class="my-product-card text-center col-4 col-md-3 px-0 mx-md-3 my-md-3">
            <a href="/product/<%= product_order.product.id%>" class="d-block h-100 w-100">
            <div class="my-product-card-body text-white h-100t"  style="background-image: url(<%= product_order.package.image0 %>);">
              <div class="my-product-card-text-wrapper py-lg-3 d-flex flex-column justify-content-center h-100">
                <h4 class="font-12 font-weight-bold"><%= product_order.product.name %></h4>
                <pre class="font-12 text-white text-center mb-0">
<%= product_order.package.name %>
<%= product_order.product_order_detail.total_price %>원 후원
<%= product_order.product.goods_dilivery_date_s %> 배송예정
<%=product_order.status%></pre>
              </div>
            </div>
            </a>
          </div>
        <% end %>
      <% current_user.product_likes.where(status: true).each do |product_like|%>

        <div class="my-product-card col-4 text-center col-4 col-md-3 px-0 mx-md-3 my-md-3" style="background-image: url(<%= product_like.product.image0 %>);">
          <a href="/product/<%= product_like.product.id %>" class="d-block h-100">
          <%=image_tag("layer.png", class:"layer-img w-100")%>
          </a>
        </div>
      <% end %>
    </div>

  </div>
  <hr>

  <section class="news-wrapper font-14">
<!--    <h4>새로운 소식</h4>-->
<!--    <div class="news px-3 py-3">-->
<!--      <span>8/20</span>-->
<!--      <p>'데이트폭력법'</p>-->
<!--      <p>국회의원 1명이 새롭게 응답했습니다.</p>-->
<!--    </div>-->
<!--    <div class="news px-3 py-3">-->
<!--      <span>8/20</span>-->
<!--      <p>'데이트폭력법'</p>-->
<!--      <p>국회의원 1명이 새롭게 응답했습니다.</p>-->
<!--    </div>-->
  </section>

</div>
<%=render '/home/bottom_bar'%>
<script type="text/javascript">
  $(document).ready(function(){
    let wid = $('.my-product-card').width();
    $('.my-product-card-body').css({'height':(wid)+'px'});
  });
  $(window).resize(function(){
    let wid = $('.my-product-card').width();
    $('.my-product-card-body').css({'height':(wid)+'px'});
  })
</script>
