<div class="content2">
<h1>{{@page_data['title']}}</h1>
<form name="receipts_chpok_form" method="GET" action="/receipts/chpok">
	<table>
		<tr>
			<td align="center">
				<input type="text" name="barcode" value="{{@GET.barcode}}" placeholder="Штрих-код или наименование" class="chpok_barcode" required="required" autocomplete="off">
				<button type="submit">
					<i class="fas fa-search"></i>
				</button>
				<check if="{{@base_settings.virtual_keyboard==1}}">
				<div class="virtual_keyboard virtual_keyboard_chpok full_keyboard virtual_keyboard_hide">
					{~@keys='1234567890-+|QWERTYUIOP_|ASDFGHJKL@|ZXCVBNM'~}
					<div class="eng hide">
					<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='chpok_barcode'>
							</false>
						</check>
					</loop>
						<button type="button" class="virtual_key_bks" for='chpok_barcode'>
							<i class="fas fa-long-arrow-alt-left"></i>
						</button>
						<input type="button" class="virtual_key_delete" for='chpok_barcode' value="CE">
						<br>
						<input type="button" class="virtual_key_ru" value="RU">
						<input type="button" class="virtual_key virtual_key_space" for='chpok_barcode' value=" ">
						<input type="button" class="virtual_key" for='chpok_barcode' value=",">
						<input type="button" class="virtual_key" for='chpok_barcode' value=".">
						<input tabindex="3" 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='chpok_barcode'>
							</false>
						</check>
					</loop>
						<button type="button" class="virtual_key_bks" for='chpok_barcode'>
							<i class="fas fa-long-arrow-alt-left"></i>
						</button>
						<input type="button" class="virtual_key_delete" for='chpok_barcode' value="CE">
						<br>
						<input type="button" class="virtual_key_eng" value="ENG">
						<input type="button" class="virtual_key virtual_key_space" for='chpok_barcode' value=" ">
						<input type="button" class="virtual_key" for='chpok_barcode' value="@">
						<input type="button" class="virtual_key" for='chpok_barcode' value=",">
						<input type="button" class="virtual_key" for='chpok_barcode' value=".">
						<input tabindex="3" type="button" class="virtual_key virtual_key_ok" value="OK">
					</div>
				</div>
				</check>
			</td>
		</tr>
		<check if="{{@products}}">
			<check if="{{@products['success']}}">
				<true>
		<tr>
			<td>
				<table class="work_table">
					<tr>
						<th>
							Наименование
						</th>
						<th width="100">
							Цена
						</th>
						<th width="100"></th>
					</tr>
					<repeat group="{{@products['products']}}" value="{{@p}}">
					<tr>
						<td>
							{{@p['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>
							<input type="button" class="show_window" href="/receipts/chpok?product_id={{@p['id']}}&barcode={{@p['barcodes'][0]['barcode']}}" value="Выбрать">
						</td>
					</tr>
					</repeat>
				</table>
			</td>
		</tr>
				</true>
				<false>
		<tr>
			<td colspan="3" align="center">
				<p class="false">
					Товары не найдены
				</p>
			</td>
		</tr>
				</false>
			</check>
		</check>
	</table>
</form>
<script type="text/javascript">
if($('form[name="receipts_chpok_form"]').length>1) {
	close_window($('form[name="receipts_chpok_form"]').eq(0));
}
//$('form[name="receipts_chpok_form"] input[name="barcode"]').focus();
</script>
</div>