<h1>{{@page_data['title']}}</h1>
<form name="tap_connection_form" action="/taps/connection" method="POST">
	<input type="hidden" name="id" value="{{@REQUEST['id']}}">
	<table width="100%">
		<tr class="{{isset(@POST['mark']) && @POST['mark']!=''?'hide':''}}">
			<td align="center">
				<input type="text" name="mark" class="width_input_100 marking_input" placeholder="Отсканируйте марку" autocomplete="off" required="true" value="{{@POST['mark']}}">
				<input type="hidden" name="caps_on" class="caps_on" value="0">
			</td>
		</tr>
		<check if="{{isset(@POST['mark']) && @POST['mark']!=''}}">
			<true>
				<check if="{{@alert==1}}">
		<tr>
			<td align="center">
				<p class="false">Внимание!!! Вы подключаете разливную номенклатуру другой марки!</p>
			</td>
		</tr>
				</check>
		<tr>
			<td align="center">
				<input type="hidden" name="connection" value="1">
				<b>Номенклатура</b><br>
				<input type="text" name="product_title" class="width_input_100 mixed_pay mixed_pay_product_title" pid="product_title" placeholder="Номенклатура" autocomplete="off" required="true" value="{{@tap['product_title']?@tap['product_title']:@products[0]['title']}}">
				<input type="hidden" name="product_id" value="{{@tap['product_id']?@tap['product_id']:@products[0]['id']}}">
			</td>
		</tr>
		<tr>
			<td align="center">
				<b>Срок годности в днях с момента подключения</b><br>
				<check if="{{isset(@result['expireDate']) && strtotime(@result['expireDate'])>0}}">
				<small>Срок годности истекает {{date('d.m.Y H:i', strtotime(@result['expireDate']))}}</small><br>
				</check>
				<input type="number" name="expiration" class="width_input_100 mixed_pay mixed_pay_expiration" pid="expiration" autocomplete="off" placeholder="Срок годности в днях {{isset(@result['expireDate']) && strtotime(@result['expireDate'])>0?' (максумум '.round((strtotime(@result['expireDate'])-time())/(24*3600)).')':''}}" required="true" min="0" step="1" max="{{isset(@result['expireDate']) && strtotime(@result['expireDate'])>0?round((strtotime(@result['expireDate'])-time())/(24*3600)):365}}" value="{{@tap['expiration']}}">
			</td>
		</tr>
		<tr>
			<td align="center">
				<b>Текущий объем в литрах</b><br>
				<input type="number" class="width_input_100 mixed_pay mixed_pay_volume" pid="volume" name="volume" autocomplete="off" placeholder="Текущий объем в литрах" required="true" min="0" max="100" step="1" value="{{@tap['volume']?@tap['volume']:@products[0]['capacity']}}">
			</td>
		</tr>
		<tr>
			<td>
				<check if="{{@base_settings.virtual_keyboard==1}}">
					<true>
				<div class="virtual_keyboard full_keyboard" align="center">
					{~@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='mixed_pay_product_title'>
							</false>
						</check>
					</loop>
						<button type="button" class="virtual_key_bks" for='mixed_pay_product_title'>
							<i class="fas fa-long-arrow-alt-left"></i>
						</button>
						<input type="button" class="virtual_key_delete" for='mixed_pay_product_title' value="CE">
						<br>
						<input type="button" class="virtual_key_ru" value="RU">
						<input type="button" class="virtual_key virtual_key_space" for='mixed_pay_product_title' value=" ">
						<input type="button" class="virtual_key" for='mixed_pay_product_title' value=",">
						<input type="button" class="virtual_key" for='mixed_pay_product_title' value=".">
						<button type="submit" class="virtual_key_submit virtual_key_total">Сохранить</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>
						<input type="button" class="virtual_key" value="{{@a}}" for='mixed_pay_product_title'>
							</false>
						</check>
					</loop>
						<button type="button" class="virtual_key_bks" for='mixed_pay_product_title'>
							<i class="fas fa-long-arrow-alt-left"></i>
						</button>
						<input type="button" class="virtual_key_delete" for='mixed_pay_product_title' value="CE">
						<br>
						<input type="button" class="virtual_key_eng" value="ENG">
						<input type="button" class="virtual_key virtual_key_space" for='mixed_pay_product_title' value=" ">
						<input type="button" class="virtual_key" for='mixed_pay_product_title' value="@">
						<input type="button" class="virtual_key" for='mixed_pay_product_title' value=",">
						<input type="button" class="virtual_key" for='mixed_pay_product_title' value=".">
						<button type="submit" class="virtual_key_submit virtual_key_total">
							Сохранить
						</button>
					</div>
				</div>
					</true>
					<false>
				<p align="center">
					<button type="submit">
						Сохранить
					</button>
				</p>
					</false>
				</check>
			</td>
		</tr>
			</true>
			<false>
		<tr>
			<td align="center">
				<button type="submit">
					Сохранить
				</button>
			</td>
		</tr>
			</false>
		</check>
	</table>
</form>
<script type="text/javascript">
if($('form[name="tap_connection_form"]').length>1) {
	$('form[name="tap_connection_form"]').eq(0).closest('.popup').remove();
}
else {
	$('form[name="tap_connection_form"] .marking_input').focus();
}
if($('#tap_error_page').length>0) {
	$('#tap_error_page').closest('.popup').remove();
}
</script>