- One-page dashboard: KPI row, invoice targets, CODA by unit, multipliers and people - Day/night theme switch (saved per browser), line icons, self-hosted Poppins digits - Side menu: 人員資料 (renamed) above 常態型外包 - Org chart: short group names, RD / CG Lead toggle buttons - Invoice roles: one-screen table by company with segmented role buttons and totals - Calmer filter menus, aligned table columns, 業務管理 lists people without groups - DEMO_DATA_FILE lets a local preview use fake data (ignored in production) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VDJVpPiGiWjJP1yVvvGhzQ
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+620
-341
File diff suppressed because it is too large
Load Diff
@@ -17,6 +17,8 @@ const isProduction = process.env.NODE_ENV === 'production';
|
||||
// Seed data must live outside COST_MODEL_DATA_DIR: production mounts a persistent
|
||||
// volume at /app/data, which hides any file baked into the image at that path.
|
||||
const demoPath = resolve(root, 'seed/demo.json');
|
||||
// Local preview only: DEMO_DATA_FILE swaps in a fake roster. Production always reads the seed.
|
||||
const previewDataPath = !isProduction && process.env.DEMO_DATA_FILE ? resolve(root, process.env.DEMO_DATA_FILE) : demoPath;
|
||||
const costModelDataDir = process.env.COST_MODEL_DATA_DIR;
|
||||
const costOverridesPath = costModelDataDir ? resolve(costModelDataDir, 'cost-overrides.json') : null;
|
||||
const contractorsPath = costModelDataDir ? resolve(costModelDataDir, 'contractors.json') : null;
|
||||
@@ -41,6 +43,10 @@ let settingsWrite = Promise.resolve();
|
||||
|
||||
const allowedStaticFiles = new Map([
|
||||
['/2022_Moonshine_Logo_MS_logo_w_EN.png', ['2022_Moonshine_Logo_MS_logo_w_EN.png', 'image/png']],
|
||||
// Poppins (SIL OFL 1.1), subset to Latin and digits for numerals; see fonts/OFL-NOTICE.txt.
|
||||
['/fonts/poppins-light.woff', ['fonts/poppins-light.woff', 'font/woff']],
|
||||
['/fonts/poppins-regular.woff', ['fonts/poppins-regular.woff', 'font/woff']],
|
||||
['/fonts/poppins-medium.woff', ['fonts/poppins-medium.woff', 'font/woff']],
|
||||
]);
|
||||
|
||||
function sendJson(response, status, body) {
|
||||
@@ -365,7 +371,7 @@ async function saveSettings(input) {
|
||||
async function getCostModel(session) {
|
||||
if (session.costModelCache?.expiresAt > Date.now()) return session.costModelCache.payload;
|
||||
const [records, organizations, demo] = await Promise.all([
|
||||
getRoster(session), getOrganizations(session), readFile(demoPath, 'utf8').then(JSON.parse),
|
||||
getRoster(session), getOrganizations(session), readFile(previewDataPath, 'utf8').then(JSON.parse),
|
||||
]);
|
||||
const salaryResults = await mapWithConcurrency(records, 6, async (person) => {
|
||||
try {
|
||||
@@ -416,7 +422,7 @@ const server = createServer(async (request, response) => {
|
||||
|
||||
try {
|
||||
if (request.method === 'GET' && url.pathname === '/api/health') {
|
||||
return sendJson(response, 200, { status: 'ok', release: 'coda-multipliers-v34' });
|
||||
return sendJson(response, 200, { status: 'ok', release: 'redesign-v35' });
|
||||
}
|
||||
|
||||
if (request.method === 'GET' && url.pathname === '/api/auth/login') {
|
||||
@@ -599,7 +605,7 @@ const server = createServer(async (request, response) => {
|
||||
if (!hr) return sendJson(response, 503, { error: 'hr_not_configured' });
|
||||
return sendJson(response, 200, await getCostModel(session));
|
||||
}
|
||||
const demo = JSON.parse(await readFile(demoPath, 'utf8'));
|
||||
const demo = JSON.parse(await readFile(previewDataPath, 'utf8'));
|
||||
const internal = demo.baseData.filter(person => !String(person.role || '').startsWith('O'));
|
||||
return sendJson(response, 200, {
|
||||
...demo,
|
||||
|
||||
Reference in New Issue
Block a user