-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA_Fuel_Status_Management.php
151 lines (139 loc) · 6.05 KB
/
A_Fuel_Status_Management.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
<?php require_once('connection.php');
/**
* @author Yasiru
* contact me : https://linktr.ee/yasiruchamuditha for more information.
*/
//session_start();
$statusMessage = '';
if(isset($_POST['btnDelete']))
{
$deleteid=$_POST['deleteid'];
$sql="DELETE FROM fuel_status WHERE Registration_No=? ";
$stmt = mysqli_prepare($con, $sql);
mysqli_stmt_bind_param($stmt, "s", $deleteid);
$ret = mysqli_stmt_execute($stmt);
if ($ret)
{
$statusMessage = '<div class="alert alert-success" role="alert">Successfully Deleted</div>';
}
else
{
$statusMessage = '<div class="alert alert-danger" role="alert">Please Try Again Shortly...</div>';
}
mysqli_stmt_close($stmt);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Admin Panel- Fuel Status Management</title>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta content="Fuel Up" name="keywords">
<meta content="Fuel Status" name="description">
<!-- Favicon -->
<link href="img/favicon.ico" rel="icon">
<!-- Google Web Fonts -->
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=Rubik&display=swap" rel="stylesheet">
<!-- Font Awesome -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/all.min.css" rel="stylesheet">
<!-- Libraries Stylesheet -->
<link href="lib/owlcarousel/assets/owl.carousel.min.css" rel="stylesheet">
<link href="lib/tempusdominus/css/tempusdominus-bootstrap-4.min.css" rel="stylesheet" />
<!-- Customized Bootstrap Stylesheet -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<!-- Template Stylesheet -->
<link href="css/styles.css" rel="stylesheet">
<link href="css/styleAMP.css" rel="stylesheet">
</head>
<body>
<?php require('A_Navigation_Bar.php');?>
<div class="container">
<h1>Admin Panel -Fuel Status Management </h1>
<p class="header">Fuel Station Status Details</p>
<table class="table">
<thead>
<tr class="table-info">
<th scope="col">Reg.No</th>
<th scope="col">Name</th>
<th scope="col">Updated Date</th>
<th scope="col">Updated Time</th>
<th scope="col">Petrol 92</th>
<th scope="col">Petrol 95</th>
<th scope="col">Diesel</th>
<th scope="col">Super Diesel</th>
<th scope="col">Kerosine Oil</th>
<th scope="col">Industrial Kerosine Oil</th>
<th scope="col">Operation</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT fuel_station_registration.Registration_No,fuel_station_registration.Station_Name,fuel_status.Updated_Date,fuel_status.Updated_Time,fuel_status.Petrol_92,fuel_status.Petrol_95,fuel_status.Diesel,fuel_status.Super_Diesel,fuel_status.Kerosine_Oil,fuel_status.Industrial_Kerosine_Oil
from fuel_station_registration
INNER JOIN fuel_status
on fuel_station_registration.Registration_No=fuel_status.Registration_No";
$ret= mysqli_query($con, $sql);
if ($ret)
{
while($row=mysqli_fetch_assoc($ret))
{
$Registration_No = htmlspecialchars($row['Registration_No']);
$Station_Name = htmlspecialchars($row['Station_Name']);
$Updated_Date = htmlspecialchars($row['Updated_Date']);
$Updated_Time = htmlspecialchars($row['Updated_Time']);
$Petrol_92 = htmlspecialchars($row['Petrol_92']);
$Petrol_95 = htmlspecialchars($row['Petrol_95']);
$Diesel = htmlspecialchars($row['Diesel']);
$Super_Diesel = htmlspecialchars($row['Super_Diesel']);
$Kerosine_Oil = htmlspecialchars($row['Kerosine_Oil']);
$Industrial_Kerosine_Oil = htmlspecialchars($row['Industrial_Kerosine_Oil']);
echo'<tr>
<th scope="row">'.$Registration_No.'</th>
<td>'.$Station_Name.'</td>
<td>'.$Updated_Date.'</td>
<td>'.$Updated_Time.'</td>
<td>'.$Petrol_92.'</td>
<td>'.$Petrol_95.'</td>
<td>'.$Diesel.'</td>
<td>'.$Super_Diesel.'</td>
<td>'.$Kerosine_Oil.'</td>
<td>'.$Industrial_Kerosine_Oil.'</td>
<td>
<form method="post">
<input type="hidden" name="deleteid" value="' . $Registration_No . '">
<button type="submit" class="btn btn-danger" name="btnDelete">Delete</button>
</form>
</td>
</tr>';
}
}
?>
</tbody>
</table>
</div>
<!-- Display the status message below the table only if it's set and use JavaScript to remove it after 3 seconds -->
<?php if (!empty($statusMessage)) { ?>
<div class="container">
<div id="statusMessage" class="alert <?php echo strpos($statusMessage, 'alert-success') !== false ? 'alert-success' : 'alert-danger'; ?>" role="alert">
<?php echo $statusMessage; ?>
</div>
</div>
<script>
// Remove the status message after 3 seconds
setTimeout(function () {
var statusMessage = document.getElementById('statusMessage');
if (statusMessage) {
statusMessage.style.display = 'none';
}
}, 4000); // 4 seconds (4000 milliseconds)
</script>
<?php } ?>
<?php require_once('A_MFooter.php');?>
<!-- Template Javascript -->
<script src="js/main.js"></script>
</body>
</html>