{~@focus=0~}
<h1>{{@page_data['title']}}</h1>
<form name="add_marking_form" class="add_marking_form" action="/receipts/add_marking" method="POST">
	<check if="{{@REQUEST.combo_id}}">
	<input type="hidden" name="combo_id" value="{{@REQUEST.combo_id}}">
	<input type="hidden" name="combo_step" value="{{@REQUEST.combo_step}}">
		<repeat group="{{@REQUEST.item}}" key="{{@step}}" value="{{@item}}">
	<input type="hidden" name="item[{{@step}}][product_id]" value="{{@item['product_id']}}">
	<input type="hidden" name="item[{{@step}}][price]" value="{{@item['price']}}">
			<repeat group="{{@item['mark_data']}}" key="{{@key}}" value="{{@mark_data}}">
	<input type="hidden" name="item[{{@step}}][mark_data][{{@key}}]" value="{{@mark_data}}">
			</repeat>
		</repeat>
	</check>
	{~@p=@products[0]~}
	<p align="center"><b>{{@p['title']}}</b></p>
	<check if="{{@spill_line}}">
	<table width="100%" class="table_border">
		<tr>
			<th align="center">
				Марка
			</th>
			<th width="100" align="center">
				Кол-во
			</th>
		</tr>
		<repeat group="{{@spill_line}}" value="{{@line}}">
		<tr>
			<td>
				<i class="fas fa-qrcode"></i>
				{{mb_substr(@line['mark'], 3, 3)}}
				{{mb_substr(@line['mark'], 6, 8)}}
			</td>
			<td align="center">
				{{@line['count']}}
				<input type="hidden" name="spill_line[{{@line['mark']}}][mark]" value="{{@line['mark']}}">
				<input type="hidden" name="spill_line[{{@line['mark']}}][count]" value="{{@line['count']}}">
			</td>
		</tr>
		</repeat>
	</table>
	</check>
	<input type="hidden" name="receipttype[{{@p['id']}}]" value="">
	<input type="hidden" name="product[{{@p['id']}}]" value="{{@p['id']}}">
	<input type="hidden" name="count[{{@p['id']}}]" value="{{@p['count']}}">
	<p align="center">
		<b>Отсканируйте марку</b><br>
		<i class="fas icon fa-qrcode"></i>
		<input type="text" class="marking_input" name="mark[{{@p['id']}}][]" autocomplete="off">
		<input type="submit" value="Отправить">
	</p>
	<check if="{{@bottles}}">
		<p align="center">
			<b>Или выберите открытую бутылку</b>
		</p>
	</check>
	<div class="select_open_bottle_div">
		<repeat group="{{@bottles}}" value="{{@product}}">
		<div align="center" class="select_open_bottle_product">
			<p align="center"><b>{{@product['title']}}</b></p>
			<repeat group="{{@product['bottles']}}" value="{{@bottle}}">
			<button type="button" class="select_open_bottle {{isset(@add_marks) && in_array(@bottle['mark'], @add_marks)?'hide':''}}" data-mark="{{@bottle['mark']}}">
				<i class="fas fa-qrcode left"></i>
				{{$bottle['serial']}} {{$bottle['number']}}<br>
				<small>{{@bottle['current_volume']}} / {{@bottle['capacity']*1000}}мл</small>
			</button>
			</repeat>
		</div>
		</repeat>
	</div>
	<br><br>
	<p align="center">
		<button type="button" class="close">Отменить</button>
		<check if="{{(@p['marking']==2 && (int)@base_settings['check_mark']==1) || (@p['egais']==1 && (int)@base_settings['check_egais']==1)}}">
		<input type="submit" class="reset" value="Пропустить">
		</check>
	</p>
</form>
<script>
window_open_alarm();
</script>
<script type="text/javascript">
if($('.add_marking_form').length>1) {
	$('.add_marking_form').eq(0).closest('.popup').remove();
}
$('.marking_input').eq(0).focus();
$('input[name="receipttype[{{@p['id']}}]"]').val($('input[name="type"]').val());
$('.close_button', $('form[name="add_marking_form"]').closest('.popup')).remove();
</script>
