<script type='text/template' id='variant_autocomplete_template'>
  <div class='variant-autocomplete-item'>
    <figure class='variant-image'>
      {{#if variant.image }}
        <img src='{{variant.image}}' />
      {{ else }}
        <img src='/noimage/mini.png' />
      {{/if}}
    </figure>

    <div class='variant-details'>
      <h6 class="variant-name">{{variant.name}}</h6>

      <ul>
        <li><strong><%= t('.producer_name') %>:</strong> {{variant.producer_name}}</li>
      </ul>
      <ul class='variant-data'>
        <li class='variant-sku'><strong><%= t('admin.sku') %>:</strong> {{variant.sku}}</li>
        {{#if variant.on_demand }}
          <li class='variant-on_demand'><strong><%= t('on_demand') %></strong></li>
        {{ else }}
          <li class='variant-on_hand'><strong><%= t('on_hand') %>:</strong> {{variant.on_hand}}</li>
        {{/if}}
        <li class='variant-options_text'><strong><%= t('.unit') %>:</strong> {{variant.options_text}}</li>
      </ul>
    </div>
  </div>
</script>
<script type='text/template' id='variant_autocomplete_stock_template'>
  <fieldset>
    <legend align="center"><%= Spree.t(:select_stock) %></legend>
      <table class="stock-levels">
        <colgroup>
          <col style="width: 60%;" />
          <col style="width: 30%;" />
          <col style="width: 10%;" />
        </colgroup>
        <thead>
          <th><%= Spree.t(:on_hand) %></th>
          <th><%= Spree.t(:quantity) %></th>
          <th class="actions"></th>
        </thead>
        <tbody>
          <tr>
            {{#if variant.in_stock}}
              {{#if variant.on_demand}}
                <td><%= Spree.t(:on_demand) %></td>
              {{else}}
                <td>
                  {{variant.on_hand}}
                </td>
              {{/if}}                  
              <td>
                <input class="quantity" id="stock_item_quantity" type="number" min="1" value="1">
              </td>
              <td class="actions">
                <button class="add_variant no-text icon-plus icon_link with-tip" title="Add" data-action="add"></button>
              </td>
            {{else}}
              <td><%= t('.out_of_stock') %></td>
              <td>0</td>
            {{/if}}
          </tr>
        </tbody>
  </fieldset>
</script>
