summaryrefslogtreecommitdiff
path: root/addons/hw_posbox_homepage/views/wifi_config.html
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/hw_posbox_homepage/views/wifi_config.html
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/hw_posbox_homepage/views/wifi_config.html')
-rw-r--r--addons/hw_posbox_homepage/views/wifi_config.html71
1 files changed, 71 insertions, 0 deletions
diff --git a/addons/hw_posbox_homepage/views/wifi_config.html b/addons/hw_posbox_homepage/views/wifi_config.html
new file mode 100644
index 00000000..94e0579b
--- /dev/null
+++ b/addons/hw_posbox_homepage/views/wifi_config.html
@@ -0,0 +1,71 @@
+{% extends "layout.html" %}
+{% from "loading.html" import loading_block_ui %}
+{% block head %}
+ <script>
+ $(document).ready(function () {
+ $('#wifi-config').submit(function(e){
+ e.preventDefault();
+ $('.loading-block').removeClass('o_hide');
+ $.ajax({
+ url: '/wifi_connect',
+ type: 'post',
+ data: $('#wifi-config').serialize(),
+ }).done(function (message) {
+ var data = JSON.parse(message);
+ var message = data.message;
+ if (data.server) {
+ message += '<br>'+ data.server.message;
+ setTimeout(function () {
+ window.location = data.server.url;
+ }, 30000);
+ }
+ $('.message-status').html(message);
+ }).fail(function () {
+ $('.error-message').text('Error in connecting to wifi');
+ $('.loading-block').addClass('o_hide');
+ });
+ });
+ });
+ </script>
+{% endblock %}
+{% block content %}
+ <h2 class="text-center">Configure Wifi</h2>
+ <p>
+ Here you can configure how the iotbox should connect to wireless networks.
+ Currently only Open and WPA networks are supported. When enabling the persistent checkbox,
+ the chosen network will be saved and the iotbox will attempt to connect to it every time it boots.
+ </p>
+ <form id="wifi-config" action='/wifi_connect' method='POST'>
+ <table align="center">
+ <tr>
+ <td>ESSID</td>
+ <td>
+ <select name="essid">
+ {% for id in ssid -%}
+ <option value="{{ id }}">{{ id }}</option>
+ {%- endfor %}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>Password</td>
+ <td><input type="password" name="password" placeholder="optional"/></td>
+ </tr>
+ <tr>
+ <td>Persistent</td>
+ <td><input type="checkbox" name="persistent"/></td>
+ </tr>
+ <tr>
+ <td/>
+ <td><input class="btn" type="submit" value="Connect"/></td>
+ </tr>
+ </table>
+ </form>
+ <div class="text-center font-small" style="margin: 10px auto;">
+ You can clear the persistent configuration
+ <form style="display: inline-block;margin-left: 4px;" action='/wifi_clear'>
+ <input class="btn btn-sm" type="submit" value="Clear"/>
+ </form>
+ </div>
+ {{ loading_block_ui(loading_message) }}
+{% endblock %}