<table class="window">
	<tr>
		<td>
			<div class="frame_center">
				<h1>
					{{@page_data.title}}
					<check if="{{@config['ServerName']}}">
						"{{@config['ServerName']}}"
					</check>
				</h1>
				<p align="center">
					(<a class="close show_window" href="/settings/drivers?path={{@GET.path}}&default=1&device={{@device}}&print_group_id={{@GET.print_group_id}}">значение по-умолчанию</a>)
				</p>
				<form name="settings_driver_form" action="/settings/driversform" method="POST">
					<input type="hidden" name="device" value="{{@device??'kkm'}}">
					<check if="{{@device=='epay'}}">
					<input type="hidden" name="id" value="{{@GET.id}}">
					</check>
					<input type="hidden" name="path" value="{{@GET.path}}">
					<input type="hidden" name="print_group_id" value="{{@GET.print_group_id??0}}">
					<input type="hidden" name="options_method" value="">
					<table width="100%">
						<repeat group="{{@config['params']}}" value="{{@key}}">
						<tr class="{{isset(@config[@key]['hide']) && @config[@key]['hide']==1?'hide':''}}">
							<td>
								<div align="{{isset(@config[@key]['default'])?'left':'center'}}">
									<b>
										{{@config[@key]['title']}}{{@config[@key]['required']==1?'*':''}}
									</b>
								</div>
								<check if="{{isset(@config[@key]['description']) && @config[@key]['description']!=''}}">
									<small>{{@config[@key]['description']|raw}}</small>
								</check>
								<check if="{{isset(@config[@key]['default'])}}">
									<check if="{{isset(@config[@key]['type'])}}">
										<true>
											<check if="{{@config[@key]['type']=='textarea'}}">
								<textarea name="params[{{@key}}]" {{@config[@key]['required']==1?'required="true"':''}} style="width: 100%;">{{is_array(@config[@key]['default'])?implode("\n", @config[@key]['default']):@config[@key]['default']}}</textarea>
											</check>
											<check if="{{@config[@key]['type']=='select'}}">
												<select name="params[{{@key}}]" {{@config[@key]['required']==1?'required="true"':''}} style="width: 100%;" data-value="{{@config[@key]['default']}}" data-getoptions="{{@config[@key]['options_method']??''}}">
													<repeat group="{{@config[@key]['options']}}" key="{{@value}}" value="{{@title}}">
													<option value="{{@value}}" {{@config[@key]['default']==@value?'selected="selected"':''}}>{{@title}}</option>
													</repeat>
												</select>
												<check if="{{isset(@config[@key]['options_method'])}}">
												<p class="false {{@config[@key]['options_method']}}_error"></p>
												<p align="center">
													<input type="button" value="Обновить значения" class="drivers_get_options" data-value="{{@config[@key]['options_method']}}">
												</p>
												</check>
											</check>
										</true>
										<false>
								<input type="text" name="params[{{@key}}]" value="{{@config[@key]['default']}}" {{@config[@key]['required']==1?'required="true"':''}} style="width: 100%;">
										</false>
									</check>
								</check>
								<br>
							</td>
						</tr>
						</repeat>						
						<tr>
							<td align="center">
								<p><small>* - поля обязательные для заполнения</small></p>
								<input type="button" class="servicebutton" href="/settings/driversform" value="Сохранить">
							</td>
						</tr>
					</table>
					<p align="center">
					<check if="{{@testconnection===true}}">
						<input type="button" class="servicebutton" value="Проверка связи" href="/settings/testconnection">
					</check>
					<check if="{{@adminmenu===true}}">
						<input type="button" class="servicebutton" value="Меню администратора" href="/settings/adminmenu">
					</check>
					<check if="{{@cashermenu===true}}">
						<input type="button" class="servicebutton" value="Меню кассира" href="/settings/cashermenu">
					</check>
					</p>
				</form>
			</div>
		</td>
	</tr>
</table>
<script>
$('.drivers_get_options').each(function(n){
	setTimeout(drivers_get_options_click, n*100, this);
});
</script>