-
Notifications
You must be signed in to change notification settings - Fork 0
/
techDashBoard.php
executable file
·305 lines (270 loc) · 9.2 KB
/
techDashBoard.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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
<?php
// Initialize the session
session_start();
// Check if the user is logged in, if not then redirect him to login page
if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){
header("location: techlogin.php");
exit;
}
// Include config file
require_once "dbconfig.php";
// Define variables and initialize with empty values
$phone = $service = $mpesa = $amount = "";
// Processing form data when form is submitted
if($_SERVER["REQUEST_METHOD"] == "POST"){
if(empty($_POST['phone']) || empty($_POST['service']) || empty($_POST['mpesa']) || empty($_POST['amount'])){
$sweet = 'error';
echo $feedback = 'Please Fill in All Details For Approval.';
}
//Validate Customer username
if(empty(trim($_POST["phone"]))){
$sweet = 'error';
$feedback = 'Please provide customers username';
}else{
$phone = trim($_POST["phone"]);
}
//Validate service code
if(empty(trim($_POST["service"]))){
$sweet = 'error';
$feedback = 'Please Choose The service Provided.';
}else{
$service = trim($_POST["service"]);
}
//Validate mpesa
if(empty(trim($_POST["mpesa"]))){
$sweet = 'error';
$feedback = 'Please enter the mpesa transaction code or amount Paid.';
} else{
$mpesa = trim($_POST["mpesa"]);
}
// Validate amount
if(empty(trim($_POST["amount"]))){
$sweet = 'error';
$feedback = 'Please enter the amount charged.';
} else{
$amount = trim($_POST["amount"]);
}
// Check input errors before inserting in database
if(empty($sweet)){
// Prepare an insert statement
$sql = "INSERT INTO partialpayments (phone, service, mpesa, amount) VALUES (?, ?, ?, ?)";
if($stmt = mysqli_prepare($conn, $sql)){
// Bind variables to the prepared statement as parameters
mysqli_stmt_bind_param($stmt, "ssss", $param_phone, $param_service, $param_mpesa, $param_amount);
// Set parameters
$param_phone = $phone;
$param_service = $service;
$param_mpesa = $mpesa;
$param_amount = $amount;
// Attempt to execute the prepared statement
if(mysqli_stmt_execute($stmt)){
// Redirect to login page
header("location: techDashBoard.php");
} else{
echo "Something went wrong. Please try again later.";
}
}
// Close statement
mysqli_stmt_close($stmt);
}
// Close connection
mysqli_close($conn);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>|Technician Dashboard</title>
<!-- Bootstrap Stylesheet -->
<link rel="stylesheet" href="css/bootstrap.min.css" />
<!-- sweet alert -->
<link rel="stylesheet" href="css/sweetalert.css" />
<!-- FontAwesome -->
<link rel="stylesheet" href="css/all.min.css" />
<link rel="stylesheet" href="css/fontawesome.min.css" />
<!--Animate Css-->
<link rel="stylesheet" href="css/animate.min.css" />
<!-- Css -->
<link rel="stylesheet" href="css/tech.css" />
</head>
<body>
<main>
<section>
<header id="heady">
<nav class="navbar navbar-expand-md navbar-light bg-transparent mb-4">
<a id="logo" href="techDashBoard.php" class="navbar-brand"
><img src="img/logo.png" alt="" ALIGN="CENTER"
/></a>
<button
type="button"
class="navbar-toggler"
data-toggle="collapse"
data-target="#navbarCollapse"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<div class="navbar-nav">
<li class="nav-item active">
<a class="nav-link active" href="techdashBoard.php">DashBoard</a>
</li>
<li class="nav-item">
<a class="nav-link " href="techEdit.php">Edit Account</a>
</li>
<li class="nav-item">
<a id="modalBtn" class="nav-link btny" href="#">Send Feedback</a>
</li>
<li class="nav-item">
<a class="nav-link" href="technicianinbox.php" class="">Inbox.</a>
</li>
</div>
<a href="customerlogout.php" class="btn btn-outline-danger ml-auto">Sign Out </a>
</div>
</nav>
</header>
</section>
<section class="main-landing">
<h1 class="welcometext animated infinite pulse">Hi Technician, <b><?php echo htmlspecialchars($_SESSION["techusername"]); ?></b>. Welcome to mafundi dashboard.</h1>
<div class="landing-content">
<div class="booking-form">
<div class="card bg-transparent text-light mb-4 animated bounceInDown delay 3s">
<div class="card-body">
<h2 class="card-title">Job Approval Form.</h2>
<div class="card-text">
<p id="">Please fill in the form with valid credentials for the approval of a job well done. Thankyou for your coperation</p>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="POST">
<div class="form-group">
<label>Client's Mobile Number.</label>
<input id="contact"
oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');"
name="phone" type="tel" class="form-control" placeholder="format(07........)[10 digits]" minlength="10"
maxlength="10" value="<?php echo $phone; ?>">
</div>
<div class="form-group">
<label>Service Provided</label>
<select class="form-control" name="service" id="service" placeholder="Service Provided..." value="<?php echo $service; ?>">
<option></option>
<option>DoorLock Breaking</option>
<option>Plumbing</option>
<option>Painting</option>
<option>Electrician</option>
<option>Inner Decorations</option>
<option>Water Heaters</option>
<option>Hanging Lines</option>
<option>Blocked Sinks</option>
<option>Blocked Toilets</option>
<option>Showers</option>
<option>Wood Works</option>
<option>Metal Works</option>
</select>
</div>
<div class="form-group">
<label>Mpesa Transaction Code</label>
<input type="text" name="mpesa" class="form-control" placeholder="Transaction Code..." value="<?php echo $mpesa; ?>">
</div>
<div class="form-group">
<label>Amount Paid/Sent</label>
<input type="text" name="amount" class="form-control" placeholder="Amount..." value="<?php echo $amount; ?>">
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" value="Submit">
<input type="reset" class="btn btn-default" value="Reset">
</div>
</form>
</div>
</div>
</div>
</div>
<div class="tasks">
<div class="feedback divy">
<div id="simplemodal" class = "modal" >
<div class="modal-content bg-dark">
<span class="closeBtn">×</span>
<form action="replymessagestech.php" method="POST" class="form-group">
<label for="">Username</label>
<input type="text" name = "techusername" class = "form-control" value="<?php echo htmlspecialchars($_SESSION["techusername"]); ?>" required>
<br>
<label for="">Comment</label>
<textarea name="message" cols="30" class = "form-control" placeholder="Your Thoughts." required></textarea>
<br>
<input type="submit" class="btn btn-outline-info text-light" value="Send Message">
<input type="reset" class="btn btn-outline-secondary ml-3" value="Reset">
</form>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- FOOTER SECTION -->
<section id="futa" class="mt-4">
<footer>
<div class="container">
<div class="row">
<div class="col-md-6 col-lg-3">
<div class="card bg-transparent mt-3">
<h4 class="card-title">Contact Us</h4>
<strong>Website: </strong><p>www.mafundiservices.com</p>
<strong>Email: </strong><p>[email protected]</p>
<strong>Social Media: </strong><p>@mafundiservices</p>
<strong>Phone: +(254) 74542-458788</strong>
</div>
</div>
<div class="col-md-6 col-lg-3">
<div class="card bg-transparent mt-3">
<h4 class="card-title">Useful Links</h4>
<ul id="useful" class="list-group">
<li class="list-group-item bg-transparent"><a href="a.home.html">Home</a></li>
<li class="list-group-item bg-transparent"><a href="aboutus">about us</a></li>
<li class="list-group-item bg-transparent"><a href="contactus">contact us</a></li>
<li class="list-group-item bg-transparent"><a href="contactus">help</a></li>
</ul>
</div>
</div>
<div class="col-md-6 col-lg-3">
<div class="card bg-transparent mt-3">
<h4 class="card-title">Social Media Links</h4>
<div class="card-text">
<a href="#" class="youtube">
<i class="fab fa-youtube fa-3x m-2"></i
></a>
<a href="#" class="twitter"
><i class="fab fa-twitter fa-3x m-2"></i
></a>
<a href="#" class="facebook"
><i class="fab fa-facebook-square fa-3x m-2"></i
></a>
<a href="#" class="google-plus"
><i class="fab fa-google-plus-g fa-3x m-2"></i
></a>
</div>
</div>
</div>
<div class="col-md-6 col-lg-3">
<div class="card bg-transparent mt-3">
<h4 class="card-title">Subscribe to our NewsLetter Here</h4>
<p class="">You can leave us with your email address below inorder to receive our latest updates on new trends and prices of certain equipment, this will also guarantee a certain discount in the future services from mafundi services,We appericiate your membership</p>
<form action="maillist.php" method="POST">
<input type="email" name="email" class="form-control" placeholder="Email Address...">
<br>
<button type="button" class="btn btn-outline-secondary mt-2">Subscribe</button>
</form>
</div>
</div>
</div>
<p id="btm">All Rights Reserved CopyRights © mafundiservices 2019</p>
</div>
</footer>
</section>
</main>
<!--Optional Javascript-->
<script src="js/index.js"></script>
<script src="js/jquery.js"></script>
<script src="js/sweetalert.js"></script>
<script src="js/jquery-3.4.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>