<table class="window">
	<tr>
		<td>
			<div class="frame_center settings_form">
				<h1>{{@page_data.title}}</h1>
				<div>
					<button type="button" id="add_new_printer">
						Добавить принтер
					</button>
					<repeat group="{{@printers}}" value="{{@p}}">
					<button type="button" class="printer_settings_show {{count(@printers)==1?'hide':''}}" data-id="{{@p['id']}}">
						Принтер {{@p['print_group_id']}}
					</button>
					</repeat>
				</div>

				<repeat group="{{@printers}}" key="{{@n}}" value="{{@data}}">
				<form name="settings_kitchen_form" action="/settings/kitchen_printer" method="POST" id="printer_form_{{@data['id']}}" class="{{@n>0?'hide':'first_printer'}}">
					<input type="hidden" name="type" value="0">
					<input type="hidden" name="device" value="kitchen">
					<table width="100%">
						<tr class="active" {{!@data.active?'style="display:none;"':''}}>
							<td colspan="2">
								<h2>
									ID принтера	<span class="printer_title">{{@data.print_group_id}}</span>
								</h2>
								<input type="hidden" name="print_group_id" value="{{@data.print_group_id}}">
							</td>
						</tr>
						<tr>
							<td>
								Использовать принтер
							</td>
							<td align="right">
								<select name="active">
									<option value="0">Нет</option>
									<option value="1" {{@data.active==1?'selected="selected"':""}}>Да</option>
								</select>
							</td>
						</tr>
						<tr class="active" {{!@data.active?'style="display:none;"':''}}>
							<td>
								Драйвер принтера
							</td>
							<td align="right">
								<select name="print_group_driver">
									<option value="">Нет</option>
									<repeat group="{{@drivers}}" value="{{@d}}">
									<option value="{{@d['path']}}" {{@data.driver==@d['path']?'selected="selected"':""}} data-url="{{@d['url']}}">{{@d['title']}}</option>
									</repeat>
								</select>
							</td>
						</tr>
						<tr class="active" {{!@data.active?'style="display:none;"':''}}>
							<td colspan="2" align="center">
								<a href="/settings/drivers?path={{@data.driver}}&device=kitchen&print_group_id={{@data['print_group_id']}}" class="print_group_driver_settings show_window {{@data.driver==''?'hide':''}}"><small>(настройка драйвера)</small></a>
							</td>
						</tr>

						<tr class="active" {{!@data.active?'style="display:none;"':''}}>
							<td>
								Адрес принтера
							</td>
							<td align="right">
								<input type="text" name="url" value="{{@data.url}}">
							</td>
						</tr>
						<tr class="active" {{!@data.active?'style="display:none;"':''}}>
							<td>
								Печать каждой позиции на отдельном чеке
							</td>
							<td align="right">
								<div class="switch right">
		  							<input type="checkbox" name="line_by_line" value="1" {{@data.line_by_line==1?'checked="checked"':''}}>
								</div>
							</td>
						</tr>
						<tr class="active" {{!@data.active?'style="display:none;"':''}}>
							<td colspan="2">
								<p align="center">Верхняя часть чека</p>
								<textarea name="header">{{@data.header}}</textarea>
							</td>
						</tr>
						<tr class="active" {{!@data.active?'style="display:none;"':''}}>
							<td colspan="2">
								<p align="center">Нижняя часть чека</p>
								<textarea name="footer">{{@data.footer}}</textarea>
							</td>
						</tr>
						<tr class="active" {{!@data.active?'style="display:none;"':''}}>
							<td colspan="2" align="center">
								<a class="show_window" href="/settings/manualforprinters"><small>Команды для чекопечатающего оборудования</small></a>
							</td>
						</tr>
						<tr>
							<td colspan="2" align="center">
								<input type="submit" value="Сохранить">
							</td>
						</tr>
					</table>
				</form>
				</repeat>
			</div>
		</td>
	</tr>
</table>
