summaryrefslogtreecommitdiff
path: root/addons/hw_posbox_homepage/views/server_config.html
blob: 6824ee67d60b2fd85b27bf101d7c2f1893682ca5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{% extends "layout.html" %}
{% from "loading.html" import loading_block_ui %}
{% block head %}
    <script>
        $(document).ready(function () {
            $('#server-config').submit(function(e){
                e.preventDefault();
                $('.loading-block').removeClass('o_hide');
                $.ajax({
                    url: '/server_connect',
                    type: 'post',
                    data: $('#server-config').serialize(),
                }).fail(function () {
                    $('.message-status').html('Configure Domain Server <br> Redirect to IoT Box');
                    if ($('#iotname')[0].defaultValue == $('#iotname')[0].value){
                        var rebootTime = 30000;
                    }else{
                        var rebootTime = 100000;
                    }
                    setTimeout(function () {
                            location.reload(true);
                    }, rebootTime);
                });
            });
        });
    </script>
{% endblock %}
{% block content %}
    <h2 class="text-center">Configure Odoo Server</h2>
    <p>
        Paste the token from the Connect wizard in your Odoo instance in the Server Token field.  If you change the IoT Box Name,
        your IoT Box will need a reboot.
    </p>
    <form id="server-config" action='/server_connect' method='POST'>
        <table align="center">
            <tr>
                <td>IoT Box Name</td>
                <td><input type="text" id="iotname" name="iotname" value="{{ hostname }}"></td>
            </tr>
            <tr>
                <td>Server Token</td>
                <td><input type="text" name="token"></td>
            </tr>
            <tr>
                <td/>
                <td><input class="btn" type="submit" value="Connect"/></td>
            </tr>
        </table>
        <p class="text-center font-small">
            Your current server <strong>{{ server_status }}</strong>
        </p>
        {{ loading_block_ui(loading_message) }}
    </form>
    <div class="text-center font-small" style="margin: 10px auto;">
        You can clear the server configuration
        <form style="display: inline-block;margin-left: 4px;" action='/server_clear'>
            <input class="btn btn-sm" type="submit" value="Clear"/>
        </form>
    </div>
{% endblock %}