{% extends 'simulation/product/product_manage.html' %}
{% block product_list %}
    {% load humanize %}
    <table class="product_list">
        <colgroup>
            <col width="5%" />
            <col width="10%" />
            <col width="10%" />
            <col width="10%" />
            <col width="10%" />
            <col width="10%" />
            <col width="30%" />
            <col width="15%" />
        </colgroup>
        <thead>
            <tr>
                <th>No.</th>
                <th>이름</th>
                <th>계절</th>
                <th>복종</th>
                <th>품목</th>
                <th>업로더</th>
                <th>등록일</th>
                <th>txm파일</th>
            </tr>
        </thead>
        <tbody>
        {% for product in object_list %}
            <tr class="product_info_tr">
                <td>{{ product.id }}</td>
                <td>{{ product.name }}</td>
                <td>{{ product.get_season_display }}</td>
                <td>{{ product.get_style_display }}</td>
                <td>{{ product.product_type.get_name_display }}</td>
                <td>{{ product.user }}</td>
                <td>{{ product.create_date }}</td>
                <td><a href="{{ product.txm.url }}">txm다운로드</a></td>
            </tr>
            <tr class="product_thumb_tr">
                <td colspan="8">
                    <ul class="product_color">
                    {% for fabric in product.mainfabric_set.all %}
                        <li class="product_color_info">
                            <div style="line-height: 190px;">
                                <img src="{{ fabric.mapping_thumb.url }}" />
                            </div>
                            <div>
                                <br><br>
                                <span>코드 : {{ product.name }}-{{ fabric.index }}</span><br>
                                <span>가격 : {{ fabric.price|intcomma }}원</span><br>
                            </div>
                            <table class="item-size-table">
                                <tr>
                                    <th>90</th>
                                    <th>100</th>
                                    <th>110</th>
                                    <th>120</th>
                                </tr>
                                <tr>
                                    <td>{% if fabric.stock90 == None %}0개 {% else %} {{ fabric.stock90 }}개 {% endif %}</td>
                                    <td>{% if fabric.stock100 == None %}0개 {% else %} {{ fabric.stock100 }}개 {% endif %}</td>
                                    <td>{% if fabric.stock110 == None %}0개 {% else %} {{ fabric.stock110 }}개 {% endif %}</td>
                                    <td>{% if fabric.stock120 == None %}0개 {% else %} {{ fabric.stock120 }}개 {% endif %}</td>
                                </tr>
                                <tr>
                                    <th>130</th>
                                    <th>140</th>
                                    <th>150</th>
                                    <th style="background-color: #FFCC75;">총합</th>
                                </tr>
                                <tr>
                                    <td>{% if fabric.stock130 == None %}0개 {% else %} {{ fabric.stock130 }}개 {% endif %}</td>
                                    <td>{% if fabric.stock140 == None %}0개 {% else %} {{ fabric.stock140 }}개 {% endif %}</td>
                                    <td>{% if fabric.stock150 == None %}0개 {% else %} {{ fabric.stock150 }}개 {% endif %}</td>
                                    <td>{% if fabric.stock == None %}0개 {% else %} {{ fabric.stock }}개 {% endif %}</td>
                                </tr>
                            </table>
                        </li>
                    {% endfor %}
                    </ul>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
{% endblock product_list %}