summaryrefslogtreecommitdiff
path: root/addons/hw_posbox_homepage/views/six_payment_terminal.html
blob: 622c6a84a6ecb7a60d9facd60a495da8f17f3222 (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
61
{% extends "layout.html" %}
{% from "loading.html" import loading_block_ui %}
{% block head %}
    <script>
        var _onQueryDone = function () {
            $('.message-status').html('Updated configuration <br> Refreshing page');
            setTimeout(function () {
                location.reload();
            }, 30000);
        }
        $(document).ready(function () {
            $('#terminal-id').submit(function(e){
                e.preventDefault();
                $('.loading-block').removeClass('o_hide');
                $.ajax({
                    url: '/six_payment_terminal_add',
                    type: 'post',
                    data: $('#terminal-id').serialize(),
                }).always(_onQueryDone);
            });
            $('#terminal-clear').submit(function(e){
                e.preventDefault();
                $('.loading-block').removeClass('o_hide');
                $.ajax({
                    url: '/six_payment_terminal_clear',
                    type: 'get',
                }).always(_onQueryDone);
            });
        });
    </script>
{% endblock %}
{% block content %}
    <h2 class="text-center">Six Payment Terminal</h2>
    <p>
        Set the Terminal ID (TID) of the terminal you want to use.
    </p>
    <form id="terminal-id" action='/six_payment_terminal_add' method='POST'>
        <table align="center">
            <tr>
                <td>Terminal ID</td>
                <td><input type="text" name="terminal_id"></td>
            </tr>
            <tr>
                <td/>
                <td><input class="btn" type="submit" value="Connect"/></td>
            </tr>
        </table>
        {{ loading_block_ui(loading_message) }}
    </form>
    {% if terminalId %}
        <p class="text-center font-small">
            Current Terminal Id: <strong>{{ terminalId }}</strong>
        </p>
        <div class="text-center font-small" style="margin: 10px auto;">
            You can clear the terminal configuration
            <form id="terminal-clear" style="display: inline-block;margin-left: 4px;">
                <input class="btn btn-sm" type="submit" value="Clear"/>
            </form>
        </div>
    {% endif %}
{% endblock %}