<form name="products_all_search_form" method="GET" action="/products/pricetags" class="no_ajax">
	<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>
				<check if="{{!@base_settings['autonomous'] && in_array('receipts/change_price', @authorization_user.module) && in_array('products/show_buy_price', @authorization_user.module)}}">
				<option value="price" {{@GET.order=='price'?'selected="selected"':''}}>По возрастанию цены</option>
				<option value="price DESC" {{@GET.order=='price DESC'?'selected="selected"':''}}>По убыванию цены</option>
				</check>
				<check if="{{!@base_settings['autonomous'] && in_array('products/currentstock', @authorization_user.module)}}">
				<option value="stock" {{@GET.order=='stock'?'selected="selected"':''}}>По возрастанию кол-ва</option>
				<option value="stock DESC" {{@GET.order=='stock DESC'?'selected="selected"':''}}>По убыванию кол-ва</option>
				</check>
			</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>
			<input type="checkbox" class="custom-checkbox" name="in_stock" id="in_stock" value="1" {{@in_stock?'checked="checked"':''}}>
			<label for="in_stock">Только в наличии</label>
		</td>
		<td width="100">
			<button type="submit">
				<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">
	{~@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>
		<input type="button" class="virtual_key" value="{{@keys[@i]}}" for="form_product_search">
				</false>
			</check>
		</loop>
		<button type="button" class="virtual_key_bks" for="form_product_search">
			<i class="fas fa-long-arrow-alt-left"></i>
		</button>
		<input type="button" class="virtual_key_delete" for="form_product_search" value="CE">
		<br>
		<input type="button" class="virtual_key_ru" value="RU">
		<input type="button" class="virtual_key virtual_key_space" for="form_product_search" value=" ">
		<input type="button" class="virtual_key" for="form_product_search" value=",">
		<input type="button" class="virtual_key" for="form_product_search" value=".">
		<input type="button" class="virtual_key virtual_key_ok" value="OK">
	</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>
		<input type="button" class="virtual_key" value="{{@a}}" for="form_product_search">
					</false>
				</check>
		</loop>
		<button type="button" class="virtual_key_bks" for="form_product_search">
			<i class="fas fa-long-arrow-alt-left"></i>
		</button>
		<input type="button" class="virtual_key_delete" for="form_product_search" value="CE">
		<br>
		<input type="button" class="virtual_key_eng" value="ENG">
		<input type="button" class="virtual_key virtual_key_space" for="form_product_search" value=" ">
		<input type="button" class="virtual_key" for="form_product_search" value=",">
		<input type="button" class="virtual_key" for="form_product_search" value=".">
		<input type="button" class="virtual_key virtual_key_ok" value="OK">
	</div>
</div>
	</check>
</form>
<div class="content2">
<h1>
	{{@page_data.title}}
	{{!@not_add && @search?'"'.@search.'"':''}}
</h1>
<include href="pagination.htm" />
<table class="work_table" id="search_products_table">
	<tr>
		<check if="{{!@base_settings['autonomous'] && in_array('products/img', @authorization_user.module)}}">
		<th width="50" class="order_hide">
			Фото
		</th>
		</check>
		<th>
			Наименование
		</th>
		<th width="150" class="order_hide">
			Категория
		</th>
		<check if="{{!@base_settings['autonomous'] && in_array('receipts/change_price', @authorization_user.module) && in_array('products/show_buy_price', @authorization_user.module)}}">
		<th width="100" class="order_hide">
			Закупочная цена
		</th>
		</check>
		<th width="100">
			Цена
		</th>
		<check if="{{!@base_settings['autonomous'] && in_array('products/currentstock', @authorization_user.module)}}">
		<th width="100" class="order_hide">
			На складе
		</th>
		</check>
		<th width="100">
		</th>
	</tr>
	<repeat group="{{@products}}" value="{{@product}}">
	<tr class="product_line">
		<check if="{{!@base_settings['autonomous'] && in_array('products/img', @authorization_user.module)}}">
		<td align="center" valign="middle" class="order_hide">
			<check if="{{@product.img && is_array(@product.img)}}">
				<true>
			{~@img=array_shift(@product.img)~}
			<button class="show_window" href="/products/img?img={{@img}}">
				<i class="far fa-file-image"></i>
			</button>
				</true>
				<false>
			<i class="fas fa-times"></i>
				</false>
			</check>
		</td>
		</check>
		<td>
			{{@product.title}}
		</td>
		<td class="order_hide">
			{{@product.category_title}}
		</td>
		<check if="{{!@base_settings['autonomous'] && in_array('receipts/change_price', @authorization_user.module) && in_array('products/show_buy_price', @authorization_user.module)}}">
		<td align="center" class="order_hide">
			{~@buy_price=@product.buy_price+(@product.buy_price*(@product.vat/100))*max(0, @product.vat_type)~}
			{~@buy_price=round(@buy_price, 2)~}
			{{@buy_price>0?number_format(@buy_price, 2):'-'}}
		</td>
		</check>
		<td align="center">
			{~@price=@product.price+(@product.price*(@product.vat/100))*max(0, @product.vat_type)~}
			{~@price=round(@price, 2)~}
			{{number_format(@price, 2)}}
		</td>
		<check if="{{!@base_settings['autonomous'] && in_array('products/currentstock', @authorization_user.module)}}">
		<td align="center" class="{{@product.stock<0?'false':''}} order_hide">
			{{numberformat(@product.stock, 3, '.', '')}}
		</td>
		</check>
		<td>
			<input type="button" value="Печатать" class="send_ajax" href="/receipts/pricetags?product_id={{@product.id}}">
		</td>
	</tr>
	</repeat>
</table>
</div>
