<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="stylesheet" href="bootstrap/css/footer.css">
<link rel="stylesheet" href="bootstrap/css/base.css">
<link rel="stylesheet" href="bootstrap/css/skeleton.css">
<link rel="stylesheet" href="bootstrap/less/datepicker.less">
<link rel="stylesheet" href="bootstrap/css/layout.css">
<link href="bootstrap/css/datepicker.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="bootstrap/css/bootstrap.css" rel="stylesheet"/>
<link type"text/css" rel="Stylesheet" href="bootstrap/css/bootstrap.css" />
<meta charset="UTF-8">
<title>AFM ASS</title>
</head>

<body>
                                    <div class="row clearfix">
                                        <div class="col-md-12 column">
                                        </div>
                                    </div>
                                        <div class="row clearfix">
                                        <div class="col-md-12 column">
                                        </div>
                                    </div>
                                        <div class="row clearfix">
                                        <div class="col-md-12 column">
                                        </div>
                                    </div>
<div class="container">
	<div class="row clearfix">
		<div class="col-md-12 column">
			<div class="page-header">
				<h1>
					AFM Asset Management <small>ระบบการจัดการสินทรัพย์บริษัท เอ เอฟ เอ็ม จำกัด</small>
				</h1>
			</div>
			<?php include("navbartop.php"); ?>
		</div>
	</div>
<form role="form" method="post" action="saveeditgadget.php">
<?php
include("connect.php");
$id = $_REQUEST['edit_id'];
$sql_show = " SELECT * FROM tb_gadget,tb_department,tb_gadgettype
where
tb_gadget.Gadgettype_id = tb_gadgettype.Gadgettype_id
AND
tb_gadget.Department_user = tb_department.Department_id
AND tb_gadget.Gadget_id = '".$id."' ";
$result_show = mysql_query($sql_show) or die(mysql_error());
$row_show = mysql_fetch_array($result_show);
?>

	<div class="form-group">
    	<div class="form-inline">
        		<label for="inputEmail3" class="col-sm-2">หมวดหมู่</label>
        			<div class="col-sm-3">
        <select class="form-control" name="gadgettype" required>
          <?php
		    mysql_query("SET NAMES UTF8");
           $result = mysql_query("SELECT * FROM `tb_gadgettype`");
           while($row = mysql_fetch_array($result)){
			   echo "<option value=\"$row[Gadgettype_id]\" ";
			   if($row_show['Gadgettype_id']==$row['Gadgettype_id']) { echo 'selected'; }
			   echo ">$row[Gadgettype]";
			   echo "</option>\n";
        ?>
           
           </option>
          <?php }?>
        </select>
    
    
    
         			</div>
		</div>
   	</div>
    <div class="form-group">
    	<div class="form-inline">
        	<label for="inputEmail3" class="col-sm-2">ยี่ห้อ</label>
        	<div class="col-sm-3">
    <input type="text" class="form-control" placeholder="HP,LENOVO,DELL,ETC." name="brand" 
    value="<?=$row_show['Brand']?>"
      required>
         	</div>
		</div>
    </div>
    									<div class="row clearfix">
                                        <div class="col-md-12 column">
                                        </div>
                                    	</div>
    <div class="form-group">
    	<div class="form-inline">
        	<label for="inputEmail3" class="col-sm-2">รุ่น</label>
        	<div class="col-sm-3">
            <input type="text" class="form-control" placeholder="Model" name="model" 
            value="<?=$row_show['Model']?>"
            required>
         	</div>
		</div>
    </div>
    <div class="form-group">
    	<div class="form-inline">
        	<label for="inputEmail3" class="col-sm-2">วันที่ซื้อ</label>
        	<div class="col-sm-3">
            <input type="date" class="form-control" id="datepicker" name="datebuy" 
            value="<?=$row_show['Date_purchase']?>"
            required >
         	</div>
		</div>
    </div>
    									<div class="row clearfix">
                                        <div class="col-md-12 column">
                                        </div>
                                    	</div>
    <div class="form-group">
    	<div class="form-inline">
        	<label for="inputEmail3" class="col-sm-2">จำนวน</label>
        	<div class="col-sm-3">
            <input type="number" class="form-control" placeholder="กรอกข้อมูลชนิดตัวเลข" name="numberbuy"
            value="<?=$row_show['Amount']?>"
             required>
         	</div>
		</div>
    </div>
    <div class="form-group">
    	<div class="form-inline">
        	<label for="inputEmail3" class="col-sm-2">หน่ยวนับ</label>
        	<div class="col-sm-3">
            <input type="text" class="form-control"  placeholder="เครื่อง,แผ่น,ตัว,อัน,อื่นๆ." name="namebuy" 
            value="<?=$row_show['Unit']?>"
            required>
         	</div>
		</div>
    </div>
    									<div class="row clearfix">
                                        <div class="col-md-12 column">
                                        </div>
                                   	 	</div>
    <div class="form-group">
    	<div class="form-inline">
        	<label for="inputEmail3" class="col-sm-2">หมายเลข</label>
        	<div class="col-sm-3">
            <input type="text" class="form-control" placeholder="Serial number" name="sn" 
            value="<?=$row_show['Serial']?>"
            required>
         	</div>
		</div>
    </div>
    <div class="form-group">
    	<div class="form-inline">
        	<label for="inputEmail3" class="col-sm-2">จำนวนการซ่อม</label>
        	<div class="col-sm-3">
            <input type="number" class="form-control" placeholder="กรุณากรอกเป็นตัวเลข" name="numberre" 
            value="<?=$row_show['Number_repair']?>"
            required>
         	</div>
		</div>
    </div>
    									<div class="row clearfix">
                                        <div class="col-md-12 column">
                                        </div>
                                   		</div>
    <div class="form-group">
    	<div class="form-inline">
        	<label for="inputEmail3" class="col-sm-2">ผู้ใช้</label>
        	<div class="col-sm-3">
            <input type="text" class="form-control" placeholder="ชื่อผู้ใช้งานอุปกรณ์" name="nameuser" 
            value="<?=$row_show['Gadget_user']?>"
            required>
         	</div>
		</div>
    </div>
    <div class="form-group">
    	<div class="form-inline">
        	<label for="inputEmail3" class="col-sm-2">แผนก</label>
        	<div class="col-sm-3">
 	<select class="form-control" name="Department"  placeholder="แผนกของผู้ใช้งานอุปกรณ์" required>
          <?php
		    mysql_query("SET NAMES UTF8");
           $result = mysql_query("SELECT * FROM `tb_department` ORDER BY `Department_id` ASC");
           while($row = mysql_fetch_array($result)){
			   echo "<option value=\"$row[Department_id]\" ";
			   if($row_show['Department_id']==$row['Department_id']) { echo 'selected'; }
			   echo ">$row[Department]";
			   echo "</option>\n";
        ?>
           
           </option>
          <?php }?>
        </select>

         	</div>
		</div>
    </div>
    									<div class="row clearfix">
                                        <div class="col-md-12 column">
                                        </div>
                                    	</div>
    <div class="form-group">
        	<label for="inputEmail3" class="col-sm-2">รายละเอียด</label>
        	<div class="col-sm-12">
            <textarea name="detail" class="form-control" rows="3" placeholder="รายละเอียดเพิ่มเติมหรือข้อเตือนความจำ"><?=$row_show['Detail']?></textarea>
        	 </div>
	</div>
    									<div class="row clearfix">
                                        <div class="col-md-12 column">
                                        </div>
                                    	</div>
    <div align="left">
           <button type="submit" class="btn btn-success">
           <span class="glyphicon glyphicon-plus"></span>
           บันทึก</button>
           								<div class="col-md-1">
                                        </div>
           <a href="viewgadget.php?view_id=<?php echo $id ?>"><button type="button" class="btn btn-danger">
           <span class="glyphicon glyphicon-minus"></span>
           ยกเลิก</button></a>
           
    </div>
    <input type="text" name="editgadget" value="<?php echo $id;?>">
</form>
<?php include("footer.php"); ?>
</div>

<script src="bootstrap/js/jquery.js"></script>
<script src="bootstrap/js/bootstrap-datepicker.js"></script>
<script src="bootstrap/js/bootstrap.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js"></script>
<script>window.jQuery || document.write("<script src='js/jquery-1.5.1.min.js'>\x3C/script>")</script>
<script src="js/app.js"></script>
</body>
</html>