<h1>{{@page_data.title}}</h1>
<form name="product_form" action="/products/form" class="change_form" method="POST">
	<check if="{{!@data['id'] && (@data['title'] || @data['barcode'])}}">
		<true>
	<input type="hidden" name="product_id" value="-1">
	<input type="hidden" name="count" value="1">
		</true>
		<false>
	<input type="hidden" name="id" value="{{@data['id']}}">
		</false>
	</check>
	<table>
		<tr>
			<check if="{{@categories}}">
				<true>
			<td>
				Категория
			</td>
			<td>
				<select name="category_id">
					<option value="0" {{@data['category_id']==0?'selected="selected"':''}}>Без категории</option>
					<repeat group="{{@categories}}" value="{{@cat}}">
						<check if="{{@cat['date_delete']==0}}">
					<option value="{{@cat['id']}}" {{@cat['id']==@data['category_id']?'selected="selected"':''}}>{{str_repeat('-', @cat['depth'])}}{{@cat['title']}}</option>
						</check>
					</repeat>
				</select>
			</td>
			<td>
				Название*
			</td>
			<td>
				<input type="text" name="title" class="mixed_pay mixed_pay_product_title" pid="product_title" value="{{@data['title']}}" required="required">
			</td>
				</true>
				<false>
			<td>
				Название*
			</td>
			<td colspan="3">
				<input type="text" name="title" class="mixed_pay mixed_pay_product_title" pid="product_title" value="{{@data['title']}}" required="required">
			</td>
				</false>
			</check>
		</tr>
		<tr>
			<td>
				Цена {{@sno_org=='01'?'без учета НДС':''}}*
			</td>
			<td>
				<input type="text" inputmode="numeric" name="price" class="mixed_pay mixed_pay_product_price" pid="product_price" step="0.01" min="0" value="{{@data['price']?number_format(@data['price'], 2, '.', ''):0}}" required="required"> <span class="order_hide">руб.</span>
			</td>
			<td>
				Максимальная скидка
			</td>
			<td>
				<input type="text" inputmode="numeric" name="max_discount" class="mixed_pay mixed_pay_product_max_discount" pid="product_max_discount" step="0.01" min="0" max="100" value="{{@data['max_discount']?number_format(@data['max_discount'], 2, '.', ''):50}}" required="required"> <span class="order_hide">%</span>
			</td>
		</tr>
		<tr {{@sno_org!='01'?'style="display:none"':''}}>
			<td>
				Вид НДС
			</td>
			<td>
				<select name="vat_type">
					<option value="0">Без НДС</option>
					<option value="-1" {{@data['vat_type']==-1?'selected="selected"':''}}>Выделить НДС</option>
					<option value="1" {{@data['vat_type']==1?'selected="selected"':''}}>Начислить НДС</option>
				</select>
			</td>
			<td>
				Ставка НДС
			</td>
			<td>
				<select name="vat">
					<option value="0">0%</option>
					<option value="5" {{@data['vat']==5?'selected="selected"':''}}>5%</option>
					<option value="7" {{@data['vat']==7?'selected="selected"':''}}>7%</option>
					<option value="10" {{@data['vat']==10?'selected="selected"':''}}>10%</option>
					<option value="20" {{@data['vat']==20?'selected="selected"':''}}>20%</option>
				</select>
			</td>
		</tr>
		<tr>
			<td>
				Ед. измерения
			</td>
			<td>
				<select name="units" class="select2">
					<repeat group="{{@units}}" key="{{@okei}}" value="{{@unit}}">
					<option value="{{@okei}}" {{isset(@data.units) && @data.units==@okei?'selected="selected"':''}}>{{@unit['title']}}</option>
					</repeat>
				</select>
			</td>
			<td>
				Штрих-код
			</td>
			<td>
				<input type="text" name="barcode" class="mixed_pay mixed_pay_product_barcode" pid="product_barcode" value="{{@data['barcode']}}">
			</td>
		</tr>
		<tr>
			<td>
				Признак предмета расчета
			</td>
			<td>
				<select name="ppr">
					<option value="1" {{@data.ppr==1?'selected="selected"':''}}>Товар</option>
					<option value="2" {{@data.ppr==2?'selected="selected"':''}}>Подакцизный товар</option>
					<option value="3" {{@data.ppr==3?'selected="selected"':''}}>Работа</option>
					<option value="4" {{@data.ppr==4?'selected="selected"':''}}>Услуга</option>
					<option value="5" {{@data.ppr==5?'selected="selected"':''}}>Материал</option>
					<option value="18" {{@data.ppr==18?'selected="selected"':''}}>Курортный сбор</option>
					<option value="13" {{@data.ppr==13?'selected="selected"':''}}>Сертификат</option>
				</select>
			</td>
			<td>
				СНО при продаже
			</td>
			<td>
				<select name="sno">
					<option value="0">СНО организации</option>
					<repeat group="{{@sno}}" key="{{@value}}" value="{{@title}}">
					<option value="{{@value}}" {{@data.sno==@value?'selected="selected"':''}}>{{@title}}</option>
					</repeat>
				</select>
			</td>
		</tr>
		<tr>
			<td>
				Группа печати
			</td>
			<td>
				<select name="print_group">
					<option value="">Нет</option>
					<option value="kitchen" {{@data.print_group=='kitchen'?'selected="selected"':''}}>Кухня</option>
					<option value="bar" {{@data.print_group=='bar'?'selected="selected"':''}}>Бар</option>
				</select>
			</td>
			<td>
				Отображать в быстрых товарах
			</td>
			<td>
				<select name="fast">
					<option value="0">Нет</option>
					<option value="1" {{@data.fast=='1'?'selected="selected"':''}}>Да</option>
				</select>
			</td>
		</tr>
		<check if="{{(int)@base_settings['check_mark']>0}}">
		<tr>
			<td>
				Маркировка товара
			</td>
			<td>
				<select name="marking">
					<option value="0">Нет</option>
					<option value="1" {{@data['marking']==1?'selected="selected"':''}}>Обязательная</option>
					<option value="2" {{@data['marking']==2?'selected="selected"':''}}>Возможна</option>
				</select>
			</td>
			<td>
				Товарная группа маркированного товара
			</td>
			<td>
				<select name="marking_group">
					<option value="">Нет</option>
					<repeat group="{{@marktype}}" key="{{@value}}" value="{{@markdata}}">
					<option value="{{@value}}" {{@data['marking_group']==@value?'selected="selected"':''}}>{{@markdata['title']}}</option>
					</repeat>
				</select>
			</td>
		</tr>
		</check>
		<check if="{{(int)@base_settings['autonomous']>0}}">
		<tr>
			<td>
				Стандартное количество для продажи
			</td>
			<td colspan="2" align="left">
				<input type="text" inputmode="numeric" name="quantity" class="mixed_pay mixed_pay_product_quantity" pid="product_quantity" step="0.001" min="0" value="{{isset(@data['quantity'])?number_format(@data['quantity'], 2, '.', ''):1}}" required="required">
			</td>
			<td colspan="2"></td>
		</tr>
		</check>
		<check if="{{(int)@base_settings['egais']>0}}">
		<tr>
			<td>
				Тип продукции в ЕГАИС
			</td>
			<td>
				<select name="egais">
					<option value="0">Нет</option>
					<option value="1" {{@data['egais']==1?'selected="selected"':''}}>Алкогольная продукция</option>
					<option value="2" {{@data['egais']==2?'selected="selected"':''}}>Пиво</option>
				</select>
			</td>
			<td>
				Алкокод
			</td>
			<td>
				<input type="text" name="alcocode" class="mixed_pay mixed_pay_product_alcocode" pid="product_alcocode" value="{{@data['alcocode']}}">
			</td>
		</tr>
		</check>
		<tr>
			<td colspan="4" align="center">
				<check if="{{@base_settings.virtual_keyboard==1}}">
					<true>
				<div class="virtual_keyboard virtual_keyboard_product_form 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="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">Сохранить</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=".">
						<button type="submit">Сохранить</button>
					</div>
				</div>
					</true>
					<false>
				<p align="center">
					<button type="submit">Сохранить</button>
				</p>
					</false>
				</check>
			</td>
		</tr>
	</table>
</form>
<script type="text/javascript">
$('form[name="product_form"] input[name="title"]').focus();
$('form[name="product_form"] input[name="title"]').select();
</script>
