index.html 3.94 KB
{% extends "starter-template.html" %}

{% block content %}

<form class="form-horizontal">
    <div class="form-group">
        <label for="inputDate" class="col-sm-2 control-label">Date</label>
        <div class="col-sm-2">
            <input name="trxdate" type="date" class="form-control" id="inputDate" value="{{ conditions.ts_date }}">
        </div>
    </div>

    <div class="form-group">
        <label for="inputDestination" class="col-sm-2 control-label">Destination</label>
        <div class="col-sm-10">
            <input name="destination" type="text" class="form-control" id="inputDestination" value="{{ conditions.destination }}">
        </div>
    </div>

    <div class="form-group">
        <label for="inputProduct" class="col-sm-2 control-label">Product</label>
        <div class="col-sm-10">
            <input name="product" type="text" class="form-control" id="inputProduct" value="{{ conditions.product }}">
        </div>
    </div>

    <div class="form-group">
        <label for="inputSupplier" class="col-sm-2 control-label">Supplier</label>
        <div class="col-sm-10">
            <select class="form-control" name="supplier" id="inputSupplier">

              {% for supplier in suppliers %}
              <option
                {% if supplier == conditions.supplier %}
                selected="selected"
                {% endif %}
              >
                {{ supplier }}
              </option>
              {% endfor %}

            </select>
        </div>
    </div>

    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <input type="submit" class="btn btn-primary">
        </div>
    </div>

</form>

<br><br>

<table class="table table-striped table-hover">

    <tr>
        <th class="hidden-xs hidden-sm hidden-md">ReqId</th>
        <th>Time</th>
        <th>Destination</th>
        <th>Product</th>
        <th class="hidden-xs hidden-sm hidden-md">Supplier</th>
        <th>RC</th>
        <th class="hidden-xs hidden-sm hidden-md">Message</th>
    </tr>

    {% for trx in trxs %}
    {% if trx.responses %}
    {% set lastResponse = trx.responses|last %}
    {% endif %}

    <tr>
        <td class="hidden-xs hidden-sm hidden-md">
            <a href="/trx/view/{{ trx.requestId }}">{{ trx.requestId }}</a>
        </td>

        <td>{{ trx.ts }}</td>

        <td>
            <a href="/trx/view/{{ trx.requestId }}">{{ trx.destination }}</a>
        </td>

        <td>{{ trx.product }}</td>

        <td class="hidden-xs hidden-sm hidden-md">
            {% if trx.supplier %}
            {{ trx.supplier }}
            {% else %}
            -
            {% endif %}
        </td>

        <td>
            {% if lastResponse %}
                {% if (trx.supplier == "CJK") %}
                    {{ lastResponse.parsed.ciwaru.rc }}
                {% elif (trx.supplier == "TRUST")  %}
                    {{ lastResponse.parsed.RESPONSECODE }}
                {% else %}
                    UNKNOWN
                {% endif %}
            {% else %}
            -
            {% endif %}
        </td>

        <td class="hidden-xs hidden-sm hidden-md">
            {% if lastResponse %}
                {% if (trx.supplier == "CJK") %}
                    {{ lastResponse.parsed.ciwaru.msg }}
                {% elif (trx.supplier == "TRUST")  %}
                    {{ lastResponse.parsed.MESSAGE }}
                {% else %}
                    UNKNOWN
                {% endif %}
            {% else %}
            -
            {% endif %}
        </td>


    </tr>
    {% endfor %}

</table>

<p>
    <ul class="pagination">
        {% for page in paginator %}
        <li
            {% if page.active %}
                class="active"
            {% endif %}
        >
            <a href="{{ page.link | safe }}">
                {{ page.number }}
            </a>
        </li>
        {% endfor %}
    </ul>
</p>

<p>
    Total {{ trxcount }} transactions available in {{ pagecount }} pages.
</p>

{% endblock %}