-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata_mobil.php
More file actions
97 lines (91 loc) · 5.36 KB
/
Copy pathdata_mobil.php
File metadata and controls
97 lines (91 loc) · 5.36 KB
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
<?php
include 'connect.php';
$sql = "SELECT * FROM Cars";
$result = $conn->query($sql);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Data Mobil</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@200;300;400;500;600;700;800&display=swap" rel="stylesheet">
<script>
tailwind.config = {
theme: {
extend: {
fontFamily: {
body: ['Plus Jakarta Sans']
},
colors: {
primary: '#1b9af5',
secondary: '#bcedff',
tertiary: '#1767b6',
accent: '#143557',
},
},
}
}
</script>
</head>
<body class="bg-gray-50 font-body min-h-screen">
<div class="container mx-auto px-4 py-8">
<h1 class="text-3xl font-bold text-accent mb-8">Data Mobil</h1>
<div class="overflow-x-auto bg-white rounded-lg shadow">
<div class="inline-block min-w-full">
<table class="min-w-full">
<thead>
<tr class="bg-gray-100">
<th class="px-6 py-4 text-left text-sm font-semibold text-gray-600">ID</th>
<th class="px-6 py-4 text-left text-sm font-semibold text-gray-600">Seller ID</th>
<th class="px-6 py-4 text-left text-sm font-semibold text-gray-600">Brand</th>
<th class="px-6 py-4 text-left text-sm font-semibold text-gray-600">Model</th>
<th class="px-6 py-4 text-left text-sm font-semibold text-gray-600">Year</th>
<th class="px-6 py-4 text-left text-sm font-semibold text-gray-600">Description</th>
<th class="px-6 py-4 text-left text-sm font-semibold text-gray-600">Foto 1</th>
<th class="px-6 py-4 text-left text-sm font-semibold text-gray-600">Foto 2</th>
<th class="px-6 py-4 text-left text-sm font-semibold text-gray-600">Foto 3</th>
<th class="px-6 py-4 text-left text-sm font-semibold text-gray-600">Starting Price</th>
<th class="px-6 py-4 text-left text-sm font-semibold text-gray-600">Status</th>
<th class="px-6 py-4 text-left text-sm font-semibold text-gray-600">Type</th>
<th class="px-6 py-4 text-left text-sm font-semibold text-gray-600">Created At</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
<?php
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo "<tr class='hover:bg-gray-50 transition-colors'>";
echo "<td class='px-6 py-4 text-sm text-gray-900'>" . $row['car_id'] . "</td>";
echo "<td class='px-6 py-4 text-sm text-gray-900'>" . $row['seller_id'] . "</td>";
echo "<td class='px-6 py-4 text-sm text-gray-900'>" . $row['brand'] . "</td>";
echo "<td class='px-6 py-4 text-sm text-gray-900'>" . $row['model'] . "</td>";
echo "<td class='px-6 py-4 text-sm text-gray-900'>" . $row['year'] . "</td>";
echo "<td class='px-6 py-4 text-sm text-gray-900'>" . $row['description'] . "</td>";
echo "<td class='px-6 py-4'><img src='" . $row['foto1'] . "' alt='Foto 1' class='w-24 h-24 object-cover rounded-lg'></td>";
echo "<td class='px-6 py-4'><img src='" . $row['foto2'] . "' alt='Foto 2' class='w-24 h-24 object-cover rounded-lg'></td>";
echo "<td class='px-6 py-4'><img src='" . $row['foto3'] . "' alt='Foto 3' class='w-24 h-24 object-cover rounded-lg'></td>";
echo "<td class='px-6 py-4 text-sm font-medium text-primary'>" . $row['starting_price'] . "</td>";
echo "<td class='px-6 py-4'><span class='px-3 py-1 text-xs font-medium rounded-full " .
($row['status'] == 'Active' ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800') .
"'>" . $row['status'] . "</span></td>";
echo "<td class='px-6 py-4 text-sm text-gray-900'>" . $row['type'] . "</td>";
echo "<td class='px-6 py-4 text-sm text-gray-500'>" . $row['created_at'] . "</td>";
echo "</tr>";
}
} else {
echo "<tr><td colspan='13' class='px-6 py-4 text-sm text-gray-500 text-center'>Tidak ada data ditemukan</td></tr>";
}
?>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>
<?php
$conn->close();
?>