Fix dashboard undefined texts, red pins and history threshold
This commit is contained in:
@@ -211,22 +211,7 @@ document.addEventListener("DOMContentLoaded", function() {
|
||||
}
|
||||
|
||||
var allPts = greenPts.concat(redPts);
|
||||
if (allPts.length > 0) {
|
||||
var startPt = greenPts[0] || allPts[0];
|
||||
var endPt = redPts.length > 0 ? redPts[redPts.length - 1] : (greenPts[greenPts.length - 1] || allPts[allPts.length - 1]);
|
||||
|
||||
// Mavi Başlangıç İğnesi (İş Yeri / Genel Merkez)
|
||||
var mStart = L.marker(startPt, { icon: createBlueStartIcon() }).addTo(map).bindPopup("<b>Başlangıç Noktası (İş Yeri):</b> " + (vehicle.start_location || "Genel Merkez Ofis"));
|
||||
// Kırmızı Hedef Bitiş İğnesi (Personel Evi / Proje Sahası / Şantiye)
|
||||
var mEnd = L.marker(endPt, { icon: createRedEndIcon() }).addTo(map).bindPopup("<b>Ulaşım Noktası (Hedef / Ev / Proje):</b> " + vehicle.destination);
|
||||
|
||||
// Yeşil Yol Üzerindeki "35 dk (Planlanan Rota)" Çağrı Kutucuğu
|
||||
if (greenPts.length > 1) {
|
||||
var midGreenIdx = Math.floor(greenPts.length / 2);
|
||||
var mGreenCallout = L.marker(greenPts[midGreenIdx], { icon: createCalloutIcon(vehicle.planned_time, '#2563eb') }).addTo(map);
|
||||
activeMarkers.push(mGreenCallout);
|
||||
}
|
||||
|
||||
// Başlangıç ve Bitiş İğnelerini (Mavi/Kırmızı) Canlı Radarda Gizliyoruz (Sadece araba ve çizgi görünecek)
|
||||
// Kırmızı Yol Üzerindeki "1.5 km Sapma" Çağrı Kutucuğu
|
||||
if (redPts.length > 0) {
|
||||
var midRedIdx = Math.floor(redPts.length / 2);
|
||||
@@ -234,8 +219,6 @@ document.addEventListener("DOMContentLoaded", function() {
|
||||
activeMarkers.push(mRedCallout);
|
||||
}
|
||||
|
||||
activeMarkers.push(mStart, mEnd);
|
||||
|
||||
// Rotada Gerçek Zamanlı Canlı Hareket Eden Araç Animasyonunu Başlat
|
||||
animateMovingVehicle(allPts, vehicle);
|
||||
|
||||
@@ -270,27 +253,27 @@ document.addEventListener("DOMContentLoaded", function() {
|
||||
'</div>' +
|
||||
'<div style="font-size: 12px; line-height: 1.6; color: #cbd5e1;">' +
|
||||
'<div style="display: flex; justify-content: space-between; margin-bottom: 4px;">' +
|
||||
'<span style="color: #94a3b8;">' + vehicle.label_home + '</span>' +
|
||||
'<strong style="color: #f1f5f9; font-size: 11px;">' + (vehicle.driver_home_address || '') + '</strong>' +
|
||||
'<span style="color: #94a3b8;">Personel Evi / Konaklama:</span>' +
|
||||
'<strong style="color: #f1f5f9; font-size: 11px;">' + (vehicle.driver_home_address || 'Bilinmiyor') + '</strong>' +
|
||||
'</div>' +
|
||||
'<div style="display: flex; justify-content: space-between; margin-bottom: 4px;">' +
|
||||
'<span style="color: #94a3b8;">' + vehicle.label_start + '</span>' +
|
||||
'<strong style="color: white; font-size: 11px;">' + (vehicle.start_location || '') + '</strong>' +
|
||||
'<span style="color: #94a3b8;">Başlangıç Noktası:</span>' +
|
||||
'<strong style="color: white; font-size: 11px;">' + (vehicle.start_location || 'Canlı GPS Konumu') + '</strong>' +
|
||||
'</div>' +
|
||||
'<div style="display: flex; justify-content: space-between; margin-bottom: 4px;">' +
|
||||
'<span style="color: #94a3b8;">' + vehicle.label_dest + '</span>' +
|
||||
'<strong style="color: #38bdf8; font-size: 11px;">' + vehicle.destination + '</strong>' +
|
||||
'<span style="color: #94a3b8;">Ulaşım Hedefi:</span>' +
|
||||
'<strong style="color: #38bdf8; font-size: 11px;">' + (vehicle.destination || 'Gerçek Zamanlı Aktif İzleme') + '</strong>' +
|
||||
'</div>' +
|
||||
'<div style="display: flex; justify-content: space-between; margin-bottom: 4px;">' +
|
||||
'<span style="color: #94a3b8;">' + vehicle.label_plan + '</span>' +
|
||||
'<span style="color: #94a3b8;">Planlanan / Gidilen Mesafe:</span>' +
|
||||
'<span>' + vehicle.planned_km + ' KM / <strong>' + vehicle.driven_km + ' KM</strong></span>' +
|
||||
'</div>' +
|
||||
'<div style="display: flex; justify-content: space-between; margin-bottom: 4px;">' +
|
||||
'<span style="color: #94a3b8;">' + vehicle.label_dev + '</span>' +
|
||||
'<span style="color: #94a3b8;">Rota Sapma Durumu:</span>' +
|
||||
'<strong style="color: ' + (vehicle.is_violation ? '#ef4444' : (vehicle.is_manager_approved ? '#38bdf8' : '#10b981')) + ';">' + vehicle.deviation_label + '</strong>' +
|
||||
'</div>' +
|
||||
'<div style="display: flex; justify-content: space-between; margin-bottom: 4px;">' +
|
||||
'<span style="color: #94a3b8;">' + vehicle.label_policy + '</span>' +
|
||||
'<span style="color: #94a3b8;">Şirket Politikası:</span>' +
|
||||
'<span style="color: ' + (vehicle.has_free_use ? '#38bdf8' : '#f59e0b') + '; font-weight: 600;">' + vehicle.policy_desc + '</span>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
@@ -319,8 +302,8 @@ document.addEventListener("DOMContentLoaded", function() {
|
||||
var addPoint = true;
|
||||
if (history.length > 0) {
|
||||
var lastPt = history[history.length - 1];
|
||||
// Eğer son konumla aynıysa (veya çok yakınsa) ekleme (yaklaşık 10 metre)
|
||||
if (Math.abs(lastPt[0] - currentLat) < 0.0001 && Math.abs(lastPt[1] - currentLon) < 0.0001) {
|
||||
// Sadece BİREBİR aynı koordinatsa ekleme. (Hafif bir GPS oynamasını bile kaydetmek için)
|
||||
if (lastPt[0] === currentLat && lastPt[1] === currentLon) {
|
||||
addPoint = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user