-
Notifications
You must be signed in to change notification settings - Fork 0
/
staff-registration.php
223 lines (204 loc) · 14 KB
/
staff-registration.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
214
215
216
217
218
219
220
221
222
223
<?php
session_start();
include 'includes/dbConnection.php';
if (!$_SESSION["user_name_loggedIn_admin"]) {
$_SESSION["expired_session"] = "Your session has been expired, relog in!";
header("Location: index.php");
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="author" content="">
<title>AX GYM</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="js/scripts.js"></script>
<!-- Page level plugin CSS-->
<link href="vendor/datatables/dataTables.bootstrap4.css" rel="stylesheet">
<?php include 'globalExternals/components.php'; ?>
</head>
<body id="page-top" class="fixed-nav">
<?php include 'navigations/NavigationBar.php'; ?>
<div id="wrapper">
<div id="content-wrapper">
<div class="container-fluid">
<section class="content">
<br>
<div class="col-md-12 box box-default">
<div class="box-header">
<section class="content-header">
<h1>
<i class="fa fa-male"></i>
Staff
</h1>
</section>
</div>
<hr>
<div class="container" id="member-registration-container">
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#myModal"><i class="fas fa-plus" style="color: white;"></i> Staff</button>
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#userModal"> <i class="fas fa-user" style="color: white;"></i> New User</button>
<br> <br> <br>
<!-- Table with query to fill it -->
<?php $sql = 'SELECT st_id,cl_id,u_id,st_first_name,st_middle_name,st_last_name,st_position, st_telephone,address,st_email,st_dob FROM staff';
$query = mysqli_query($con, $sql);
if (!$query) {
die('SQL Error:' . mysqli_error($con));
}
?>
<!-- DataTables Example -->
<div class="card mb-3">
<div class="card-header"><i class="fas fa-table"></i> Staff List</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<!-- Table Column Header -->
<th class="sorting_desc">First Name</th>
<th class="sorting_desc">Middle Name</th>
<th class="sorting_desc">Last Name</th>
<th class="sorting_desc">Position</th>
<th class="sorting_desc">Address</th>
<th class="sorting_desc">Telephone</th>
<th class="sorting_desc">Email</th>
<th class="sorting_desc">Date of Birth</th>
<th class="sorting_desc">Action</th>
</tr>
<thead>
<?php while ($row = mysqli_fetch_array($query)) { ?>
<tr>
<td><?php echo $row['st_first_name']; ?></td>
<td><?php echo $row['st_middle_name']; ?></td>
<td><?php echo $row['st_last_name']; ?></td>
<td><?php echo $row['st_position']; ?></td>
<td><?php echo $row['address']; ?></td>
<td><?php echo $row['st_telephone']; ?></td>
<td><?php echo $row['st_email']; ?></td>
<td><?php echo $row['st_dob']; ?></td>
<td>
<a href="" style="color:blue;"><i class="fas fa-pen"></i></a>
<a href="staff-registration.php?idd=<?php echo $row['st_id']; ?>" onclick="return confirm('Are you sure ?')" style="color:red;"><i class="fas fa-remove"></i></a>
</td>
</tr>
<?php
} ?>
</table>
</div>
</div>
</div>
<!-- Delete Query -->
<?php
if (isset($_GET['idd'])) {
$idd = $_GET['idd'];
$sql = "Delete from staff where st_id='" . $idd . "'";
if ($idd != '') {
$query = mysqli_query($con, $sql);
//header("Refresh:0; url=staff-registration.php");
}
}
?>
<!-- session for add member button -->
<?php if (isset($_SESSION["success"])) { ?>
<div class="alert alert-success">
<strong>Success! </strong> <?php echo $_SESSION["success"];
session_unset(); ?>
</div>
<?php
} ?>
<?php if (isset($_SESSION["error"])) { ?>
<div class="alert alert-danger">
<strong>Alert! </strong> <?php echo $_SESSION["error"];
session_unset(); ?>
</div>
<?php
} ?>
<!-- ADD Staff -->
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="card card-register">
<div class="card-header">Add Staff</div>
<div class="card-body">
<form method="post" action="includes/phpScripts.php">
<div class="form-group">
<input type="text" name="txtFName" placeholder="First Name" id="txtFirstName" class="form-control" required="required">
</div>
<div class="form-group">
<input type="text" name="txtMName" placeholder="Middle Name" id="txtMName" class="form-control" required="required">
</div>
<div class="form-group">
<input type="text" name="txtLName" placeholder="Last Name" id="txtLastName" class="form-control" required="required">
</div>
<div class="form-group">
<select class="form-control" name="cbxPosition" style="height:40px;">
<option disabled="disabled" selected="selected">Select Position</option>
<option value="Admin">Admin</option>
<option value="Reception Manager">Reception Manager</option>
<option value="Reception User">Reception User</option>
<option value="Sales Manager">Sales Manager</option>
<option value="Sales User">Sales User</option>
<option value="Personal Trainer Manager">Personal Trainer Manager</option>
<option value="Personal Trainer User">Personal Trainer User</option>
</select>
</div>
<div class="form-group">
<input type="text" name="txtTelephone" placeholder="Telephone" class="form-control" required="required">
</div>
<div class="form-group">
<input type="email" name="txtEmail" placeholder="Email" class="form-control" required="required">
</div>
<div class="form-group">
<input type="date" name="dob" placeholder="Date of Birth" class="form-control" required="required">
</div>
<div class="form-group">
<input type="text" name="txtAddress" placeholder="Address" class="form-control" required="required">
</div>
</div>
<div class="modal-footer">
<button class="btn btn-primary btn-md" name="btnRegisterStaff">Register Staff</button>
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<div class="modal fade" id="userModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" style="color: black;font-size:25px;text-decoration: underline;">User Registration</h4>
</div>
<div class="modal-body">
<form id="user-registration-container" action="includes/phpScripts.php" method="POST">
<input type="text" name="txtName" placeholder="Name" id="txtUserName" class="form-control">
<br>
<input type="text" name="txtUsername" placeholder="Username" class="form-control">
<br>
<input type="password" name="txtPassword" placeholder="Password" class="form-control">
<br>
<input type="text" name="UserType" placeholder="User Type" class="form-control">
<br>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-primary btn-md" type="submit" name="btnRegisterUser">Register User</button>
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>