<commit_before>{% extends 'layout/page.html' %}
{% import 'macros.twig' as scat %}

{% block title %}
  {{ txn.friendly_type }} {{ txn.formatted_number }}
{% endblock %}

{% block extra_head %}
  <script src="/extern/mousetrap-1.6.2/mousetrap.min.js"></script>
  <script src="/extern/mousetrap-1.6.2/plugins/global-bind/mousetrap-global-bind.min.js"></script>
{% endblock %}

{% block content %}
  <style>
    [data-action~="editable"] {
      border-bottom: 1px solid rgba(255, 0, 0, 0.2);
    }
    [data-action] {
      cursor: pointer;
    }
  </style>
  <div class="row">
    <div class="col-sm-9">
      {{ block('search') }}
      <br>
      <div id="search-results"></div>
      <div data-reload="invoice">
        {{ block('invoice') }}
      </div>
    </div>
    <div data-reload="sidebar" id="sidebar" class="col-md-3">
      {{ block('sidebar') }}
    </div>
  </div>
{% endblock %}

{% block search %}
  <form class="form form-inline" data-action="search">
    <div class="input-group">
      <span class="input-group-addon"><i class="fa fa-fw fa-barcode"></i></span>
      <input type="hidden" name="scope" value="items">
      <input type="text" class="form-control autofocus"
             name="q"
             autocomplete="off" autocorrect="off" autocapitalize="off"
             spellcheck="false"
             placeholder="Scan item or enter search terms"
             value="" size="200">
      <span class="input-group-btn">
        <input type="submit" class="btn btn-default" value="Find Items">
        <div class="btn-group">
          <button type="button" class="btn btn-default dropdown-toggle"
                  data-toggle="dropdown" aria-haspopup="true"
                  aria-expanded="false">
            Custom <span class="caret"></span>
          </button>
          <ul class="dropdown-menu">
            <li>
              <a data-action="add-item-by-code" data-code="ZZ-GIFT">
                Gift Card
              </a>
            </li>
            <li role="separator" class="divider"></li>
            <li>
              <a data-action="add-item-by-code" data-code="ZZ-FLOAT">
                Floater Frame
              </a>
            </li>
            <li>
              <a data-action="add-item-by-code" data-code="ZZ-CANVAS">
                Canvas
              </a>
            </li>
            <li>
              <a data-action="add-item-by-code" data-code="ZZ-PANEL">
                Panel
              </a>
            </li>
          </ul>
        </div>
      </span>
    </div>
  </form>
{% endblock %}

{% block invoice %}
  {% import 'macros.twig' as scat %}
  <div class="panel panel-default"
        data-txn-id="{{ txn.id }}" data-status="{{ txn.status }}">
    <style>
      #txn th:last-child, #txn td:last-child {
        padding-right: 1rem;
      }
    </style>
    <table id="txn" class="table table-striped table-condensed table-hover">
      <thead>
        <tr>
          <th></th>
          <th>Qty</th>
          <th>Rec</th>
          <th>Code</th>
          <th>SKU</th>
          <th width="50%">Name</th>
          <th style="text-align: right">Price</th>
          <th style="text-align: right">Ext</th>
        </tr>
      </thead>
      <tbody>
        {% for line in txn.items.find_many %}
          <tr data-id="{{ line.id }}" data-item-id="{{ line.item_id }}"
              data-editable-base="/sale/{{ txn.id }}/item/{{ line.id }}">
            <td>
              {% if not line.kit_id %}
                <a data-action="remove-item" class="btn btn-link btn-xs">
                  <i class="fa fa-fw fa-trash-o"></i>
                </a>
              {% endif %}
            </td>
            <td>
              <div data-action="editable" data-name="ordered">
                {{- (txn.type == 'vendor' ? 1 : -1) * line.ordered -}}
              </div>
            </td>
            <td>
              <div data-action="editable" data-name="allocated"
                   class="{{ (line.allocated < line.ordered) ? 'text-danger' }}">
                {{- (txn.type == 'vendor' ? 1 : -1) * line.allocated -}}
              </div>
            </td>
            <td>
              <a data-action="show-item-info" data-code="{{ line.code }}">
                {{ line.code }}
              </a>
            </td>
            <td>
              {{ line.vendor_sku }}
            </td>
            <td>
              <span data-action="editable" data-name="override_name">
                {{- line.name -}}
              </span>
              <div><small>{{ line.pricing_detail }}</small></div>
            </td>
            <td style="text-align: right">
              {% if not line.kit_id %}
                <div data-action="editable" data-name="sale_price">
                  {{- scat.amount(line.sale_price) -}}
                </div>
              {% endif %}
            </td>
            <td style="text-align: right">
              {% if not line.kit_id %}
                {{ scat.amount((txn.type == 'vendor' ? 1 : -1) * line.ext_price) }}
              {% endif %}
            </td>
          </tr>
        {% endfor %}
      </tbody>
      <tfoot><commit_msg>Fix display of quantities on correction<commit_after>{% extends 'layout/page.html' %}
{% import 'macros.twig' as scat %}

{% block title %}
  {{ txn.friendly_type }} {{ txn.formatted_number }}
{% endblock %}

{% block extra_head %}
  <script src="/extern/mousetrap-1.6.2/mousetrap.min.js"></script>
  <script src="/extern/mousetrap-1.6.2/plugins/global-bind/mousetrap-global-bind.min.js"></script>
{% endblock %}

{% block content %}
  <style>
    [data-action~="editable"] {
      border-bottom: 1px solid rgba(255, 0, 0, 0.2);
    }
    [data-action] {
      cursor: pointer;
    }
  </style>
  <div class="row">
    <div class="col-sm-9">
      {{ block('search') }}
      <br>
      <div id="search-results"></div>
      <div data-reload="invoice">
        {{ block('invoice') }}
      </div>
    </div>
    <div data-reload="sidebar" id="sidebar" class="col-md-3">
      {{ block('sidebar') }}
    </div>
  </div>
{% endblock %}

{% block search %}
  <form class="form form-inline" data-action="search">
    <div class="input-group">
      <span class="input-group-addon"><i class="fa fa-fw fa-barcode"></i></span>
      <input type="hidden" name="scope" value="items">
      <input type="text" class="form-control autofocus"
             name="q"
             autocomplete="off" autocorrect="off" autocapitalize="off"
             spellcheck="false"
             placeholder="Scan item or enter search terms"
             value="" size="200">
      <span class="input-group-btn">
        <input type="submit" class="btn btn-default" value="Find Items">
      </span>
    </div>
  </form>
{% endblock %}

{% block invoice %}
  {% import 'macros.twig' as scat %}
  <div class="panel panel-default"
        data-txn-id="{{ txn.id }}" data-status="{{ txn.status }}">
    <style>
      #txn th:last-child, #txn td:last-child {
        padding-right: 1rem;
      }
    </style>
    <table id="txn" class="table table-striped table-condensed table-hover">
      <thead>
        <tr>
          <th></th>
          <th>Qty</th>
          <th>Rec</th>
          <th>Code</th>
          <th>SKU</th>
          <th width="50%">Name</th>
          <th style="text-align: right">Price</th>
          <th style="text-align: right">Ext</th>
        </tr>
      </thead>
      <tbody>
        {% for line in txn.items.find_many %}
          <tr data-id="{{ line.id }}" data-item-id="{{ line.item_id }}"
              data-editable-base="/sale/{{ txn.id }}/item/{{ line.id }}">
            <td>
              {% if not line.kit_id %}
                <a data-action="remove-item" class="btn btn-link btn-xs">
                  <i class="fa fa-fw fa-trash-o"></i>
                </a>
              {% endif %}
            </td>
            <td>
              <div data-action="editable" data-name="ordered">
                {{- (txn.type == 'correction' ? 1 : -1) * line.ordered -}}
              </div>
            </td>
            <td>
              <div data-action="editable" data-name="allocated"
                   class="{{ (line.allocated < line.ordered) ? 'text-danger' }}">
                {{- (txn.type == 'correction' ? 1 : -1) * line.allocated -}}
              </div>
            </td>
            <td>
              <a data-action="show-item-info" data-code="{{ line.code }}">
                {{ line.code }}
              </a>
            </td>
            <td>
              {{ line.vendor_sku }}
            </td>
            <td>
              <span data-action="editable" data-name="override_name">
                {{- line.name -}}
              </span>
              <div><small>{{ line.pricing_detail }}</small></div>
            </td>
            <td style="text-align: right">
              {% if not line.kit_id %}
                <div data-action="editable" data-name="sale_price">
                  {{- scat.amount(line.sale_price) -}}
                </div>
              {% endif %}
            </td>
            <td style="text-align: right">
              {% if not line.kit_id %}
                {{ scat.amount((txn.type == 'correction' ? 1 : -1) * line.ext_price) }}
              {% endif %}
            </td>
          </tr>
        {% endfor %}
      </tbody>
      <tfoot>
{'fraction_non_alphanumeric': 0.18498716852010266, 'fraction_numerical': 0.005988023952095809, 'mean_word_length': 1.5758744147617736, 'pattern_counts': {'":': 0, '<': 217, '<?xml version=': 0, '>': 215, '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': '894476', 'n_tokens_mistral': 3132, 'n_tokens_neox': 2961, 'n_words': 559}