<!doctype html>
<html lang="en">
<head>
	<meta charset="utf-8" />
	<link rel="apple-touch-icon" sizes="76x76" href="assets/img/apple-icon.png">
	<link rel="icon" type="image/png" sizes="96x96" href="assets/img/favicon.png">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

	<title>MYORI - KPDNKK</title>

	<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
    <meta name="viewport" content="width=device-width" />


    <!-- Bootstrap core CSS     -->
    <link href="assets/css/bootstrap.min.css" rel="stylesheet" />

    <!-- Animation library for notifications   -->
    <link href="assets/css/animate.min.css" rel="stylesheet"/>

    <!--  Paper Dashboard core CSS    -->
    <link href="assets/css/paper-dashboard.css" rel="stylesheet"/>

    <!--  CSS for Demo Purpose, don't include it in your project     -->
    <link href="assets/css/demo.css" rel="stylesheet" />

    <!--  Fonts and icons     -->
    <link href="http://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css" rel="stylesheet">
    <link href='https://fonts.googleapis.com/css?family=Muli:400,300' rel='stylesheet' type='text/css'>
    <link href="assets/css/themify-icons.css" rel="stylesheet">

</head>
<body>

<?php
//receiving parameter
$id = $_GET['id'];
//echo $id;
echo "<input id='id' type='hidden' value='" .$id. "'/>";
?>

<div class="wrapper">
    <div class="sidebar" data-background-color="white" data-active-color="danger">

    <!--
		Tip 1: you can change the color of the sidebar's background using: data-background-color="white | black"
		Tip 2: you can change the color of the active button using the data-active-color="primary | info | success | warning | danger"
	-->

    	<div class="sidebar-wrapper">
            <div class="logo">
            <img src="./assets/img/logo.png" alt="logo.png" width="55%" style="display:block;margin:auto;"/>

                <a href="#" class="simple-text">
                    <b>PENGILANG</b>
                </a>
            </div>

            <ul class="nav">
                <li>
                    <a href="dashboard.html">
                        <i class="ti-stats-up"></i>
                        <p>Dashboard</p>
                    </a>
                </li>

                <li style="background-color:#EAEAEA;">
                    <a href="#" aria-disabled="disabled">
                        <i class="ti-home"></i>
                        <p>PENGILANG</p>
                    </a>
                </li>                
                <li>
                    <a href="edit_manu.php?id=M00001">
                        <i class="ti-angle-right" style="font-size:12px;color:#A0A0A0"></i>
                        <p>&nbsp;Kemaskini Maklumat</p>
                    </a>
                </li>                

                <li style="background-color:#EAEAEA;">
                    <a href="#" aria-disabled="disabled">
                        <i class="ti-package"></i>
                        <p>PRODUK</p>
                    </a>
                </li>                
                <li>
                    <a href="add_prod.php?id=M00001">
                        <i class="ti-angle-right"></i>
                        <p>&nbsp;Tambah Produk</p>
                    </a>
                </li>                
                <li class="active">
                    <a href="table_prod.php?id=M00001">
                        <i class="ti-angle-right"></i>
                        <p>&nbsp;Senarai Produk</p>
                    </a>
                </li>     
                
                <!-- STIKER -->
                <!--
                <li style="background-color:#EAEAEA;">
                    <a href="#" aria-disabled="disabled">
                        <i class="ti-rss-alt"></i>
                        <p>STIKER</p>
                    </a>
                </li>                
                <li>
                    <a href="#">
                        <i class="ti-angle-right"></i>
                        <p>&nbsp;Mohon Stiker</p>
                    </a>
                </li>    
                <li>
                    <a href="#">
                        <i class="ti-angle-right"></i>
                        <p>&nbsp;Kemaskini Stiker</p>
                    </a>
                </li>                             
                <li>
                    <a href="#">
                        <i class="ti-angle-right"></i>
                        <p>&nbsp;Senarai Stiker</p>
                    </a>
                </li> 
--> 

                <!-- TADBIR -->
                <li style="background-color:#EAEAEA;">
                    <a href="#" aria-disabled="disabled">
                        <i class="ti-settings"></i>
                        <p>TADBIR</p>
                    </a>
                </li>                
                <li>
                    <a href="#">
                        <i class="ti-angle-right"></i>
                        <p>&nbsp;Pengguna</p>
                    </a>
                </li>                

                



<!--
                <li>
                    <a href="user.html">
                        <i class="ti-user"></i>
                        <p>User Profile</p>
                    </a>
                </li>
                <li>
                    <a href="table.html">
                        <i class="ti-view-list-alt"></i>
                        <p>Table List</p>
                    </a>
                </li>
                <li>
                    <a href="typography.html">
                        <i class="ti-text"></i>
                        <p>Typography</p>
                    </a>
                </li>
                <li>
                    <a href="icons.html">
                        <i class="ti-pencil-alt2"></i>
                        <p>Icons</p>
                    </a>
                </li>
                <li>
                    <a href="maps.html">
                        <i class="ti-map"></i>
                        <p>Maps</p>
                    </a>
                </li>
                <li>
                    <a href="notifications.html">
                        <i class="ti-bell"></i>
                        <p>Notifications</p>
                    </a>
                </li>
				<li class="active-pro">
                    <a href="upgrade.html">
                        <i class="ti-export"></i>
                        <p>Upgrade to PRO</p>
                    </a>
                </li>
-->

            </ul>
    	</div>
    </div>
    <div class="main-panel">
		<nav class="navbar navbar-default">
            <div class="container-fluid">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar bar1"></span>
                        <span class="icon-bar bar2"></span>
                        <span class="icon-bar bar3"></span>
                    </button>
                    <a class="navbar-brand" href="#">PRODUK</a>
                </div>
                <div class="collapse navbar-collapse">
                    <ul class="nav navbar-nav navbar-right">
                        <li>
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                <i class="ti-panel"></i>
								<p>Stats</p>
                            </a>
                        </li>
                        <li class="dropdown">
                              <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                    <i class="ti-bell"></i>
                                    <p class="notification">5</p>
									<p>Notifications</p>
									<b class="caret"></b>
                              </a>
                              <ul class="dropdown-menu">
                                <li><a href="#">Notification 1</a></li>
                                <li><a href="#">Notification 2</a></li>
                                <li><a href="#">Notification 3</a></li>
                                <li><a href="#">Notification 4</a></li>
                                <li><a href="#">Another notification</a></li>
                              </ul>
                        </li>
						<li>
                            <a href="#">
								<i class="ti-settings"></i>
								<p>Settings</p>
                            </a>
                        </li>
                    </ul>

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


        <div class="content">
            <div class="container-fluid">
                <div class="row">

                    <div class="col-md-12">
                        <div class="card card-plain">
                            <div class="header">
                                <h4 class="title">Senarai Produk</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>Jenis</b></th>
                                    	<th><b>Jenama</b></th>
                                    	<th><b>Model/Kod Produk</b></th>
                                    	<th><b>Tahun Keluaran</b></th>
                                    	<th>[Tindakan]</th>
                                    </thead>
                                    <tbody>
                                        <!-- jquery to fill -->
                                    </tbody>
                                </table>

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


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

        <footer class="footer">
            <div class="container-fluid">
                <nav class="pull-left">
                <!--
                    <ul>

                        <li>
                            <a href="http://www.creative-tim.com">
                                Creative Tim
                            </a>
                        </li>
                        <li>
                            <a href="http://blog.creative-tim.com">
                               Blog
                            </a>
                        </li>
                        <li>
                            <a href="http://www.creative-tim.com/license">
                                Licenses
                            </a>
                        </li>
                    </ul>
                -->
                </nav>
				<div class="copyright pull-right">
                    &copy; <script>document.write(new Date().getFullYear())</script>, made with <i class="fa fa-heart heart"></i> by <a href="#">myori services</a>
                </div>
            </div>
        </footer>


    </div>
</div>


</body>

    <!--   Core JS Files   -->
    <script src="assets/js/jquery-1.10.2.js" type="text/javascript"></script>
	<script src="assets/js/bootstrap.min.js" type="text/javascript"></script>

	<!--  Checkbox, Radio & Switch Plugins -->
	<script src="assets/js/bootstrap-checkbox-radio.js"></script>

	<!--  Charts Plugin -->
	<script src="assets/js/chartist.min.js"></script>

    <!--  Notifications Plugin    -->
    <script src="assets/js/bootstrap-notify.js"></script>

    <!--  Google Maps Plugin    -->
    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js"></script>

    <!-- Paper Dashboard Core javascript and methods for Demo purpose -->
	<script src="assets/js/paper-dashboard.js"></script>

	<!-- Paper Dashboard DEMO methods, don't include it in your project! -->
    <script src="assets/js/demo.js"></script>
    
    <script>

        $(document).ready(function() {

            var id = $('#id').val();
            console.log('id...', id);

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

            getData();



            function getData(){
                $.ajax({
                    type: "get",
                    url: url + "/m/ws/get_products.php?id=" + id
                    }).done(function(json) { 
                    //console.log(json);
                    var data = $.parseJSON(json);
                    console.log('data...', data);
                    
                    if (data && data.length > 0) {
                        //console.log('data0...', data[0]);
                        /*
                        $("#name").val(data[0].name).change();
                        $("#regno").val(data[0].regno).change();
                        $("#address").val(data[0].address).change();
                        $("#postcode").val(data[0].postcode).change();
                        $("#town").val(data[0].town).change();
                        $("#state").val(data[0].state).change();
                        $("#telephone").val(data[0].telephone).change();
                        $("#fax").val(data[0].fax).change();
                        $("#url").val(data[0].url).change();
                        $("#officer").val(data[0].officer).change();
                        $("#phone").val(data[0].phone).change();
                        $("#email").val(data[0].email).change();
                        $("#type").val(data[0].type).change();

                        $("#label_title").html(data[0].name).change();
                        $("#label_reg").html(data[0].regno).change();
                        */

                        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.type+ "</td>";
                            tr = tr + "    <td>" +v.jenama+ "</td>";
                            tr = tr + "    <td>" +v.model+"/"+v.produk+  "</td>";
                            tr = tr + "    <td>" +v.prod_year+ "</td>";
                            tr = tr + "    <td>";
                            tr = tr + "        <a href='show_prod.php?id=" +v.nfc+ "'>";
                            tr = tr + "            <i class='ti-info-alt' title='Papar Maklumat'></i>&nbsp;&nbsp;&nbsp;";
                            tr = tr + "        </a>";
                            tr = tr + "        <a href='edit_prod.php?id=" +v.nfc+ "'>";
                            tr = tr + "            <i class='ti-pencil' title='Kemaskini Maklumat'></i>&nbsp;&nbsp;&nbsp;";
                            tr = tr + "        </a>";
                            tr = tr + "    </td>";
                            tr = tr + "</tr>";

                            console.log('tr...', tr);

                            $("#products tbody").append(tr);

                        });

                        $("#totalrow").html(loop).change();




                    }                
                });	
            }


        });

    </script>    


</html>
