config.index.html 4.63 KB
{% extends "template.starter.html" %}

{% block content %}


{% for modem in modems %}
    <a href="#modem{{modem.name}}" class="btn btn-sm btn-primary">{{modem.name}}</a>
{% endfor %}

<a href="#addmodem" class="btn btn-sm btn-success">Tambah modem...</a>

<br>

{% for modem in modems %}
<div id="modem{{modem.name}}">&nbsp;</div>

<div class="card">
    <h5 class="card-header">
        {{ modem.name }}
    </h5>
    <div class="card-body">

        <dl class="row">
            <dt class="col-sm-3">Outgoing</dt>
            <dd class="col-sm-9">
                {% if modem.outgoing %}
                {% set newValue = 0 %}
                {% set btnClass = "btn btn-success" %}
                {% set btnTitle = "klik disini untuk menonaktifkan outgoing" %}
                {% else %}
                {% set newValue = 1 %}
                {% set btnClass = "btn btn-danger" %}
                {% set btnTitle = "klik disini untuk mengaktifkan outgoing" %}
                {% endif %}
                <a href="{{ baseUrl }}/modem/set-outgoing/{{ modem.name | urlencode }}/{{ newValue }}"
                    class="{{ btnClass }}" title="{{ btnTitle }}"
                    onclick="return window.confirm('Apakah anda yakin ingin mengubah status outgoing modem {{ modem.name }} menjadi {{ not modem.outgoing }}?');">
                {{ modem.outgoing }}
                </a>
            </dd>

            <dt class="col-sm-3">IMSI</dt>
            <dd class="col-sm-9">
                {{ modem.imsi or '-' }}
                <br>
                <form method="post" action="{{ baseUrl }}/modem/update-imsi" class="form-inline">
                    <input type="hidden" name="name" value="{{ modem.name | urlencode }}">
                    <div class="form-group">
                        <input type="text" name="imsi" class="form-control" placeholder="imsi baru, misal: 5100xxxxxxxxxxx">
                    </div>
                    <button type="submit" class="btn btn-primary">Simpan IMSI baru</button>
                </form>
            </dd>

            <dt class="col-sm-3">Prefix</dt>
            <dd class="col-sm-9">
                {% for prefix_item in modem.prefix %}
                {{ prefix_item }}
                <a href="{{ baseUrl }}/modem/del-prefix/{{ modem.name | urlencode }}/{{ prefix_item | urlencode}}" onclick="return window.confirm('Apakah anda yakin ingin mengapus prefix {{ prefix_item }} dari modem {{ modem.name }}?');">
                x
                </a>
                <br>
                {% endfor %}
                <form method="post" action="{{ baseUrl }}/modem/add-prefix" class="form-inline">
                    <input type="hidden" name="name" value="{{ modem.name | urlencode }}">
                    <div class="form-group">
                        <input type="text" name="prefix" class="form-control" placeholder="prefix baru, misal 6281x">
                    </div>
                    <button type="submit" class="btn btn-primary">Simpan prefix baru</button>
                </form>
            </dd>

            <dt class="col-sm-3">Custom Sender</dt>
            <dd class="col-sm-9">
                <br>
                <form method="post" action="{{ baseUrl }}/modem/update-custom-ip">
                    <input type="hidden" name="name" value="{{ modem.name | urlencode }}">
                    <div class="form-group">
                        <input type="text" name="url" class="form-control" placeholder="url: misal http://127.0.0.0:59194/service/sendsms" value="{{ modem.url }}">
                    </div>
                    <div class="form-group">
                        <input type="text" name="username" class="form-control" placeholder="username" value="{{ modem.username }}">
                    </div>
                    <div class="form-group">
                        <input type="password" name="password" class="form-control" placeholder="password"  value="{{ modem.password }}">
                    </div>
                    <button type="submit" class="btn btn-primary">Simpan custom data sender</button>
                </form>
            </dd>
        </dl>

        <div class="text-right">
            <form method="post" action="{{ baseUrl }}/modem/delete">
                <input type="hidden" name="name" value="{{ modem.name | urlencode }}">
                <button type="submit" class="btn btn-danger"
                    onclick="return window.confirm('Apakah anda yakin ingin menghapus modem {{ modem.name }}?');"
                >
                    Hapus Modem
                </button>
            </form>        
        </div>
    </div>
</div>
<br>
{% endfor %}

{% include "config.include.addmodem.html" %}

{% endblock %}