Files
openfoodnetwork/app/views/spree/admin/variants/_autocomplete.js.erb

70 lines
2.4 KiB
Plaintext

<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='/assets/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>
<li class='variant-on_hand'><strong><%= t('on_hand') %>:</strong> {{variant.on_hand}}</li>
</ul>
{{#if variant.option_values}}
<ul class='variant-options'>
{{#each variant.option_values}}
<li><strong>{{this.option_type.presentation}}:</strong> {{this.presentation}}</li>
{{/each}}
</ul>
{{/if}}
</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" data-hook="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" data-stock-location-id="{{variant.stock_location_id}}" type="number" min="1" value="1">
</td>
<td class="actions">
<button class="add_variant no-text icon-plus icon_link with-tip" data-stock-location-id="{{variant.stock_location_id}}" title="Add" data-action="add"></button>
</td>
{{else}}
<td><%= Spree.t(:out_of_stock) %></td>
<td>0</td>
{{/if}}
</tr>
</tbody>
</fieldset>
</script>