559Labs/django-dtg-store-manager

View on GitHub
src/business/templates/app_product/home.html

Summary

Maintainability
Test Coverage
{% extends "base.html" %}
{% load staticfiles crispy_forms_tags humanize %}
{% load render_table from django_tables2 %}
{% block title %}{{ block.super }}{{ active_apptitle }}{% endblock %}

{% block navbar-left %}
  {% include "_navbar.html" %}
{% endblock %}

{% block navbar-secondary %}{% endblock %}

{% block container %}
<form method="post">
  <div class="container business-head">
    <div class="row">
      <div class="col-md-12">
        <h3><small><span class="glyphicon glyphicon-sunglasses"></span></small>
          Product Catalog {% if active_product %}<small>/ {{ active_product }}</small>{% endif %}
          <span class="pull-right">
            <div class="btn-group" role="group">
              <a href="{% url 'business:app_product_create' %}" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-plus"></span> New</a>
              {% if active_product %}
              <a href="{% url 'business:app_product_update' active_product.pk %}" role="button" class="btn btn-default btn-sm">
                <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit</a>
              {% endif %}
            </div>
          </span>
        </h3>
      </div>
    </div>
  </div>
  <div class="container business-body">
    <div class="row">
      <div class="col-md-3" id="navSidebar">
        <div class="list-group">
          {% if products %}
          {% for p in products %}
          <a href="{% url 'business:app_product_home' product=p.pk %}" class="list-group-item {% if active_product == p %} active{% endif %}">
            <span class="badge" data-toggle="tooltip" data-placement="bottom" title="{{ p.status }} / {{ p.num_variants }} Variants">
              {{ p.status }} / {{ p.num_variants }}</span>
            <span data-toggle="tooltip" data-placement="right" title="{{ p }}">{{ p|truncatechars:30 }}</span>
          </a>
          {% endfor %}
          {% endif %}
        </div>
      </div>
      <div class="col-md-9" id="pageContent">
        {% if active_product %}
        <ul class="nav nav-tabs" role="tablist">
          <li role="presentation" class="active"><a href="#detail" aria-controls="detail" role="tab" data-toggle="tab">About</a></li>
          <li role="presentation"><a href="#variants" aria-controls="designs" role="tab" data-toggle="tab">Variants</a></li>
        </ul>
        <div class="tab-content business-body">
          <div role="tabpanel" class="tab-pane active" id="detail">
            <div class="text-right"></div>
            <table class="table table-striped">
              <tr>
                <th>Name</th>
                <td>{{ active_product.name }}</td>
              </tr>
              <tr>
                <th>SKU Code Base</th>
                <td>{{ active_product.code }}</td>
              </tr>
              <tr>
                <th>Status</th>
                <td>{{ active_product.status }}</td>
              </tr>
              <tr>
                <th>Design</th>
                <td>{{ active_product.bzDesign }}</td>
              </tr>
              <tr>
                <th>Layout</th>
                <td>{{ active_product.bzLayout }}</td>
              </tr>
              <tr>
                <th>Brand</th>
                <td>{{ active_product.bzDesign.bzcreativecollection.bzbrand }}</td>
              </tr>
              <tr>
                <th>Colors</th>
                <td><strong>{{ active_product.colors.count|apnumber|title }}:</strong> {{ active_product.get_colors_as_string }}</td>
              </tr>
              <tr>
                <th>Sizes</th>
                <td><strong>{{ active_product.sizes.count|apnumber|title }}:</strong> {{ active_product.get_sizes_as_string }}</td>
              </tr>
              <tr>
                <th>Printful Product</th>
                <td>{{ active_product.pfProduct }}</td>
              </tr>
              <tr>
                <th>WooCommerce Product</th>
                <td>{{ active_product.wooProduct }}</td>
              </tr>
              <tr>
                <th>Printful Sync Product</th>
                <td>{{ active_product.pfSyncProduct }}</td>
              </tr>
              <tr>
                <th>UUID</th>
                <td>{{ active_product.pk }}</td>
              </tr>
              <tr>
                <th>Created</th>
                <td>{{ active_product.date_added|naturaltime }}</td>
              </tr>
              <tr>
                <th>Updated</th>
                <td>{{ active_product.date_updated|naturaltime }}</td>
              </tr>

            </table>
          </div>
          <div role="tabpanel" class="tab-pane" id="variants">
            <div class="text-right">
              [TK]
            </div>
            {% render_table table_variants %}
          </div>
        </div>
        {% else %}
        No products yet. Create one!
        {% endif %}
      </div>
    </div>
  </div>
</form>
{% endblock %}

{% block scripts %}
<script>$(function(){ $('[data-toggle="tooltip"]').tooltip() })</script>
{% endblock %}