<div class="container-fluid">
    <div class="row">
        <div class="col-md-12">
            <div class="card card-plain">
                <div class="header">
                    <h4 class="title">Senarai Kes</h4>
                    <p class="category">Jumlah Rekod: <span id="totalrow">0</span></p>
                </div>
                <div class="content table-responsive table-full-width">
                    <table id="products" class="table table-hover">
                        <thead>
                            <th>#</th>
                            <th><b>Tarikh Laporan</b></th>
                            <th><b>No. Kes</b></th>
                            <th><b>Industri</b></th>
                            <th><b>Negeri</b></th>
                            <th>[Tindakan]</th>
                        </thead>
                        <tbody>
                            <!-- jquery to fill -->
                        </tbody>
                    </table>

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

<script type="text/javascript">
    	$(document).ready(function(){

            //globals
            var url = "";
            url = url + "http://myori.afxtechnologies.com/";

            //app starts here...
            getData();


            function getData(){
                $.ajax({
                    type: "get",
                    url: url + "/k/ws/get_reports.php"
                    }).done(function(json) { 
                    //console.log(json);
                    var data = $.parseJSON(json);
                    console.log('data...', data);
                    
                    if (data && data.length > 0) {

                        var loop = 0;
                        $.each(data, function(k, v) {
                            //console.log('loop...', loop);
                            //console.log('val...', v);
                            var tr = "";
                            loop++;
                            tr = tr + "<tr>";
                            tr = tr + "    <td>" +loop+ "</td>";
                            tr = tr + "    <td>" +v.rpt_txn+ "</td>";
                            tr = tr + "    <td>" +v.id+ "</td>";
                            tr = tr + "    <td>" +v.status+  "</td>";
                            tr = tr + "    <td>" +v.officer+ "</td>";
                            tr = tr + "    <td>";
                            tr = tr + "        <a href='show_kes.php?id=" +v.id+ "'>";
                            tr = tr + "            <i class='ti-info-alt' title='Papar Maklumat'></i>&nbsp;&nbsp;&nbsp;";
                            tr = tr + "        </a>";
                            tr = tr + "    </td>";
                            tr = tr + "</tr>";
                            $("#products tbody").append(tr);
                        });
                        $("#totalrow").html(loop).change();
                    }        
                });	
            }

        });
</script>


