<form name="products_all_search_form" method="GET" action="/taps/connection_select_product" class="close_window">
	<input type="hidden" name="id" value="{{@REQUEST.id}}">
	<input type="hidden" name="mark" value="{{@REQUEST.mark}}">
	<input type="hidden" name="not_check_mark" value="{{@REQUEST.not_check_mark}}">
<table width="100%">
	<tr>
		<td>
			<input type="text" name="product_search" class="form_product_search with_full_keyboard" value="{{@REQUEST.product_search}}" placeholder="Наименование" autocomplete="off">
		</td>
		<td>
			<select name="order">
				<option value="0">По релевантности</option>
				<option value="title" {{@REQUEST.order=='title'?'selected="selected"':''}}>По алфавиту от А до Я</option>
				<option value="title DESC" {{@REQUEST.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" {{@REQUEST.order=='price'?'selected="selected"':''}}>По возрастанию цены</option>
				<option value="price DESC" {{@REQUEST.order=='price DESC'?'selected="selected"':''}}>По убыванию цены</option>
				</check>
				<check if="{{!@base_settings['autonomous'] && in_array('products/currentstock', @authorization_user.module)}}">
				<option value="stock" {{@REQUEST.order=='stock'?'selected="selected"':''}}>По возрастанию кол-ва</option>
				<option value="stock DESC" {{@REQUEST.order=='stock DESC'?'selected="selected"':''}}>По убыванию кол-ва</option>
				</check>
			</select>
		</td>
		<td>
			<input type="checkbox" class="custom-checkbox" id="exact_match" name="exact_match" value="1" {{@REQUEST.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" {{@REQUEST.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">
<p>Выберите номенклатуру, которую подключаете</p>
<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">
			<form name="products_all_search_form" method="POST" action="/taps/connection" class="close_window">
				<input type="hidden" name="id" value="{{@REQUEST.id}}">
				<input type="hidden" name="product_id" value="0">
				<input type="hidden" name="mark" value="{{@REQUEST.mark}}">
				<input type="hidden" name="not_check_mark" value="{{@REQUEST.not_check_mark}}">
				<input type="submit" value="Пропуск">
			</form>
		</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>
			<form name="products_all_search_form" method="POST" action="/taps/connection" class="close_window">
				<input type="hidden" name="id" value="{{@REQUEST.id}}">
				<input type="hidden" name="product_id" value="{{@product.id}}">
				<input type="hidden" name="mark" value="{{@REQUEST.mark}}">
				<input type="hidden" name="not_check_mark" value="{{@REQUEST.not_check_mark}}">
				<input type="submit" value="Выбрать">
			</form>
		</td>
	</tr>
	</repeat>
</table>
</div>
