list.pt 3.38 KB
<div metal:use-macro="load: ../layout-menu.pt">

    <div metal:fill-slot="head">
        <link href="/static/grid.css" rel="stylesheet"/>
    </div>
 
    <div metal:fill-slot="content">
        <h1>Pesan</h1>

        <div tal:content="structure form"/>

        <div tal:condition="request.GET.get('lihat')">
            <div tal:condition="not count">
                <div class="alert alert-danger">Tidak ada hasil.</div>
            </div>

            <div tal:condition="count">
                <div class="alert alert-success">Ada ${count} hasil.</div>
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>Waktu Catat &amp;<br/>Operator</th>
                            <th>Pengirim &amp;<br/>Penerima</th>
                            <th>Pesan &amp;<br/>Jawaban</th>
                            <th>Status</th>
                            <th>Parser</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr tal:repeat="row rows">
                            <td>${row.id}</td>
                            <td>
                                ${row.tgl.strftime('%-d %B %Y %H:%M:%S')}<br/>
                                ${row.tgl_operator and row.tgl_operator.strftime('%-d %B %Y %H:%M:%S')}
                            </td>
                            <td>
                                <span tal:condition="row.pengirim" tal:replace="row.pengirim"/>
                                <span tal:condition="not row.pengirim">
                                    Tidak ada pengirim
                                </span>
                                <br/>
                                <span tal:condition="row.penerima" tal:replace="row.penerima"/>
                                <span tal:condition="not row.penerima">
                                    USSD
                                </span>
                            </td>
                            <td>
                                ${row.pesan}<br/>
                                <i>${row.jawaban}</i>
                            </td>
                            <td tal:condition="row.kirim">
                                <span tal:condition="row.status == 0">Terkirim</span>
                                <span tal:condition="row.status > 0 and row.status != 4">Sedang dikirim</span>
                                <span tal:condition="row.status < 0">Gagal terkirim</span>
                                <span tal:condition="row.status == 4">Sudah dikirim ulang</span>
                                <br/>
                                <a tal:condition="row.status not in [0, 4]"
                                    href="/message/${row.id}/resend?from_url=${from_url}">
                                    Kirim ulang
                                </a>
                            </td>
                            <td tal:condition="not row.kirim">Pesan masuk</td>
                            <td>${row.parser}</td>
                        </tr>
                    </tbody>
                </table>

                <center
                    tal:content="structure
                        rows.pager(format='$link_previous ~4~ $link_next')"/>
            </div><!-- condition count -->
        </div><!-- condition lihat -->

    </div>

</div>