-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddmanagement.php
213 lines (192 loc) · 8.03 KB
/
addmanagement.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<?php require_once("./controller/deps.php"); ?>
<?php header_section("Dashboard | Add Management"); ?>
<?php
$errors_message = [];
$success_message = "";
if (isset($_GET['successfull'])) {
if ($_GET['successfull'] == "true") {
// var_dump($_GET);
$success_message = "Successfully Added";
}
}
if (isset($_GET['errors'])) {
$errors_code = explode(",", $_GET['errors']);
foreach ($errors_code as $error) {
// if ($error == "name") {
// array_push($errors_message, "Name must be larger than 2 character, alphanumeric");
// }
if ($error == "emptyname") {
array_push($errors_message, "Empty Name");
}
if ($error == "emptyemail") {
array_push($errors_message, "Empty email");
}
if ($error == "emptyadminid") {
array_push($errors_message, "Empty Admin ID");
}
if ($error == "emptywtype") {
array_push($errors_message, "Empty Worker Type");
}
if ($error == "emptyphone") {
array_push($errors_message, "Empty Phone");
}
if ($error == "emptylocation") {
array_push($errors_message, "Empty Location");
}
if ($error == "emptynid") {
array_push($errors_message, "Empty NID");
}
if ($error == "emptyrid") {
array_push($errors_message, "Empty Restaurent ID");
}
if ($error == "emptypassword") {
array_push($errors_message, "Empty Password");
}
if ($error == "emptycpassword") {
array_push($errors_message, "Empty Confirm Password");
}
if ($error == "emptytype") {
array_push($errors_message, "Empty Type");
}
if ($error == "password") {
array_push($errors_message, "Password must be larger than 8 character, include at least one of them (@, #, $, %)");
}
if ($error == "cpassword") {
array_push($errors_message, "Confirm Password didn't match your Password");
}
if ($error == "email") {
array_push($errors_message, "Invalid Email");
}
if ($error == "duplicate") {
array_push($errors_message, "Duplicate Email address");
}
// if ($error == "gender") {
// array_push($errors_message, "Invalid Gender");
// }
if ($error == "ridnotfound") {
array_push($errors_message, "Restaurent user not found");
}
// if ($error == "uidnotfound") {
// array_push($errors_message, "User not found");
// }
if ($error == "type") {
array_push($errors_message, "Invalid Type");
}
// if ($error == "dob") {
// array_push($errors_message, "Invalid Date Of Birth");
// }
}
}
?>
<main class="clearfix">
<?php if (count($errors_message)) : ?>
<div class="errors-list">
<table>
<tbody>
<?php foreach ($errors_message as $err_msg) : ?>
<tr>
<td>!! <?php echo $err_msg; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
<?php if (!empty($success_message)) : ?>
<div class="success">
<table>
<tbody>
<tr>
<td><?php echo $success_message; ?></td>
</tr>
</tbody>
</table>
</div>
<?php endif; ?>
<form action="./controller/registration.php" method="post">
<!-- <input type="hidden" name="usertype" value="employee"> -->
<input type="hidden" name="type" value="addmanagement">
<table>
<tbody>
<!-- <tr>
<td><label for="name">Name</label></td>
<td><input class="inp" id="name" type="text" name="name"></td>
</tr> -->
<tr>
<td><label for="email">Email</label></td>
<td><input class="inp" id="email" type="text" name="email" onkeyup="validateEmail(this)"></td>
<td class="err-msg" colspan="3"></td>
</tr>
<tr>
<td><label for="wtype">Work Type</label></td>
<td><input class="inp" id="wtype" type="text" name="wtype" onkeyup="validateWorker(this)"></td>
<td class="err-msg" colspan="3"></td>
</tr>
<tr>
<td><label for="rid">Restaurent ID</label></td>
<td><input class="inp" id="rid" type="number" name="rid" onkeyup="validateRID(this)"></td>
<td class="err-msg" colspan="3"></td>
</tr>
<!-- <tr>
<td><label for="uid">User ID</label></td>
<td><input class="inp" id="uid" type="number" name="uid"></td>
</tr> -->
<!-- <tr>
<td><label for="location">Location</label></td>
<td><input class="inp" id="location" type="text" name="location"></td>
</tr> -->
<tr>
<td><label for="phone">Phone</label></td>
<td><input class="inp" id="phone" type="number" name="phone" onkeyup="validatePhone(this)"></td>
<td class="err-msg" colspan="3"></td>
</tr>
<tr>
<td><label for="nid">NID</label></td>
<td><input class="inp" id="nid" type="number" name="nid" onkeyup="validateNID(this)"></td>
<td class="err-msg" colspan="3"></td>
</tr>
<tr>
<td><label for="password">Password</label></td>
<td><input class="inp" id="password" type="password" name="password" onkeyup="validatePassword(this)"></td>
<td class="err-msg" colspan="3"></td>
</tr>
<tr>
<td><label for="cpassword">Confirm Password</label></td>
<td><input class="inp" id="cpassword" type="password" name="cpassword" onkeyup="validateCPassword(this)"></td>
<td class="err-msg" colspan="3"></td>
</tr>
<!-- <tr>
<td><label>Gender</label></td>
<td>
<input id="male" type="radio" name="gender" value="male">
<label for="male">Male</label>
<input id="female" type="radio" name="gender" value="female">
<label for="female">Female</label>
<input id="others" type="radio" name="gender" value="others">
<label for="others">Others</label>
</td>
</tr> -->
<!-- <tr>
<td><label>Type</label></td>
<td>
<input id="restaurant" type="radio" name="type" value="restaurantadmin">
<label for="restaurant">Restaurant Admin</label>
<input id="management" type="radio" name="type" value="management">
<label for="management">Management</label>
<input id="user" type="radio" name="type" value="user">
<label for="user">User</label>
</td>
</tr> -->
<!-- <tr>
<td><label for="dob">Date Of Birth</label></td>
<td><input class="inp" id="dob" type="date" name="dob"></td>
</tr> -->
<tr>
<td><button class="btn" type="reset">Reset</button></td>
<td><button class="btn" id="addsubmit" type="submit" name="addmanagement">Add to Management list</button></td>
</tr>
</tbody>
</table>
</form>
</main>
<?php footer_section(); ?>