-
Notifications
You must be signed in to change notification settings - Fork 0
/
operator_action.php
139 lines (131 loc) · 4.49 KB
/
operator_action.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<!DOCTYPE html>
<HTML>
<meta charset="UTF-8">
<title>Manage People</title>
<link rel="stylesheet" type="text/css" href="w3.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="source/progress_bar.css">
<link rel="stylesheet" href="font-awesome-4.7.0/css/font-awesome.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
</HEAD>
<BODY>
<?php
//conect to database
require("connection.php");
// prevent dreamweaver error
if(!isset($_GET['o_id'])){
$_GET['o_id']='';
}
$o_id=$_GET['o_id'];
if(!isset($_POST['action'])){
$_POST['action']='';
$action="edit";
}else{
$action=$_POST['action'];
}
if(!isset($_GET['time']))$_GET['time']=3;
$time=$_GET['time'];
// Header and sidenav import
require("header.html");
?>
<?php
//select data
$query="SELECT * FROM Operator where o_id = '$o_id' ";
$result=odbc_exec($db,$query);
while($list=odbc_fetch_array($result))
{
if($list['o_id']!=''){
$o_id=$list['o_id'];
$o_name = iconv("TIS-620", "UTF-8", $list['o_name']);
$o_type=$list['o_type'];
$birthdate=$list['birthdate'];
$address=iconv("TIS-620", "UTF-8",$list['address']);
$parttime=$list['parttime'];
}
}
?>
<div class="w3-container w3-section">
<div class="w3-container w3-card-2 w3-center">
<h2 class="w3-border-bottom">
<A class="w3-btn w3-left w3-white w3-xlarge" HREF="operator.php?time=<?php echo $time;?>"> « กลับ</A>
<?php
//Echo heading
if ($action=='edit'){
$new_id="";
echo "แก้ไขรายชื่อพนักงาน";
}else {
$result=odbc_exec($db,"SELECT COUNT(o_id)+1 AS MaxID FROM operator");
if($list=odbc_fetch_array($result)){
$new_id=$list['MaxID'];
}
echo "เพิ่มรายชื่อพนักงาน";
$o_id="0".$new_id;
$o_name="";
$o_type=1;
$birthdate="";
$address="";
$parttime=$time;
}
?>
</h2>
<FORM class="w3-center w3-section" METHOD=POST ACTION="operator_success.php?time=<?php echo $time;?>">
<TABLE class="w3-table w3-center" style="width: 500px; margin: auto">
<tr>
<td>รหัสพนักงาน<br><span class="w3-small w3-text-gray">part time ใช้รหัสประจำตัวประชาชน</span></td>
<td><?php if($action=='edit')echo "<input class='w3-input' type='text' name='new_id' value=".$o_id."><INPUT TYPE='hidden' name='o_id' value=".$o_id.">" ; else echo "<input class='w3-input' type='text' name='o_id' value=".$o_id.">" ; ?> </td>
</tr>
<tr>
<td>ชื่อ-สกุล<br></td>
<td><input class='w3-input' type="text" name="o_name" value="<?php echo $o_name;?>"></td>
</tr>
<tr>
<td>งานที่ทำ<br></td>
<td><select class='w3-select' name=o_type value='1'></option>
<?php
if ($o_type==1)
echo "<option value='1'>Picking</option>
<option value='2'>Decocting</option>
<option value='3'>Dispensing</option>
</select>";
else
echo "<option value='1'>Picking</option>
<option value='2'>Decocting</option>
<option value='3'>Dispensing</option>
</select>";
?></td>
</tr>
<tr>
<td>วันเกิด<br></td>
<td><input class='w3-input' type="date" id="dateInput" name="birthdate" value="<?php echo date('Y-m-d', $birthdate); ?>" >
</td>
</tr>
<tr>
<td>ที่อยู่<br></td>
<td><input class='w3-input' type="text" name="address" value="<?php echo $address;?>"></td>
</tr>
<tr>
<td>สัญญาจ้าง<br></td>
<td><select class='w3-select' name=parttime value='1'></option>
<?php
if($time==$parttime){
if ($parttime==1)
echo "<option value='1'>Full-Time</option>
<option value='2'>Part-Time</option>
</select>";
else
echo "
<option value='2'>Part-Time</option>
<option value='1'>Full-Time</option>
</select>";
}
?></td>
</tr>
</TABLE>
<INPUT TYPE='hidden' name='action' value='<?php echo $action;?>'></INPUT>
<INPUT class="w3-btn w3-green w3-large w3-padding-12" TYPE='submit' value='ยืนยัน'></INPUT>
<INPUT class="w3-btn w3-light-gray w3-large" TYPE="reset" value="เริ่มใหม่"></INPUT>
</div>
</div>
<!--Form send data-->
</body>
</html>