{"id":1949,"date":"2026-05-12T12:40:24","date_gmt":"2026-05-12T12:40:24","guid":{"rendered":"https:\/\/webthly.com\/mr-klinika\/?page_id=1949"},"modified":"2026-05-12T12:40:48","modified_gmt":"2026-05-12T12:40:48","slug":"pregledi-po-danu","status":"publish","type":"page","link":"https:\/\/webthly.com\/mr-klinika\/pregledi-po-danu\/","title":{"rendered":"Pregledi po Danu"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"1949\" class=\"elementor elementor-1949\">\n\t\t\t\t<div class=\"elementor-element elementor-element-717a2f3 e-flex e-con-boxed e-con e-parent\" data-id=\"717a2f3\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-07d8913 elementor-widget elementor-widget-html\" data-id=\"07d8913\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t\t<!-- DASHBOARD ZA PO\u010cETNU - SA ALARMOM ZA POTVRDU -->\r\n<div class=\"dashboard-wrapper\" style=\"font-family: 'Inter', sans-serif; padding: 20px;\">\r\n    <div style=\"max-width: 1200px; margin: 0 auto;\">\r\n        <div style=\"display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px;\">\r\n            <h2 style=\"margin: 0; color: #1e293b;\">Dana\u0161nji termini <span id=\"current-date-label\" style=\"font-size: 1rem; color: #64748b; font-weight: 400;\"><\/span><\/h2>\r\n            <button onclick=\"loadAllAppointments()\" style=\"padding: 10px 20px; background: #ea1c82; color: white; border: none; border-radius: 8px; cursor: pointer; font-weight: 600;\">Osve\u017ei tablu<\/button>\r\n        <\/div>\r\n\r\n        <div id=\"dashboard-list\" style=\"display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px;\">\r\n            <div style=\"text-align: center; grid-column: 1\/-1; padding: 50px; color: #94a3b8;\">U\u010ditavanje rasporeda...<\/div>\r\n        <\/div>\r\n    <\/div>\r\n<\/div>\r\n\r\n<script>\r\n(function() {\r\n    const DB_URL = \"https:\/\/mr-klinika-default-rtdb.europe-west1.firebasedatabase.app\/\";\r\n    const dashboardList = document.getElementById('dashboard-list');\r\n\r\n    async function loadAllAppointments() {\r\n        try {\r\n            const now = new Date();\r\n            const offset = now.getTimezoneOffset() * 60000; \r\n            const localDate = new Date(now - offset);\r\n            const todayISO = localDate.toISOString().split('T')[0]; \r\n            \r\n            const parts = todayISO.split('-');\r\n            const displayDate = `${parts[2]}.${parts[1]}.${parts[0]}`;\r\n            document.getElementById('current-date-label').innerText = `(${displayDate})`;\r\n\r\n            const response = await fetch(`${DB_URL}appointments.json`);\r\n            const allData = await response.json();\r\n            \r\n            dashboardList.innerHTML = '';\r\n            let allAppointmentsList = [];\r\n\r\n            if (!allData) {\r\n                dashboardList.innerHTML = '<div style=\"grid-column:1\/-1; text-align:center; padding:50px;\">Nema podataka u bazi.<\/div>';\r\n                return;\r\n            }\r\n\r\n            for (const rawId in allData) {\r\n                let cleanId = rawId.startsWith('dr-') ? rawId.replace('dr-', '') : rawId;\r\n                const doctorAppointments = allData[rawId];\r\n                if (doctorAppointments[todayISO] && doctorAppointments[todayISO].slots) {\r\n                    const slots = doctorAppointments[todayISO].slots;\r\n                    for (const time in slots) {\r\n                        const slot = slots[time];\r\n                        if (slot.status === 'pending' || slot.status === 'confirmed') {\r\n                            allAppointmentsList.push({\r\n                                doctorId: cleanId,\r\n                                time: time,\r\n                                ...slot\r\n                            });\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            allAppointmentsList.sort((a, b) => a.time.localeCompare(b.time));\r\n\r\n            if (allAppointmentsList.length === 0) {\r\n                dashboardList.innerHTML = `<div style=\"grid-column:1\/-1; text-align:center; padding:50px; color: #94a3b8;\">Danas (${displayDate}) nema zakazanih termina.<\/div>`;\r\n                return;\r\n            }\r\n\r\n            const currentTimeStr = now.getHours().toString().padStart(2, '0') + ':' + now.getMinutes().toString().padStart(2, '0');\r\n\r\n            allAppointmentsList.forEach(item => {\r\n                renderCard(item, currentTimeStr);\r\n            });\r\n\r\n        } catch (e) {\r\n            dashboardList.innerHTML = '<div style=\"grid-column:1\/-1; text-align:center; padding:50px; color: #ef4444;\">Gre\u0161ka pri povezivanju.<\/div>';\r\n        }\r\n    }\r\n\r\n    function renderCard(item, currentTimeStr) {\r\n        const card = document.createElement('div');\r\n        const drDisplayName = \"DR \" + item.doctorId.replace(\/-\/g, ' ').toUpperCase();\r\n        \r\n        \/\/ Logika za proveru vremena (Panic mode)\r\n        const now = new Date();\r\n        const [h, m] = item.time.split(':').map(Number);\r\n        const appointmentTime = new Date();\r\n        appointmentTime.setHours(h, m, 0, 0);\r\n        \r\n        const diffMs = appointmentTime - now;\r\n        const diffMins = Math.floor(diffMs \/ 60000); \r\n        const isPast = item.time < currentTimeStr;\r\n        \r\n        \/\/ Uslov: Status je \"naru\u010deno\", termin je za manje od 60 min, a nije pro\u0161ao\r\n        const isUrgent = item.status === 'pending' && diffMins <= 60 && diffMins > -10;\r\n\r\n        let statusText = item.status === 'confirmed' ? 'POTVR\u0110ENO' : 'NARU\u010cENO';\r\n        let statusColor = item.status === 'confirmed' ? '#ef4444' : '#f97316';\r\n        let cardBg = 'white';\r\n        let opacity = '1';\r\n\r\n        if (isPast) {\r\n            statusText = 'ZAVR\u0160ENO';\r\n            statusColor = '#64748b';\r\n            cardBg = '#f1f5f9';\r\n            opacity = '0.8';\r\n        }\r\n\r\n        \/\/ Stil kartice (zadr\u017ean tvoj originalni stil uz dodatak animacije ako je hitno)\r\n        card.style = `background: ${cardBg}; border-radius: 16px; padding: 20px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); border-left: 6px solid ${isUrgent ? '#ef4444' : statusColor}; display: flex; flex-direction: column; gap: 10px; opacity: ${opacity}; position: relative; transition: all 0.3s ease;`;\r\n\r\n        if (isUrgent) {\r\n            card.style.animation = \"treperenje 1s infinite alternate\";\r\n        }\r\n\r\n        card.innerHTML = `\r\n            <style>\r\n                @keyframes treperenje {\r\n                    from { box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); }\r\n                    to { box-shadow: 0 0 15px rgba(239, 68, 68, 0.5); border-left-color: #b91c1c; }\r\n                }\r\n            <\/style>\r\n            <div style=\"display: flex; justify-content: space-between; align-items: flex-start;\">\r\n                <div>\r\n                    <div style=\"font-size: 0.75rem; font-weight: 800; color: #64748b; text-transform: uppercase;\">${drDisplayName}<\/div>\r\n                    <div style=\"font-size: 1.4rem; font-weight: 800; color: #1e293b;\">${item.time} h<\/div>\r\n                <\/div>\r\n                <div style=\"background: ${isPast ? '#e2e8f0' : (item.status === 'confirmed' ? '#fff1f2' : '#fff7ed')}; color: ${statusColor}; font-size: 0.7rem; font-weight: 800; padding: 4px 10px; border-radius: 20px;\">\r\n                    ${statusText}\r\n                <\/div>\r\n            <\/div>\r\n            \r\n            <div style=\"border-top: 1px solid rgba(0,0,0,0.05); padding-top: 10px;\">\r\n                <div style=\"font-weight: 700; color: #1e293b; font-size: 1.1rem;\">${item.name}<\/div>\r\n                <a href=\"tel:${item.phone}\" style=\"font-size: 0.9rem; color: #64748b; text-decoration: none; font-weight: 600; display: block; margin-top: 2px;\">\ud83d\udcde ${item.phone}<\/a>\r\n                \r\n                ${isUrgent ? `\r\n                    <div style=\"margin-top: 10px; padding: 8px; background: #fee2e2; border-radius: 8px; color: #b91c1c; font-size: 0.8rem; font-weight: 700; line-height: 1.3;\">\r\n                        \u26a0\ufe0f Ovaj termin je za manje od sat vremena, pacijent nije potvrdio dolazak, nazovite ga \u0161to prije!\r\n                    <\/div>\r\n                ` : ''}\r\n\r\n                ${item.note ? `<div style=\"margin-top: 8px; font-size: 0.85rem; color: #475569; font-style: italic; background: rgba(0,0,0,0.03); padding: 6px; border-radius: 6px;\">\ud83d\udcdd ${item.note}<\/div>` : ''}\r\n            <\/div>\r\n            <a href=\"\/mr-klinika\/dr-${item.doctorId}\" style=\"margin-top: auto; font-size: 0.75rem; color: #ea1c82; text-decoration: none; font-weight: 600; padding-top:10px;\">Otvori profil doktora \u2192<\/a>\r\n        `;\r\n        dashboardList.appendChild(card);\r\n    }\r\n\r\n    setInterval(loadAllAppointments, 30000); \r\n    loadAllAppointments();\r\n})();\r\n<\/script>\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Dana\u0161nji termini Osve\u017ei tablu U\u010ditavanje rasporeda&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"elementor_header_footer","meta":{"footnotes":""},"class_list":["post-1949","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Pregledi po Danu -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webthly.com\/mr-klinika\/pregledi-po-danu\/\" \/>\n<meta property=\"og:locale\" content=\"bs_BA\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pregledi po Danu -\" \/>\n<meta property=\"og:description\" content=\"Dana\u0161nji termini Osve\u017ei tablu U\u010ditavanje rasporeda&#8230;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webthly.com\/mr-klinika\/pregledi-po-danu\/\" \/>\n<meta property=\"article:modified_time\" content=\"2026-05-12T12:40:48+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/webthly.com\\\/mr-klinika\\\/pregledi-po-danu\\\/\",\"url\":\"https:\\\/\\\/webthly.com\\\/mr-klinika\\\/pregledi-po-danu\\\/\",\"name\":\"Pregledi po Danu -\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/webthly.com\\\/mr-klinika\\\/#website\"},\"datePublished\":\"2026-05-12T12:40:24+00:00\",\"dateModified\":\"2026-05-12T12:40:48+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/webthly.com\\\/mr-klinika\\\/pregledi-po-danu\\\/#breadcrumb\"},\"inLanguage\":\"bs-BA\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/webthly.com\\\/mr-klinika\\\/pregledi-po-danu\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/webthly.com\\\/mr-klinika\\\/pregledi-po-danu\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/webthly.com\\\/mr-klinika\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Pregledi po Danu\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/webthly.com\\\/mr-klinika\\\/#website\",\"url\":\"https:\\\/\\\/webthly.com\\\/mr-klinika\\\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/webthly.com\\\/mr-klinika\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"bs-BA\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pregledi po Danu -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webthly.com\/mr-klinika\/pregledi-po-danu\/","og_locale":"bs_BA","og_type":"article","og_title":"Pregledi po Danu -","og_description":"Dana\u0161nji termini Osve\u017ei tablu U\u010ditavanje rasporeda&#8230;","og_url":"https:\/\/webthly.com\/mr-klinika\/pregledi-po-danu\/","article_modified_time":"2026-05-12T12:40:48+00:00","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/webthly.com\/mr-klinika\/pregledi-po-danu\/","url":"https:\/\/webthly.com\/mr-klinika\/pregledi-po-danu\/","name":"Pregledi po Danu -","isPartOf":{"@id":"https:\/\/webthly.com\/mr-klinika\/#website"},"datePublished":"2026-05-12T12:40:24+00:00","dateModified":"2026-05-12T12:40:48+00:00","breadcrumb":{"@id":"https:\/\/webthly.com\/mr-klinika\/pregledi-po-danu\/#breadcrumb"},"inLanguage":"bs-BA","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webthly.com\/mr-klinika\/pregledi-po-danu\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webthly.com\/mr-klinika\/pregledi-po-danu\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webthly.com\/mr-klinika\/"},{"@type":"ListItem","position":2,"name":"Pregledi po Danu"}]},{"@type":"WebSite","@id":"https:\/\/webthly.com\/mr-klinika\/#website","url":"https:\/\/webthly.com\/mr-klinika\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webthly.com\/mr-klinika\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"bs-BA"}]}},"_links":{"self":[{"href":"https:\/\/webthly.com\/mr-klinika\/wp-json\/wp\/v2\/pages\/1949","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webthly.com\/mr-klinika\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/webthly.com\/mr-klinika\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/webthly.com\/mr-klinika\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webthly.com\/mr-klinika\/wp-json\/wp\/v2\/comments?post=1949"}],"version-history":[{"count":4,"href":"https:\/\/webthly.com\/mr-klinika\/wp-json\/wp\/v2\/pages\/1949\/revisions"}],"predecessor-version":[{"id":1953,"href":"https:\/\/webthly.com\/mr-klinika\/wp-json\/wp\/v2\/pages\/1949\/revisions\/1953"}],"wp:attachment":[{"href":"https:\/\/webthly.com\/mr-klinika\/wp-json\/wp\/v2\/media?parent=1949"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}