diff --git a/Dockerfile b/Dockerfile index 216287a..93afd91 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,7 @@ WORKDIR /app COPY --chown=node:node package.json server.js access.js hr-sync.js hr-org.js cost-model.js contractor-store.js settings-store.js index.html 2022_Moonshine_Logo_MS_logo_w_EN.png ./ COPY --chown=node:node seed ./seed +COPY --chown=node:node fonts ./fonts RUN mkdir -p /app/data && chown node:node /app/data USER node diff --git a/fonts/OFL-NOTICE.txt b/fonts/OFL-NOTICE.txt new file mode 100644 index 0000000..011b8ff --- /dev/null +++ b/fonts/OFL-NOTICE.txt @@ -0,0 +1,4 @@ +Poppins — Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins) +This Font Software is licensed under the SIL Open Font License, Version 1.1. +The license is available with a FAQ at: https://scripts.sil.org/OFL +The files in this folder are subsets (Basic Latin, digits and a few symbols) of Poppins Light, Regular and Medium. diff --git a/fonts/poppins-light.woff b/fonts/poppins-light.woff new file mode 100644 index 0000000..049933a Binary files /dev/null and b/fonts/poppins-light.woff differ diff --git a/fonts/poppins-medium.woff b/fonts/poppins-medium.woff new file mode 100644 index 0000000..807a92f Binary files /dev/null and b/fonts/poppins-medium.woff differ diff --git a/fonts/poppins-regular.woff b/fonts/poppins-regular.woff new file mode 100644 index 0000000..f668e7d Binary files /dev/null and b/fonts/poppins-regular.woff differ diff --git a/index.html b/index.html index 9d168d0..6f8ca32 100644 --- a/index.html +++ b/index.html @@ -5,6 +5,17 @@ Studio Cost Model Pro - Animation KPI System + + @@ -1265,24 +1596,29 @@
-
+
正在從預覽伺服器載入合成資料…
- -
-

📊 營運概況

- -
+
+

營運概況

+ +
- - -
- -
- - -
-
-

- 📈 部門 CODA 成本佔比

-
- -
-
-
-

- 👥 人力分佈

-
-
-
-

- 🧾 各部門年度發票目標

-
+
+
+
+

各部門年度發票目標

佔比 · P/A 佔比 · H1
+
+
+
+

部門 CODA 成本佔比

承擔發票其他
+
+
+
+
+

部門倍率

人薪倍率 × 內部成本 ÷ A 成本
+
+
+
+

人力分佈

+
+
@@ -1379,10 +1705,10 @@
+ style="margin-bottom: 0; display: flex; gap: 1rem; align-items: center; background: var(--inset); border-color: var(--wash); padding: 0.5rem 1rem;">
- ${INVOICE_ROLE_LABELS[r]} - `).join(''); + const seg = (kind, name, role, label) => ` +
${['bear', 'share', 'exclude'].map(r => ` + `).join('')} +
`; const savedDepts = globalParams.invoiceRoles?.depts || {}; - const companyRows = [...companies.entries()].sort((a, b) => (companyDefaultRole(a[0]) === 'bear' ? 0 : 1) - (companyDefaultRole(b[0]) === 'bear' ? 0 : 1) || a[0].localeCompare(b[0], 'zh-Hant')).map(([company, depts]) => { + const companyBlocks = [...companies.entries()].sort((a, b) => (companyDefaultRole(a[0]) === 'bear' ? 0 : 1) - (companyDefaultRole(b[0]) === 'bear' ? 0 : 1) || b[1].size - a[1].size || a[0].localeCompare(b[0], 'zh-Hant')).map(([company, depts]) => { + const short = shortCompanyName(company); const cRole = companyDefaultRole(company); + const anyCustom = [...depts].some(d => Object.prototype.hasOwnProperty.call(savedDepts, d)); const deptRows = [...depts].sort((a, b) => a.localeCompare(b, 'zh-Hant')).map(d => { const custom = Object.prototype.hasOwnProperty.call(savedDepts, d); const role = deptRole(d, company); const cost = costOf(p => (p.dept || '').trim() === d); return ` -
- ${escapeHtml(d)} - ${money(cost)} - ${radios('dept', d, role)} - ${custom ? `` : `跟隨公司`} -
`; +
+ ${escapeHtml(d)} + ${money(cost)} + ${seg('dept', d, role, d + ' 發票角色')} + ${custom ? `` : '跟隨公司'} +
`; }).join(''); return ` -
-
- 🏢 ${escapeHtml(shortCompanyName(company))} - 公司預設: - ${radios('company', company, cRole)} +
+
+ ${escapeHtml(short)}${depts.size} 個部門 · 預設 + ${seg('company', company, cRole, short + ' 公司預設')} + ${anyCustom ? `` : ''}
- ${deptRows || '
(沒有部門,公司內所有人套用公司預設)
'} -
`; + ${deptRows || '
沒有部門,公司內所有人套用公司預設。
'} + `; }).join(''); const bearDepts = invoiceDepts(current); @@ -2533,17 +2822,19 @@ const excludedCost = costOf(p => personInvoiceRole(p, map) === 'exclude'); const stale = Object.keys(savedDepts).filter(d => !Object.prototype.hasOwnProperty.call(globalParams.orgStructure, d)); container.innerHTML = ` -
-

🏢 發票承擔設定

-

- 承擔發票:成本計入發票總額,並依 P/A 佔比與超標指標分配發票。 - 成本分攤:成本計入發票總額,但不分配發票,由承擔部門吸收(也不列入三個指標)。 - 不計入:不進發票,只顯示年度薪資成本 × 人薪倍率。新部門自動套用所屬公司的預設。 -

- ${bearDepts.length ? '' : '
⚠️ 目前沒有任何「承擔發票」的部門,發票無法分配。
'} -
目前結果:發票總額 ${money(inv.finalInvoiceTotal)},由 ${bearDepts.length} 個部門承擔;成本分攤 ${money(inv.sharedCost || 0)};不計入單位成本 ${money(excludedCost)}。
- ${companyRows} - ${stale.length ? `
已失效的部門設定(部門已不存在):${stale.map(d => `${escapeHtml(d)} `).join('、')}
` : ''} +
+

發票承擔設定

+ 承擔發票:計入總額並分配發票成本分攤:計入總額、不分配不計入:只看成本 × 人薪倍率 +
+
+
${money(inv.finalInvoiceTotal)}發票總額
+
${bearDepts.length}承擔發票的部門
+
${money(inv.sharedCost || 0)}成本分攤
+
${money(excludedCost)}不計入單位成本
+
+ ${bearDepts.length ? '' : '
目前沒有任何「承擔發票」的部門,發票無法分配。
'} +
${companyBlocks}
+
新部門自動套用所屬公司的預設;部門可以個別改。${stale.length ? `已失效的部門設定:${stale.map(d => `${escapeHtml(d)} `).join('、')}` : ''}
`; } @@ -2576,7 +2867,7 @@
${unit}
@@ -2586,9 +2877,9 @@ container.innerHTML = ` -
+

- 📋 基本參數 + 基本參數

調整人薪倍率、年度工作天數與產出率,這些值會直接影響各部門 CODA 的計算基準。 @@ -2600,17 +2891,17 @@ ${buildParamRow("P-人員 產出率 (Utilization P)", "utilizationP", "率", false, "0.05")} ${buildParamRow("A-人員 產出率 (Utilization A)", "utilizationA", "率", false, "0.05")}

-
+

- 📌 此處設定為系統計算之基礎基準。 + 此處設定為系統計算之基礎基準。

-
+

- 🎯 發票分配與目標 + 發票分配與目標

設定各項指標權重與年度專案成本,系統將依此自動演算出各部門應達成的發票目標。 @@ -2622,8 +2913,8 @@ ${buildParamRow("理想 A/P 比率", "targetAPRatio", ":1", false, "0.5")}

-
-
📈 年度目標基準預估
+
+
年度目標基準預估
${buildParamRow("專案委外費用", "externalProjectOutsourcing", "NT$", true)} ${buildParamRow("員旅/不計毛利額", "employeeTripInvoices", "NT$", true)} ${buildParamRow("預計毛利率", "grossMarginPct", "%", false, "0.05")} @@ -2634,9 +2925,9 @@
-
+

- 🧪 研發參數與標註 + 研發參數與標註

設定研發減免比例。 @@ -2645,9 +2936,9 @@

-
+

- ⚖️ 管理與PC承擔%數 + 管理與PC承擔%數

定義管理職與 PC 職位的成本承擔比例,未承擔的成本將由組員共同分攤。 @@ -2716,7 +3007,7 @@ const panelKey = `${company}|${dept}|${g}`; const open = window.orgAssignOpen.has(panelKey); const label = !dept ? '指定部門' : g === '未分組' ? '手動分組' : '修改手動'; - const toggle = ``; + const toggle = ``; if (!open) return toggle; const slug = 'org-opts-' + btoa(unescape(encodeURIComponent(panelKey))).replace(/[^a-zA-Z0-9]/g, ''); const deptOptions = [...(companies.get(company)?.depts.keys() || [])].filter(Boolean); @@ -2748,46 +3039,52 @@

`; }; - const manualTag = entry => entry.manual ? `手動 ${entry.manual}` : ''; + const manualTag = entry => entry.manual ? `手動 ${entry.manual}` : ''; + + // The card already names the department, so 「前製部_設計組」 shows as 「設計組」. + const shortGroup = (dept, g) => { + if (!dept) return g; + for (const sep of ['_', '-', ' ', '/', '/']) { + if (g.startsWith(dept + sep) && g.length > dept.length + 1) return g.slice(dept.length + 1); + } + return g; + }; const groupRow = (company, dept, g, entry) => { const count = entry.count; + const name = shortGroup(dept, g); + const top = ` +
+ ${escapeHtml(name)} + ${count} 人 +
`; if (!dept) { return ` -
-
- ${escapeHtml(g)}${manualTag(entry)} - ${count} 人 -
- ${assignPanel(company, dept, g, entry)} -
`; +
${top} +
${manualTag(entry)}${assignPanel(company, dept, g, entry)}
+
`; } const key = `${dept}|${g}`; const isRD = (globalParams.rdGroups || []).includes(key); const isCGLead = (globalParams.cgLeadGroups || []).includes(key); const dArg = escapeHtml(JSON.stringify(dept)); const gArg = escapeHtml(JSON.stringify(g)); + const assign = (g === '未分組' || entry.manual) ? assignPanel(company, dept, g, entry) : ''; return ` -
-
-
- - RD -
-
- - CG -
- ${escapeHtml(g)} +
${top} +
+ + + ${manualTag(entry)}
- ${count} 人${manualTag(entry)} -
${(g === '未分組' || entry.manual) ? `
${assignPanel(company, dept, g, entry)}
` : ''}`; + ${assign ? `
${assign}
` : ''} +
`; }; let html = `
-

🏢 組織架構

+

組織架構

依 HR 組織資料自動產生:公司 → 部門 → 組別。RD/CG 勾選會自動儲存;未歸部門的人員不列入部門 CODA。

`; @@ -2867,6 +3164,7 @@ globalParams.rdGroups.push(key); } saveAndRefresh(); + renderOrgStructure(); } function toggleCGLeadGroup(dept, group) { @@ -2879,6 +3177,7 @@ globalParams.cgLeadGroups.push(key); } saveAndRefresh(); + renderOrgStructure(); } function removeRDTag(groupKey) { @@ -2912,57 +3211,25 @@ function renderRoleStats(data) { const statsEl = document.getElementById('role-stats'); if (!statsEl) return; - const total = data.length; - const roles = { - '🎨 藝術家': { count: 0, color: 'var(--accent-primary)' }, - '💼 專案管理': { count: 0, color: 'var(--accent-secondary)' }, - '🏢 特約外包': { count: 0, color: 'var(--accent-warning)' } - }; - - const durations = { - '📅 12個月 (全年度)': { count: 0, color: 'var(--accent-success)' }, - '⏳ 低於 12個月': { count: 0, color: 'var(--accent-warning)' } - }; - - data.forEach(p => { - // Role grouping - if (p.role.startsWith('A')) roles['🎨 藝術家'].count++; - else if (p.role.startsWith('P')) roles['💼 專案管理'].count++; - else if (p.role.startsWith('O')) roles['🏢 特約外包'].count++; - - // Duration grouping - const m1 = (p.h1Start && p.h1End) ? Math.max(0, parseInt(p.h1End) - parseInt(p.h1Start) + 1) : 0; - const m2 = (p.h2Start && p.h2End) ? Math.max(0, parseInt(p.h2End) - parseInt(p.h2Start) + 1) : 0; - const months = m1 + m2; - - if (months === 12) durations['📅 12個月 (全年度)'].count++; - else durations['⏳ 低於 12個月'].count++; - }); - - const renderBarList = (title, items) => { - let html = `
-

${title}

`; - - Object.entries(items).forEach(([label, info]) => { - const pct = total === 0 ? 0 : (info.count / total * 100); - html += ` -
-
- ${label} - ${info.count} 人 (${formatPct(pct)}%) -
-
-
-
-
- `; - }); - html += '
'; - return html; - }; - - statsEl.innerHTML = renderBarList('職能類別 (Role)', roles) + renderBarList('合約期間 (Duration)', durations); + const count = prefix => data.filter(p => (p.role || '').startsWith(prefix)).length; + const a = count('A'), p = count('P'), o = count('O'); + const rest = total - a - p - o; + const pct = n => total ? (n / total * 100) : 0; + const fullYear = data.filter(person => activeMonths(person) === 12).length; + const totalEl = document.getElementById('role-total'); + if (totalEl) totalEl.textContent = `${total} 人`; + const tile = (n, label) => `
${n}${label} · ${formatPct(pct(n))}%
`; + statsEl.innerHTML = ` +
${tile(a, '藝術家')}${tile(p, '專案管理')}${tile(o, '特約外包')}
+ + 灰色:G 營運支援與待分類 ${rest} 人 +
合約期間全年度 ${fullYear} · 未滿 12 個月 ${total - fullYear}
`; } // Group analysis: company → department → group. Contractors follow their department's @@ -3034,7 +3301,7 @@ const bar = (pct, color) => `
-
+
${formatPct(pct)}% @@ -3047,7 +3314,7 @@ shown.forEach(c => { const cKey = `c|${c.name}`; html += ` - + ${arrow(cKey)}${escapeHtml(shortCompanyName(c.name))} ${peopleText(c)} $${Math.round(c.cost).toLocaleString()} @@ -3152,7 +3419,7 @@

${dept.name}

- ${totalPeople} 人 + ${totalPeople} 人
@@ -3168,7 +3435,7 @@