<!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 class="active">
                    <a href="edit_manu.php?id=M00001">
                        <i class="ti-angle-right" style="font-size:12px;"></i>
                        <p>&nbsp;Kemaskini Maklumat</p>
                    </a>
                </li>                
    
            <!-- PRODUK -->
            <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>
                <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="#">PENGILANG</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-lg-4 col-md-5">
                    <div class="card card-user">
                    <div class="image" style="height:206px !important">
                        <img src="assets/img/background2.jpg" alt="..."/>
                    </div>
                    <div class="content" style="margin-top:0px">
                        <div class="author"> 
                          <img class="avatar border-white" style="opacity:10% !important;" src="assets/img/logo.jpg" alt="..."/>
                          <h4 class="title"><span id="label_title"></span><br />
                             <a href="#"><span id="label_reg"></span></a>
                          </h4>
                        </div>
                    </div>
                    <hr>
                    <div class="text-center">
                        <div class="row">
                            <!--
                            <div class="col-md-3 col-md-offset-1">
                                <h5>12<br /><small>Files</small></h5>
                            </div>
                            -->
                            <div class="col-md-4 col-md-offset-2">
                                <h5>000<br /><small>Produk</small></h5>
                            </div>
                            <div class="col-md-4">
                                <h5>000<br /><small>Stiker</small></h5>
                            </div>
                        </div>
                    </div>
                </div>
                        <div class="card hidden">
                            <div class="header">
                                <h4 class="title">Team Members</h4>
                            </div>
                            <div class="content">
                                <ul class="list-unstyled team-members">
                                            <li>
                                                <div class="row">
                                                    <div class="col-xs-3">
                                                        <div class="avatar">
                                                            <img src="assets/img/faces/face-0.jpg" alt="Circle Image" class="img-circle img-no-padding img-responsive">
                                                        </div>
                                                    </div>
                                                    <div class="col-xs-6">
                                                        DJ Khaled
                                                        <br />
                                                        <span class="text-muted"><small>Offline</small></span>
                                                    </div>

                                                    <div class="col-xs-3 text-right">
                                                        <btn class="btn btn-sm btn-success btn-icon"><i class="fa fa-envelope"></i></btn>
                                                    </div>
                                                </div>
                                            </li>
                                            <li>
                                                <div class="row">
                                                    <div class="col-xs-3">
                                                        <div class="avatar">
                                                            <img src="assets/img/faces/face-1.jpg" alt="Circle Image" class="img-circle img-no-padding img-responsive">
                                                        </div>
                                                    </div>
                                                    <div class="col-xs-6">
                                                        Creative Tim
                                                        <br />
                                                        <span class="text-success"><small>Available</small></span>
                                                    </div>

                                                    <div class="col-xs-3 text-right">
                                                        <btn class="btn btn-sm btn-success btn-icon"><i class="fa fa-envelope"></i></btn>
                                                    </div>
                                                </div>
                                            </li>
                                            <li>
                                                <div class="row">
                                                    <div class="col-xs-3">
                                                        <div class="avatar">
                                                            <img src="assets/img/faces/face-3.jpg" alt="Circle Image" class="img-circle img-no-padding img-responsive">
                                                        </div>
                                                    </div>
                                                    <div class="col-xs-6">
                                                        Flume
                                                        <br />
                                                        <span class="text-danger"><small>Busy</small></span>
                                                    </div>

                                                    <div class="col-xs-3 text-right">
                                                        <btn class="btn btn-sm btn-success btn-icon"><i class="fa fa-envelope"></i></btn>
                                                    </div>
                                                </div>
                                            </li>
                                        </ul>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-8 col-md-7">
                        <div class="card card-plain">
                            <div class="header">
                                <h4 class="title">Kemaskini Maklumat</h4>
                            </div>
                            <div class="content">
                                <form id="formid">

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

                                    <div class="row">
                                        <div class="col-md-8">
                                            <div class="form-group">
                                                <label>Nama Pengilang / Syarikat</label>
                                                <input id="name" name="name" type="text" class="form-control border-input" placeholder="Nama" value="" readonly>
                                            </div>
                                        </div>
                                        <div class="col-md-4" >
                                            <div class="form-group">
                                                <label >Pendaftaran Syarikat</label>
                                                <input id="regno" name="regno" type="text" class="form-control border-input" placeholder="Pendaftaran Syarikat" readonly>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="row">
                                        <div class="col-md-8">
                                            <div class="form-group">
                                                <label>Alamat</label>
                                                <input id="address" name="address" type="text" class="form-control border-input" placeholder="Alamat" value="" >
                                            </div>
                                        </div>
                                    </div>

                                    <div class="row">
                                        <div class="col-md-4">
                                            <div class="form-group">
                                                <input id="postcode" name="postcode" type="text" class="form-control border-input" placeholder="Poskod" >
                                            </div>
                                        </div>
                                        <div class="col-md-4">
                                            <div class="form-group">
                                                <input id="town" name="town" type="text" class="form-control border-input" placeholder="Bandar" value="" >
                                            </div>
                                        </div>
                                        <div class="col-md-4">
                                            <div class="form-group">
                                                <!--
                                                <input type="text" class="form-control border-input" placeholder="Negeri" value="Australia">
                                                -->
                                                <select id="state" name="state" class="form-control border-input" placeholder="Negeri">
                                                    <option value="PER">Perlis</option>
                                                    <option value="KED">Kedah</option>
                                                    <option value="PPG">Pulau Pinang</option>
                                                    <option value="KEL">Kelantan</option>
                                                    <option value="TRG">Terengganu</option>
                                                    <option value="PRK">Perak</option>
                                                    <option value="SEL" selected>Selangor</option>
                                                    <option value="NGS">Negri Sembilan</option>
                                                    <option value="MLK">Melaka</option>
                                                    <option value="PAH">Pahang</option>
                                                    <option value="JOH">Johor</option>
                                                    <option value="WP1">WP K. Lumpur</option>
                                                    <option value="WP2">WP Putrajaya</option>
                                                    <option value="WP3">WP Labuan</option>
                                                    <option value="SWK">Sarawak</option>
                                                    <option value="SBH">Sabah</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>

                                    <hr/>

                                    <div class="row">
                                        <div class="col-md-4">
                                            <div class="form-group">
                                                <label>Komunikasi</label>
                                                <input id="telephone" name="telephone" type="text" class="form-control border-input" placeholder="No. Telefon" value="" >
                                            </div>
                                        </div>
                                        <div class="col-md-4">
                                            <div class="form-group">
                                                <label>&nbsp;</label>
                                                <input id="fax" name="fax" type="text" class="form-control border-input" placeholder="No. Faks" value="" >
                                            </div>
                                        </div>
                                        <div class="col-md-4">
                                            <div class="form-group">
                                                <label>&nbsp;</label>
                                                <input id="url" name="url" type="email" class="form-control border-input" placeholder="Alamat Email" >
                                            </div>
                                        </div>
                                    </div>

                                    <div class="row">
                                        <div class="col-md-8">
                                            <div class="form-group">
                                                <label>Nama Pegawai / Admin</label>
                                                <input id="officer" name="officer" type="text" class="form-control border-input" placeholder="Nama Pegawai" value="" >
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-4">
                                            <div class="form-group">
                                                <input id="phone" name="phone" type="text" class="form-control border-input" placeholder="No. Telefon" value="" >
                                            </div>
                                        </div>
                                        <div class="col-md-4">
                                            <div class="form-group">
                                                <input id="email" name="email" type="email" class="form-control border-input" placeholder="Alamat Email" >
                                            </div>
                                        </div>
                                    </div>                                    

                                    <hr/>

                                    <div class="row">
                                        <div class="col-md-4">
                                            <div class="form-group">
                                                <label>Jenis Perniagaan</label>
                                                <select id="type" name="type" class="form-control border-input" placeholder="Jenis Perniagaan">
                                                    <option value="LED">LED</option>
                                                    <option value="TOYS">TOYS</option>
                                                    <option value="FOOD">FOOD</option>
                                                </select>                                                
                                            </div>
                                        </div>                                        
                                    </div>
<!--
                                    <div class="row">
                                        <div class="col-md-12">
                                            <div class="form-group">
                                                <label>About Me</label>
                                                <textarea rows="5" class="form-control border-input" placeholder="Here can be your description" value="Mike">Oh so, your weak rhyme
You doubt I'll bother, reading into it
I'll probably won't, left to my own devices
But that's the difference in our opinions.</textarea>
                                            </div>
                                        </div>
                                    </div>
-->                                    
                                    <div class="row">
                                            <br/>
                                            <br/>
                                            <br/>
                                    </div>
                                    <div class="text-center">
                                        
                                        <button id="simpan" name="simpan" type="button" class="btn btn-info btn-fill btn-wd">Simpan Maklumat</button>
                                        
                                    </div>
                                    <div class="clearfix"></div>
                                </form>
                            </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="http://www.creative-tim.com">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_manu_detail.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();
                    }                
                });	
            }

            $("#simpan").click(function() {
                simpan();
            });

            function simpan() {
                console.log("simpan maklumat...");

                var formArray = $('#formid').serializeArray();
                var arr = objectifyForm(formArray);
                console.log(arr);

                post_Simpan(arr);

            }

            function objectifyForm(formArray) {//serialize data function
                var returnArray = {};
                for (var i = 0; i < formArray.length; i++){
                    returnArray[formArray[i]['name']] = formArray[i]['value'];
                }
                return returnArray;
            }     


            function post_Simpan(obj) {

                var json = JSON.stringify(obj);
                console.log('json...', json);
                console.log(url);

                $.ajax({
                    type: 'POST',
                    url: url + "/m/ws/post_manu_detail.php",
                    data: json, // or JSON.stringify ({name: 'jonas'}),
                    //contentType: "application/json",
                    //dataType: 'json',
                    success: function(data) { 
                        var msg = data;
                        if (msg && msg.indexOf('Error:') > -1){
                            alert('Simpan maklumat gagal !' + msg);
                        }
                        else {
                            alert('Simpan maklumat berjaya.'); 
                        }
                    },
                    error: function(){
                        alert('Simpan maklumat gagal !'); 
                    }
                });

            }       

        });

    </script>


</html>
