{"id":8,"date":"2026-02-03T17:13:07","date_gmt":"2026-02-03T17:13:07","guid":{"rendered":"http:\/\/www.piattaformafcr.it\/?page_id=8"},"modified":"2026-03-16T18:02:25","modified_gmt":"2026-03-16T18:02:25","slug":"smart-manager-v6-0-plus","status":"publish","type":"page","link":"https:\/\/www.piattaformafcr.it\/app\/smart-manager-v6-0-plus\/","title":{"rendered":"Smart Manager v6.0 Plus"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"8\" class=\"elementor elementor-8\">\n\t\t\t\t<div class=\"elementor-element elementor-element-85cfb5c e-flex e-con-boxed e-con e-parent\" data-id=\"85cfb5c\" 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-7d164dc elementor-align-center elementor-widget elementor-widget-button\" data-id=\"7d164dc\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"button.default\">\n\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-button elementor-button-link elementor-size-sm\" href=\"https:\/\/www.piattaformafcr.it\/app\/\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">Torna alla Home<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-2fe2661 e-con-full e-flex e-con e-parent\" data-id=\"2fe2661\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-61e63c5 elementor-widget elementor-widget-html\" data-id=\"61e63c5\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t\t<!DOCTYPE html>\n<html lang=\"it\">\n<head>\n    <meta charset=\"UTF-8\">\n    <title>Smart Manager v7.1 - FCR Official<\/title>\n    <script src=\"https:\/\/cdn.tailwindcss.com\"><\/script>\n    <script src=\"https:\/\/cdn.jsdelivr.net\/npm\/chart.js\"><\/script>\n    <link href=\"https:\/\/fonts.googleapis.com\/css?family=Inter:wght@300;400;600;700;800&display=swap\" rel=\"stylesheet\">\n    <style>\n        #cs-app { all: initial; font-family: 'Inter', sans-serif; display: block; background: #f8fafc; min-height: 100vh; color: #1e293b; }\n        #cs-app * { box-sizing: border-box; }\n        .gantt-grid { display: grid; grid-template-columns: 300px 1fr; background: white; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; }\n        .row-height { height: 65px; display: flex; align-items: center; border-bottom: 1px solid #f1f5f9; }\n        .day-cell { min-width: 42px; width: 42px; flex-shrink: 0; border-right: 1px solid #f1f5f9; text-align: center; justify-content: center; }\n        .is-weekend { background: #f8fafc; color: #cbd5e1; }\n        .field-label { display: block; font-size: 10px; font-weight: 900; color: #64748b; text-transform: uppercase; margin-bottom: 4px; }\n        .custom-scroll::-webkit-scrollbar { height: 8px; width: 8px; }\n        .custom-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }\n        .color-dot { width: 22px; height: 22px; border-radius: 6px; cursor: pointer; border: 2px solid transparent; }\n        .color-dot.active { border-color: #000; transform: scale(1.1); }\n        #cloud-loader { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.9); z-index: 999999; align-items: center; justify-content: center; color: white; flex-direction: column; gap: 1rem; }\n        @media print {.no-print { display: none !important; } #cs-app { background: white; } }\n    <\/style>\n<\/head>\n<body>\n<div id=\"cs-app\">\n    <div id=\"cloud-loader\">\n        <div class=\"w-12 h-12 border-4 border-blue-500 border-t-transparent rounded-full animate-spin\"><\/div>\n        <div id=\"loader-text\" class=\"font-black uppercase text-[10px] tracking-widest text-center\">Sincronizzazione Cloud...<\/div>\n    <\/div>\n\n    <div id=\"login-overlay\" class=\"fixed inset-0 z-[99999] bg-slate-900 flex items-center justify-center no-print\">\n        <div class=\"bg-white p-10 rounded-[30px] shadow-2xl max-w-sm w-full text-center\">\n            <h2 class=\"text-xl font-black uppercase mb-6\">FCR Manager <span class=\"text-blue-600\">v7.1<\/span><\/h2>\n            <input type=\"password\" id=\"app-pass\" class=\"w-full p-4 border rounded-xl mb-4 text-center text-lg\" placeholder=\"Password Accesso\">\n            <button onclick=\"app.login()\" class=\"w-full bg-blue-600 text-white p-4 rounded-xl font-bold uppercase hover:bg-blue-700 transition-all shadow-lg\">Accedi<\/button>\n            <div id=\"login-error\" class=\"text-red-500 text-xs mt-3 hidden font-bold\">Errore di connessione o Password errata<\/div>\n        <\/div>\n    <\/div>\n\n    <div id=\"main-ui\" class=\"hidden p-4 lg:p-8 opacity-0 transition-opacity duration-500\">\n        <header class=\"bg-white p-6 rounded-3xl shadow-sm mb-6 border border-slate-200 no-print\">\n            <div class=\"flex flex-wrap justify-between items-center gap-6 mb-6\">\n                <div class=\"flex items-center gap-4\">\n                    <div class=\"bg-blue-600 p-3 rounded-2xl text-white shadow-lg\">\n                        <svg class=\"w-6 h-6\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-14h1m4-4h1m-1 4h1m-5 10v-5a1 10 011-1h2a1 10 011 1v5m-4 0h4\"\/><\/svg>\n                    <\/div>\n                    <div>\n                        <label class=\"field-label italic\">Cantiere Attivo<\/label>\n                        <div class=\"flex gap-2\">\n                            <select id=\"project-selector\" onchange=\"app.switchProject(this.value)\" class=\"bg-slate-100 font-black text-lg rounded-lg px-2 py-1 outline-none border-none cursor-pointer\"><\/select>\n                            <button onclick=\"app.addNewProject()\" class=\"bg-green-600 text-white px-3 rounded-lg font-bold text-lg hover:bg-green-700 shadow-sm\">+<\/button>\n                            <button onclick=\"app.deleteCurrentProject()\" class=\"bg-red-50 text-red-600 px-3 rounded-lg font-bold hover:bg-red-100 transition-colors text-[10px]\">ELIMINA<\/button>\n                        <\/div>\n                    <\/div>\n                <\/div>\n                <div class=\"flex gap-2\">\n                    <button onclick=\"ui.showModal('modal-master')\" class=\"bg-slate-100 p-3 rounded-xl text-[10px] font-black uppercase\">Anagrafica<\/button>\n                    <button onclick=\"ui.generateReport()\" class=\"bg-amber-500 text-white px-5 py-3 rounded-xl text-[10px] font-black uppercase shadow-lg\">Report PDF<\/button>\n                    <button onclick=\"app.save(true)\" class=\"bg-blue-600 text-white px-6 py-3 rounded-xl text-[10px] font-black uppercase shadow-lg animate-pulse\">Salva Cloud<\/button>\n                <\/div>\n            <\/div>\n            <div id=\"header-details\" class=\"grid grid-cols-4 gap-4 text-[11px] border-t pt-4\">\n                <div><span class=\"text-slate-400 font-bold uppercase text-[9px]\">Indirizzo:<\/span><div id=\"h-addr\" class=\"font-medium text-slate-700 truncate\">-<\/div><\/div>\n                <div><span class=\"text-slate-400 font-bold uppercase text-[9px]\">Committente:<\/span><div id=\"h-comm\" class=\"font-medium text-slate-700 truncate\">-<\/div><\/div>\n                <div><span class=\"text-slate-400 font-bold uppercase text-[9px]\">D.L.:<\/span><div id=\"h-geo\" class=\"text-blue-600 font-bold truncate\">-<\/div><\/div>\n                <div><span class=\"text-slate-400 font-bold uppercase text-[9px]\">Impresa:<\/span><div id=\"h-app\" class=\"font-bold\">FCR S.R.L.<\/div><\/div>\n            <\/div>\n        <\/header>\n\n        <div class=\"flex gap-4 mb-6 items-center no-print\">\n            <button onclick=\"logic.addTask()\" class=\"bg-slate-900 text-white px-6 py-3 rounded-xl text-[10px] font-black uppercase shadow-xl\">+ Nuova Fase<\/button>\n            <div id=\"cal-label\" class=\"ml-auto font-bold text-xs uppercase bg-white px-4 py-2 rounded-lg border border-slate-200 shadow-sm\"><\/div>\n            <div class=\"flex border rounded-lg bg-white overflow-hidden shadow-sm\">\n                <button onclick=\"logic.shift(-7)\" class=\"px-4 py-2 hover:bg-slate-50 border-r font-bold\">\u2190<\/button>\n                <button onclick=\"logic.shift(7)\" class=\"px-4 py-2 hover:bg-slate-50 font-bold\">\u2192<\/button>\n            <\/div>\n        <\/div>\n\n        <div class=\"gantt-grid shadow-2xl border-slate-200 bg-white\">\n            <div class=\"border-r bg-slate-50\/50\">\n                <div class=\"row-height bg-white px-4 text-[10px] font-black text-slate-400 uppercase border-b flex items-center\">Lavorazioni<\/div>\n                <div id=\"task-labels\"><\/div>\n            <\/div>\n            <div id=\"gantt-viewport\" class=\"overflow-x-auto relative custom-scroll\">\n                <div id=\"gantt-header\" class=\"flex sticky top-0 bg-white z-20 border-b row-height\"><\/div>\n                <div id=\"gantt-body\" class=\"relative\"><\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n\n    <div id=\"modal-report\" class=\"fixed inset-0 bg-slate-900\/60 hidden z-[10002] flex items-center justify-center p-4\">\n        <div class=\"bg-white p-8 rounded-[35px] w-full max-w-4xl max-h-[90vh] flex flex-col shadow-2xl\">\n            <h3 class=\"font-black uppercase mb-4 text-blue-600\">Diario Cantiere & Analisi Imprese<\/h3>\n            <div id=\"report-content\" class=\"flex-grow overflow-y-auto p-6 bg-slate-50 rounded-2xl text-sm border\"><\/div>\n            <div class=\"mt-6 flex gap-3\">\n                <button onclick=\"window.print()\" class=\"flex-grow bg-slate-900 text-white p-4 rounded-xl font-black uppercase text-xs\">Stampa PDF<\/button>\n                <button onclick=\"ui.closeModal('modal-report')\" class=\"bg-slate-100 p-4 rounded-xl font-black uppercase text-xs\">Chiudi<\/button>\n            <\/div>\n        <\/div>\n    <\/div>\n\n    <div id=\"editor-side\" class=\"fixed right-0 top-0 w-[480px] h-full bg-white shadow-2xl z-[10001] translate-x-full transition-transform duration-500 flex flex-col border-l\">\n        <div class=\"p-8 border-b flex justify-between items-center bg-slate-50\">\n            <h3 class=\"font-black uppercase italic text-sm text-slate-900\">Configura Fase<\/h3>\n            <button onclick=\"ui.closeEditor()\" class=\"text-3xl font-light hover:text-red-500\">&times;<\/button>\n        <\/div>\n        <div id=\"ed-body\" class=\"flex-grow overflow-y-auto p-8 space-y-6 text-left custom-scroll\"><\/div>\n        <div class=\"p-8 bg-slate-50 border-t flex gap-3\">\n            <button onclick=\"app.saveTask()\" class=\"flex-grow bg-blue-600 text-white py-4 rounded-2xl font-black uppercase text-xs\">Salva Modifiche<\/button>\n            <button onclick=\"app.delTask()\" class=\"bg-red-50 text-red-500 px-6 rounded-2xl font-bold uppercase text-[10px]\">Elimina<\/button>\n        <\/div>\n    <\/div>\n\n    <div id=\"modal-master\" class=\"fixed inset-0 bg-slate-900\/60 hidden z-[10000] flex items-center justify-center p-4\">\n        <div class=\"bg-white p-8 rounded-[35px] w-full max-w-lg shadow-2xl\">\n            <h3 class=\"font-black uppercase mb-6 text-blue-600\">Dati Generali Cantiere<\/h3>\n            <div class=\"space-y-4\">\n                <div><label class=\"field-label\">Nome<\/label><input id=\"in-nome\" type=\"text\" class=\"w-full p-3 border rounded-xl bg-slate-50 font-bold uppercase\"><\/div>\n                <div><label class=\"field-label\">Indirizzo<\/label><input id=\"in-addr\" type=\"text\" class=\"w-full p-3 border rounded-xl bg-slate-50\"><\/div>\n                <div><label class=\"field-label\">Committente<\/label><input id=\"in-comm\" type=\"text\" class=\"w-full p-3 border rounded-xl bg-slate-50\"><\/div>\n                <div class=\"grid grid-cols-2 gap-4\">\n                    <div><label class=\"field-label\">D.L.<\/label><input id=\"in-geo\" type=\"text\" class=\"w-full p-3 border rounded-xl bg-slate-50\"><\/div>\n                    <div><label class=\"field-label\">Impresa Capofila<\/label><input id=\"in-app\" type=\"text\" class=\"w-full p-3 border rounded-xl bg-slate-50\"><\/div>\n                <\/div>\n            <\/div>\n            <button onclick=\"app.updateMaster()\" class=\"mt-8 w-full bg-blue-600 text-white p-4 rounded-2xl font-black uppercase text-xs\">Salva<\/button>\n        <\/div>\n    <\/div>\n<\/div>\n\n<script>\n\/\/ CONFIGURAZIONE CHIAVI UTENTE\nconst BIN_ID = \"69b7e151b7ec241ddc7237b6\";\nconst MASTER_KEY = \"$2a$10$oe.mBDoEsbq\/aTV5nVKThOvaF\/i2udMSTtbRPBOZgb2OxghrPeMlW\";\nconst TASK_COLORS=['#2563eb','#16a34a','#dc2626','#ca8a04','#9333ea','#0891b2','#4b5563','#ea580c'];\nconst METEO_ICONS={clear:'\u2600\ufe0f', clouds:'\u2601\ufe0f', rain:'\ud83c\udf27\ufe0f', snow:'\u2744\ufe0f'};\n\nlet globalState = {\n    projects: [],\n    activeProjectId: null,\n    editingId: null,\n    viewDate: new Date()\n};\n\nconst app = {\n    login: async () => {\n        const pass = document.getElementById('app-pass').value;\n        if (pass === \"1234\") {\n            document.getElementById('cloud-loader').style.display = 'flex';\n            await app.fetchFromCloud();\n        } else {\n            document.getElementById('login-error').classList.remove('hidden');\n        }\n    },\n\n    fetchFromCloud: async () => {\n        try {\n            const response = await fetch(`https:\/\/api.jsonbin.io\/v3\/b\/${BIN_ID}\/latest`, {\n                method: 'GET',\n                headers: { 'X-Master-Key': MASTER_KEY }\n            });\n            if (!response.ok) throw new Error(\"Errore API\");\n            const data = await response.json();\n            globalState.projects = data.record.projects || [];\n            if(globalState.projects.length > 0) {\n                globalState.activeProjectId = globalState.projects[0].id;\n            }\n            app.initUI();\n        } catch (error) {\n            console.error(error);\n            document.getElementById('cloud-loader').style.display = 'none';\n            document.getElementById('login-error').innerText = \"Errore Cloud: Verifica le chiavi API\";\n            document.getElementById('login-error').classList.remove('hidden');\n        }\n    },\n\n    initUI: () => {\n        document.getElementById('login-overlay').style.display = 'none';\n        document.getElementById('main-ui').classList.remove('hidden');\n        setTimeout(() => document.getElementById('main-ui').style.opacity = '1', 50);\n        ui.renderProjectList();\n        ui.render();\n        document.getElementById('cloud-loader').style.display = 'none';\n    },\n\n    save: async (notify) => {\n        document.getElementById('cloud-loader').style.display = 'flex';\n        try {\n            const res = await fetch(`https:\/\/api.jsonbin.io\/v3\/b\/${BIN_ID}`, {\n                method: 'PUT',\n                headers: { 'Content-Type': 'application\/json', 'X-Master-Key': MASTER_KEY },\n                body: JSON.stringify({ projects: globalState.projects })\n            });\n            if(!res.ok) throw new Error(\"Errore salvataggio\");\n            if(notify) alert(\"Sincronizzato con successo!\");\n        } catch (e) { alert(\"Errore durante il salvataggio cloud.\"); }\n        document.getElementById('cloud-loader').style.display = 'none';\n    },\n\n    saveTask: () => {\n        const p = logic.getActive();\n        const t = p.tasks.find(x => x.id === globalState.editingId);\n        if(!t) return;\n\n        t.name = document.getElementById('ed-name').value.toUpperCase();\n        t.start = document.getElementById('ed-start').value;\n        t.end = document.getElementById('ed-end').value;\n        t.dur = parseInt(document.getElementById('ed-dur').value);\n        t.activity = document.getElementById('ed-activity').value;\n        t.notes = document.getElementById('ed-notes').value;\n        t.meteo = document.getElementById('ed-meteo').value;\n        t.color = document.querySelector('.color-dot.active')?.dataset.color || '#2563eb';\n\n        const updatedCompanies = [];\n        document.querySelectorAll('.company-row').forEach(row => {\n            updatedCompanies.push({\n                name: row.querySelector('.co-name').value.toUpperCase() || \"Senza Nome\",\n                workers: parseInt(row.querySelector('.co-workers').value) || 0,\n                hours: parseInt(row.querySelector('.co-hours').value) || 0,\n                desc: row.querySelector('.co-desc').value || \"\"\n            });\n        });\n        t.companies = updatedCompanies;\n        t.workers = updatedCompanies.reduce((s, c) => s + c.workers, 0);\n        t.hours = updatedCompanies.reduce((s, c) => s + c.hours, 0);\n\n        ui.closeEditor();\n        ui.render();\n    },\n\n    delTask: () => {\n        if(confirm(\"Eliminare la fase selezionata?\")){\n            const p = logic.getActive();\n            p.tasks = p.tasks.filter(x => x.id !== globalState.editingId);\n            ui.closeEditor();\n            ui.render();\n        }\n    },\n\n    addNewProject: () => {\n        const id = 'P' + Date.now();\n        globalState.projects.push({\n            id: id,\n            master: { nome: 'NUOVO CANTIERE', addr: '-', comm: '-', geo: '-', app: 'FCR S.R.L.' },\n            tasks: []\n        });\n        globalState.activeProjectId = id;\n        ui.renderProjectList();\n        ui.render();\n        ui.showModal('modal-master');\n    },\n\n    deleteCurrentProject: () => {\n        if(confirm(\"Eliminare definitivamente questo cantiere?\")){\n            globalState.projects = globalState.projects.filter(p => p.id !== globalState.activeProjectId);\n            globalState.activeProjectId = globalState.projects.length > 0 ? globalState.projects[0].id : null;\n            ui.renderProjectList();\n            ui.render();\n        }\n    },\n\n    switchProject: (id) => { globalState.activeProjectId = id; ui.render(); },\n\n    updateMaster: () => {\n        const p = logic.getActive();\n        p.master = {\n            nome: document.getElementById('in-nome').value.toUpperCase(),\n            addr: document.getElementById('in-addr').value,\n            comm: document.getElementById('in-comm').value,\n            geo: document.getElementById('in-geo').value,\n            app: document.getElementById('in-app').value\n        };\n        ui.renderProjectList();\n        ui.closeModal('modal-master');\n        ui.render();\n    }\n};\n\nconst logic = {\n    getActive: () => globalState.projects.find(x => x.id === globalState.activeProjectId),\n    shift: (n) => { globalState.viewDate.setDate(globalState.viewDate.getDate() + n); ui.render(); },\n    sync: (id, f, v) => {\n        const p = logic.getActive();\n        const t = p.tasks.find(x => x.id === id);\n        if(!t) return;\n        if(f==='start') t.start=v;\n        else if(f==='end') t.end=v;\n        else if(f==='dur'){\n            t.dur=parseInt(v);\n            let d=new Date(t.start);\n            d.setDate(d.getDate()+(t.dur-1));\n            t.end=d.toISOString().split('T')[0];\n        }\n        if(f!=='dur'){\n            const diff = Math.round((new Date(t.end)-new Date(t.start))\/86400000)+1;\n            t.dur = diff > 0 ? diff: 1;\n        }\n        ui.refreshEd(t);\n    },\n    addTask: () => {\n        const p = logic.getActive();\n        if(!p) return alert(\"Crea prima un cantiere!\");\n        const id = Date.now();\n        const today = new Date().toISOString().split('T')[0];\n        p.tasks.push({\n            id, name: 'NUOVA LAVORAZIONE', start: today, end: today, dur: 1,\n            color: '#2563eb', meteo: 'clear', notes: \"\", workers: 0, hours: 0, activity: \"\",\n            companies: []\n        });\n        ui.render();\n        ui.openEditor(id);\n    }\n};\n\nconst ui = {\n    renderProjectList: () => {\n        const sel = document.getElementById('project-selector');\n        sel.innerHTML = globalState.projects.map(p => `<option value=\"${p.id}\" ${p.id === globalState.activeProjectId ? 'selected':\"\"}>${p.master.nome}<\/option>`).join(\"\");\n    },\n\n    render: () => {\n        const p = logic.getActive();\n        if(!p) {\n            document.getElementById('task-labels').innerHTML = \"<div class='p-4 text-xs italic'>Nessun cantiere presente<\/div>\";\n            return;\n        }\n        document.getElementById('h-addr').innerText = p.master.addr;\n        document.getElementById('h-comm').innerText = p.master.comm;\n        document.getElementById('h-geo').innerText = p.master.geo;\n        document.getElementById('h-app').innerText = p.master.app;\n\n        const h = document.getElementById('gantt-header'), b = document.getElementById('gantt-body'), l = document.getElementById('task-labels');\n        h.innerHTML = \"\"; b.innerHTML = \"\"; l.innerHTML = \"\";\n\n        const base = new Date(globalState.viewDate); base.setHours(0,0,0,0);\n        document.getElementById('cal-label').innerText = base.toLocaleDateString('it-IT', { month: 'long', year: 'numeric' });\n\n        for(let i=0; i<45; i++){\n            let d = new Date(base); d.setDate(base.getDate() + i);\n            let isW = d.getDay() === 0 || d.getDay() === 6;\n            h.innerHTML += `<div class=\"day-cell flex flex-col items-center justify-center text-[9px] font-bold ${isW?'is-weekend':\"\"}\"><span class=\"text-slate-400 uppercase\">${d.toLocaleDateString('it-IT', {weekday:'short'})}<\/span><span class=\"text-[11px] font-black\">${d.getDate()}<\/span><\/div>`;\n        }\n\n        p.tasks.sort((a,b)=>new Date(a.start)-new Date(b.start)).forEach(t => {\n            l.innerHTML += `<div onclick=\"ui.openEditor(${t.id})\" class=\"row-height border-b px-3 text-[10px] font-black uppercase truncate cursor-pointer hover:bg-slate-50 border-l-4\" style=\"border-left-color:${t.color}\">\n                <div>${t.name}<\/div><div class=\"text-[8px] text-slate-400 font-normal\">W: ${t.workers} | H: ${t.hours}h<\/div>\n            <\/div>`;\n\n            const row = document.createElement('div'); row.className = 'row-height border-b relative flex';\n            const offset = Math.round((new Date(t.start) - base) \/ 86400000);\n            if(offset > -t.dur && offset < 45){\n                const bar = document.createElement('div');\n                bar.className = 'absolute top-2 h-12 rounded-xl shadow-sm text-white text-[9px] font-bold flex flex-col justify-center px-3 cursor-pointer hover:scale-[1.01] transition-transform overflow-hidden';\n                bar.style.backgroundColor = t.color;\n                bar.style.left = (offset*42) + 'px';\n                bar.style.width = (t.dur *42) + 'px';\n                bar.innerHTML = `<div class=\"truncate\">${METEO_ICONS[t.meteo] || ''} ${t.name}<\/div><div class=\"opacity-80 text-[7px]\">W:${t.workers} H:${t.hours}h<\/div>`;\n                bar.onclick = () => ui.openEditor(t.id);\n                row.appendChild(bar);\n            }\n            b.appendChild(row);\n        });\n    },\n\n    openEditor: (id) => {\n        globalState.editingId = id;\n        const p = logic.getActive();\n        const t = p.tasks.find(x => x.id === id);\n        const b = document.getElementById('ed-body');\n        \n        b.innerHTML = `\n            <div><label class=\"field-label\">Titolo Lavorazione<\/label><input id=\"ed-name\" type=\"text\" value=\"${t.name}\" class=\"w-full p-3 border rounded-xl font-bold uppercase\"><\/div>\n            \n            <div class=\"bg-blue-50 p-4 rounded-2xl border border-blue-100\">\n                <div class=\"flex justify-between items-center mb-4\">\n                    <label class=\"field-label !mb-0\">Imprese e Personale<\/label>\n                    <button onclick=\"ui.addCoRow()\" class=\"bg-blue-600 text-white px-2 py-1 rounded text-[9px] font-black\">+ AGGIUNGI<\/button>\n                <\/div>\n                <div id=\"co-list\" class=\"space-y-3\">\n                    ${(t.companies || []).map((co, i) => `\n                        <div class=\"company-row grid grid-cols-12 gap-2 items-end bg-white p-2 rounded-lg border\">\n                            <div class=\"col-span-5\"><label class=\"text-[8px] font-bold\">IMPRESA<\/label><input type=\"text\" value=\"${co.name}\" class=\"co-name w-full p-1 text-xs border rounded\"><\/div>\n                            <div class=\"col-span-2\"><label class=\"text-[8px] font-bold\">OP.<\/label><input type=\"number\" value=\"${co.workers}\" class=\"co-workers w-full p-1 text-xs border rounded\"><\/div>\n                            <div class=\"col-span-2\"><label class=\"text-[8px] font-bold\">ORE<\/label><input type=\"number\" value=\"${co.hours}\" class=\"co-hours w-full p-1 text-xs border rounded\"><\/div>\n                            <div class=\"col-span-2\"><label class=\"text-[8px] font-bold\">TASK<\/label><input type=\"text\" value=\"${co.desc||''}\" class=\"co-desc w-full p-1 text-xs border rounded\"><\/div>\n                            <div class=\"col-span-1 text-right\"><button onclick=\"this.parentElement.parentElement.remove()\" class=\"text-red-500 font-bold\">\u00d7<\/button><\/div>\n                        <\/div>\n                    `).join('')}\n                <\/div>\n            <\/div>\n\n            <div><label class=\"field-label\">Cosa fanno (Dettaglio)<\/label><textarea id=\"ed-activity\" class=\"w-full p-3 border rounded-xl h-16 text-xs\">${t.activity||\"\"}<\/textarea><\/div>\n            \n            <div class=\"grid grid-cols-2 gap-4\">\n                <div><label class=\"field-label\">Meteo<\/label><select id=\"ed-meteo\" class=\"w-full p-3 border rounded-xl\">${Object.keys(METEO_ICONS).map(k=>`<option value=\"${k}\" ${t.meteo==k?'selected':\"\"}>${k.toUpperCase()}<\/option>`).join('')}<\/select><\/div>\n                <div><label class=\"field-label\">Colore<\/label><div class=\"flex gap-1\">${TASK_COLORS.map(c=>`<div class=\"color-dot ${t.color==c?'active':\"\"}\" data-color=\"${c}\" style=\"background:${c}\" onclick=\"document.querySelectorAll('.color-dot').forEach(d=>d.classList.remove('active'));this.classList.add('active');\"><\/div>`).join(\"\")}<\/div><\/div>\n            <\/div>\n\n            <div class=\"grid grid-cols-2 gap-4\">\n                <div><label class=\"field-label\">Inizio<\/label><input id=\"ed-start\" type=\"date\" value=\"${t.start}\" onchange=\"logic.sync(${id}, 'start', this.value)\" class=\"w-full p-3 border rounded-xl text-xs\"><\/div>\n                <div><label class=\"field-label\">Fine<\/label><input id=\"ed-end\" type=\"date\" value=\"${t.end}\" onchange=\"logic.sync(${id}, 'end', this.value)\" class=\"w-full p-3 border rounded-xl text-xs\"><\/div>\n            <\/div>\n\n            <div class=\"bg-slate-50 p-4 rounded-xl border\"><label class=\"field-label\">Durata: <span id=\"ed-dur-val\">${t.dur}<\/span> GG<\/label><input id=\"ed-dur\" type=\"range\" min=\"1\" max=\"100\" value=\"${t.dur}\" oninput=\"logic.sync(${id}, 'dur', this.value)\" class=\"w-full accent-blue-600\"><\/div>\n            <div><label class=\"field-label\">Note Fase<\/label><textarea id=\"ed-notes\" class=\"w-full p-3 border rounded-xl h-16 text-xs italic\">${t.notes||\"\"}<\/textarea><\/div>\n        `;\n        document.getElementById('editor-side').classList.remove('translate-x-full');\n    },\n\n    addCoRow: () => {\n        const div = document.createElement('div');\n        div.className = \"company-row grid grid-cols-12 gap-2 items-end bg-white p-2 rounded-lg border\";\n        div.innerHTML = `\n            <div class=\"col-span-5\"><label class=\"text-[8px] font-bold\">IMPRESA<\/label><input type=\"text\" class=\"co-name w-full p-1 text-xs border rounded\"><\/div>\n            <div class=\"col-span-2\"><label class=\"text-[8px] font-bold\">OP.<\/label><input type=\"number\" value=\"0\" class=\"co-workers w-full p-1 text-xs border rounded\"><\/div>\n            <div class=\"col-span-2\"><label class=\"text-[8px] font-bold\">ORE<\/label><input type=\"number\" value=\"0\" class=\"co-hours w-full p-1 text-xs border rounded\"><\/div>\n            <div class=\"col-span-2\"><label class=\"text-[8px] font-bold\">TASK<\/label><input type=\"text\" class=\"co-desc w-full p-1 text-xs border rounded\"><\/div>\n            <div class=\"col-span-1 text-right\"><button onclick=\"this.parentElement.parentElement.remove()\" class=\"text-red-500 font-bold\">\u00d7<\/button><\/div>\n        `;\n        document.getElementById('co-list').appendChild(div);\n    },\n\n    generateReport: () => {\n        const p = logic.getActive();\n        const content = document.getElementById('report-content');\n        let totaliPerImpresa = {};\n        \n        p.tasks.forEach(t => {\n            (t.companies || []).forEach(co => {\n                const name = co.name || 'IMPRESA NON SPEC.';\n                if(!totaliPerImpresa[name]) totaliPerImpresa[name] = { w: 0, h: 0 };\n                totaliPerImpresa[name].w += co.workers;\n                totaliPerImpresa[name].h += co.hours;\n            });\n        });\n\n        let html = `\n            <div class=\"mb-8 p-6 bg-white rounded-2xl border shadow-sm\">\n                <h4 class=\"font-black uppercase text-xs mb-6 text-slate-400\">Analisi Carico Lavoro per Impresa<\/h4>\n                <div class=\"grid grid-cols-1 md:grid-cols-2 gap-8 items-center\">\n                    <div style=\"max-width:250px; margin:auto;\"><canvas id=\"chartImprese\"><\/canvas><\/div>\n                    <div class=\"space-y-4\">\n                        <table class=\"w-full text-xs\">\n                            <thead><tr class=\"text-left border-b text-slate-400\"><th>IMPRESA<\/th><th class=\"text-center\">OP. TOTALI<\/th><th class=\"text-right\">ORE TOTALI<\/th><\/tr><\/thead>\n                            <tbody>\n                                ${Object.keys(totaliPerImpresa).map(k => `\n                                    <tr class=\"border-b\"><td class=\"py-2 font-bold\">${k}<\/td><td class=\"text-center\">${totaliPerImpresa[k].w}<\/td><td class=\"text-right font-black text-blue-600\">${totaliPerImpresa[k].h}h<\/td><\/tr>\n                                `).join('')}\n                            <\/tbody>\n                        <\/table>\n                    <\/div>\n                <\/div>\n            <\/div>\n            <div class=\"space-y-4\">\n                <h4 class=\"font-black uppercase text-xs text-slate-400\">Dettaglio Presenze Giornaliere<\/h4>\n                ${p.tasks.map(t => `\n                    <div class=\"p-4 bg-white rounded-xl border border-l-4\" style=\"border-left-color:${t.color}\">\n                        <div class=\"flex justify-between font-bold text-sm\"><span>${t.name}<\/span><span class=\"text-slate-400 text-xs\">${t.start} \/ ${t.end}<\/span><\/div>\n                        <div class=\"text-[10px] text-slate-500 mt-1 italic\">${t.activity || 'Nessuna descrizione attivit\u00e0'}<\/div>\n                        <div class=\"mt-3 flex flex-wrap gap-2\">\n                            ${(t.companies || []).map(c => `<span class=\"bg-slate-100 px-2 py-1 rounded text-[9px]\"><b>${c.name}<\/b>: ${c.workers} Op. | ${c.hours} Ore (${c.desc||'No note'})<\/span>`).join('')}\n                        <\/div>\n                    <\/div>\n                `).join('')}\n            <\/div>\n        `;\n        \n        content.innerHTML = html;\n        ui.showModal('modal-report');\n\n        setTimeout(() => {\n            const ctx = document.getElementById('chartImprese').getContext('2d');\n            new Chart(ctx, {\n                type: 'doughnut',\n                data: {\n                    labels: Object.keys(totaliPerImpresa),\n                    datasets: [{\n                        data: Object.values(totaliPerImpresa).map(v => v.h),\n                        backgroundColor: TASK_COLORS,\n                        borderWidth: 0\n                    }]\n                },\n                options: { plugins: { legend: { position: 'bottom', labels: { boxWidth: 12, font: { size: 10 } } } } }\n            });\n        }, 200);\n    },\n\n    showModal: (id) => document.getElementById(id).classList.remove('hidden'),\n    closeModal: (id) => document.getElementById(id).classList.add('hidden'),\n    closeEditor: () => document.getElementById('editor-side').classList.add('translate-x-full'),\n    refreshEd: (t) => {\n        document.getElementById('ed-start').value = t.start;\n        document.getElementById('ed-end').value = t.end;\n        document.getElementById('ed-dur-val').innerText = t.dur;\n        document.getElementById('ed-dur').value = t.dur;\n    }\n};\n\ndocument.getElementById('app-pass').addEventListener('keypress', (e) => { if (e.key === 'Enter') app.login(); });\n<\/script>\n<\/body>\n<\/html>\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>Torna alla Home Smart Manager v7.1 &#8211; FCR Official Sincronizzazione Cloud&#8230; FCR Manager v7.1 Accedi Errore di connessione o Password [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"elementor_canvas","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"class_list":["post-8","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.piattaformafcr.it\/app\/wp-json\/wp\/v2\/pages\/8","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.piattaformafcr.it\/app\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.piattaformafcr.it\/app\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.piattaformafcr.it\/app\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.piattaformafcr.it\/app\/wp-json\/wp\/v2\/comments?post=8"}],"version-history":[{"count":270,"href":"https:\/\/www.piattaformafcr.it\/app\/wp-json\/wp\/v2\/pages\/8\/revisions"}],"predecessor-version":[{"id":346,"href":"https:\/\/www.piattaformafcr.it\/app\/wp-json\/wp\/v2\/pages\/8\/revisions\/346"}],"wp:attachment":[{"href":"https:\/\/www.piattaformafcr.it\/app\/wp-json\/wp\/v2\/media?parent=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}