-
Notifications
You must be signed in to change notification settings - Fork 0
/
ShippmentStatus.php
142 lines (128 loc) · 4.08 KB
/
ShippmentStatus.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
<!DOCTYPE html>
<html>
<head>
<title>Courier Tracking System</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"> <!-- Font Awesome CDN for icons -->
<style>
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
background-color: #f1f1f1;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
padding: 50px;
}
.card {
width: 400px;
background-color: #fff;
border-radius: 10px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
padding: 30px;
margin-bottom: 20px;
}
.card-title {
font-size: 24px;
color: black;
margin-bottom: 20px;
}
.phase-container {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.phase {
display: flex;
flex-direction: column;
align-items: center;
color: rgb(226, 226, 216);
}
.phase-name {
margin-top: 10px;
font-size: 16px;
color: rgb(0, 0, 0);
text-align: center;
}
.tick {
margin-top: 10px;
color: black;
}
.item-info {
font-size: 16px;
color: rgb(0, 0, 0);
}
p{
margin-left:5px;
}
</style>
</head>
<body>
<?php
include("Connection.php");
// Track ID received from the previous page
$trackId = $_POST['track_id'];
// if(empty($trackId)){echo "empty";}
if(!isset($trackId) || empty($trackId)){
header("Location: index.html");
exit();
}
$sql = "select * from shipment where sh_id = '$trackId'";
$result = $connect->query($sql);
if(mysqli_num_rows($result) < 1){
echo "<script>alert('No Shipment found!'); window.location.href = 'index.html';</script>";
exit();
}
$row = $result->fetch_assoc();
$sql1 = "select name from shipper where s_id = $row[s_id]";
$shipper_name = ($connect->query($sql1))->fetch_assoc();
// var_dump($shipper_name);
// Simulated data for the courier tracking information
$trackingInfo = array(
'status' => $row['status'],
'in_transit' => true ,
'out_for_delivery' => !($row['c_id'] === NULL),
'delivered' => ($row['status'] === 'delivered'),
'category' => $row['category'],
'item_weight' => $row['weight'],
'shipment_id' => $row['sh_id'],
'customer_name' => $shipper_name['name'],
'order_date' => $row['issue_date'],
'estimated_delivery_date' => $row['delivery_date']
);
?>
<div class="container">
<div class="card">
<h2 class="card-title"><?php echo $trackingInfo['status']; ?></h2>
<div class="phase-container">
<div class="phase">
<i class="fas <?php echo $trackingInfo['in_transit'] ? 'fa-check-circle fa-3x tick' : 'fa-circle fa-3x'; ?>""></i>
<span class="phase-name">In Transit</span>
</div>
<div class="phase">
<i class="fas <?php echo $trackingInfo['out_for_delivery'] ? 'fa-check-circle fa-3x tick' : 'fa-circle fa-3x'; ?>""></i>
<span class="phase-name">Out for Delivery</span>
</div>
<div class="phase">
<i class="fas <?php echo $trackingInfo['delivered'] ? 'fa-check-circle fa-3x tick' : 'fa-circle fa-3x'; ?>""></i>
<span class="phase-name">Delivered</span>
</div>
</div>
</div >
<div class="card">
<h1 class="card-title">Item Details</h1>
<p class="item-info">Customer Name: <?php echo $trackingInfo['customer_name']; ?></p>
<p class="item-info">Category: <?php echo $trackingInfo['category']; ?></p>
<p class="item-info">Item Weight: <?php echo $trackingInfo['item_weight']; ?></p>
<p class="item-info">Shipment ID: <?php echo $trackingInfo['shipment_id']; ?></p>
<p class="item-info">Order Date: <?php echo $trackingInfo['order_date']; ?></p>
<p class="item-info">Est. Delivery Date: <?php echo $trackingInfo['estimated_delivery_date']; ?></p>
</div>
</div>
<script>
</script>
</body>
</html>