<?
	session_start();
	
	$dpmid = $_GET['edid'];
	
	include "../../Connections/connect_mysql.php";
	
	if($dpmid){
		$sqle=" select * from department_tb where dpmid=" . $dpmid . "; ";
		$resulte = mysql_query($sqle) or die(mysql_error());
		$recorde=mysql_fetch_array($resulte);
		$dpmcode = $recorde['dpmcode'];
		$dpmname = $recorde['dpmname'];
	}
?>
<?
	mysql_close($c);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Untitled Document</title>
  
</head>

<body>
	<div class="row">
	<div class="col-md-12">
		<form id="frmcomp" class="form-inline">
        	<div class="form-group mx-sm-3 mb-2">
    			<input type="text" class="form-control" id="dpm1" placeholder=" รหัสแผนก/ฝ่าย " onBlur="javascript:chkdlgadduser(this.id);" value="<?=$dpmcode?>">
  			</div>
            <div class="form-group mx-sm-3 mb-2">
    			<input type="text" class="form-control" id="dpm2" placeholder=" ชื่อแผนก/ฝ่าย " onBlur="javascript:chkdlgadduser(this.id);" value="<?=$dpmname?>">
  			</div>
            	<? if($dpmid){ ?>
					<button type="button" class="btn btn-primary" id="btneditdpm" onClick="javascript:saveeditdept(<?=$dpmid?>,'dpm',2);"><i class='fa fa-pencil-square-o'></i> บันทึกแก้ไขรายการ</button>
                    <button type="button" class="btn btn-danger" id="btneditcanceldpm" onClick="javascript:canceleditdept();"><i class='fa fa-reply-all'></i> ยกเลิกแก้ไขรายการ</button>
			   <? }else{ ?>
            		<button type="button" class="btn btn-primary" id="btnadddpm" onClick="javascript:adddepartment('dpm',2);"><i class='fa fa-plus-circle'></i> เพิ่มรายการ</button>
                <?
				}
				?>
        </form>    
    </div>
    <div class="row">
    	<div class="col-md-12">
        	<hr>
        </div>
    </div>
</div>

</body>
</html>