{% extends "../base.html" %}
{% block content %}
{% macro wirelessView(WifiSSID,WifiType,Quality) %}
<form action="/wifi/connect" method="post">
<tr>
	<td>
		<input name="WifiSSID" value="{{WifiSSID}}" class="WifiSSID" type="hidden">{{WifiSSID}}
	</td>
	<td>
		<input name="WifiType" value="{{WifiType}}" class="WifiType" type="hidden">{{WifiType}}
	</td>
	<td>{% if WifiType!="" %}<input name="WifiPass" value="" placeholder="Wireless Password">{% endif %}</td>
	<td>
		{{Quality}}/70
	</td>
	<td><input type="submit" value="Connect" class="btn btn-success"></td>
</tr>
</form>
{% endmacro %}
<div class="row">
	<div class="col-md-12 edit-table edit-page">
		<div class="alert alert-warning" role="alert" translate>Changing the WiFi settings during printing could cause interruption.</div>
		<table>
			<tr class="thead">
				<th translate>SSID</th>
				<th translate>Authentication</th>
				<th translate>Password</th>
				<th translate>Quality</th>
				<th translate>Connect</th>
			</tr>
			{% if networks %}
				{% for network in networks %}
					{% if network.ESSID!="" %}
						{{ wirelessView(network.ESSID,network.SecurityProtocol,network.QualityLevel) }}
					{% endif %}
				{% endfor %}
				<form action="/wifi/connect" method="post">
				<tr>
					<td>
						<input name="WifiSSID" class="WifiSSID" placeholder="Enter Hidden SSID">
					</td>
					<td>
						<select name="WifiType">
							<option value="" {% if WifiType=="" %}selected{% endif %} translate>No Encryption</option>
							<option value="WEP" {% if WifiType=="WEP" %}selected{% endif %} translate>WEP</option>
							<option value="WPA" {% if WifiType=="WPA" %}selected{% endif %} translate>WPA</option>
						</select>
					</td>
					<td><input name="WifiPass" value="" placeholder="Wireless Password"></td>
					<td>-/70</td>
					<td><input type="submit" value="Connect" class="btn btn-success"></td>
				</form>
			{% else %}
				<tr><td colspan="5" translate>No wireless connection found</td></tr>
			{% endif %}
		</table>
		<br>
	</div>
</div>
<div class="row">
	<div class="col-md-12">
		<form action="/wifi/connect" method="post">
			<input name="WifiSSID" type="hidden">
			<button type="submit" class="btn-warning" translate>Terminate WiFi Connections</button>
		</form>
	</div>
</div>

{% endblock %}
