<check if="{{@search}}">
<form name="products_all_search_form" method="GET" action="/products/search_barcodes" class="close_window">
	<input type="hidden" name="not_add" value="1">
<table width="100%">
	<tr>
		<td>
			<input type="text" name="product_search" class="form_product_search with_full_keyboard" value="{{@search}}" placeholder="Наименование" autocomplete="off">
		</td>
		<td>
			<select name="order">
				<option value="0">По релевантности</option>
				<option value="title" {{@GET.order=='title'?'selected="selected"':''}}>По алфавиту от А до Я</option>
				<option value="title DESC" {{@GET.order=='title DESC'?'selected="selected"':''}}>По алфавиту от Я до А</option>
				<option value="price" {{@GET.order=='price'?'selected="selected"':''}}>По возрастанию цены</option>
				<option value="price DESC" {{@GET.order=='price DESC'?'selected="selected"':''}}>По убыванию цены</option>
			</select>
		</td>
		<td>
			<input type="checkbox" class="custom-checkbox" id="exact_match" name="exact_match" value="1" {{@exact_match?'checked="checked"':''}}>
			<label for="exact_match">Точное соответствие</label>
		</td>
		<td width="100">
			<button type="submit" class="btn btn-primary">
				<i class="fas fa-search"></i>
				<br>
				<div class="small">Искать</div>
			</button>
		</td>
	</tr>
</table>
<check if="{{@base_settings.virtual_keyboard==1}}">
<div class="virtual_keyboard virtual_keyboard_hide virtual_keyboard_product_search full_keyboard" align="center">
	{~@keys='1234567890-+|QWERTYUIOP_|ASDFGHJKL@|ZXCVBNM'~}
	<div class="eng">
		<loop from="{{@i=0}}" to="{{@i<mb_strlen(@keys)}}" step="{{@i++}}">
			<check if="{{@keys[@i]=='|'}}">
				<true>
		<br>
				</true>
				<false>
		<button type="button" class="virtual_key btn btn-light border border-secondary" value="{{@keys[@i]}}" for="form_product_search">{{@keys[@i]}}</button>
				</false>
			</check>
		</loop>
		<button type="button" class="virtual_key_bks btn btn-light border border-secondary" for="form_product_search">
			<i class="fas fa-long-arrow-alt-left"></i>
		</button>
		<button type="button" class="virtual_key_delete btn btn-light border border-secondary" for="form_product_search" value="CE">CE</button>
		<br>
		<button type="button" class="virtual_key_ru btn btn-light border border-secondary" value="RU">RU</button>
		<button type="button" class="virtual_key virtual_key_space btn btn-light border border-secondary" for="form_product_search" value=" "> </button>
		<button type="button" class="virtual_key btn btn-light border border-secondary" for="form_product_search" value=",">,</button>
		<button type="button" class="virtual_key btn btn-light border border-secondary" for="form_product_search" value=".">.</button>
		<button type="button" class="virtual_key virtual_key_ok btn btn-light border border-secondary" value="OK">OK</button>
	</div>
	{~@keys='1234567890-+|ЙЦУКЕНГШЩЗХЪ|ФЫВАПРОЛДЖЭ_|ЯЧСМИТЬБЮ@'~}
	<div class="ru">
		<loop from="{{@i=0}}" to="{{@i<mb_strlen(@keys)}}" step="{{@i++}}">
			{~@a=mb_substr(@keys, @i, 1)~}
				<check if="{{@a=='|'}}">
					<true>
		<br>
					</true>
					<false>
		<button type="button" class="virtual_key btn btn-light border border-secondary" value="{{@a}}" for="form_product_search">{{@a}}</button>
					</false>
				</check>
		</loop>
		<button type="button" class="virtual_key_bks btn btn-light border border-secondary" for="form_product_search">
			<i class="fas fa-long-arrow-alt-left"></i>
		</button>
		<button type="button" class="virtual_key_delete btn btn-light border border-secondary" for="form_product_search" value="CE">CE</button>
		<br>
		<button type="button" class="virtual_key_eng btn btn-light border border-secondary" value="ENG">ENG</button>
		<button type="button" class="virtual_key virtual_key_space btn btn-light border border-secondary" for="form_product_search" value=" "> </button>
		<button type="button" class="virtual_key btn btn-light border border-secondary" for="form_product_search" value=",">,</button>
		<button type="button" class="virtual_key btn btn-light border border-secondary" for="form_product_search" value=".">.</button>
		<button type="button" class="virtual_key virtual_key_ok btn btn-light border border-secondary" value="OK">OK</button>
	</div>
</div>
	</check>
</form>
</check>
<div class="content2">
<h1>
	{{@page_data.title}}
	{{!@not_add && @search?'"'.@search.'"':''}}
</h1>
<check if="{{@pagination.page_count>1}}">
<ul class="pagination">
	<repeat group="{{@pagination.pages}}" value="{{@number}}">
		<li class="page-item {{@number==@GET.page?'active':''}}"><a {{@number!='...'?'href="'.@pagination.url.@number.'"':''}} class="page-link">{{@number}}</a></li>
	</repeat>
</ul>
</check>
<table class="w-100" id="search_products_table">
	<tr>
		<th width="50" class="order_hide">
			Фото
		</th>
		<th>
			Наименование
		</th>
		<th width="150" class="order_hide">
			Категория
		</th>
		<th width="100">
			Цена
		</th>
		<th width="100">
		</th>
	</tr>
	<repeat group="{{@products}}" value="{{@p}}">
	<tr class="product_line">
		<td align="center" valign="middle" class="order_hide">
			<div class="images images40 d-flex">
	         <check if="{{is_array(@p['img']) && count(@p['img'])>0}}">
	            <true>
	          <img src="//{{@api_data['domen']}}/upload/{{@api_data['subdomen']}}/40_40/{{@p['img'][0]}}" class="small_img">
	            </true>
	            <false>
	          <div class="no_img"></div>
	            </false>
	          </check>
	        </div>
	        </check>
		</td>
		</check>
		<td>
			{{@p['title']}}
		</td>
		<td class="order_hide">
			{{@p['category_title']}}
		</td>
		<td align="center">
			{~@price=@p['price']+(@p['price']*(@p['vat']/100))*max(0, @p['vat_type'])~}
			{~@price=round(@price, 2)~}
			{{number_format(@price, 2)}}
		</td>
		<td>
			<button type="button" class="send_ajax btn btn-primary" href="/receipts/add_line?product_id={{@p['id']}}&count={{@GET.coeff}}">Выбрать</button>
		</td>
	</tr>
	</repeat>
</table>
</div>
<script type="text/javascript">
	show_close_button();
	show_scroll();
</script>