<div id="page-wrapper">
	<div class="container-fluid">
		<div class="row">
			<div class="col-lg-12">
				<?php echo flash_show(); ?>
				<div class="panel panel-primary">
					<div class="panel-heading">
						<h3 class="panel-title">
							<i class="fa fa-bar-chart-o"></i>
							<?php echo T('Управление платежами'); ?>
							<span style="float: right;">
								<i class="fa fa-question-circle" aria-hidden="true" data-toggle="tooltip" data-placement="left"
								   title="<?php echo T('В этом блоке отображены настройки работы платежей'); ?>"></i>
							</span>
						</h3>
					</div>
					<div class="panel-body">
						<div class="flot-chart">
							<div class="flot-chart-content" id="flot-line-chart">
								<div class="table-responsive">
									<table class="table table-bordered table-hover">
										<thead>
										<tr>
											<th><?php echo T('Параметр'); ?></th>
											<th><?php echo T('Текущее значение'); ?></th>
											<th><?php echo T('Новое значение'); ?></th>
										</tr>
										</thead>
										<tbody>
										<form enctype="multipart/form-data" action = "/handlers/adg/settings.php" method = "POST" class = "settings">
											<?php echo form_init(); ?>
											<?php foreach (get_list("settings", "show_admin = ".escape_db(1)." AND groups = ".escape_db("set")) as $key => $value) { ?>
												<tr>
													<td>
														<i class="fa fa-question-circle" aria-hidden="true" data-toggle="tooltip" data-placement="top" title="<?php echo T(escape($value["comment"])); ?>"></i>
														<?php echo escape($value["title"]); ?>
													</td>
													<td>
														<?php
														if ($value["value"] === "true") {
															echo T("Включено");
														} else if ($value["value"] === "false") {
															echo T("Выключено");
														} else if ($value["name"] === "start_data") {
															echo escape(str_replace("T", " ", $value["value"]));
														} else {
															echo escape($value["value"]);
														}
														?>
													</td>
													<td>
														<!-- для даты устанавливаем интпут с выбором даты -->
														<?php if ($value["name"] === "start_data") { ?>
															<input name = "<?php echo escape($value["name"]); ?>" class="form-control" type="datetime-local" value="<?php echo escape($value['value']); ?>" id="example-datetime-local-input">
															<!-- для валют устанавливаем селект -->
														<?php } else if ($value["name"] === "currency") { ?>
															<select name = "<?php echo escape($value["name"]); ?>" class = "form-control">
																<option <?php if ($value['value'] === "RUB" ) echo "selected"; ?> value="RUB">RUB</option>
																<option <?php if ($value['value'] === "USD" ) echo "selected"; ?> value="USD">USD</option>
																<option <?php if ($value['value'] === "BTC" ) echo "selected"; ?> value="BTC">BTC</option>
															</select>
														<?php } else if ($value["value"] === "true" || $value["value"] === "false") { ?>
															<select name = "<?php echo escape($value["name"]); ?>" class = "form-control">
																<option <?php if ($value['value'] === 'true') echo 'selected'; ?> value="true"><?php echo T('Включено'); ?></option>
																<option <?php if ($value['value'] === 'false') echo 'selected'; ?>  value="false"><?php echo T('Выключено'); ?></option>
															</select>
														<?php } else { ?>
															<input name = "<?php echo escape($value["name"]); ?>" class = "form-control" placeholder = "<?php echo T(escape($value["title"])); ?>" value="<?php echo escape($value["value"]); ?>">
														<?php } ?>
													</td>
												</tr>
											<?php } ?>

											<tr>
												<td colspan="3">
													<button type="submit" name = "save" class = "btn btn-default" style="width: 100%;background: #3c763d;color: #fff;"><?php echo T('Обновить'); ?></button>
												</td>
											</tr>
										</form>
										</tbody>
									</table>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->
<script>
	$(function () {
		$('[data-toggle="tooltip"]').tooltip()
	})
</script>