60 lines
2.8 KiB
HTML
Executable File
60 lines
2.8 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html lang="hu">
|
|
<head>
|
|
<meta charset="UTF-8"><title>Service Finder - Dashboard</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<style>
|
|
body { background: #0f172a; color: white; }
|
|
.vehicle-tile { background: #1e293b; border-radius: 15px; padding: 20px; border: 1px solid #334155; transition: 0.3s; position: relative; }
|
|
.vehicle-tile:hover { transform: translateY(-5px); border-color: #3b82f6; }
|
|
.brand-logo { width: 40px; height: 40px; margin-right: 10px; opacity: 0.8; }
|
|
.alert-icon { position: absolute; top: 10px; right: 10px; font-size: 1.5rem; }
|
|
</style>
|
|
</head>
|
|
<body class="p-4">
|
|
<div class="container">
|
|
<div class="d-flex justify-content-between align-items-center mb-5">
|
|
<h1 style="font-weight: 900;">GARÁZS</h1>
|
|
<button class="btn btn-primary" onclick="location.href='register_vehicle.html'">+ ÚJ JÁRMŰ</button>
|
|
</div>
|
|
<div id="vehicleList" class="row g-4">
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
const TOKEN = localStorage.getItem('token');
|
|
if (!TOKEN) window.location.href = 'login.html';
|
|
|
|
async function loadVehicles() {
|
|
const res = await fetch('/api/v1/fleet/vehicles', {
|
|
headers: { 'Authorization': 'Bearer ' + TOKEN }
|
|
});
|
|
const vehicles = await res.json();
|
|
const container = document.getElementById('vehicleList');
|
|
container.innerHTML = '';
|
|
|
|
vehicles.forEach(v => {
|
|
// Egyszerű logika a figyelmeztetésekhez (Backend hivatkozás helyett egyelőre itt)
|
|
let alertHtml = v.current_odometer > 150000 ? '<span class="alert-icon">🔴</span>' : '';
|
|
|
|
container.innerHTML += `
|
|
<div class="col-md-4">
|
|
<div class="vehicle-tile shadow">
|
|
${alertHtml}
|
|
<div class="d-flex align-items-center mb-3">
|
|
<img src="https://logo.clearbit.com/${v.make.toLowerCase()}.com" class="brand-logo" onerror="this.src='https://via.placeholder.com/40?text=🚗'">
|
|
<h4 class="m-0">${v.license_plate}</h4>
|
|
</div>
|
|
<p class="text-info mb-1">${v.make} ${v.model} (${v.year})</p>
|
|
<p class="small text-muted">Aktuális km: <strong>${v.current_odometer} km</strong></p>
|
|
<button class="btn btn-sm btn-outline-light w-100 mt-2">ADATLAP ÉS KÖLTSÉG</button>
|
|
</div>
|
|
</div>
|
|
`;
|
|
});
|
|
}
|
|
loadVehicles();
|
|
</script>
|
|
</body>
|
|
</html>
|