<commit_before>{% import 'macros.twig' as scat %}
{% import _self as s %}

{% macro style_item_color(color) %}
  {% if color %}
    {% set r= color[:2]|hexdec %}
    {% set g= color[2:2]|hexdec %}
    {% set b= color[4:2]|hexdec %}
    background: #{{ color }};
    color: #{{ ((r * 0.2126 + g * 0.7152 + b * 0.0722) > 179) ? '000' : 'fff' }}
  {% endif %}
{% endmacro %}

<tr data-id="{{ i.id }}"
    class="{{ (item and item.id == i.id) ? 'info' }}
           {{ not i.active ? 'inactive' }}">
  <td class="item-select">
    <input type="checkbox" checked>
  </td>
  <td>
    <a href="{{ url_for('catalog-item', { 'code' : i.code }) }}">
      {{- i.code -}}
    </a><br>
    {% if i.width == 0 or i.weight == 0 %}
      <small class="text-danger"><i class="fa fa-cube"></i>
    {% endif %}
    {% if not i.media|length %}
      <small class="text-danger"><i class="fa fa-file-image-o"></i>
    {% endif %}
  </td>
  <td class="item-name" style="{{ s.style_item_color(i.color) }}">
    <span class="editable"
          data-pk="{{ i.code }}"
          data-name="name">
    {{- i.name -}}
  </td>
  <td class="item-short-name" style="{{ s.style_item_color(i.color) }}">
    <span class="editable"
          data-pk="{{ i.code }}"
          data-name="short_name">
    {{- i.short_name -}}
  </td>
  <td class="text-right" nowrap>
    <span class="editable"
          data-pk="{{ i.code }}"
          data-name="retail_price" data-value="{{ i.retail_price }}">
      {{ scat.amount(i.retail_price) }}
    </span>
  </td>
  <td class="text-right" nowrap>
    <span class="editable"
          data-pk="{{ i.code }}"
          data-name="discount" data-value="{{ i.discount }}">
      {{ scat.amount(i.sale_price) }}
      {% if i.discount_type in [ 'percentage', 'relative' ] %}
        <br>
        <small>{{ scat.format_discount(i) }}</small>
      {% endif %}
    </span>
  </td>
  <td class="text-center">
    <span class="editable"
          data-pk="{{ i.code }}"
          data-name="stock" data-value="{{ i.stock }}">
      {{ i.stock }}
    </span>
  </td>
  <td class="text-center">
    <span class="editable"
          data-pk="{{ i.code }}"
          data-name="minimum_quantity" data-value="{{ i.minimum_quantity }}">
      {{ i.minimum_quantity }}
    </span>
  </td>
  <td class="text-center">{{ i.recent_sales.units }}</td>
  <td class="text-right" nowrap>
    {% if i.prop65 %}
      <span title="{{ i.prop65_warning.warning }}"><img src="{{ STATIC }}/msds/warning.svg" width="16" alt="WARNING"></span>
    {% endif %}
    {% if i.hazmat %}
      <span title="Hazardous materials: special shipping is required, and there may be additional costs."><img src="{{ STATIC }}/msds/dot-limited-quantity-surface.svg" width="16" alt="Hazardous Materials"></span>
    {% endif %}
    {% if i.oversized %}
      <span title="Oversized item: special shipping is required, and there will be additional costs."><i class="fa fa-truck"></i></span>
    {% endif %}
    {% if i.product_id %}
      <a class="product-link" href="{{ i.product.full_slug }}">
        <i class="fa fa-cubes"></i>
      </a>
    {% endif %}
  </td>
{# critical that <script> be inside tr so currentScript.parentNode works #}
<script><commit_msg>Include product breadcrumb on item rows<commit_after>{% import 'macros.twig' as scat %}
{% import _self as s %}

{% macro style_item_color(color) %}
  {% if color %}
    {% set r= color[:2]|hexdec %}
    {% set g= color[2:2]|hexdec %}
    {% set b= color[4:2]|hexdec %}
    background: #{{ color }};
    color: #{{ ((r * 0.2126 + g * 0.7152 + b * 0.0722) > 179) ? '000' : 'fff' }}
  {% endif %}
{% endmacro %}

<tr data-id="{{ i.id }}"
    class="{{ (item and item.id == i.id) ? 'info' }}
           {{ not i.active ? 'inactive' }}">
  <td class="item-select">
    <input type="checkbox" checked>
  </td>
  <td>
    <a href="{{ url_for('catalog-item', { 'code' : i.code }) }}">
      {{- i.code -}}
    </a><br>
    {% if i.width == 0 or i.weight == 0 %}
      <small class="text-danger"><i class="fa fa-cube"></i>
    {% endif %}
    {% if not i.media|length %}
      <small class="text-danger"><i class="fa fa-file-image-o"></i>
    {% endif %}
  </td>
  <td class="item-name" style="{{ s.style_item_color(i.color) }}">
    <span class="editable"
          data-pk="{{ i.code }}"
          data-name="name">
      {{- i.name -}}
    </span>
    {% if i.product_id %}
      <br>
      <small class="product-link text-muted ">
        <a href="{{ i.product.dept.parent.full_slug }}">
          {{ i.product.dept.parent.name }}
        </a>
        /
        <a href="{{ i.product.dept.full_slug }}">
          {{ i.product.dept.name }}
        </a>
        /
        <a href="{{ i.product.full_slug }}">
          {{ i.product.name }}
        </a>
      </small>
    {% endif %}
  </td>
  <td class="item-short-name" style="{{ s.style_item_color(i.color) }}">
    <span class="editable"
          data-pk="{{ i.code }}"
          data-name="short_name">
    {{- i.short_name -}}
  </td>
  <td class="text-right" nowrap>
    <span class="editable"
          data-pk="{{ i.code }}"
          data-name="retail_price" data-value="{{ i.retail_price }}">
      {{ scat.amount(i.retail_price) }}
    </span>
  </td>
  <td class="text-right" nowrap>
    <span class="editable"
          data-pk="{{ i.code }}"
          data-name="discount" data-value="{{ i.discount }}">
      {{ scat.amount(i.sale_price) }}
      {% if i.discount_type in [ 'percentage', 'relative' ] %}
        <br>
        <small>{{ scat.format_discount(i) }}</small>
      {% endif %}
    </span>
  </td>
  <td class="text-center">
    <span class="editable"
          data-pk="{{ i.code }}"
          data-name="stock" data-value="{{ i.stock }}">
      {{ i.stock }}
    </span>
  </td>
  <td class="text-center">
    <span class="editable"
          data-pk="{{ i.code }}"
          data-name="minimum_quantity" data-value="{{ i.minimum_quantity }}">
      {{ i.minimum_quantity }}
    </span>
  </td>
  <td class="text-center">{{ i.recent_sales.units }}</td>
  <td class="text-right" nowrap>
    {% if i.prop65 %}
      <span title="{{ i.prop65_warning.warning }}"><img src="{{ STATIC }}/msds/warning.svg" width="16" alt="WARNING"></span>
    {% endif %}
    {% if i.hazmat %}
      <span title="Hazardous materials: special shipping is required, and there may be additional costs."><img src="{{ STATIC }}/msds/dot-limited-quantity-surface.svg" width="16" alt="Hazardous Materials"></span>
    {% endif %}
    {% if i.oversized %}
      <span title="Oversized item: special shipping is required, and there will be additional costs."><i class="fa fa-truck"></i></span>
    {% endif %}
  </td>
{# critical that <script> be inside tr so currentScript.parentNode works #}
<script>
{'fraction_non_alphanumeric': 0.22025129342202512, 'fraction_numerical': 0.010643015521064302, 'mean_word_length': 2.52212389380531, 'pattern_counts': {'":': 0, '<': 129, '<?xml version=': 0, '>': 131, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4005602', 'n_tokens_mistral': 2565, 'n_tokens_neox': 2386, 'n_words': 507}