{"id":418,"date":"2026-06-13T08:36:30","date_gmt":"2026-06-13T06:36:30","guid":{"rendered":"https:\/\/hungary-map.hu\/?page_id=418"},"modified":"2026-06-13T09:26:21","modified_gmt":"2026-06-13T07:26:21","slug":"dashboard","status":"publish","type":"page","link":"https:\/\/hungary-map.hu\/index.php\/dashboard\/","title":{"rendered":"Dashboard"},"content":{"rendered":"\n<style data-wp-block-html=\"css\">\n#progress-bar {\n    transition: width 1.5s cubic-bezier(0.16, 1, 0.3, 1);\n}\n\n\/* Ha a Dashboard oldalra teszed a k\u00f3dot, ez elrejti a WP fejl\u00e9cet\/l\u00e1bl\u00e9cet *\/\n.page-id-123 .site-header, \n.page-id-123 .site-footer {\n    display: none !important;\n}\n\n.page-id-123 .content-area {\n    padding: 0 !important;\n    margin: 0 !important;\n}\n<\/style>\n\n<script data-wp-block-html=\"js\">\n<script>\n\/\/ A PHP-val ki\u00edratjuk a bejelentkezett felhaszn\u00e1l\u00f3 ID-j\u00e1t a JavaScriptbe\nconst currentDriverId = <?php echo get_current_user_id(); ?>;\n\nasync function updateDashboard(driverId) {\n    try {\n        const response = await fetch(`\/wp-json\/hm-vtlog\/v1\/user-stats\/${driverId}`);\n        if (!response.ok) throw new Error(\"API hiba\");\n        \n        const data = await response.json();\n        \n        \/\/ Friss\u00edtj\u00fck a DOM elemeket\n        document.getElementById('driver-name').innerText = \"<?php echo wp_get_current_user()->display_name; ?>\";\n        document.getElementById('level-badge').innerText = data.level;\n        document.getElementById('stat-dist').innerText = data.total_distance.toLocaleString() + \" km\";\n        document.getElementById('stat-jobs').innerText = data.total_jobs;\n        document.getElementById('stat-truck').innerText = data.truck_name || \"Ismeretlen\";\n        \/\/ A friss\u00edt\u00e9s ut\u00e1ni ellen\u0151rz\u00e9s\nconst oldLevel = parseInt(document.getElementById('level-badge').innerText);\nconst newLevel = data.level;\n\nif (newLevel > oldLevel && !isNaN(oldLevel)) {\n    \/\/ Itt triggerelhet\u00fcnk egy kis anim\u00e1ci\u00f3t vagy \u00e9rtes\u00edt\u00e9st\n    alert(\"Gratul\u00e1lunk! Szintet l\u00e9pt\u00e9l: \" + newLevel);\n}\n        \/\/ Progress bar friss\u00edt\u00e9se\n        const progress = data.progress;\n        document.getElementById('progress-bar').style.width = progress + \"%\";\n        document.getElementById('progress-text').innerText = progress + \"%\";\n    } catch (e) {\n        console.error(\"Dashboard hiba:\", e);\n    }\n}\n\n\/\/ Els\u0151 h\u00edv\u00e1s \u00e9s intervallum\nupdateDashboard(currentDriverId);\nsetInterval(() => updateDashboard(currentDriverId), 5000);\n<\/script>\n<\/script>\n\n<div id=\"dashboard\" class=\"max-w-4xl mx-auto bg-slate-950 p-8 rounded-3xl border border-slate-800 text-white shadow-2xl\">\n    <header class=\"flex justify-between items-center mb-8\">\n        <div>\n            <h2 class=\"text-3xl font-bold tracking-tight\">\u00dcdv \u00fajra, <span id=\"driver-name\" class=\"text-lime-400\">Bet\u00f6lt\u00e9s&#8230;<\/span><\/h2>\n            <p class=\"text-slate-400\">Teheraut\u00f3 telemetria &#8211; \u00e9l\u0151 adatok<\/p>\n        <\/div>\n        <div class=\"text-right\">\n            <div class=\"text-xs uppercase text-slate-500 tracking-widest\">Aktu\u00e1lis Szint<\/div>\n            <div id=\"level-badge\" class=\"text-4xl font-bold text-lime-400\">&#8212;<\/div>\n        <\/div>\n    <\/header>\n\n    <div class=\"grid grid-cols-1 md:grid-cols-3 gap-6 mb-10\">\n        <div class=\"bg-slate-900 p-6 rounded-2xl border border-slate-800\">\n            <div class=\"text-slate-400 text-sm mb-1\">\u00d6sszes\u00edtett t\u00e1v<\/div>\n            <div id=\"stat-dist\" class=\"text-2xl font-semibold\">0 km<\/div>\n        <\/div>\n        <div class=\"bg-slate-900 p-6 rounded-2xl border border-slate-800\">\n            <div class=\"text-slate-400 text-sm mb-1\">Fuvarok<\/div>\n            <div id=\"stat-jobs\" class=\"text-2xl font-semibold\">0<\/div>\n        <\/div>\n        <div class=\"bg-slate-900 p-6 rounded-2xl border border-slate-800\">\n            <div class=\"text-slate-400 text-sm mb-1\">Kamion<\/div>\n            <div id=\"stat-truck\" class=\"text-2xl font-semibold\">&#8211;<\/div>\n        <\/div>\n    <\/div>\n\n    <div class=\"bg-slate-900 p-6 rounded-2xl border border-slate-800\">\n        <div class=\"flex justify-between text-sm mb-3\">\n            <span class=\"text-slate-400\">K\u00f6vetkez\u0151 szinthez<\/span>\n            <span id=\"progress-text\" class=\"text-lime-400 font-bold\">0%<\/span>\n        <\/div>\n        <div class=\"w-full h-4 bg-slate-800 rounded-full overflow-hidden\">\n            <div id=\"progress-bar\" class=\"h-full bg-lime-500 transition-all duration-1000\" style=\"width: 0%\"><\/div>\n        <\/div>\n    <\/div>\n<\/div>\n\n\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00dcdv \u00fajra, Bet\u00f6lt\u00e9s&#8230; Teheraut\u00f3 telemetria &#8211; \u00e9l\u0151 adatok Aktu\u00e1lis Szint &#8212; \u00d6sszes\u00edtett t\u00e1v 0 km Fuvarok 0 Kamion &#8211; K\u00f6vetkez\u0151 szinthez 0%<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"templates\/page-nosidebar_template.php","meta":{"footnotes":""},"class_list":["post-418","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/hungary-map.hu\/index.php\/wp-json\/wp\/v2\/pages\/418","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hungary-map.hu\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/hungary-map.hu\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/hungary-map.hu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hungary-map.hu\/index.php\/wp-json\/wp\/v2\/comments?post=418"}],"version-history":[{"count":8,"href":"https:\/\/hungary-map.hu\/index.php\/wp-json\/wp\/v2\/pages\/418\/revisions"}],"predecessor-version":[{"id":426,"href":"https:\/\/hungary-map.hu\/index.php\/wp-json\/wp\/v2\/pages\/418\/revisions\/426"}],"wp:attachment":[{"href":"https:\/\/hungary-map.hu\/index.php\/wp-json\/wp\/v2\/media?parent=418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}