{"id":9,"date":"2026-04-23T09:54:56","date_gmt":"2026-04-23T09:54:56","guid":{"rendered":"https:\/\/motion-blinds.pl\/?page_id=9"},"modified":"2026-04-23T11:42:27","modified_gmt":"2026-04-23T11:42:27","slug":"manager-opinii","status":"publish","type":"page","link":"https:\/\/motion-blinds.pl\/index.php\/manager-opinii\/","title":{"rendered":"Manager Opinii"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n    \n    <div id=\"mo-app-container\" style=\"width:100%;\">\n        <div id=\"mo-root\">\n            <div style=\"text-align:center;padding:50px;color:#999;\">\n                Inicjalizacja modu\u0142u Excel...\n            <\/div>\n        <\/div>\n    <\/div>\n\n    <!-- SheetJS -->\n    <script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/xlsx\/0.18.5\/xlsx.full.min.js\"><\/script>\n\n    <script>\n    document.addEventListener(\"DOMContentLoaded\", function() {\n\n        const CONFIG = {\n            LIMIT_DNI: 21,\n            DZISIAJ: new Date()\n        };\n\n        let customers = [];\n        let state = { filter: 'all', log: '' };\n\n        function policzDni(dateObj) {\n            if (!dateObj) return 0;\n            return Math.floor((CONFIG.DZISIAJ - dateObj) \/ (1000 * 60 * 60 * 24));\n        }\n\n        function render() {\n            const root = document.getElementById('mo-root');\n            if (!root) return;\n\n            root.innerHTML = `\n                <h2>Mened\u017cer Opinii<\/h2>\n                <input type=\"file\" id=\"excelInput\"><br><br>\n                ${state.log ? `<div>${state.log}<\/div>` : ''}\n\n                <table border=\"1\" cellpadding=\"5\">\n                    <tr><th>ID<\/th><th>Dni<\/th><\/tr>\n                    ${customers.map(k => {\n                        const dni = policzDni(k.dateObj);\n                        return `<tr><td>${k.id}<\/td><td>${dni}<\/td><\/tr>`;\n                    }).join('')}\n                <\/table>\n            `;\n\n            document.getElementById('excelInput').onchange = function(e) {\n                const file = e.target.files[0];\n                const reader = new FileReader();\n\n                reader.onload = function(event) {\n                    const data = new Uint8Array(event.target.result);\n                    const workbook = XLSX.read(data, { type: 'array' });\n                    const sheet = workbook.Sheets[workbook.SheetNames[0]];\n                    const rows = XLSX.utils.sheet_to_json(sheet, { header: 1 });\n\n                    customers = rows.map(r => ({\n                        id: r[0],\n                        dateObj: new Date()\n                    })).filter(r => r.id);\n\n                    state.log = \"Wczytano \" + customers.length;\n                    render();\n                };\n\n                reader.readAsArrayBuffer(file);\n            };\n        }\n\n        render();\n    });\n    <\/script>\n\n    \n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"no-title","meta":{"footnotes":""},"class_list":["post-9","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/motion-blinds.pl\/index.php\/wp-json\/wp\/v2\/pages\/9","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/motion-blinds.pl\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/motion-blinds.pl\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/motion-blinds.pl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/motion-blinds.pl\/index.php\/wp-json\/wp\/v2\/comments?post=9"}],"version-history":[{"count":16,"href":"https:\/\/motion-blinds.pl\/index.php\/wp-json\/wp\/v2\/pages\/9\/revisions"}],"predecessor-version":[{"id":33,"href":"https:\/\/motion-blinds.pl\/index.php\/wp-json\/wp\/v2\/pages\/9\/revisions\/33"}],"wp:attachment":[{"href":"https:\/\/motion-blinds.pl\/index.php\/wp-json\/wp\/v2\/media?parent=9"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}