3385 lines
146 KiB
HTML
3385 lines
146 KiB
HTML
<!DOCTYPE html>
|
|
|
|
<html lang="ko">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>팀/개인별 분석</title>
|
|
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
|
|
|
|
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
|
|
|
|
<script src="https://unpkg.com/lucide@latest"></script>
|
|
|
|
<style>
|
|
@import url('https://fonts.googleapis.com/css2?family=Pretendard:wght@400;600;700;900&display=swap');
|
|
:root {
|
|
--theme-dark: #0f172a;
|
|
--theme-header: #1e293b;
|
|
--theme-main: #ffffff;
|
|
--theme-alt: #f8fafc;
|
|
--theme-hover: #f1f5f9;
|
|
--theme-primary: #4f46e5;
|
|
--theme-primary-hover: #4338ca;
|
|
--theme-accent: #f59e0b;
|
|
--theme-text-dark: #0f172a;
|
|
--theme-text-base: #334155;
|
|
--theme-text-muted: #64748b;
|
|
--theme-border: #e2e8f0;
|
|
--theme-border-dark: #cbd5e1;
|
|
--theme-surface: #ffffff;
|
|
--theme-surface-soft: #f8fafc;
|
|
--theme-shadow: 0 10px 40px -10px rgba(0,0,0,0.08);
|
|
--theme-soft-shadow: 0 4px 20px -2px rgba(0,0,0,0.04);
|
|
}
|
|
html { font-size: 14px; background: var(--theme-alt); }
|
|
body { font-family: 'Pretendard', sans-serif; font-size: 1rem; line-height: 1.45; background-color: var(--theme-alt); letter-spacing: -0.02em; }
|
|
body.mh-theme-shell {
|
|
min-height: 100vh;
|
|
color: var(--theme-text-dark);
|
|
background:
|
|
radial-gradient(circle at 15% 50%, rgba(79, 70, 229, 0.08), transparent 25%),
|
|
radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.08), transparent 25%),
|
|
var(--theme-alt);
|
|
}
|
|
#tab-team-personal-pane {
|
|
width: 100%;
|
|
max-width: 1680px;
|
|
margin: 0 auto;
|
|
}
|
|
input, select, button, textarea { font: inherit; }
|
|
.google-visualization-tooltip {
|
|
border: 1px solid var(--theme-border) !important;
|
|
border-radius: 1rem !important;
|
|
box-shadow: 0 20px 25px -5px rgb(10 33 20 / 0.16) !important;
|
|
background: var(--theme-surface) !important;
|
|
padding: 1rem !important;
|
|
}
|
|
.custom-scrollbar::-webkit-scrollbar { width: 6px; }
|
|
.custom-scrollbar::-webkit-scrollbar-track { background: var(--theme-hover); }
|
|
.custom-scrollbar::-webkit-scrollbar-thumb { background: var(--theme-border-dark); border-radius: 10px; }
|
|
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: var(--theme-text-muted); }
|
|
#search-dropdown {
|
|
max-height: 300px;
|
|
overflow-y: auto;
|
|
z-index: 1000;
|
|
}
|
|
#mh-topbar,
|
|
#mh-matrix-section,
|
|
#mh-person-section {
|
|
background: var(--theme-main) !important;
|
|
border-color: var(--theme-border) !important;
|
|
box-shadow: var(--theme-shadow) !important;
|
|
}
|
|
#mh-sections-grid {
|
|
display: grid;
|
|
grid-template-columns: minmax(0, 1fr);
|
|
gap: 1.5rem;
|
|
align-items: start;
|
|
margin-bottom: 5rem;
|
|
}
|
|
@media (min-width: 1400px) {
|
|
#mh-sections-grid {
|
|
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
|
}
|
|
}
|
|
#mh-topbar {
|
|
overflow: visible;
|
|
}
|
|
#mh-topbar > div:first-of-type {
|
|
margin: -1rem -1rem 0.75rem;
|
|
padding: 0.9rem 1.1rem 0.85rem;
|
|
background: var(--theme-surface);
|
|
border-bottom: 1px solid var(--theme-border);
|
|
border-top-left-radius: 1rem;
|
|
border-top-right-radius: 1rem;
|
|
}
|
|
#mh-topbar-head {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: 1rem;
|
|
}
|
|
#mh-topbar > div:first-of-type h2 {
|
|
color: var(--theme-text-dark) !important;
|
|
letter-spacing: -0.03em;
|
|
}
|
|
#btn-upload-mh {
|
|
background: var(--theme-primary) !important;
|
|
color: #fff !important;
|
|
box-shadow: none !important;
|
|
border: 1px solid rgba(255, 255, 255, 0.12);
|
|
}
|
|
#btn-upload-mh:hover {
|
|
background: var(--theme-primary-hover) !important;
|
|
}
|
|
#mh-scope-toggle {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
padding: 4px;
|
|
border-radius: 16px;
|
|
border: 1px solid var(--theme-border);
|
|
background: var(--theme-surface);
|
|
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
|
|
}
|
|
.mh-scope-btn {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
min-width: 72px;
|
|
padding: 9px 14px;
|
|
border-radius: 12px;
|
|
border: 1px solid transparent;
|
|
background: transparent;
|
|
color: var(--theme-text-muted);
|
|
font-size: 13px;
|
|
font-weight: 900;
|
|
letter-spacing: 0.02em;
|
|
transition: all 0.18s ease;
|
|
}
|
|
.mh-scope-btn:hover {
|
|
background: #eef2ff;
|
|
color: var(--theme-primary);
|
|
}
|
|
.mh-scope-btn.active {
|
|
background: var(--theme-primary);
|
|
color: #fff;
|
|
border-color: var(--theme-primary);
|
|
box-shadow: 0 10px 24px rgba(79, 70, 229, 0.22);
|
|
}
|
|
#mh-topbar .bg-slate-50\/80 {
|
|
background: var(--theme-surface-soft) !important;
|
|
border-color: var(--theme-border) !important;
|
|
}
|
|
#mh-topbar input[type="text"],
|
|
#mh-topbar input[type="date"],
|
|
#mh-topbar select {
|
|
background: var(--theme-surface) !important;
|
|
border: 1px solid var(--theme-border) !important;
|
|
color: var(--theme-text-dark) !important;
|
|
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
|
|
}
|
|
#mh-topbar input[type="text"]:focus,
|
|
#mh-topbar input[type="date"]:focus,
|
|
#mh-topbar select:focus {
|
|
border-color: var(--theme-primary) !important;
|
|
box-shadow: 0 0 0 3px rgba(0, 150, 94, 0.12);
|
|
}
|
|
#mh-filter-grid {
|
|
display: none;
|
|
}
|
|
#mh-filter-grid > * {
|
|
min-width: 0;
|
|
}
|
|
#mh-filter-grid > label {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
}
|
|
#mh-filter-grid > label > span {
|
|
line-height: 1;
|
|
}
|
|
#mh-topbar-actions {
|
|
flex: 1 1 auto;
|
|
width: auto;
|
|
justify-content: flex-end;
|
|
row-gap: 0.75rem;
|
|
}
|
|
#mh-inline-filters {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.75rem;
|
|
flex: 0 1 460px;
|
|
min-width: 0;
|
|
}
|
|
#mh-inline-search {
|
|
position: relative;
|
|
flex: 0 1 280px;
|
|
min-width: 200px;
|
|
z-index: 20;
|
|
}
|
|
#mh-inline-team {
|
|
flex: 0 0 170px;
|
|
min-width: 160px;
|
|
}
|
|
#mh-date-row {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
padding: 10px 14px;
|
|
border-radius: 18px;
|
|
border: 1px solid var(--theme-border);
|
|
background: var(--theme-surface);
|
|
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
|
|
}
|
|
#mh-date-row .mh-date-label {
|
|
font-size: 13px;
|
|
font-weight: 900;
|
|
color: #4f46e5;
|
|
white-space: nowrap;
|
|
}
|
|
#mh-date-row .mh-date-sep {
|
|
font-size: 13px;
|
|
font-weight: 900;
|
|
color: var(--theme-text-muted);
|
|
opacity: 0.9;
|
|
}
|
|
#mh-date-row .mh-date-field {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
min-width: 0;
|
|
}
|
|
#mh-date-row input[type="date"] {
|
|
width: 152px;
|
|
min-width: 0;
|
|
padding: 0;
|
|
border: 0 !important;
|
|
background: transparent !important;
|
|
box-shadow: none !important;
|
|
font-size: 13px;
|
|
font-weight: 900;
|
|
color: var(--theme-text-dark) !important;
|
|
}
|
|
#mh-date-row input[type="date"]:focus {
|
|
box-shadow: none !important;
|
|
}
|
|
#mh-date-row input[type="date"]::-webkit-calendar-picker-indicator {
|
|
opacity: 1;
|
|
cursor: pointer;
|
|
}
|
|
#btn-upload-mh {
|
|
order: 2;
|
|
}
|
|
#mh-date-row {
|
|
order: 1;
|
|
}
|
|
@media (max-width: 900px) {
|
|
#mh-topbar-head {
|
|
align-items: flex-start;
|
|
flex-direction: column;
|
|
}
|
|
#mh-inline-filters {
|
|
width: 100%;
|
|
flex: 1 1 100%;
|
|
flex-wrap: wrap;
|
|
}
|
|
#mh-inline-search,
|
|
#mh-inline-team {
|
|
flex: 1 1 100%;
|
|
min-width: 0;
|
|
}
|
|
#mh-topbar-actions {
|
|
width: 100%;
|
|
justify-content: flex-start;
|
|
}
|
|
#mh-date-row {
|
|
width: 100%;
|
|
justify-content: space-between;
|
|
flex-wrap: wrap;
|
|
}
|
|
#mh-date-row input[type="date"] {
|
|
width: 100%;
|
|
}
|
|
#btn-upload-mh {
|
|
order: 1;
|
|
}
|
|
#mh-scope-toggle {
|
|
width: 100%;
|
|
justify-content: stretch;
|
|
}
|
|
.mh-scope-btn {
|
|
flex: 1 1 0;
|
|
}
|
|
}
|
|
#search-dropdown {
|
|
background: var(--theme-surface) !important;
|
|
border: 1px solid var(--theme-border) !important;
|
|
box-shadow: 0 24px 40px rgba(10, 33, 20, 0.12) !important;
|
|
z-index: 2000;
|
|
}
|
|
#kpi-container > .mh-kpi-card {
|
|
background: var(--theme-surface) !important;
|
|
border-color: var(--theme-border) !important;
|
|
box-shadow: var(--theme-soft-shadow) !important;
|
|
}
|
|
#kpi-container > .mh-kpi-card:hover {
|
|
box-shadow: 0 18px 34px rgba(10, 33, 20, 0.12) !important;
|
|
}
|
|
.mh-kpi-card {
|
|
height: 100%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: flex-start;
|
|
padding: 14px !important;
|
|
border-radius: 16px !important;
|
|
}
|
|
.mh-kpi-head {
|
|
display: grid;
|
|
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
align-items: center;
|
|
gap: 8px;
|
|
margin-bottom: 6px;
|
|
}
|
|
.mh-kpi-icon {
|
|
padding: 8px;
|
|
border-radius: 12px;
|
|
}
|
|
.mh-kpi-summary {
|
|
min-width: 0;
|
|
}
|
|
.mh-kpi-main {
|
|
display: flex;
|
|
align-items: baseline;
|
|
justify-content: space-between;
|
|
gap: 10px;
|
|
}
|
|
.mh-kpi-value {
|
|
font-size: 22px;
|
|
font-weight: 900;
|
|
color: #1e293b;
|
|
line-height: 1;
|
|
letter-spacing: -0.04em;
|
|
white-space: nowrap;
|
|
}
|
|
.mh-kpi-title {
|
|
margin-top: 0;
|
|
font-size: 12px;
|
|
font-weight: 900;
|
|
color: #334155;
|
|
letter-spacing: -0.02em;
|
|
line-height: 1.15;
|
|
}
|
|
.mh-kpi-title-row {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.35rem;
|
|
position: relative;
|
|
}
|
|
.mh-kpi-info {
|
|
position: relative;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 16px;
|
|
height: 16px;
|
|
border-radius: 999px;
|
|
border: 1px solid #fecaca;
|
|
background: #fff1f2;
|
|
color: #dc2626;
|
|
font-size: 10px;
|
|
font-weight: 900;
|
|
cursor: help;
|
|
}
|
|
.mh-kpi-tooltip {
|
|
position: absolute;
|
|
top: calc(100% + 8px);
|
|
right: 0;
|
|
width: 520px;
|
|
max-width: min(520px, calc(100vw - 2rem));
|
|
padding: 10px 12px;
|
|
border-radius: 14px;
|
|
border: 1px solid #e2e8f0;
|
|
background: #ffffff;
|
|
box-shadow: 0 18px 34px rgba(10, 33, 20, 0.14);
|
|
opacity: 0;
|
|
visibility: hidden;
|
|
transform: translateY(-4px);
|
|
transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
|
|
z-index: 30;
|
|
}
|
|
.mh-kpi-info:hover .mh-kpi-tooltip,
|
|
.mh-kpi-info:focus-visible .mh-kpi-tooltip {
|
|
opacity: 1;
|
|
visibility: visible;
|
|
transform: translateY(0);
|
|
}
|
|
.mh-kpi-tooltip-title {
|
|
font-size: 12px;
|
|
font-weight: 900;
|
|
color: #0f172a;
|
|
margin-bottom: 8px;
|
|
}
|
|
.mh-kpi-tooltip-footnote {
|
|
margin-top: 8px;
|
|
font-size: 10px;
|
|
font-weight: 800;
|
|
color: #64748b;
|
|
text-align: left;
|
|
}
|
|
.mh-kpi-tooltip-table {
|
|
display: grid;
|
|
grid-template-columns: 84px 88px minmax(0, 1fr);
|
|
border-top: 1px solid #cbd5e1;
|
|
border-left: 1px solid #cbd5e1;
|
|
}
|
|
.mh-kpi-tooltip-cell {
|
|
padding: 6px 7px;
|
|
border-right: 1px solid #cbd5e1;
|
|
border-bottom: 1px solid #cbd5e1;
|
|
font-size: 11px;
|
|
line-height: 1.25;
|
|
color: #334155;
|
|
background: #fff;
|
|
white-space: nowrap;
|
|
}
|
|
.mh-kpi-tooltip-cell.head {
|
|
background: #f8fafc;
|
|
font-weight: 900;
|
|
color: #0f172a;
|
|
text-align: center;
|
|
}
|
|
.mh-kpi-tooltip-cell.rank {
|
|
font-weight: 900;
|
|
color: #334155;
|
|
text-align: center;
|
|
}
|
|
.mh-kpi-tooltip-cell.money {
|
|
text-align: right;
|
|
font-weight: 900;
|
|
color: #0f172a;
|
|
}
|
|
.mh-kpi-subgrid {
|
|
display: grid;
|
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
gap: 6px;
|
|
margin-top: 6px;
|
|
}
|
|
.mh-kpi-subitem {
|
|
padding: 5px 7px;
|
|
border-radius: 10px;
|
|
background: #f8fafc;
|
|
border: 1px solid #e2e8f0;
|
|
}
|
|
.mh-kpi-subitem .label {
|
|
font-size: 8px;
|
|
font-weight: 800;
|
|
color: #64748b;
|
|
letter-spacing: 0.04em;
|
|
text-transform: uppercase;
|
|
}
|
|
.mh-kpi-subitem .value {
|
|
margin-top: 1px;
|
|
font-size: 12px;
|
|
font-weight: 900;
|
|
color: #0f172a;
|
|
line-height: 1.1;
|
|
}
|
|
.mh-kpi-list {
|
|
display: flex;
|
|
flex-wrap: nowrap;
|
|
gap: 4px;
|
|
margin-top: 6px;
|
|
overflow: hidden;
|
|
}
|
|
.mh-kpi-list.all {
|
|
flex-wrap: wrap;
|
|
overflow: visible;
|
|
}
|
|
.mh-kpi-chip {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
flex: 0 0 auto;
|
|
padding: 2px 6px;
|
|
border-radius: 999px;
|
|
background: #eef2ff;
|
|
color: #334155;
|
|
font-size: 10px;
|
|
font-weight: 800;
|
|
border: 1px solid #dbe4ff;
|
|
white-space: nowrap;
|
|
}
|
|
.mh-kpi-chip.more {
|
|
background: #f8fafc;
|
|
border-color: #e2e8f0;
|
|
color: #64748b;
|
|
}
|
|
.mh-kpi-chip.warn {
|
|
background: #fff7ed;
|
|
border-color: #fed7aa;
|
|
}
|
|
.mh-kpi-empty {
|
|
margin-top: 6px;
|
|
font-size: 10px;
|
|
font-weight: 700;
|
|
color: #94a3b8;
|
|
line-height: 1.2;
|
|
}
|
|
.mh-kpi-more {
|
|
display: none;
|
|
}
|
|
#mh-matrix-section > div:first-child,
|
|
#mh-person-section > div:first-child {
|
|
background: var(--theme-surface) !important;
|
|
min-height: 88px;
|
|
}
|
|
#mh-matrix-section > div:first-child {
|
|
border-bottom: 1px solid var(--theme-border) !important;
|
|
}
|
|
#mh-matrix-section > div:first-child h3,
|
|
#mh-person-section > div:first-child h3,
|
|
#mh-matrix-section > div:first-child h4,
|
|
#mh-person-section > div:first-child #chart-title {
|
|
color: var(--theme-text-dark) !important;
|
|
}
|
|
#mh-matrix-section > div:first-child .text-slate-400,
|
|
#mh-person-section > div:first-child .text-slate-400,
|
|
#mh-matrix-section > div:first-child .text-blue-600 {
|
|
color: var(--theme-text-muted) !important;
|
|
}
|
|
#mh-matrix-header-group {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 1rem;
|
|
flex-wrap: wrap;
|
|
}
|
|
#mh-person-section > div:first-child {
|
|
display: flex;
|
|
align-items: stretch;
|
|
}
|
|
#mh-person-section > div:first-child > div {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
#matrix-footer-visual {
|
|
display: flex;
|
|
align-items: center;
|
|
flex-wrap: wrap;
|
|
gap: 0.75rem;
|
|
}
|
|
.mh-matrix-meta-chip {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.35rem;
|
|
padding: 0.42rem 0.85rem;
|
|
border-radius: 999px;
|
|
border: 1px solid #dbe4f3;
|
|
background: #ffffff;
|
|
color: #475569;
|
|
font-size: 0.78rem;
|
|
font-weight: 900;
|
|
line-height: 1;
|
|
box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
|
|
}
|
|
.mh-matrix-meta-chip.all {
|
|
background: #e2e8f0;
|
|
border-color: #cbd5e1;
|
|
color: #0f172a;
|
|
}
|
|
.mh-matrix-meta-chip.owner {
|
|
background: #eef2ff;
|
|
border-color: #c7d2fe;
|
|
color: #4338ca;
|
|
}
|
|
.mh-matrix-meta-chip.support {
|
|
background: #fff7ed;
|
|
border-color: #fed7aa;
|
|
color: #c2410c;
|
|
}
|
|
.mh-matrix-filter {
|
|
cursor: pointer;
|
|
transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
|
|
}
|
|
.mh-matrix-filter:not(.active) {
|
|
opacity: 0.62;
|
|
box-shadow: none;
|
|
}
|
|
.mh-matrix-filter.active {
|
|
transform: translateY(-1px);
|
|
}
|
|
.mh-project-owner-badge {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
min-width: 2.15rem;
|
|
padding: 0.2rem 0.48rem;
|
|
border-radius: 999px;
|
|
background: #eef2ff;
|
|
border: 1px solid #c7d2fe;
|
|
color: #4338ca;
|
|
font-size: 0.66rem;
|
|
font-weight: 900;
|
|
letter-spacing: 0.04em;
|
|
line-height: 1;
|
|
}
|
|
#matrix-visual-container {
|
|
display: grid;
|
|
grid-template-columns: minmax(0, 1fr);
|
|
gap: 0.8rem;
|
|
}
|
|
#matrix-visual-container > .mh-matrix-card {
|
|
background: var(--theme-surface) !important;
|
|
border-color: var(--theme-border) !important;
|
|
box-shadow: var(--theme-soft-shadow) !important;
|
|
}
|
|
.mh-matrix-card {
|
|
padding: 0 !important;
|
|
border-radius: 1rem !important;
|
|
overflow: hidden;
|
|
}
|
|
.mh-matrix-toggle {
|
|
display: block;
|
|
width: 100%;
|
|
text-align: left;
|
|
background: transparent;
|
|
border: 0;
|
|
padding: 0;
|
|
cursor: pointer;
|
|
}
|
|
.mh-matrix-card-head {
|
|
display: grid;
|
|
align-items: center;
|
|
grid-template-columns: minmax(0, 1fr) 238px;
|
|
gap: 0.9rem;
|
|
padding: 0.9rem 1rem;
|
|
background: var(--biz-bg, #eef2ff);
|
|
border-bottom: 1px solid var(--biz-border, #c7d2fe);
|
|
}
|
|
.mh-matrix-card-title {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
min-width: 0;
|
|
}
|
|
.mh-matrix-card-main {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
flex-wrap: wrap;
|
|
}
|
|
.mh-matrix-card-title h5 {
|
|
font-size: 1.05rem;
|
|
font-weight: 900;
|
|
color: var(--theme-text-dark);
|
|
line-height: 1.1;
|
|
}
|
|
.mh-matrix-card-count {
|
|
font-size: 11px;
|
|
font-weight: 800;
|
|
color: var(--biz-text, #4338ca);
|
|
white-space: nowrap;
|
|
}
|
|
.mh-matrix-total-badge {
|
|
display: block;
|
|
padding: 0;
|
|
color: var(--biz-text, #4338ca);
|
|
font-size: 15px;
|
|
font-weight: 900;
|
|
line-height: 1.2;
|
|
white-space: nowrap;
|
|
text-align: right;
|
|
}
|
|
.mh-matrix-card-actions {
|
|
display: flex;
|
|
align-items: stretch;
|
|
justify-content: flex-end;
|
|
width: 238px;
|
|
flex-shrink: 0;
|
|
}
|
|
.mh-matrix-toggle-icon {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 1.9rem;
|
|
height: 1.9rem;
|
|
border-radius: 999px;
|
|
background: rgba(255, 255, 255, 0.85);
|
|
border: 1px solid rgba(255, 255, 255, 0.65);
|
|
color: var(--biz-text, #4338ca);
|
|
transition: transform 0.18s ease;
|
|
}
|
|
.mh-matrix-toggle[aria-expanded="true"] .mh-matrix-toggle-icon {
|
|
transform: rotate(180deg);
|
|
}
|
|
.mh-matrix-card-body {
|
|
display: grid;
|
|
gap: 0;
|
|
padding: 0.2rem 1rem;
|
|
}
|
|
#matrix-visual-container .mh-matrix-project {
|
|
border-bottom-color: #E6DCCB !important;
|
|
}
|
|
.mh-matrix-project {
|
|
padding: 0.72rem 0;
|
|
}
|
|
.mh-matrix-project + .mh-matrix-project {
|
|
border-top: 1px solid #edf2f7;
|
|
}
|
|
.mh-project-row {
|
|
display: grid;
|
|
grid-template-columns: minmax(180px, 1.06fr) minmax(0, 1.96fr) 126px;
|
|
align-items: center;
|
|
gap: 0.9rem;
|
|
}
|
|
.mh-project-main {
|
|
min-width: 0;
|
|
}
|
|
.mh-project-name {
|
|
color: var(--theme-text-base);
|
|
font-size: 14px;
|
|
font-weight: 800;
|
|
line-height: 1.2;
|
|
}
|
|
.mh-project-name:hover {
|
|
color: var(--theme-primary);
|
|
}
|
|
.mh-project-meta {
|
|
display: grid;
|
|
align-items: center;
|
|
justify-content: flex-end;
|
|
width: 238px;
|
|
grid-template-columns: minmax(150px, 1fr) minmax(50px, 58px);
|
|
gap: 0.4rem;
|
|
text-align: right;
|
|
justify-self: end;
|
|
}
|
|
.mh-project-hours {
|
|
font-size: 15px;
|
|
font-weight: 900;
|
|
color: var(--theme-text-dark);
|
|
white-space: nowrap;
|
|
text-align: right;
|
|
}
|
|
.mh-project-submeta {
|
|
font-size: 12px;
|
|
font-weight: 800;
|
|
color: var(--theme-text-muted);
|
|
white-space: nowrap;
|
|
text-align: right;
|
|
}
|
|
.mh-matrix-head-summary {
|
|
display: grid;
|
|
grid-template-columns: minmax(150px, 1fr) minmax(50px, 58px);
|
|
gap: 0.4rem;
|
|
width: 100%;
|
|
}
|
|
.mh-matrix-head-item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: flex-end;
|
|
gap: 0.12rem;
|
|
min-width: 0;
|
|
}
|
|
.mh-matrix-head-label {
|
|
font-size: 8px;
|
|
font-weight: 800;
|
|
color: #94a3b8;
|
|
line-height: 1;
|
|
white-space: nowrap;
|
|
letter-spacing: -0.01em;
|
|
}
|
|
.mh-matrix-head-meta {
|
|
font-size: 11px;
|
|
font-weight: 800;
|
|
color: var(--biz-text, #4338ca);
|
|
white-space: nowrap;
|
|
min-width: 28px;
|
|
text-align: right;
|
|
}
|
|
.mh-rank-summary {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 0.45rem;
|
|
align-items: center;
|
|
}
|
|
.mh-inline-pill {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
flex-wrap: wrap;
|
|
gap: 0.35rem;
|
|
padding: 0.28rem 0.52rem;
|
|
border-radius: 999px !important;
|
|
font-size: 11px;
|
|
line-height: 1.1;
|
|
background: var(--theme-alt);
|
|
border: 1px solid var(--theme-border);
|
|
}
|
|
.mh-inline-pill .rank {
|
|
font-weight: 900;
|
|
color: #475569;
|
|
}
|
|
.mh-inline-pill .hours {
|
|
font-weight: 900;
|
|
color: #0f172a;
|
|
}
|
|
.mh-inline-pill .count,
|
|
.mh-inline-pill .names {
|
|
font-weight: 700;
|
|
color: #64748b;
|
|
}
|
|
@media (max-width: 900px) {
|
|
.mh-project-row {
|
|
grid-template-columns: minmax(0, 1fr);
|
|
gap: 0.45rem;
|
|
}
|
|
.mh-project-meta {
|
|
justify-content: flex-start;
|
|
grid-template-columns: repeat(2, max-content);
|
|
text-align: left;
|
|
}
|
|
.mh-project-hours,
|
|
.mh-project-submeta,
|
|
.mh-matrix-head-meta {
|
|
text-align: left;
|
|
}
|
|
.mh-matrix-card-actions {
|
|
grid-template-columns: repeat(2, max-content);
|
|
width: auto;
|
|
justify-content: flex-start;
|
|
}
|
|
.mh-matrix-card-body {
|
|
padding: 0.15rem 0.85rem;
|
|
}
|
|
}
|
|
#matrix-footer-visual > div {
|
|
padding: 0.8rem 1rem;
|
|
border-radius: 1rem;
|
|
background: rgba(255, 255, 255, 0.08);
|
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
}
|
|
.mh-matrix-share-box {
|
|
display: flex;
|
|
align-items: center;
|
|
flex-wrap: wrap;
|
|
gap: 0.45rem;
|
|
max-width: 100%;
|
|
}
|
|
.mh-matrix-share-label {
|
|
font-size: 11px;
|
|
font-weight: 900;
|
|
color: var(--theme-text-muted);
|
|
letter-spacing: 0.08em;
|
|
white-space: nowrap;
|
|
}
|
|
.mh-matrix-share-chip {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.35rem;
|
|
padding: 0.4rem 0.65rem;
|
|
border-radius: 999px;
|
|
background: #eef2ff;
|
|
border: 1px solid #dbe4ff;
|
|
color: #334155;
|
|
font-size: 11px;
|
|
font-weight: 800;
|
|
line-height: 1;
|
|
white-space: nowrap;
|
|
}
|
|
.mh-matrix-share-chip .pct {
|
|
color: var(--theme-primary);
|
|
font-weight: 900;
|
|
}
|
|
.mh-matrix-share-empty {
|
|
font-size: 12px;
|
|
font-weight: 800;
|
|
color: var(--theme-text-muted);
|
|
}
|
|
#target-badge {
|
|
background: #fff1f2 !important;
|
|
border-color: #ffe4e6 !important;
|
|
}
|
|
#target-badge .text-red-400 {
|
|
color: #fb7185 !important;
|
|
}
|
|
#target-badge .text-red-600 {
|
|
color: #e11d48 !important;
|
|
}
|
|
.mh-chart-guide {
|
|
margin-top: 0;
|
|
padding-top: 0;
|
|
border-top: 0;
|
|
font-size: 11px;
|
|
font-weight: 800;
|
|
color: var(--theme-text-muted);
|
|
line-height: 1.35;
|
|
text-align: right;
|
|
align-self: flex-end;
|
|
white-space: normal;
|
|
}
|
|
#chart_div .mh-person-row {
|
|
background: var(--theme-surface) !important;
|
|
border-color: var(--theme-border) !important;
|
|
box-shadow: var(--theme-soft-shadow) !important;
|
|
}
|
|
#chart_div .mh-person-toggle {
|
|
display: block;
|
|
width: 100%;
|
|
text-align: left;
|
|
background: transparent;
|
|
border: 0;
|
|
padding: 0;
|
|
cursor: pointer;
|
|
}
|
|
#chart_div .mh-person-summary {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
justify-content: space-between;
|
|
gap: 1rem;
|
|
padding-bottom: 0.75rem;
|
|
margin-bottom: 0.75rem;
|
|
border-bottom: 1px solid #e2e8f0;
|
|
}
|
|
#chart_div .mh-person-summary-right {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.65rem;
|
|
flex-shrink: 0;
|
|
}
|
|
#chart_div .mh-person-summary-total {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: flex-end;
|
|
gap: 0.22rem;
|
|
}
|
|
#chart_div .mh-person-summary-formula {
|
|
font-size: 10px;
|
|
line-height: 1.1;
|
|
font-weight: 900;
|
|
white-space: nowrap;
|
|
color: #475569;
|
|
text-shadow: 0 0 0.01px currentColor;
|
|
}
|
|
#chart_div .mh-person-summary-formula .normal {
|
|
color: #475569;
|
|
}
|
|
#chart_div .mh-person-summary-formula .extra {
|
|
color: #e11d48;
|
|
}
|
|
#chart_div .mh-person-summary-total-main {
|
|
font-size: 1.45rem;
|
|
line-height: 1;
|
|
font-weight: 900;
|
|
white-space: nowrap;
|
|
}
|
|
#chart_div .mh-person-summary-total-main .current {
|
|
color: #4f46e5;
|
|
}
|
|
#chart_div .mh-person-summary-total-main .base {
|
|
color: #94a3b8;
|
|
}
|
|
#chart_div .mh-person-over-inline {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.3rem;
|
|
margin-left: 0.45rem;
|
|
color: #ef4444;
|
|
font-size: 11px;
|
|
font-weight: 900;
|
|
vertical-align: middle;
|
|
}
|
|
#chart_div .mh-person-toggle-icon {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 1.65rem;
|
|
height: 1.65rem;
|
|
border-radius: 999px;
|
|
background: #eef2ff;
|
|
border: 1px solid #dbe4ff;
|
|
color: #4f46e5;
|
|
transition: transform 0.18s ease;
|
|
}
|
|
#chart_div .mh-person-toggle[aria-expanded="true"] .mh-person-toggle-icon {
|
|
transform: rotate(180deg);
|
|
}
|
|
#chart_div .mh-person-projects {
|
|
display: grid;
|
|
gap: 0.55rem;
|
|
}
|
|
#chart_div .mh-project-row {
|
|
display: grid;
|
|
grid-template-columns: minmax(150px, 1.1fr) minmax(120px, 0.8fr) minmax(0, 1.45fr) 64px;
|
|
align-items: center;
|
|
gap: 0.55rem;
|
|
padding: 0.6rem 0.75rem;
|
|
border-radius: 0.9rem;
|
|
background: #f8fafc;
|
|
border: 1px solid #e2e8f0;
|
|
}
|
|
#chart_div .mh-project-main {
|
|
min-width: 0;
|
|
}
|
|
#chart_div .mh-project-title {
|
|
font-size: 14px;
|
|
font-weight: 900;
|
|
color: #0f172a;
|
|
line-height: 1.2;
|
|
}
|
|
#chart_div .mh-project-date {
|
|
font-size: 11px;
|
|
font-weight: 800;
|
|
color: #64748b;
|
|
white-space: nowrap;
|
|
text-align: left;
|
|
}
|
|
#chart_div .mh-project-time {
|
|
min-width: 0;
|
|
padding-left: 0.2rem;
|
|
font-size: 12px;
|
|
font-weight: 900;
|
|
color: #0f172a;
|
|
text-align: left;
|
|
}
|
|
#chart_div .mh-project-breakdown-inline {
|
|
display: grid;
|
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
gap: 0.5rem;
|
|
}
|
|
#chart_div .mh-project-breakdown-inline .seg {
|
|
white-space: nowrap;
|
|
}
|
|
#chart_div .mh-project-breakdown-inline .seg.empty {
|
|
visibility: hidden;
|
|
}
|
|
#chart_div .mh-project-breakdown-inline .seg .label {
|
|
color: #64748b;
|
|
margin-right: 0.18rem;
|
|
}
|
|
#chart_div .mh-project-breakdown-inline .seg .value {
|
|
color: #0f172a;
|
|
}
|
|
#chart_div .mh-project-share {
|
|
font-size: 12px;
|
|
font-weight: 900;
|
|
color: #4f46e5;
|
|
white-space: nowrap;
|
|
text-align: right;
|
|
}
|
|
#chart_div .mh-person-total {
|
|
margin-top: 0.2rem;
|
|
font-size: 12px;
|
|
font-weight: 800;
|
|
color: #64748b;
|
|
}
|
|
@media (max-width: 900px) {
|
|
#chart_div .mh-project-row {
|
|
grid-template-columns: minmax(0, 1fr);
|
|
gap: 0.45rem;
|
|
}
|
|
#chart_div .mh-project-time,
|
|
#chart_div .mh-person-summary,
|
|
#chart_div .mh-person-summary-right,
|
|
#chart_div .mh-person-stat-list,
|
|
#chart_div .mh-project-stat-list,
|
|
#chart_div .mh-project-share {
|
|
text-align: left;
|
|
justify-content: flex-start;
|
|
}
|
|
#chart_div .mh-project-date {
|
|
text-align: left;
|
|
}
|
|
}
|
|
#chart_div .mh-empty-state,
|
|
#matrix-visual-container .mh-empty-state {
|
|
color: var(--theme-text-muted) !important;
|
|
}
|
|
#chart_div {
|
|
min-height: 360px !important;
|
|
}
|
|
#project-members-modal > div:last-child {
|
|
background: var(--theme-main) !important;
|
|
border: 1px solid var(--theme-border) !important;
|
|
box-shadow: var(--theme-shadow) !important;
|
|
}
|
|
#project-members-dialog {
|
|
width: fit-content;
|
|
min-width: min(560px, calc(100vw - 2rem));
|
|
max-width: min(760px, calc(100vw - 2rem));
|
|
}
|
|
#project-members-modal > div:last-child > div:first-child,
|
|
#project-members-modal > div:last-child > div:last-child {
|
|
background: var(--theme-surface-soft) !important;
|
|
border-color: var(--theme-border) !important;
|
|
}
|
|
#person-calendar-modal > div:last-child {
|
|
background: var(--theme-main) !important;
|
|
border: 1px solid var(--theme-border) !important;
|
|
box-shadow: var(--theme-shadow) !important;
|
|
}
|
|
.mh-person-calendar-weekdays,
|
|
.mh-person-calendar-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(7, minmax(0, 1fr));
|
|
gap: 0.45rem;
|
|
}
|
|
.mh-person-calendar-grid {
|
|
grid-auto-rows: 88px;
|
|
}
|
|
.mh-person-calendar-weekdays {
|
|
margin-top: 0.75rem;
|
|
margin-bottom: 0.45rem;
|
|
}
|
|
.mh-person-calendar-weekday {
|
|
text-align: center;
|
|
font-size: 11px;
|
|
font-weight: 900;
|
|
color: var(--theme-text-muted);
|
|
line-height: 1;
|
|
}
|
|
.mh-person-calendar-day {
|
|
min-height: 88px;
|
|
padding: 0.42rem;
|
|
border-radius: 0.9rem;
|
|
border: 1px solid var(--theme-border);
|
|
background: var(--theme-surface);
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.22rem;
|
|
overflow: hidden;
|
|
}
|
|
.mh-person-calendar-day.empty {
|
|
background: transparent;
|
|
border-color: transparent;
|
|
}
|
|
.mh-person-calendar-day.today {
|
|
border-color: #6366f1;
|
|
background: #eef2ff;
|
|
box-shadow: inset 0 0 0 1px #c7d2fe;
|
|
}
|
|
.mh-person-calendar-daynum {
|
|
font-size: 12px;
|
|
font-weight: 900;
|
|
color: var(--theme-text-dark);
|
|
width: fit-content;
|
|
}
|
|
.mh-person-calendar-note-stack {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.18rem;
|
|
flex: 1 1 auto;
|
|
min-width: 0;
|
|
overflow-y: auto;
|
|
overflow-x: hidden;
|
|
padding-right: 2px;
|
|
}
|
|
.mh-person-calendar-day.today .mh-person-calendar-daynum {
|
|
padding: 0.12rem 0.38rem;
|
|
border-radius: 999px;
|
|
background: #4f46e5;
|
|
color: #fff;
|
|
}
|
|
.mh-person-calendar-note {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
width: fit-content;
|
|
max-width: 100%;
|
|
padding: 0.14rem 0.34rem;
|
|
border-radius: 999px;
|
|
background: #eef2ff;
|
|
color: #4338ca;
|
|
font-size: 9px;
|
|
font-weight: 900;
|
|
line-height: 1.05;
|
|
word-break: keep-all;
|
|
}
|
|
.mh-person-calendar-note.neutral {
|
|
background: #f8fafc;
|
|
color: #334155;
|
|
}
|
|
.mh-person-calendar-note.warn {
|
|
background: #fff1f2;
|
|
color: #e11d48;
|
|
}
|
|
.mh-person-calendar-note.orange {
|
|
background: #fff7ed;
|
|
color: #c2410c;
|
|
}
|
|
.mh-person-calendar-note.green {
|
|
background: #ecfdf5;
|
|
color: #047857;
|
|
}
|
|
.mh-person-calendar-summary {
|
|
display: inline-flex;
|
|
flex-wrap: wrap;
|
|
justify-content: flex-end;
|
|
gap: 0.4rem;
|
|
}
|
|
.mh-person-calendar-summary .item {
|
|
font-weight: 900;
|
|
}
|
|
.mh-person-calendar-summary .attendance {
|
|
color: #334155;
|
|
}
|
|
.mh-person-calendar-summary .extraHoliday {
|
|
color: #c2410c;
|
|
}
|
|
.mh-person-calendar-summary .tripEdu {
|
|
color: #047857;
|
|
}
|
|
.mh-person-calendar-summary .late {
|
|
color: #e11d48;
|
|
}
|
|
.mh-person-calendar-nav {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: 0.75rem;
|
|
margin-bottom: 0.1rem;
|
|
}
|
|
.mh-person-calendar-nav button {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 2.25rem;
|
|
height: 2.25rem;
|
|
border-radius: 999px;
|
|
border: 1px solid var(--theme-border);
|
|
background: var(--theme-surface);
|
|
color: var(--theme-text-base);
|
|
transition: all 0.18s ease;
|
|
}
|
|
.mh-person-calendar-nav button:hover:not(:disabled) {
|
|
border-color: #c7d2fe;
|
|
background: #eef2ff;
|
|
color: #4338ca;
|
|
}
|
|
.mh-person-calendar-nav button:disabled {
|
|
opacity: 0.45;
|
|
cursor: default;
|
|
}
|
|
@media (max-width: 768px) {
|
|
body.mh-theme-shell {
|
|
padding: 12px;
|
|
}
|
|
#mh-topbar > div:first-of-type {
|
|
margin: -1rem -1rem 0.65rem;
|
|
padding: 0.85rem 0.9rem 0.8rem;
|
|
}
|
|
.mh-chart-guide {
|
|
white-space: normal;
|
|
text-align: right;
|
|
}
|
|
.mh-person-calendar-day {
|
|
min-height: 72px;
|
|
padding: 0.45rem;
|
|
}
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body class="mh-theme-shell p-3 md:p-4">
|
|
|
|
<div id="project-members-modal" class="hidden fixed inset-0 z-[100] flex items-center justify-center p-4">
|
|
<div class="absolute inset-0 bg-slate-900/60 backdrop-blur-sm" onclick="closeProjectModal()"></div>
|
|
|
|
<div id="project-members-dialog" class="bg-white rounded-2xl shadow-2xl overflow-hidden relative z-10 animate-in zoom-in duration-300">
|
|
|
|
<div class="p-6 border-b bg-slate-50/50 flex items-center justify-between">
|
|
|
|
<div>
|
|
|
|
<h3 id="modal-project-title" class="text-lg font-black text-slate-900 leading-tight">프로젝트 참여 명단</h3>
|
|
|
|
<p id="modal-project-count" class="text-sm text-slate-400 font-bold mt-1">총 0명 참여 중</p>
|
|
|
|
</div>
|
|
|
|
<button onclick="closeProjectModal()" class="p-2 hover:bg-slate-200 rounded-full transition-colors text-slate-400 hover:text-slate-600">
|
|
|
|
<i data-lucide="x" size="24"></i>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<div id="modal-members-list" class="p-6 max-h-[60vh] overflow-y-auto custom-scrollbar flex flex-col gap-2">
|
|
|
|
</div>
|
|
|
|
<div class="p-6 bg-slate-50/50 border-t flex justify-end">
|
|
|
|
<button onclick="closeProjectModal()" class="px-6 py-2.5 bg-slate-900 text-white rounded-xl font-black text-sm hover:bg-slate-800 transition-all">닫기</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="tab-team-personal-pane" class="w-full animate-in fade-in duration-700">
|
|
<div id="mh-topbar" class="bg-white rounded-2xl shadow-xl border border-slate-200 p-4 mb-6 sticky top-3 z-50 backdrop-blur-xl bg-white/95">
|
|
<h1 id="main-title" class="hidden"></h1>
|
|
<div id="mh-topbar-head" class="mb-2">
|
|
<div>
|
|
<h2 class="text-[1.75rem] font-black text-slate-900 leading-none">팀/개인별 분석</h2>
|
|
</div>
|
|
<div id="mh-topbar-actions" class="flex flex-wrap items-center justify-end gap-3">
|
|
<div id="mh-scope-toggle" aria-label="조직 구분 선택">
|
|
<button type="button" class="mh-scope-btn active" data-scope="all">전체</button>
|
|
<button type="button" class="mh-scope-btn" data-scope="gpd">GPD</button>
|
|
<button type="button" class="mh-scope-btn" data-scope="tdc">TDC</button>
|
|
</div>
|
|
<div id="mh-inline-filters">
|
|
<div id="mh-inline-search" class="relative">
|
|
<input type="text" id="main-search" autocomplete="off" placeholder="팀 또는 이름 검색" class="w-full bg-white border border-slate-200 rounded-xl px-4 py-2.5 text-sm font-bold outline-none text-slate-700 focus:border-indigo-300">
|
|
<div id="search-dropdown" class="hidden absolute top-full left-0 w-full mt-2 bg-white border border-slate-200 rounded-2xl shadow-2xl overflow-hidden custom-scrollbar">
|
|
<div id="search-results-list" class="py-2"></div>
|
|
</div>
|
|
</div>
|
|
<div id="mh-inline-team">
|
|
<select id="team-select" class="bg-white border border-slate-200 rounded-xl px-4 py-2.5 text-sm font-black outline-none cursor-pointer text-slate-700 w-full">
|
|
<option value="">팀 선택</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="mh-filter-grid" class="bg-slate-50/80 p-2 rounded-2xl border border-slate-200 grid grid-cols-1 md:grid-cols-3 gap-2 items-center">
|
|
<select id="person-select" class="hidden bg-white border border-slate-200 rounded-xl px-4 py-2.5 text-sm font-black outline-none cursor-pointer text-indigo-600 w-full">
|
|
<option value="">팀원을 선택하세요</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<input type="hidden" id="start-date">
|
|
<input type="hidden" id="end-date">
|
|
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8" id="kpi-container">
|
|
|
|
<div class="bg-white p-4 rounded-2xl shadow-xl border border-slate-200 animate-pulse h-24"></div>
|
|
|
|
<div class="bg-white p-4 rounded-2xl shadow-xl border border-slate-200 animate-pulse h-24"></div>
|
|
|
|
<div class="bg-white p-4 rounded-2xl shadow-xl border border-slate-200 animate-pulse h-24"></div>
|
|
|
|
<div class="bg-white p-4 rounded-2xl shadow-xl border border-slate-200 animate-pulse h-24"></div>
|
|
|
|
</div>
|
|
|
|
<div id="mh-sections-grid">
|
|
<div id="mh-matrix-section" class="bg-white rounded-2xl shadow-xl shadow-slate-200/50 border border-slate-100 overflow-hidden">
|
|
|
|
<div class="p-5 lg:p-6 border-b bg-slate-50/50 flex flex-wrap items-center justify-between gap-6">
|
|
|
|
<div id="mh-matrix-header-group">
|
|
<h3 id="matrix-section-title" class="font-black text-2xl lg:text-3xl flex items-center gap-4 tracking-tighter text-slate-900">
|
|
|
|
<i data-lucide="file-text" size="36" class="text-indigo-500"></i> 팀별 진행 프로젝트
|
|
|
|
</h3>
|
|
|
|
<div id="matrix-footer-visual"></div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="p-6 lg:p-8">
|
|
|
|
<div id="matrix-visual-container" class="pr-1">
|
|
|
|
<div class="text-slate-300 font-bold italic p-10 text-center w-full">파일을 업로드하면 프로젝트 현황이 표시됩니다.</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
<div id="mh-person-section" class="bg-white rounded-2xl shadow-xl shadow-slate-200/50 border border-slate-100 overflow-hidden">
|
|
|
|
<div class="p-5 lg:p-6 border-b bg-slate-50/50">
|
|
<div class="flex h-full flex-col lg:flex-row lg:items-end justify-between gap-6">
|
|
|
|
<div class="flex items-center gap-5">
|
|
|
|
<div class="p-4 bg-slate-50 rounded-[1.5rem] border border-slate-100">
|
|
|
|
<i id="chart-icon" data-lucide="bar-chart-2" class="text-indigo-600" size="32"></i>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<h3 id="chart-title" class="text-2xl lg:text-3xl font-black text-slate-900 tracking-tighter">분석 데이터를 기다리는 중..</h3>
|
|
<p id="chart-desc" class="hidden text-slate-400 font-bold mt-1"></p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="flex flex-col items-end justify-end gap-2 self-stretch">
|
|
<div id="target-badge" class="hidden flex items-center gap-4 bg-red-50/50 p-5 rounded-2xl border border-red-100/50">
|
|
|
|
<div class="text-right">
|
|
|
|
<span class="text-[10px] font-black text-red-400 uppercase tracking-widest block mb-1">Target Limit</span>
|
|
|
|
<div id="target-value" class="text-2xl font-black text-red-600 leading-none">0.00h</div>
|
|
|
|
</div>
|
|
</div>
|
|
<p id="chart-guide" class="mh-chart-guide mt-auto">※ 인정시간: 평일(8시간+연장 3시간) 및 주말(5시간)</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="p-6 lg:p-8">
|
|
<div id="chart_div" class="w-full min-h-[500px] flex items-center justify-center text-slate-200">
|
|
|
|
<i data-lucide="bar-chart" size="64"></i>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="person-calendar-modal" class="hidden fixed inset-0 z-[110] flex items-center justify-center p-4">
|
|
<div id="person-calendar-overlay" class="absolute inset-0 bg-slate-900/60 backdrop-blur-sm" onclick="closePersonCalendarModal()"></div>
|
|
|
|
<div class="bg-white rounded-2xl shadow-2xl w-full max-w-4xl overflow-hidden relative z-10">
|
|
<div class="p-6 border-b bg-slate-50/50 flex items-center justify-between">
|
|
<div>
|
|
<h3 id="person-calendar-title" class="text-lg font-black text-slate-900 leading-tight">개인 일정</h3>
|
|
<p id="person-calendar-subtitle" class="text-sm text-slate-400 font-bold mt-1"></p>
|
|
</div>
|
|
|
|
<button id="person-calendar-close" type="button" onclick="closePersonCalendarModal()" class="p-2 hover:bg-slate-200 rounded-full transition-colors text-slate-400 hover:text-slate-600">
|
|
<i data-lucide="x" size="24"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="p-6">
|
|
<div class="mh-person-calendar-nav">
|
|
<button id="person-calendar-prev" type="button" onclick="changePersonCalendarMonth(-1)">
|
|
<i data-lucide="chevron-left" size="18"></i>
|
|
</button>
|
|
<div id="person-calendar-month" class="text-base font-black text-slate-900"></div>
|
|
<button id="person-calendar-next" type="button" onclick="changePersonCalendarMonth(1)">
|
|
<i data-lucide="chevron-right" size="18"></i>
|
|
</button>
|
|
</div>
|
|
<div class="mh-person-calendar-weekdays">
|
|
<div class="mh-person-calendar-weekday">일</div>
|
|
<div class="mh-person-calendar-weekday">월</div>
|
|
<div class="mh-person-calendar-weekday">화</div>
|
|
<div class="mh-person-calendar-weekday">수</div>
|
|
<div class="mh-person-calendar-weekday">목</div>
|
|
<div class="mh-person-calendar-weekday">금</div>
|
|
<div class="mh-person-calendar-weekday">토</div>
|
|
</div>
|
|
<div id="person-calendar-grid" class="mh-person-calendar-grid"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
// --- Configuration ---
|
|
|
|
const HOLIDAYS = ["2026-01-01", "2026-03-01", "2026-05-05", "2026-06-06", "2026-08-15", "2026-10-03", "2026-10-09", "2026-12-25"];
|
|
|
|
const RANK_WEIGHTS = { '수석': 1, '책임': 2, '선임': 3, '연구원': 4 };
|
|
|
|
let teamData = [];
|
|
const ALL_TEAM_VALUE = '__ALL__';
|
|
let allTeams = [];
|
|
let allPeopleData = [];
|
|
let searchTeams = [];
|
|
let searchPeopleData = [];
|
|
let currentScope = 'all';
|
|
let matrixBizOpenState = {};
|
|
let matrixProjectFilter = 'all';
|
|
let currentMatrixData = {};
|
|
let personChartOpenState = {};
|
|
let personCalendarState = { name: '', team: '', year: 2026, month: 0 };
|
|
let lastUploadedBinary = '';
|
|
let lastPmSheetData = [];
|
|
let projectPmMap = new Map();
|
|
let memberTeamMap = new Map();
|
|
const GPD_TEAM_DIVISIONS = new Set(['총괄', '영업']);
|
|
const STANDARD_LABOR_RATES = {
|
|
executive: 46600,
|
|
senior: 46600,
|
|
principal: 40500,
|
|
lead: 35300,
|
|
staff: 28900
|
|
};
|
|
const DEFAULT_COLUMN_MAP = {
|
|
date: 0,
|
|
lateFlag: 2,
|
|
team: 2,
|
|
teamDivision: 3,
|
|
name: 4,
|
|
rank: 5,
|
|
userState: 6,
|
|
shiftTime: 7,
|
|
calendarNote: 8,
|
|
normalCost: 47,
|
|
extraCost: 48,
|
|
slots: [
|
|
{ biz: 8, code: 9, proj: 10, time: 12, extra: false },
|
|
{ biz: 14, code: 15, proj: 16, time: 18, extra: false },
|
|
{ biz: 19, code: 20, proj: 21, time: 23, extra: false },
|
|
{ biz: 24, code: 25, proj: 26, time: 28, extra: false },
|
|
{ biz: 29, code: 30, proj: 31, time: 33, extra: false },
|
|
{ biz: 34, code: 35, proj: 36, time: 38, extra: false },
|
|
{ biz: 39, code: 40, proj: 41, time: 44, extra: true }
|
|
]
|
|
};
|
|
const cloneDefaultColumnMap = () => ({
|
|
...DEFAULT_COLUMN_MAP,
|
|
slots: DEFAULT_COLUMN_MAP.slots.map(s => ({ ...s }))
|
|
});
|
|
let columnMap = cloneDefaultColumnMap();
|
|
|
|
// --- Utils ---
|
|
const formatNum = (v) => Number(v || 0).toLocaleString('ko-KR', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
const normalizeHeader = (v) => String(v || '').replace(/\s+/g, '').toLowerCase();
|
|
const parseNumber = (v) => parseFloat(String(v || '').replace(/[^0-9.]/g, '')) || 0;
|
|
const roundWon = (v) => Math.round(Number(v || 0));
|
|
const WEEKDAY_TARGET_HOURS = 11;
|
|
const HOLIDAY_TARGET_HOURS = 5;
|
|
const dStr = (v) => {
|
|
if (!v) return "";
|
|
let d = (typeof v === 'number') ? new Date(Math.round((v - 25569) * 86400 * 1000)) : new Date(v);
|
|
if (isNaN(d.getTime())) return "";
|
|
return `${d.getFullYear()}-${("0" + (d.getMonth() + 1)).slice(-2)}-${("0" + d.getDate()).slice(-2)}`;
|
|
};
|
|
const calculateTargetHours = (startStr, endStr) => {
|
|
const start = new Date(startStr);
|
|
const end = new Date(endStr);
|
|
if (isNaN(start.getTime()) || isNaN(end.getTime()) || end < start) return 0;
|
|
const startUtc = Date.UTC(start.getFullYear(), start.getMonth(), start.getDate());
|
|
const endUtc = Date.UTC(end.getFullYear(), end.getMonth(), end.getDate());
|
|
const oneDay = 86400000;
|
|
let totalTarget = 0;
|
|
for (let dayUtc = startUtc; dayUtc <= endUtc; dayUtc += oneDay) {
|
|
const day = new Date(dayUtc);
|
|
const dateText = `${day.getUTCFullYear()}-${String(day.getUTCMonth() + 1).padStart(2, '0')}-${String(day.getUTCDate()).padStart(2, '0')}`;
|
|
const dayOfWeek = day.getUTCDay();
|
|
const isWeekend = dayOfWeek === 0 || dayOfWeek === 6;
|
|
const isHoliday = isWeekend || HOLIDAYS.includes(dateText);
|
|
totalTarget += isHoliday ? HOLIDAY_TARGET_HOURS : WEEKDAY_TARGET_HOURS;
|
|
}
|
|
return Math.round(totalTarget);
|
|
};
|
|
const formatLocalDate = (date) => {
|
|
if (!(date instanceof Date) || isNaN(date.getTime())) return '';
|
|
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
|
|
};
|
|
const getMonthRangeForDate = (date) => {
|
|
if (!(date instanceof Date) || isNaN(date.getTime())) return { startDate: '', endDate: '' };
|
|
const start = new Date(date.getFullYear(), date.getMonth(), 1);
|
|
const end = new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
|
return {
|
|
startDate: formatLocalDate(start),
|
|
endDate: formatLocalDate(end)
|
|
};
|
|
};
|
|
const getDefaultMhDateRange = (dates = []) => {
|
|
const now = new Date();
|
|
const previousMonthRange = getMonthRangeForDate(new Date(now.getFullYear(), now.getMonth() - 1, 1));
|
|
const latestDateText = [...dates].filter(Boolean).sort().slice(-1)[0] || '';
|
|
const latestDate = latestDateText ? new Date(latestDateText) : null;
|
|
const previousMonthStart = new Date(now.getFullYear(), now.getMonth() - 1, 1);
|
|
if (latestDate instanceof Date && !isNaN(latestDate.getTime()) && latestDate < previousMonthStart) {
|
|
return getMonthRangeForDate(latestDate);
|
|
}
|
|
return previousMonthRange;
|
|
};
|
|
const findHeaderIndex = (normalizedHeaders, candidates) => {
|
|
const targets = candidates.map(normalizeHeader);
|
|
for (let i = 0; i < normalizedHeaders.length; i++) {
|
|
if (targets.includes(normalizedHeaders[i])) return i;
|
|
}
|
|
return -1;
|
|
};
|
|
const getRowTeamDivision = (row) => String(row?.[columnMap.teamDivision] || '').trim();
|
|
const rebuildMemberTeamMap = () => {
|
|
memberTeamMap = new Map();
|
|
teamData.slice(1).forEach(row => {
|
|
const memberName = String(row?.[columnMap.name] || '').trim();
|
|
const memberTeam = String(row?.[columnMap.team] || '').trim();
|
|
if (memberName && memberTeam && !memberTeamMap.has(memberName)) {
|
|
memberTeamMap.set(memberName, memberTeam);
|
|
}
|
|
});
|
|
};
|
|
const getProjectOwnership = (teamName, projectCode) => {
|
|
const normalizedTeam = String(teamName || '').trim();
|
|
const normalizedCode = String(projectCode || '').trim();
|
|
const pmName = normalizedCode ? String(projectPmMap.get(normalizedCode) || '').trim() : '';
|
|
const pmTeam = pmName ? String(memberTeamMap.get(pmName) || '').trim() : '';
|
|
return {
|
|
code: normalizedCode,
|
|
pmName,
|
|
pmTeam,
|
|
ownership: normalizedTeam && pmTeam && pmTeam === normalizedTeam ? '\uC8FC\uAD00' : '\uC9C0\uC6D0'
|
|
};
|
|
};
|
|
const getStandardLaborRate = (rankText) => {
|
|
const rank = String(rankText || '').trim();
|
|
if (rank.includes('이사')) return STANDARD_LABOR_RATES.executive;
|
|
if (rank.includes('수석')) return STANDARD_LABOR_RATES.senior;
|
|
if (rank.includes('책임')) return STANDARD_LABOR_RATES.principal;
|
|
if (rank.includes('선임')) return STANDARD_LABOR_RATES.lead;
|
|
return STANDARD_LABOR_RATES.staff;
|
|
};
|
|
const deriveLaborCostsFromRow = (row) => {
|
|
const slots = columnMap.slots || [];
|
|
const lateFlagText = String(row[columnMap.lateFlag] || '').trim();
|
|
const isWeekend = lateFlagText.includes('주말') || lateFlagText.includes('휴일');
|
|
const hourlyRate = getStandardLaborRate(row[columnMap.rank]);
|
|
let normalHours = 0;
|
|
let extraHours = 0;
|
|
slots.forEach(slot => {
|
|
const hours = parseNumber(row[slot.time]);
|
|
if (hours <= 0) return;
|
|
if (isWeekend || slot.extra) extraHours += hours;
|
|
else normalHours += hours;
|
|
});
|
|
return {
|
|
normalLaborCost: roundWon(normalHours * hourlyRate),
|
|
extraLaborCost: roundWon(extraHours * hourlyRate * 1.5)
|
|
};
|
|
};
|
|
const isRowInScope = (row, scope = currentScope) => {
|
|
const division = getRowTeamDivision(row);
|
|
if (scope === 'gpd') return GPD_TEAM_DIVISIONS.has(division);
|
|
if (scope === 'tdc') return !GPD_TEAM_DIVISIONS.has(division);
|
|
return true;
|
|
};
|
|
const getScopedRows = (scope = currentScope) => teamData.slice(1).filter(row => isRowInScope(row, scope));
|
|
const getTeamScope = (teamName) => {
|
|
const normalizedTeam = String(teamName || '').trim();
|
|
if (!normalizedTeam) return 'all';
|
|
const matchedRow = teamData.slice(1).find(row => String(row?.[columnMap.team] || '').trim() === normalizedTeam);
|
|
const division = getRowTeamDivision(matchedRow);
|
|
if (!division) return 'all';
|
|
return GPD_TEAM_DIVISIONS.has(division) ? 'gpd' : 'tdc';
|
|
};
|
|
const buildScopedPeopleData = (rows) => {
|
|
const seen = new Set();
|
|
return rows.map(r => ({
|
|
name: String(r[columnMap.name] || '').trim(),
|
|
team: String(r[columnMap.team] || '').trim()
|
|
})).filter(p => {
|
|
if (!p.name || !p.team) return false;
|
|
const key = `${p.name}-${p.team}`;
|
|
if (seen.has(key)) return false;
|
|
seen.add(key);
|
|
return true;
|
|
}).map(p => ({
|
|
...p,
|
|
value: `${p.name}|${p.team}`,
|
|
label: `${p.name} (${p.team})`
|
|
}));
|
|
};
|
|
const findBizIndexByProject = (normalizedHeaders, projIdx) => {
|
|
const bizKey = normalizeHeader('사업 종류');
|
|
for (let i = projIdx - 1; i >= 0; i--) {
|
|
if (normalizedHeaders[i] === bizKey) return i;
|
|
}
|
|
return -1;
|
|
};
|
|
function buildColumnMap() {
|
|
columnMap = cloneDefaultColumnMap();
|
|
if (teamData.length === 0 || !Array.isArray(teamData[0])) return;
|
|
|
|
const normalizedHeaders = teamData[0].map(normalizeHeader);
|
|
if (normalizedHeaders.length === 0) return;
|
|
|
|
const dateIdx = findHeaderIndex(normalizedHeaders, ['근무일자']);
|
|
const teamIdx = findHeaderIndex(normalizedHeaders, ['팀']);
|
|
const teamDivisionIdx = findHeaderIndex(normalizedHeaders, ['팀분류', '팀 분류']);
|
|
const nameIdx = findHeaderIndex(normalizedHeaders, ['이름']);
|
|
const rankIdx = findHeaderIndex(normalizedHeaders, ['직책']);
|
|
const lateFlagIdx = findHeaderIndex(normalizedHeaders, ['\uC8FC\uB9D0/\uC9C0\uAC01']);
|
|
const stateIdx = findHeaderIndex(normalizedHeaders, ['user_state']);
|
|
const shiftTimeIdx = findHeaderIndex(normalizedHeaders, ['시차시간']);
|
|
const calendarNoteIdx = findHeaderIndex(normalizedHeaders, ['근태', '상태', '비고', '지각/휴가', '휴가/지각', '근무상태']);
|
|
const normalCostIdx = findHeaderIndex(normalizedHeaders, ['일반근무', '일반근무비용', '일반근무 비용']);
|
|
const extraCostIdx = findHeaderIndex(normalizedHeaders, ['추가근무', '초과근무', '추가근무비용', '추가근무 비용', '초과근무비용', '초과근무 비용']);
|
|
|
|
if (dateIdx >= 0) columnMap.date = dateIdx;
|
|
if (teamIdx >= 0) columnMap.team = teamIdx;
|
|
if (teamDivisionIdx >= 0) columnMap.teamDivision = teamDivisionIdx;
|
|
if (nameIdx >= 0) columnMap.name = nameIdx;
|
|
if (rankIdx >= 0) columnMap.rank = rankIdx;
|
|
if (lateFlagIdx >= 0) columnMap.lateFlag = lateFlagIdx;
|
|
if (stateIdx >= 0) columnMap.userState = stateIdx;
|
|
if (shiftTimeIdx >= 0) columnMap.shiftTime = shiftTimeIdx;
|
|
if (calendarNoteIdx >= 0) columnMap.calendarNote = calendarNoteIdx;
|
|
else if (normalizedHeaders[8] !== undefined) columnMap.calendarNote = 8;
|
|
else columnMap.calendarNote = -1;
|
|
if (normalCostIdx >= 0) columnMap.normalCost = normalCostIdx;
|
|
else if (normalizedHeaders[47] !== undefined) columnMap.normalCost = 47;
|
|
else columnMap.normalCost = -1;
|
|
if (extraCostIdx >= 0) columnMap.extraCost = extraCostIdx;
|
|
else if (normalizedHeaders[48] !== undefined) columnMap.extraCost = 48;
|
|
else columnMap.extraCost = -1;
|
|
|
|
const slotDefs = [
|
|
{ codeHeaders: ['메인업무 프로젝트 코드'], projHeaders: ['메인업무 프로젝트명'], timeHeaders: ['메인업무 근무시간'], extra: false },
|
|
{ codeHeaders: ['추가업무1 프로젝트 코드'], projHeaders: ['추가업무1 프로젝트명'], timeHeaders: ['추가업무1 근무시간'], extra: false },
|
|
{ codeHeaders: ['추가업무2 프로젝트 코드'], projHeaders: ['추가업무2 프로젝트명'], timeHeaders: ['추가업무2 근무시간'], extra: false },
|
|
{ codeHeaders: ['추가업무3 프로젝트 코드'], projHeaders: ['추가업무3 프로젝트명'], timeHeaders: ['추가업무3 근무시간'], extra: false },
|
|
{ codeHeaders: ['추가업무4 프로젝트 코드'], projHeaders: ['추가업무4 프로젝트명'], timeHeaders: ['추가업무4 근무시간'], extra: false },
|
|
{ codeHeaders: ['추가업무5 프로젝트 코드'], projHeaders: ['추가업무5 프로젝트명'], timeHeaders: ['추가업무5 근무시간'], extra: false },
|
|
{ codeHeaders: ['연장근무 프로젝트 코드'], projHeaders: ['연장근무 프로젝트명'], timeHeaders: ['연장근무 시간(가공)', '연장근무시간(가공)'], extra: true }
|
|
];
|
|
const mappedSlots = slotDefs.map(def => {
|
|
const code = findHeaderIndex(normalizedHeaders, def.codeHeaders);
|
|
const proj = findHeaderIndex(normalizedHeaders, def.projHeaders);
|
|
const time = findHeaderIndex(normalizedHeaders, def.timeHeaders);
|
|
if (proj < 0 || time < 0) return null;
|
|
return { biz: findBizIndexByProject(normalizedHeaders, proj), code, proj, time, extra: def.extra };
|
|
}).filter(Boolean);
|
|
if (mappedSlots.length > 0) columnMap.slots = mappedSlots;
|
|
}
|
|
|
|
google.charts.load('current', {'packages':['corechart']});
|
|
|
|
|
|
// --- Popup Functions ---
|
|
|
|
function _deprecated_showProjectMembers_v0(pName) {
|
|
|
|
const modal = document.getElementById('project-members-modal');
|
|
|
|
const titleEl = document.getElementById('modal-project-title');
|
|
|
|
const countEl = document.getElementById('modal-project-count');
|
|
|
|
const listEl = document.getElementById('modal-members-list');
|
|
|
|
|
|
|
|
const startStr = document.getElementById('start-date').value;
|
|
const endStr = document.getElementById('end-date').value;
|
|
const currentTeam = String(document.getElementById('team-select').value || '').trim();
|
|
let matchedProjectCode = '';
|
|
|
|
let memberMap = {};
|
|
const slots = columnMap.slots || [];
|
|
|
|
teamData.slice(1).forEach(row => {
|
|
const d = dStr(row[columnMap.date]);
|
|
if (!d || d < startStr || d > endStr || !isRowInScope(row)) return;
|
|
const team = String(row[columnMap.team] || '').trim();
|
|
const name = String(row[columnMap.name] || '').trim();
|
|
const rank = String(row[columnMap.rank] || '연구원').trim();
|
|
|
|
slots.forEach(s => {
|
|
const rowPName = String(row[s.proj] || '').trim();
|
|
const val = parseNumber(row[s.time]);
|
|
const projectCode = (s.code >= 0 ? String(row[s.code] || '') : '').trim();
|
|
if (rowPName === pName && val > 0) {
|
|
if (!matchedProjectCode && projectCode) matchedProjectCode = projectCode;
|
|
const key = `${name}|${team}|${rank}`;
|
|
memberMap[key] = true;
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
const members = Object.keys(memberMap).map(k => {
|
|
|
|
const [n, t, r] = k.split('|');
|
|
|
|
return { name: n, team: t, rank: r };
|
|
|
|
}).sort((a,b) => a.name.localeCompare(b.name, 'ko'));
|
|
|
|
const getMemberRankOrder = (rankText) => (
|
|
String(rankText || '').includes("\uC218\uC11D") ? 1 :
|
|
String(rankText || '').includes("\uCC45\uC784") ? 2 :
|
|
String(rankText || '').includes("\uC120\uC784") ? 3 : 4
|
|
);
|
|
|
|
const teamGroups = Object.values(members.reduce((acc, member) => {
|
|
if (!acc[member.team]) acc[member.team] = { team: member.team, members: [] };
|
|
acc[member.team].members.push(member);
|
|
return acc;
|
|
}, {})).map(group => {
|
|
const sortedMembers = group.members.sort((a, b) => {
|
|
const rankDiff = getMemberRankOrder(a.rank) - getMemberRankOrder(b.rank);
|
|
return rankDiff !== 0 ? rankDiff : a.name.localeCompare(b.name, 'ko');
|
|
});
|
|
const rankGroups = Object.values(sortedMembers.reduce((acc, member) => {
|
|
const rankKey = member.rank || '연구원';
|
|
if (!acc[rankKey]) acc[rankKey] = { rank: rankKey, order: getMemberRankOrder(rankKey), names: [] };
|
|
acc[rankKey].names.push(member.name);
|
|
return acc;
|
|
}, {})).sort((a, b) => {
|
|
const rankDiff = a.order - b.order;
|
|
return rankDiff !== 0 ? rankDiff : a.rank.localeCompare(b.rank, 'ko');
|
|
});
|
|
return {
|
|
...group,
|
|
members: sortedMembers,
|
|
rankGroups
|
|
};
|
|
}).sort((a, b) => {
|
|
const aCurrent = currentTeam && a.team === currentTeam;
|
|
const bCurrent = currentTeam && b.team === currentTeam;
|
|
if (aCurrent !== bCurrent) return aCurrent ? -1 : 1;
|
|
return a.team.localeCompare(b.team, 'ko');
|
|
});
|
|
|
|
const pmName = matchedProjectCode ? String(projectPmMap.get(matchedProjectCode) || '').trim() : '';
|
|
const pmTeam = pmName ? String(memberTeamMap.get(pmName) || '').trim() : '';
|
|
teamGroups.forEach(group => {
|
|
group.isPmTeam = !!pmTeam && group.team === pmTeam;
|
|
});
|
|
|
|
|
|
|
|
titleEl.innerText = pName;
|
|
countEl.innerText = `총 ${members.length}명 참여 중 (전체 팀 기준)`;
|
|
|
|
countEl.innerText = `총 ${members.length}명 참여 중 (전체 팀 기준)`;
|
|
|
|
|
|
|
|
countEl.innerText = `총 ${members.length}명 참여 중 (전체 팀 기준)`;
|
|
|
|
listEl.innerHTML = teamGroups.map(group => `
|
|
|
|
<div class="p-4 bg-slate-50/50 border border-slate-100 rounded-2xl">
|
|
|
|
<div class="flex items-center justify-between gap-3 mb-3">
|
|
<div class="flex items-center gap-2 min-w-0">
|
|
<button type="button" onclick="openTeamAnalysisPopup('${group.team.replace(/'/g, "\\'")}')" class="text-sm font-black text-slate-800 hover:text-indigo-600 transition-colors">
|
|
${group.team}
|
|
</button>
|
|
${group.isPmTeam ? '<span class="text-[10px] font-black text-amber-700 bg-amber-50 px-2 py-0.5 rounded-lg border border-amber-100">PM팀</span>' : ''}
|
|
${group.team === currentTeam ? '<span class="text-[10px] font-black text-indigo-700 bg-indigo-50 px-2 py-0.5 rounded-lg border border-indigo-100">현재 선택 팀</span>' : ''}
|
|
</div>
|
|
<span class="text-[11px] font-black text-slate-400 whitespace-nowrap">${group.members.length}명</span>
|
|
</div>
|
|
|
|
<div class="flex flex-col gap-2">
|
|
${group.rankGroups.map(rankGroup => `
|
|
<div class="flex items-start gap-3 px-3 py-2 bg-white rounded-xl border border-slate-200">
|
|
<span class="text-[11px] font-black text-indigo-700 bg-indigo-50 px-2 py-0.5 rounded-lg border border-indigo-100 whitespace-nowrap">${rankGroup.rank}</span>
|
|
<span class="text-[13px] font-black text-slate-800 leading-relaxed break-keep">${rankGroup.names.join(', ')}</span>
|
|
</div>
|
|
`).join('')}
|
|
</div>
|
|
|
|
</div>
|
|
|
|
`).join('');
|
|
|
|
|
|
|
|
modal.classList.remove('hidden');
|
|
|
|
lucide.createIcons();
|
|
|
|
}
|
|
|
|
function _deprecated_showProjectMembers_v1(pName) {
|
|
|
|
const modal = document.getElementById('project-members-modal');
|
|
const titleEl = document.getElementById('modal-project-title');
|
|
const countEl = document.getElementById('modal-project-count');
|
|
const listEl = document.getElementById('modal-members-list');
|
|
const startStr = document.getElementById('start-date').value;
|
|
const endStr = document.getElementById('end-date').value;
|
|
const currentTeam = String(document.getElementById('team-select').value || '').trim();
|
|
const slots = columnMap.slots || [];
|
|
let matchedProjectCode = '';
|
|
const memberMap = {};
|
|
|
|
teamData.slice(1).forEach(row => {
|
|
const d = dStr(row[columnMap.date]);
|
|
if (!d || d < startStr || d > endStr || !isRowInScope(row)) return;
|
|
const team = String(row[columnMap.team] || '').trim();
|
|
const name = String(row[columnMap.name] || '').trim();
|
|
const rank = String(row[columnMap.rank] || '연구원').trim();
|
|
|
|
slots.forEach(slot => {
|
|
const rowProjectName = String(row[slot.proj] || '').trim();
|
|
const projectCode = (slot.code >= 0 ? String(row[slot.code] || '') : '').trim();
|
|
const value = parseNumber(row[slot.time]);
|
|
if (rowProjectName !== pName || value <= 0) return;
|
|
if (!matchedProjectCode && projectCode) matchedProjectCode = projectCode;
|
|
memberMap[`${name}|${team}|${rank}`] = true;
|
|
});
|
|
});
|
|
|
|
const members = Object.keys(memberMap).map(key => {
|
|
const [name, team, rank] = key.split('|');
|
|
return { name, team, rank };
|
|
}).sort((a, b) => a.name.localeCompare(b.name, 'ko'));
|
|
|
|
const getMemberRankOrder = (rankText) => (
|
|
String(rankText || '').includes('수석') ? 1 :
|
|
String(rankText || '').includes('책임') ? 2 :
|
|
String(rankText || '').includes('선임') ? 3 : 4
|
|
);
|
|
|
|
const pmName = matchedProjectCode ? String(projectPmMap.get(matchedProjectCode) || '').trim() : '';
|
|
const pmTeam = pmName ? String(memberTeamMap.get(pmName) || '').trim() : '';
|
|
|
|
const teamGroups = Object.values(members.reduce((acc, member) => {
|
|
if (!acc[member.team]) acc[member.team] = { team: member.team, members: [] };
|
|
acc[member.team].members.push(member);
|
|
return acc;
|
|
}, {})).map(group => {
|
|
const sortedMembers = group.members.sort((a, b) => {
|
|
const rankDiff = getMemberRankOrder(a.rank) - getMemberRankOrder(b.rank);
|
|
return rankDiff !== 0 ? rankDiff : a.name.localeCompare(b.name, 'ko');
|
|
});
|
|
const rankGroups = Object.values(sortedMembers.reduce((acc, member) => {
|
|
const rankKey = member.rank || '연구원';
|
|
if (!acc[rankKey]) acc[rankKey] = { rank: rankKey, order: getMemberRankOrder(rankKey), names: [] };
|
|
acc[rankKey].names.push(member.name);
|
|
return acc;
|
|
}, {})).sort((a, b) => {
|
|
const rankDiff = a.order - b.order;
|
|
return rankDiff !== 0 ? rankDiff : a.rank.localeCompare(b.rank, 'ko');
|
|
});
|
|
return {
|
|
...group,
|
|
members: sortedMembers,
|
|
rankGroups,
|
|
isPmTeam: !!pmTeam && group.team === pmTeam
|
|
};
|
|
}).sort((a, b) => {
|
|
const aCurrent = currentTeam && a.team === currentTeam;
|
|
const bCurrent = currentTeam && b.team === currentTeam;
|
|
if (aCurrent !== bCurrent) return aCurrent ? -1 : 1;
|
|
if (a.isPmTeam !== b.isPmTeam) return a.isPmTeam ? -1 : 1;
|
|
return a.team.localeCompare(b.team, 'ko');
|
|
});
|
|
|
|
titleEl.innerText = pName;
|
|
countEl.innerText = `총 ${members.length}명 참여 중 (전체 팀 기준)`;
|
|
|
|
listEl.innerHTML = teamGroups.map(group => `
|
|
<div class="p-4 bg-slate-50/50 border border-slate-100 rounded-2xl">
|
|
<div class="flex items-center justify-between gap-3 mb-3">
|
|
<div class="flex items-center gap-2 min-w-0 flex-wrap">
|
|
<button type="button" onclick="openTeamAnalysisPopup('${group.team.replace(/'/g, "\\'")}')" class="text-sm font-black text-slate-800 hover:text-indigo-600 transition-colors">
|
|
${group.team}
|
|
</button>
|
|
${group.isPmTeam ? '<span class="text-[10px] font-black text-amber-700 bg-amber-50 px-2 py-0.5 rounded-lg border border-amber-100">PM팀</span>' : ''}
|
|
${group.team === currentTeam ? '<span class="text-[10px] font-black text-indigo-700 bg-indigo-50 px-2 py-0.5 rounded-lg border border-indigo-100">현재 선택 팀</span>' : ''}
|
|
</div>
|
|
<span class="text-[11px] font-black text-slate-400 whitespace-nowrap">${group.members.length}명</span>
|
|
</div>
|
|
|
|
<div class="flex flex-col gap-2">
|
|
${group.rankGroups.map(rankGroup => `
|
|
<div class="flex items-start gap-3 px-3 py-2 bg-white rounded-xl border border-slate-200">
|
|
<span class="text-[11px] font-black text-slate-700 bg-slate-100 px-2 py-0.5 rounded-lg border border-slate-200 whitespace-nowrap">${rankGroup.rank}</span>
|
|
<span class="text-[13px] font-black text-slate-800 leading-relaxed break-keep">${rankGroup.names.join(', ')}</span>
|
|
</div>
|
|
`).join('')}
|
|
</div>
|
|
</div>
|
|
`).join('');
|
|
|
|
modal.classList.remove('hidden');
|
|
lucide.createIcons();
|
|
}
|
|
|
|
|
|
|
|
function closeProjectModal() {
|
|
|
|
document.getElementById('project-members-modal').classList.add('hidden');
|
|
|
|
}
|
|
|
|
function showProjectMembers(pName) {
|
|
|
|
const modal = document.getElementById('project-members-modal');
|
|
const titleEl = document.getElementById('modal-project-title');
|
|
const countEl = document.getElementById('modal-project-count');
|
|
const listEl = document.getElementById('modal-members-list');
|
|
const startStr = document.getElementById('start-date').value;
|
|
const endStr = document.getElementById('end-date').value;
|
|
const currentTeam = String(document.getElementById('team-select').value || '').trim();
|
|
const slots = columnMap.slots || [];
|
|
let matchedProjectCode = '';
|
|
const memberMap = {};
|
|
|
|
teamData.slice(1).forEach(row => {
|
|
const d = dStr(row[columnMap.date]);
|
|
if (!d || d < startStr || d > endStr) return;
|
|
const team = String(row[columnMap.team] || '').trim();
|
|
const name = String(row[columnMap.name] || '').trim();
|
|
const rank = String(row[columnMap.rank] || '연구원').trim();
|
|
|
|
slots.forEach(slot => {
|
|
const rowProjectName = String(row[slot.proj] || '').trim();
|
|
const projectCode = (slot.code >= 0 ? String(row[slot.code] || '') : '').trim();
|
|
const value = parseNumber(row[slot.time]);
|
|
if (rowProjectName !== pName || value <= 0) return;
|
|
if (!matchedProjectCode && projectCode) matchedProjectCode = projectCode;
|
|
memberMap[`${name}|${team}|${rank}`] = true;
|
|
});
|
|
});
|
|
|
|
const members = Object.keys(memberMap).map(key => {
|
|
const [name, team, rank] = key.split('|');
|
|
return { name, team, rank };
|
|
}).sort((a, b) => a.name.localeCompare(b.name, 'ko'));
|
|
|
|
const getMemberRankOrder = (rankText) => (
|
|
String(rankText || '').includes('수석') ? 1 :
|
|
String(rankText || '').includes('책임') ? 2 :
|
|
String(rankText || '').includes('선임') ? 3 : 4
|
|
);
|
|
|
|
const pmName = matchedProjectCode ? String(projectPmMap.get(matchedProjectCode) || '').trim() : '';
|
|
const pmTeam = pmName ? String(memberTeamMap.get(pmName) || '').trim() : '';
|
|
|
|
const teamGroups = Object.values(members.reduce((acc, member) => {
|
|
if (!acc[member.team]) acc[member.team] = { team: member.team, members: [] };
|
|
acc[member.team].members.push(member);
|
|
return acc;
|
|
}, {})).map(group => {
|
|
const sortedMembers = group.members.sort((a, b) => {
|
|
const rankDiff = getMemberRankOrder(a.rank) - getMemberRankOrder(b.rank);
|
|
return rankDiff !== 0 ? rankDiff : a.name.localeCompare(b.name, 'ko');
|
|
});
|
|
const rankGroups = Object.values(sortedMembers.reduce((acc, member) => {
|
|
const rankKey = member.rank || '연구원';
|
|
if (!acc[rankKey]) acc[rankKey] = { rank: rankKey, order: getMemberRankOrder(rankKey), names: [] };
|
|
acc[rankKey].names.push(member.name);
|
|
return acc;
|
|
}, {})).sort((a, b) => {
|
|
const rankDiff = a.order - b.order;
|
|
return rankDiff !== 0 ? rankDiff : a.rank.localeCompare(b.rank, 'ko');
|
|
});
|
|
return {
|
|
...group,
|
|
members: sortedMembers,
|
|
rankGroups,
|
|
isPmTeam: !!pmTeam && group.team === pmTeam
|
|
};
|
|
}).sort((a, b) => {
|
|
const aCurrent = currentTeam && a.team === currentTeam;
|
|
const bCurrent = currentTeam && b.team === currentTeam;
|
|
if (aCurrent !== bCurrent) return aCurrent ? -1 : 1;
|
|
if (a.isPmTeam !== b.isPmTeam) return a.isPmTeam ? -1 : 1;
|
|
return a.team.localeCompare(b.team, 'ko');
|
|
});
|
|
|
|
if (pmTeam && !teamGroups.some(group => group.team === pmTeam)) {
|
|
const pmRank = String(teamData.slice(1).find(row => String(row[columnMap.name] || '').trim() === pmName)?.[columnMap.rank] || '연구원').trim();
|
|
teamGroups.unshift({
|
|
team: pmTeam,
|
|
members: [{ name: pmName, team: pmTeam, rank: pmRank }],
|
|
rankGroups: [{ rank: pmRank, order: getMemberRankOrder(pmRank), names: [pmName] }],
|
|
isPmTeam: true
|
|
});
|
|
}
|
|
|
|
titleEl.innerText = pName;
|
|
countEl.innerText = `총 ${members.length}명 참여 중 (전체 팀 기준)`;
|
|
|
|
listEl.innerHTML = teamGroups.map(group => `
|
|
<div class="p-4 bg-slate-50/50 border border-slate-100 rounded-2xl">
|
|
<div class="flex items-center justify-between gap-3 mb-3">
|
|
<div class="flex items-center gap-2 min-w-0 flex-wrap">
|
|
<button type="button" onclick="openTeamAnalysisPopup('${group.team.replace(/'/g, "\\'")}')" class="text-sm font-black text-slate-800 hover:text-indigo-600 transition-colors">
|
|
${group.team}
|
|
</button>
|
|
${group.isPmTeam ? '<span class="text-[10px] font-black text-amber-700 bg-amber-50 px-2 py-0.5 rounded-lg border border-amber-100">PM팀</span>' : ''}
|
|
${group.team === currentTeam ? '<span class="text-[10px] font-black text-indigo-700 bg-indigo-50 px-2 py-0.5 rounded-lg border border-indigo-100">현재 선택 팀</span>' : ''}
|
|
</div>
|
|
<span class="text-[11px] font-black text-slate-400 whitespace-nowrap">${group.members.length}명</span>
|
|
</div>
|
|
|
|
<div class="flex flex-col gap-2">
|
|
${group.rankGroups.map(rankGroup => `
|
|
<div class="flex items-start gap-3 px-3 py-2 bg-white rounded-xl border border-slate-200">
|
|
<span class="text-[11px] font-black text-slate-700 bg-slate-100 px-2 py-0.5 rounded-lg border border-slate-200 whitespace-nowrap">${rankGroup.rank}</span>
|
|
<span class="text-[13px] font-black text-slate-800 leading-relaxed break-keep">${rankGroup.names.join(', ')}</span>
|
|
</div>
|
|
`).join('')}
|
|
</div>
|
|
</div>
|
|
`).join('');
|
|
|
|
modal.classList.remove('hidden');
|
|
lucide.createIcons();
|
|
}
|
|
|
|
function openPersonCalendarModal(name, initialDate = '') {
|
|
|
|
const currentTeam = String(document.getElementById('team-select').value || '').trim();
|
|
const today = new Date();
|
|
const minMonthDate = new Date(2026, 0, 1);
|
|
const parsedInitialDate = initialDate ? new Date(initialDate) : null;
|
|
const hasValidInitialDate = parsedInitialDate && !isNaN(parsedInitialDate.getTime()) && parsedInitialDate >= minMonthDate;
|
|
const baseDate = hasValidInitialDate ? parsedInitialDate : (today < minMonthDate ? minMonthDate : today);
|
|
|
|
personCalendarState = {
|
|
name,
|
|
team: currentTeam,
|
|
year: baseDate.getFullYear(),
|
|
month: baseDate.getMonth()
|
|
};
|
|
|
|
renderPersonCalendarModal();
|
|
const modal = document.getElementById('person-calendar-modal');
|
|
if (modal) modal.classList.remove('hidden');
|
|
lucide.createIcons();
|
|
|
|
}
|
|
|
|
function renderPersonCalendarModal() {
|
|
|
|
const titleEl = document.getElementById('person-calendar-title');
|
|
const subtitleEl = document.getElementById('person-calendar-subtitle');
|
|
const monthEl = document.getElementById('person-calendar-month');
|
|
const gridEl = document.getElementById('person-calendar-grid');
|
|
const prevButton = document.getElementById('person-calendar-prev');
|
|
const nextButton = document.getElementById('person-calendar-next');
|
|
const today = new Date();
|
|
const minYear = 2026;
|
|
const minMonth = 0;
|
|
const { name, team, year, month } = personCalendarState;
|
|
const rankText = (() => {
|
|
const matchedRow = teamData.slice(1).find(row => {
|
|
if (!isRowInScope(row)) return false;
|
|
const rowName = String(row[columnMap.name] || '').trim();
|
|
const rowTeam = String(row[columnMap.team] || '').trim();
|
|
return rowName === name && (!team || rowTeam === team);
|
|
});
|
|
return String(matchedRow?.[columnMap.rank] || '').trim();
|
|
})();
|
|
const firstDay = new Date(year, month, 1);
|
|
const lastDay = new Date(year, month + 1, 0);
|
|
const startOffset = firstDay.getDay();
|
|
const lastDate = lastDay.getDate();
|
|
const noteMap = {};
|
|
const monthCounts = {
|
|
attendance: 0,
|
|
extraHoliday: 0,
|
|
tripEdu: 0,
|
|
late: 0
|
|
};
|
|
const slots = columnMap.slots || [];
|
|
|
|
teamData.slice(1).forEach(row => {
|
|
if (!isRowInScope(row)) return;
|
|
const rowTeam = String(row[columnMap.team] || '').trim();
|
|
const rowName = String(row[columnMap.name] || '').trim();
|
|
const dateText = dStr(row[columnMap.date]);
|
|
if (!rowName || rowName !== name || rowTeam !== team || !dateText) return;
|
|
|
|
const rowDate = new Date(dateText);
|
|
if (isNaN(rowDate.getTime()) || rowDate.getFullYear() !== year || rowDate.getMonth() !== month) return;
|
|
|
|
const day = rowDate.getDate();
|
|
if (!noteMap[day]) noteMap[day] = new Map();
|
|
|
|
const addNote = (label, tone = 'neutral', category = '') => {
|
|
if (!label) return;
|
|
if (!noteMap[day].has(label)) {
|
|
noteMap[day].set(label, tone);
|
|
if (category && monthCounts[category] !== undefined) monthCounts[category] += 1;
|
|
}
|
|
};
|
|
|
|
const noteText = String((row[8] || row[columnMap.calendarNote] || '')).trim();
|
|
const lateFlagText = String(row[columnMap.lateFlag] || '').trim();
|
|
const hasExtraWork = slots.some(s => s.extra && parseNumber(row[s.time]) > 0);
|
|
const hasHolidayWork = lateFlagText.includes('주말') || lateFlagText.includes('휴일');
|
|
const hasLate = lateFlagText.includes('지각');
|
|
|
|
if (noteText) {
|
|
const normalizedNote = noteText.includes('휴가') ? noteText.replace(/휴가/g, '연차') : noteText;
|
|
const isTripEdu = normalizedNote.includes('교육') || normalizedNote.includes('출장');
|
|
const noteTone = isTripEdu ? 'green' : 'neutral';
|
|
addNote(normalizedNote, noteTone, isTripEdu ? 'tripEdu' : 'attendance');
|
|
}
|
|
if (hasLate) addNote('지각', 'warn', 'late');
|
|
if (hasExtraWork) addNote('연장근무', 'orange', 'extraHoliday');
|
|
if (hasHolidayWork) addNote('휴일근무', 'orange', 'extraHoliday');
|
|
});
|
|
|
|
titleEl.innerText = rankText ? `${name} ${rankText}` : name;
|
|
const monthSummaryParts = [];
|
|
if (monthCounts.attendance > 0) monthSummaryParts.push(`<span class="item attendance">근태 ${monthCounts.attendance}회</span>`);
|
|
if (monthCounts.extraHoliday > 0) monthSummaryParts.push(`<span class="item extraHoliday">연장/휴일근무 ${monthCounts.extraHoliday}회</span>`);
|
|
if (monthCounts.tripEdu > 0) monthSummaryParts.push(`<span class="item tripEdu">출장/교육 ${monthCounts.tripEdu}회</span>`);
|
|
if (monthCounts.late > 0) monthSummaryParts.push(`<span class="item late">지각 ${monthCounts.late}회</span>`);
|
|
const monthSummaryText = monthSummaryParts.length ? `<span class="mh-person-calendar-summary">${monthSummaryParts.join('<span class="text-slate-300">·</span>')}</span>` : '';
|
|
subtitleEl.innerHTML = [team, monthSummaryText].filter(Boolean).join(monthSummaryText ? ' <span class="text-slate-300">·</span> ' : '') || '월별 일정';
|
|
monthEl.innerText = `${year}.${String(month + 1).padStart(2, '0')}`;
|
|
prevButton.disabled = (year === minYear && month === minMonth);
|
|
nextButton.disabled = false;
|
|
|
|
const cells = [];
|
|
for (let i = 0; i < startOffset; i++) {
|
|
cells.push('<div class="mh-person-calendar-day empty"></div>');
|
|
}
|
|
for (let day = 1; day <= lastDate; day++) {
|
|
const isToday = today.getFullYear() === year && today.getMonth() === month && today.getDate() === day;
|
|
const notes = noteMap[day] ? Array.from(noteMap[day].entries()) : [];
|
|
cells.push(`
|
|
<div class="mh-person-calendar-day ${isToday ? 'today' : ''}">
|
|
<div class="mh-person-calendar-daynum">${day}</div>
|
|
${notes.length ? `
|
|
<div class="mh-person-calendar-note-stack">
|
|
${notes.map(([note, tone]) => `<span class="mh-person-calendar-note ${tone}">${note}</span>`).join('')}
|
|
</div>
|
|
` : ''}
|
|
</div>
|
|
`);
|
|
}
|
|
while (cells.length < 42) {
|
|
cells.push('<div class="mh-person-calendar-day empty"></div>');
|
|
}
|
|
|
|
gridEl.innerHTML = cells.join('');
|
|
|
|
}
|
|
|
|
function changePersonCalendarMonth(delta) {
|
|
|
|
let nextYear = personCalendarState.year;
|
|
let nextMonth = personCalendarState.month + delta;
|
|
while (nextMonth < 0) {
|
|
nextMonth += 12;
|
|
nextYear -= 1;
|
|
}
|
|
while (nextMonth > 11) {
|
|
nextMonth -= 12;
|
|
nextYear += 1;
|
|
}
|
|
if (nextYear < 2026) return;
|
|
personCalendarState.year = nextYear;
|
|
personCalendarState.month = nextMonth;
|
|
renderPersonCalendarModal();
|
|
lucide.createIcons();
|
|
|
|
}
|
|
|
|
function closePersonCalendarModal() {
|
|
|
|
const modal = document.getElementById('person-calendar-modal');
|
|
if (modal) modal.classList.add('hidden');
|
|
|
|
}
|
|
|
|
function applyPopupTeamState(payload) {
|
|
if (!payload) return;
|
|
if (payload.binary) {
|
|
loadWorkbookBinary(payload.binary);
|
|
} else if (Array.isArray(payload.teamData)) {
|
|
applyMhSourceRows(payload.teamData, Array.isArray(payload.pmSheet) ? payload.pmSheet : []);
|
|
}
|
|
if (payload.scope) {
|
|
currentScope = payload.scope === 'tdc' ? 'tdc' : 'gpd';
|
|
syncScopeButtons();
|
|
refreshScopedSelections(false);
|
|
}
|
|
const startInput = document.getElementById('start-date');
|
|
const endInput = document.getElementById('end-date');
|
|
if (payload.startDate) startInput.value = payload.startDate;
|
|
if (payload.endDate) endInput.value = payload.endDate;
|
|
const teamSelect = document.getElementById('team-select');
|
|
const personSelect = document.getElementById('person-select');
|
|
if (payload.team && [...teamSelect.options].some(option => option.value === payload.team)) {
|
|
teamSelect.value = payload.team;
|
|
}
|
|
updateFilters();
|
|
personSelect.value = '';
|
|
render();
|
|
}
|
|
|
|
function openTeamAnalysisPopup(team) {
|
|
|
|
if (!teamData.length) return;
|
|
|
|
closeProjectModal();
|
|
|
|
const matchedTeamRow = teamData.slice(1).find(row => String(row?.[columnMap.team] || '').trim() === String(team || '').trim());
|
|
const matchedTeamDivision = matchedTeamRow ? getRowTeamDivision(matchedTeamRow) : '';
|
|
const popupScope = matchedTeamDivision ? (GPD_TEAM_DIVISIONS.has(matchedTeamDivision) ? 'gpd' : 'tdc') : currentScope;
|
|
|
|
const popupWidth = Math.min(1380, Math.max(1100, Math.floor(window.screen.availWidth * 0.78)));
|
|
const popupHeight = Math.min(920, Math.max(760, Math.floor(window.screen.availHeight * 0.82)));
|
|
const popupLeft = Math.max(0, Math.floor((window.screen.availWidth - popupWidth) / 2));
|
|
const popupTop = Math.max(0, Math.floor((window.screen.availHeight - popupHeight) / 2));
|
|
const popupUrl = `${window.location.pathname}?popup=team-analysis`;
|
|
const popupFeatures = `width=${popupWidth},height=${popupHeight},left=${popupLeft},top=${popupTop},resizable=yes,scrollbars=yes`;
|
|
const popupWindow = window.open(popupUrl, `mh-team-analysis-${Date.now()}`, popupFeatures);
|
|
if (!popupWindow) return;
|
|
|
|
const payload = {
|
|
source: 'team-popup-init',
|
|
team,
|
|
scope: popupScope,
|
|
startDate: document.getElementById('start-date').value || '',
|
|
endDate: document.getElementById('end-date').value || ''
|
|
};
|
|
if (lastUploadedBinary) {
|
|
payload.binary = lastUploadedBinary;
|
|
} else {
|
|
payload.teamData = teamData;
|
|
payload.pmSheet = lastPmSheetData;
|
|
}
|
|
const sendPayload = () => {
|
|
if (!popupWindow || popupWindow.closed) return;
|
|
try {
|
|
popupWindow.postMessage(payload, '*');
|
|
popupWindow.focus();
|
|
} catch (error) {
|
|
console.error(error);
|
|
}
|
|
};
|
|
|
|
try {
|
|
popupWindow.onload = () => setTimeout(sendPayload, 60);
|
|
} catch (error) {
|
|
console.error(error);
|
|
}
|
|
setTimeout(sendPayload, 250);
|
|
setTimeout(sendPayload, 900);
|
|
|
|
}
|
|
|
|
function goToTeamAnalysis(team) {
|
|
|
|
closeProjectModal();
|
|
|
|
const teamSelect = document.getElementById('team-select');
|
|
|
|
const personSelect = document.getElementById('person-select');
|
|
|
|
teamSelect.value = team;
|
|
|
|
updateFilters();
|
|
|
|
personSelect.value = '';
|
|
|
|
render();
|
|
|
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
|
|
|
}
|
|
|
|
|
|
|
|
// --- Handlers ---
|
|
function applyMhSourceRows(nextTeamData, nextPmSheet = []) {
|
|
teamData = Array.isArray(nextTeamData) ? nextTeamData : [];
|
|
lastPmSheetData = Array.isArray(nextPmSheet) ? nextPmSheet : [];
|
|
buildColumnMap();
|
|
rebuildMemberTeamMap();
|
|
projectPmMap = new Map();
|
|
lastPmSheetData.forEach(row => {
|
|
const projectCode = String(row?.[0] || '').trim();
|
|
const pmName = String(row?.[1] || '').trim();
|
|
if (projectCode && pmName) projectPmMap.set(projectCode, pmName);
|
|
});
|
|
initTeamTabAfterUpload();
|
|
}
|
|
|
|
function loadWorkbookBinary(binaryStr) {
|
|
if (!binaryStr) return;
|
|
lastUploadedBinary = binaryStr;
|
|
const workbook = XLSX.read(binaryStr, {type: 'binary', cellDates: true, dateNF: 'yyyy-mm-dd'});
|
|
const nextTeamData = XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]], {header: 1, defval: ""});
|
|
const nextPmSheet = workbook.SheetNames[1] ? XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[1]], {header: 1, defval: ""}) : [];
|
|
applyMhSourceRows(nextTeamData, nextPmSheet);
|
|
}
|
|
|
|
const fileInput = document.getElementById('file-input');
|
|
const uploadMhButton = document.getElementById('btn-upload-mh');
|
|
|
|
if (uploadMhButton && fileInput) {
|
|
uploadMhButton.addEventListener('click', function() {
|
|
fileInput.click();
|
|
});
|
|
|
|
fileInput.addEventListener('change', function(e) {
|
|
const file = e.target.files[0];
|
|
if (!file) return;
|
|
|
|
const reader = new FileReader();
|
|
reader.onload = function(evt) {
|
|
loadWorkbookBinary(evt.target.result);
|
|
};
|
|
reader.readAsBinaryString(file);
|
|
});
|
|
}
|
|
|
|
window.addEventListener('message', function(event) {
|
|
const payload = event?.data;
|
|
if (!payload || payload.source !== 'total-upload' || payload.type !== 'mh') return;
|
|
try {
|
|
loadWorkbookBinary(payload.binary || '');
|
|
} catch (err) {
|
|
console.error(err);
|
|
}
|
|
});
|
|
|
|
window.addEventListener('message', function(event) {
|
|
const payload = event?.data;
|
|
if (!payload || payload.source !== 'team-popup-init') return;
|
|
try {
|
|
applyPopupTeamState(payload);
|
|
} catch (err) {
|
|
console.error(err);
|
|
}
|
|
});
|
|
|
|
window.addEventListener('message', function(event) {
|
|
const payload = event?.data;
|
|
if (!payload || payload.source !== 'total-control') return;
|
|
if (payload.type === 'tab-activated' && payload.tab === 'mh') {
|
|
// Hidden state에서 먼저 그려진 차트 레이아웃 보정
|
|
setTimeout(() => render(), 0);
|
|
setTimeout(() => render(), 120);
|
|
return;
|
|
}
|
|
if (payload.type !== 'date-range') return;
|
|
const startInput = document.getElementById('start-date');
|
|
const endInput = document.getElementById('end-date');
|
|
if ('startDate' in payload) startInput.value = payload.startDate || '';
|
|
if ('endDate' in payload) endInput.value = payload.endDate || '';
|
|
render();
|
|
});
|
|
|
|
async function initializeMhFromIntegration() {
|
|
try {
|
|
const response = await fetch('/api/integration/mh-source', { credentials: 'same-origin' });
|
|
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
const payload = await response.json();
|
|
applyMhSourceRows(
|
|
Array.isArray(payload.teamData) ? payload.teamData : [],
|
|
Array.isArray(payload.pmSheet) ? payload.pmSheet : []
|
|
);
|
|
} catch (error) {
|
|
console.error(error);
|
|
}
|
|
}
|
|
|
|
function syncScopeButtons() {
|
|
document.querySelectorAll('.mh-scope-btn').forEach(btn => {
|
|
const isActive = btn.dataset.scope === currentScope;
|
|
btn.classList.toggle('active', isActive);
|
|
btn.setAttribute('aria-pressed', isActive ? 'true' : 'false');
|
|
});
|
|
}
|
|
|
|
function refreshScopedSelections(preserveSelection = true) {
|
|
if (teamData.length < 2) return;
|
|
|
|
const teamSelect = document.getElementById('team-select');
|
|
const personSelect = document.getElementById('person-select');
|
|
const currentTeam = preserveSelection ? teamSelect.value : '';
|
|
const currentPerson = preserveSelection ? personSelect.value : '';
|
|
const scopedRows = getScopedRows();
|
|
const allRows = getScopedRows('all');
|
|
|
|
allTeams = [...new Set(scopedRows.map(r => String(r[columnMap.team] || '').trim()))].filter(Boolean).sort();
|
|
allPeopleData = buildScopedPeopleData(scopedRows);
|
|
searchTeams = [...new Set(allRows.map(r => String(r[columnMap.team] || '').trim()))].filter(Boolean).sort();
|
|
searchPeopleData = buildScopedPeopleData(allRows);
|
|
|
|
teamSelect.innerHTML = allTeams.map(t => `<option value="${t}">${t}</option>`).join('') + `<option value="${ALL_TEAM_VALUE}">전체</option>`;
|
|
|
|
if (currentTeam === ALL_TEAM_VALUE) {
|
|
teamSelect.value = ALL_TEAM_VALUE;
|
|
} else if (currentTeam && allTeams.includes(currentTeam)) {
|
|
teamSelect.value = currentTeam;
|
|
} else if (allTeams.length > 0) {
|
|
teamSelect.value = allTeams[0];
|
|
} else {
|
|
teamSelect.value = '';
|
|
}
|
|
|
|
updateFilters();
|
|
|
|
if (currentPerson && [...personSelect.options].some(option => option.value === currentPerson)) {
|
|
personSelect.value = currentPerson;
|
|
} else {
|
|
personSelect.value = '';
|
|
}
|
|
}
|
|
|
|
function setScope(scope, preserveSelection = true) {
|
|
currentScope = scope === 'gpd' || scope === 'tdc' ? scope : 'all';
|
|
syncScopeButtons();
|
|
refreshScopedSelections(preserveSelection);
|
|
render();
|
|
}
|
|
|
|
function initTeamTabAfterUpload() {
|
|
if (teamData.length < 2) return;
|
|
const dates = teamData.slice(1).map(r => dStr(r[columnMap.date])).filter(Boolean).sort();
|
|
const defaultRange = getDefaultMhDateRange(dates);
|
|
document.getElementById('start-date').value = defaultRange.startDate;
|
|
document.getElementById('end-date').value = defaultRange.endDate;
|
|
syncScopeButtons();
|
|
refreshScopedSelections(false);
|
|
render();
|
|
lucide.createIcons();
|
|
|
|
}
|
|
|
|
function initPersonCalendarModalEvents() {
|
|
const overlay = document.getElementById('person-calendar-overlay');
|
|
const closeButton = document.getElementById('person-calendar-close');
|
|
if (overlay && !overlay.dataset.bound) {
|
|
overlay.addEventListener('click', closePersonCalendarModal);
|
|
overlay.dataset.bound = 'true';
|
|
}
|
|
if (closeButton && !closeButton.dataset.bound) {
|
|
closeButton.addEventListener('click', closePersonCalendarModal);
|
|
closeButton.dataset.bound = 'true';
|
|
}
|
|
}
|
|
|
|
initPersonCalendarModalEvents();
|
|
|
|
|
|
|
|
// --- Dashboard Search & Filters ---
|
|
|
|
const mainSearchInput = document.getElementById('main-search');
|
|
|
|
const searchDropdown = document.getElementById('search-dropdown');
|
|
|
|
const searchResultsList = document.getElementById('search-results-list');
|
|
|
|
|
|
|
|
mainSearchInput.addEventListener('input', function(e) {
|
|
|
|
const val = e.target.value.trim().toLowerCase();
|
|
|
|
if (!val || teamData.length === 0) {
|
|
|
|
searchDropdown.classList.add('hidden');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const matchedTeams = searchTeams.filter(t => t.toLowerCase().includes(val));
|
|
|
|
const matchedPeople = searchPeopleData.filter(p =>
|
|
p.name.toLowerCase().includes(val) || p.team.toLowerCase().includes(val)
|
|
);
|
|
|
|
|
|
|
|
if (matchedTeams.length === 0 && matchedPeople.length === 0) {
|
|
|
|
searchResultsList.innerHTML = `<div class="px-4 py-3 text-slate-400 text-sm italic text-center">검색 결과가 없습니다</div>`;
|
|
|
|
} else {
|
|
|
|
let html = "";
|
|
|
|
if (matchedTeams.length > 0) {
|
|
|
|
html += `<div class="px-4 py-1 text-[10px] font-black text-blue-500 uppercase tracking-widest bg-blue-50/50">Teams</div>`;
|
|
|
|
matchedTeams.forEach(t => {
|
|
|
|
html += `<div class="search-item px-4 py-2 hover:bg-slate-50 cursor-pointer text-sm font-bold text-slate-700" data-type="team" data-value="${t}">${t}</div>`;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if (matchedPeople.length > 0) {
|
|
|
|
html += `<div class="px-4 py-1 text-[10px] font-black text-emerald-500 uppercase tracking-widest bg-emerald-50/50 mt-1">People</div>`;
|
|
|
|
matchedPeople.forEach(p => {
|
|
|
|
html += `<div class="search-item px-4 py-2 hover:bg-slate-50 cursor-pointer text-sm flex items-center justify-between" data-type="person" data-name="${p.name}" data-team="${p.team}">
|
|
|
|
<span class="font-bold text-slate-700">${p.name}</span>
|
|
|
|
<span class="text-[10px] text-slate-400 font-medium">${p.team}</span>
|
|
|
|
</div>`;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
searchResultsList.innerHTML = html;
|
|
|
|
}
|
|
|
|
searchDropdown.classList.remove('hidden');
|
|
|
|
});
|
|
|
|
|
|
|
|
searchResultsList.addEventListener('click', function(e) {
|
|
|
|
const item = e.target.closest('.search-item');
|
|
|
|
if (!item) return;
|
|
|
|
const type = item.dataset.type;
|
|
|
|
const teamSelect = document.getElementById('team-select');
|
|
|
|
const personSelect = document.getElementById('person-select');
|
|
|
|
|
|
|
|
if (type === 'team') {
|
|
setScope(getTeamScope(item.dataset.value), false);
|
|
teamSelect.value = item.dataset.value;
|
|
updateFilters();
|
|
personSelect.value = "";
|
|
} else {
|
|
setScope(getTeamScope(item.dataset.team), false);
|
|
teamSelect.value = item.dataset.team;
|
|
updateFilters();
|
|
const targetValue = `${item.dataset.name}|${item.dataset.team}`;
|
|
personSelect.value = [...personSelect.options].some(option => option.value === targetValue)
|
|
? targetValue
|
|
: item.dataset.name;
|
|
}
|
|
|
|
mainSearchInput.value = "";
|
|
|
|
searchDropdown.classList.add('hidden');
|
|
|
|
render();
|
|
|
|
});
|
|
|
|
|
|
|
|
document.addEventListener('click', function(e) {
|
|
|
|
if (!mainSearchInput.contains(e.target) && !searchDropdown.contains(e.target)) {
|
|
|
|
searchDropdown.classList.add('hidden');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
function updateFilters() {
|
|
if (teamData.length === 0) return;
|
|
const team = document.getElementById('team-select').value;
|
|
const personSelect = document.getElementById('person-select');
|
|
if (!team) {
|
|
document.getElementById('main-title').innerText = '';
|
|
personSelect.innerHTML = '<option value="">팀원을 선택하세요</option>';
|
|
return;
|
|
}
|
|
if (team === ALL_TEAM_VALUE) {
|
|
document.getElementById('main-title').innerText = '전체';
|
|
const allPeople = buildScopedPeopleData(getScopedRows());
|
|
personSelect.innerHTML = '<option value="">전체 구성원</option>' + allPeople.map(p => `<option value="${p.value}">${p.label}</option>`).join('');
|
|
return;
|
|
}
|
|
document.getElementById('main-title').innerText = team;
|
|
const teamPeople = [...new Set(getScopedRows().filter(r => String(r[columnMap.team] || '').trim() === team).map(r => String(r[columnMap.name] || '').trim()))].filter(Boolean).sort();
|
|
personSelect.innerHTML = '<option value="">팀원을 선택하세요</option>' + teamPeople.map(p => `<option value="${p}">${p}</option>`).join('');
|
|
}
|
|
|
|
function resetMhView() {
|
|
if (teamData.length < 2) return;
|
|
const teamSelect = document.getElementById('team-select');
|
|
const personSelect = document.getElementById('person-select');
|
|
const mainSearch = document.getElementById('main-search');
|
|
const searchDropdown = document.getElementById('search-dropdown');
|
|
const startInput = document.getElementById('start-date');
|
|
const endInput = document.getElementById('end-date');
|
|
|
|
if (mainSearch) mainSearch.value = '';
|
|
if (searchDropdown) searchDropdown.classList.add('hidden');
|
|
|
|
refreshScopedSelections(false);
|
|
if (personSelect) personSelect.value = '';
|
|
|
|
const dates = teamData.slice(1).map(r => dStr(r[columnMap.date])).filter(Boolean).sort();
|
|
if (dates.length > 0) {
|
|
const defaultRange = getDefaultMhDateRange(dates);
|
|
startInput.value = defaultRange.startDate;
|
|
endInput.value = defaultRange.endDate;
|
|
}
|
|
|
|
render();
|
|
}
|
|
|
|
|
|
document.getElementById('team-select').addEventListener('change', () => { updateFilters(); render(); });
|
|
|
|
document.getElementById('person-select').addEventListener('change', render);
|
|
|
|
document.getElementById('start-date').addEventListener('change', render);
|
|
|
|
document.getElementById('end-date').addEventListener('change', render);
|
|
|
|
document.querySelectorAll('.mh-scope-btn').forEach(btn => {
|
|
btn.addEventListener('click', () => {
|
|
if (btn.dataset.scope === currentScope) return;
|
|
setScope(btn.dataset.scope);
|
|
});
|
|
});
|
|
|
|
initializeMhFromIntegration();
|
|
|
|
|
|
|
|
// --- Core Rendering: Dashboard ---
|
|
|
|
function render() {
|
|
|
|
if (teamData.length === 0) return;
|
|
|
|
const team = document.getElementById('team-select').value;
|
|
|
|
if (!team) return;
|
|
|
|
const person = document.getElementById('person-select').value;
|
|
|
|
const start = document.getElementById('start-date').value;
|
|
|
|
const end = document.getElementById('end-date').value;
|
|
|
|
|
|
|
|
const targetH = calculateTargetHours(start, end);
|
|
|
|
const results = processData(team, person, start, end, targetH);
|
|
|
|
renderKPIs(results.stats);
|
|
|
|
renderMatrix(results.matrix);
|
|
|
|
drawChart(results.personRows, targetH, person, start, end);
|
|
|
|
lucide.createIcons();
|
|
|
|
}
|
|
|
|
|
|
|
|
function processData(teamF, personF, startStr, endStr, targetH) {
|
|
let pMap = {}; let mMap = {};
|
|
let stats = {
|
|
totalMH: 0,
|
|
normalMH: 0,
|
|
personCount: 0,
|
|
extraHolMH: 0,
|
|
overCount: 0,
|
|
lateCount: 0,
|
|
normalLaborCost: 0,
|
|
extraLaborCost: 0,
|
|
laborCost: 0,
|
|
hasLaborCostCols: true,
|
|
memberNames: [],
|
|
lateNames: [],
|
|
lateDetails: []
|
|
};
|
|
const slots = columnMap.slots || [];
|
|
const latePeople = new Set();
|
|
const latePeopleMap = {};
|
|
|
|
teamData.slice(1).forEach(row => {
|
|
const d = dStr(row[columnMap.date]);
|
|
const rowTeam = String(row[columnMap.team] || '').trim();
|
|
if (!d || d < startStr || d > endStr || !isRowInScope(row) || (teamF !== ALL_TEAM_VALUE && rowTeam !== teamF)) return;
|
|
const lateFlagText = String(row[columnMap.lateFlag] || '').trim();
|
|
const userStateText = String(row[columnMap.userState] || '').trim();
|
|
const isWeekend = lateFlagText.includes("\uC8FC\uB9D0");
|
|
const name = String(row[columnMap.name] || '').trim();
|
|
const rank = String(row[columnMap.rank] || '연구원').trim();
|
|
const personKey = teamF === ALL_TEAM_VALUE ? `${name}|${rowTeam}` : name;
|
|
const personLabel = teamF === ALL_TEAM_VALUE ? `${name} (${rowTeam})` : name;
|
|
const hasSourceCostCols = columnMap.normalCost >= 0 || columnMap.extraCost >= 0;
|
|
const sourceNormalLaborCost = columnMap.normalCost >= 0 ? parseNumber(row[columnMap.normalCost]) : 0;
|
|
const sourceExtraLaborCost = columnMap.extraCost >= 0 ? parseNumber(row[columnMap.extraCost]) : 0;
|
|
const derivedCosts = deriveLaborCostsFromRow(row);
|
|
const normalLaborCost = hasSourceCostCols ? sourceNormalLaborCost : derivedCosts.normalLaborCost;
|
|
const extraLaborCost = hasSourceCostCols ? sourceExtraLaborCost : derivedCosts.extraLaborCost;
|
|
if (!name) return;
|
|
if (lateFlagText.includes("\uC9C0\uAC01")) {
|
|
latePeople.add(name);
|
|
if (!latePeopleMap[name]) latePeopleMap[name] = { count: 0, firstDate: d };
|
|
latePeopleMap[name].count += 1;
|
|
if (!latePeopleMap[name].firstDate || d < latePeopleMap[name].firstDate) latePeopleMap[name].firstDate = d;
|
|
}
|
|
stats.normalLaborCost += normalLaborCost;
|
|
stats.extraLaborCost += extraLaborCost;
|
|
stats.laborCost += normalLaborCost + extraLaborCost;
|
|
if (!pMap[personKey]) pMap[personKey] = { name, team: rowTeam, displayName: personLabel, personKey, rank, normal: 0, extra: 0, holiday: 0, extraCount: 0, holidayCount: 0, total: 0, projects: {} };
|
|
slots.forEach(s => {
|
|
const val = parseNumber(row[s.time]);
|
|
const projectCode = (s.code >= 0 ? String(row[s.code] || '') : '').trim();
|
|
const pName = String(row[s.proj] || '').trim();
|
|
const biz = (s.biz >= 0 ? String(row[s.biz] || '') : '').trim() || '공통';
|
|
if (val > 0 && pName) {
|
|
const ownershipInfo = getProjectOwnership(teamF === ALL_TEAM_VALUE ? rowTeam : teamF, projectCode);
|
|
stats.totalMH += val; pMap[personKey].total += val;
|
|
let type = 'normal';
|
|
if (isWeekend) { type = 'holiday'; pMap[personKey].holiday += val; pMap[personKey].holidayCount += 1; stats.extraHolMH += val; }
|
|
|
|
else if (s.extra) { type = 'extra'; pMap[personKey].extra += val; pMap[personKey].extraCount += 1; stats.extraHolMH += val; }
|
|
|
|
else { pMap[personKey].normal += val; stats.normalMH += val; }
|
|
|
|
if (!pMap[personKey].projects[pName]) {
|
|
pMap[personKey].projects[pName] = {
|
|
normal: 0,
|
|
extra: 0,
|
|
holiday: 0,
|
|
extraCount: 0,
|
|
holidayCount: 0,
|
|
total: 0,
|
|
firstDate: d,
|
|
lastDate: d
|
|
};
|
|
}
|
|
|
|
pMap[personKey].projects[pName].total += val; pMap[personKey].projects[pName][type] += val;
|
|
if (type === 'extra') pMap[personKey].projects[pName].extraCount += 1;
|
|
if (type === 'holiday') pMap[personKey].projects[pName].holidayCount += 1;
|
|
if (!pMap[personKey].projects[pName].firstDate || d < pMap[personKey].projects[pName].firstDate) pMap[personKey].projects[pName].firstDate = d;
|
|
if (!pMap[personKey].projects[pName].lastDate || d > pMap[personKey].projects[pName].lastDate) pMap[personKey].projects[pName].lastDate = d;
|
|
|
|
if (!mMap[biz]) mMap[biz] = {};
|
|
|
|
if (!mMap[biz][pName]) {
|
|
|
|
mMap[biz][pName] = { total: 0, ps: new Set(), rankDetails: { "수석": { mh: 0, ps: new Set() }, "책임": { mh: 0, ps: new Set() }, "선임": { mh: 0, ps: new Set() }, "연구원": { mh: 0, ps: new Set() } } };
|
|
|
|
}
|
|
|
|
if (!mMap[biz][pName].code && ownershipInfo.code) mMap[biz][pName].code = ownershipInfo.code;
|
|
if (!mMap[biz][pName].pmName && ownershipInfo.pmName) mMap[biz][pName].pmName = ownershipInfo.pmName;
|
|
if (!mMap[biz][pName].pmTeam && ownershipInfo.pmTeam) mMap[biz][pName].pmTeam = ownershipInfo.pmTeam;
|
|
if (!mMap[biz][pName].ownership) mMap[biz][pName].ownership = ownershipInfo.ownership;
|
|
else if (ownershipInfo.ownership === '\uC8FC\uAD00') mMap[biz][pName].ownership = ownershipInfo.ownership;
|
|
|
|
mMap[biz][pName].total += val; mMap[biz][pName].ps.add(personLabel);
|
|
|
|
const rKey = rank.includes("수석") ? "수석" : rank.includes("책임") ? "책임" : rank.includes("선임") ? "선임" : "연구원";
|
|
|
|
mMap[biz][pName].rankDetails[rKey].mh += val; mMap[biz][pName].rankDetails[rKey].ps.add(name);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
const teamList = Object.values(pMap).sort((a, b) => {
|
|
|
|
const wa = RANK_WEIGHTS[a.rank.includes('수석') ? '수석' : a.rank.includes('책임') ? '책임' : a.rank.includes('선임') ? '선임' : '연구원'] || 99;
|
|
|
|
const wb = RANK_WEIGHTS[b.rank.includes('수석') ? '수석' : b.rank.includes('책임') ? '책임' : b.rank.includes('선임') ? '선임' : '연구원'] || 99;
|
|
|
|
return (wa !== wb) ? wa - wb : (a.displayName || a.name).localeCompare((b.displayName || b.name), 'ko');
|
|
|
|
});
|
|
|
|
stats.personCount = teamList.length;
|
|
stats.memberNames = teamList.map(p => ({ name: p.name, label: p.displayName || p.name }));
|
|
stats.lateNames = teamList.filter(p => latePeople.has(p.name)).map(p => p.displayName || p.name);
|
|
stats.lateDetails = teamList.filter(p => latePeople.has(p.name)).map(p => ({
|
|
name: p.name,
|
|
label: `${p.displayName || p.name}(${latePeopleMap[p.name]?.count || 0})`,
|
|
firstDate: latePeopleMap[p.name]?.firstDate || ''
|
|
}));
|
|
stats.lateCount = stats.lateNames.length;
|
|
|
|
teamList.forEach(p => { if (p.total > targetH) stats.overCount++; });
|
|
|
|
|
|
|
|
const personRows = teamList.map(p => ({
|
|
name: p.name,
|
|
team: p.team,
|
|
displayName: p.displayName || p.name,
|
|
personKey: p.personKey || p.name,
|
|
rank: p.rank,
|
|
normal: p.normal,
|
|
extra: p.extra,
|
|
holiday: p.holiday,
|
|
extraCount: p.extraCount,
|
|
holidayCount: p.holidayCount,
|
|
total: p.total,
|
|
projects: Object.entries(p.projects)
|
|
.map(([projectName, d]) => ({ projectName, ...d }))
|
|
.sort((a, b) => b.total - a.total)
|
|
}));
|
|
|
|
return { stats, matrix: mMap, personRows };
|
|
|
|
}
|
|
|
|
|
|
|
|
function renderKPIs(s) {
|
|
const container = document.getElementById('kpi-container');
|
|
const laborCostText = s.hasLaborCostCols
|
|
? ('₩' + Number(s.laborCost || 0).toLocaleString('ko-KR'))
|
|
: (s.overCount + '명');
|
|
const buildCompactList = (items, warn = false, emptyText = '표시할 항목이 없습니다.', showAll = false, clickable = false) => {
|
|
if (!items || !items.length) return `<div class="mh-kpi-empty">${emptyText}</div>`;
|
|
const visibleItems = showAll ? items : items.slice(0, 4);
|
|
const moreCount = items.length - visibleItems.length;
|
|
return `
|
|
<div class="mh-kpi-list ${showAll ? 'all' : ''} custom-scrollbar">
|
|
${visibleItems.map(item => {
|
|
const itemName = typeof item === 'string' ? item : String(item?.name || '');
|
|
const itemLabel = typeof item === 'string' ? item : String(item?.label || item?.name || '');
|
|
const itemInitialDate = typeof item === 'string' ? '' : String(item?.firstDate || '');
|
|
return clickable
|
|
? `<button type="button" onclick="openPersonCalendarModal('${itemName.replace(/'/g, "\\'")}', '${itemInitialDate.replace(/'/g, "\\'")}')" class="mh-kpi-chip ${warn ? 'warn' : ''}">${itemLabel}</button>`
|
|
: `<span class="mh-kpi-chip ${warn ? 'warn' : ''}">${itemLabel}</span>`;
|
|
}).join('')}
|
|
${!showAll && moreCount > 0 ? `<span class="mh-kpi-chip more ${warn ? 'warn' : ''}">+${moreCount}</span>` : ''}
|
|
</div>
|
|
`;
|
|
};
|
|
const cards = [
|
|
{
|
|
title: "총 투입 시간",
|
|
val: formatNum(s.totalMH) + 'h',
|
|
icon: "clock",
|
|
color: "text-blue-600",
|
|
bg: "bg-blue-50",
|
|
iconBorder: "border-blue-100",
|
|
ring: "ring-blue-500/10",
|
|
detailHtml: `
|
|
<div class="mh-kpi-subgrid">
|
|
<div class="mh-kpi-subitem">
|
|
<div class="label">일반근무</div>
|
|
<div class="value">${formatNum(s.normalMH)}h</div>
|
|
</div>
|
|
<div class="mh-kpi-subitem">
|
|
<div class="label">연장/휴일근무</div>
|
|
<div class="value">${formatNum(s.extraHolMH)}h</div>
|
|
</div>
|
|
</div>
|
|
`
|
|
},
|
|
{
|
|
title: "참여 실무자",
|
|
val: s.personCount + '명',
|
|
icon: "users",
|
|
color: "text-emerald-600",
|
|
bg: "bg-emerald-50",
|
|
iconBorder: "border-emerald-100",
|
|
ring: "ring-emerald-500/10",
|
|
detailHtml: buildCompactList(s.memberNames, false, '표시할 실무자 명단이 없습니다.', true, true)
|
|
},
|
|
{
|
|
title: "지각 인원",
|
|
val: s.lateCount + '명',
|
|
icon: "alarm-clock",
|
|
color: "text-amber-600",
|
|
bg: "bg-amber-50",
|
|
iconBorder: "border-amber-100",
|
|
ring: "ring-amber-500/10",
|
|
detailHtml: buildCompactList(s.lateDetails, true, '선택 기간 내 지각 인원이 없습니다.', true, true)
|
|
},
|
|
{
|
|
title: "인건비",
|
|
val: laborCostText,
|
|
icon: "wallet",
|
|
color: "text-red-600",
|
|
bg: "bg-red-50",
|
|
iconBorder: "border-red-100",
|
|
ring: "ring-red-500/10",
|
|
infoHtml: `
|
|
<div class="mh-kpi-tooltip">
|
|
<div class="mh-kpi-tooltip-title">표준 인건비</div>
|
|
<div class="mh-kpi-tooltip-table">
|
|
<div class="mh-kpi-tooltip-cell head">직급</div>
|
|
<div class="mh-kpi-tooltip-cell head">표준금액</div>
|
|
<div class="mh-kpi-tooltip-cell head">산정식</div>
|
|
<div class="mh-kpi-tooltip-cell rank">수석</div>
|
|
<div class="mh-kpi-tooltip-cell money">46,600</div>
|
|
<div class="mh-kpi-tooltip-cell">이사 표준금액과 동일</div>
|
|
<div class="mh-kpi-tooltip-cell rank">책임</div>
|
|
<div class="mh-kpi-tooltip-cell money">40,500</div>
|
|
<div class="mh-kpi-tooltip-cell">(부장단가*5)+(차장단가*2))/7</div>
|
|
<div class="mh-kpi-tooltip-cell rank">선임</div>
|
|
<div class="mh-kpi-tooltip-cell money">35,300</div>
|
|
<div class="mh-kpi-tooltip-cell">((차장단가*2)+(과장단가*3)+(대리단가))/6</div>
|
|
<div class="mh-kpi-tooltip-cell rank">연구원</div>
|
|
<div class="mh-kpi-tooltip-cell money">28,900</div>
|
|
<div class="mh-kpi-tooltip-cell">((대리단가*2)+(사원단가*3))/5</div>
|
|
</div>
|
|
<div class="mh-kpi-tooltip-footnote">※ 자료: 한맥 표준인건비 2025-07 기준</div>
|
|
</div>
|
|
`,
|
|
detailHtml: s.hasLaborCostCols ? `
|
|
<div class="mh-kpi-subgrid">
|
|
<div class="mh-kpi-subitem">
|
|
<div class="label">일반근무 비용</div>
|
|
<div class="value">₩${Number(s.normalLaborCost || 0).toLocaleString('ko-KR')}</div>
|
|
</div>
|
|
<div class="mh-kpi-subitem">
|
|
<div class="label">연장/휴일근무 비용</div>
|
|
<div class="value">₩${Number(s.extraLaborCost || 0).toLocaleString('ko-KR')}</div>
|
|
</div>
|
|
</div>
|
|
` : ``
|
|
}
|
|
];
|
|
container.innerHTML = cards.map(c => `
|
|
|
|
<div class="mh-kpi-card bg-white p-6 rounded-2xl shadow-xl border border-slate-200 transition-all hover:-translate-y-1 ring-4 ${c.ring}">
|
|
|
|
<div class="mh-kpi-head">
|
|
|
|
<div class="mh-kpi-icon ${c.bg} ${c.color} border ${c.iconBorder} shadow-sm">
|
|
|
|
<i data-lucide="${c.icon}"></i>
|
|
|
|
</div>
|
|
|
|
<div class="mh-kpi-summary">
|
|
<div class="mh-kpi-title-row">
|
|
<div class="mh-kpi-title">${c.title}</div>
|
|
${c.infoHtml ? `<button type="button" class="mh-kpi-info" aria-label="${c.title} 안내">!${c.infoHtml}</button>` : ''}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mh-kpi-value">${c.val}</div>
|
|
</div>
|
|
|
|
${c.detailHtml || ''}
|
|
|
|
</div>
|
|
|
|
`).join('');
|
|
|
|
const kpiCards = container.querySelectorAll('.mh-kpi-card');
|
|
if (kpiCards[1] && !kpiCards[1].querySelector('.mh-kpi-hint')) {
|
|
kpiCards[1].insertAdjacentHTML('beforeend', '<div class="mh-kpi-hint mt-2 text-[11px] font-bold text-slate-400">※ 이름 클릭 시, 일정 확인 가능</div>');
|
|
}
|
|
const kpiHint = container.querySelector('.mh-kpi-hint');
|
|
if (kpiHint) kpiHint.textContent = '\u203B \uC774\uB984 \uD074\uB9AD \uC2DC, \uC77C\uC815 \uD655\uC778 \uAC00\uB2A5';
|
|
|
|
}
|
|
|
|
|
|
|
|
function renderMatrix(m) {
|
|
|
|
currentMatrixData = m || {};
|
|
const visualContainer = document.getElementById('matrix-visual-container');
|
|
const footerVisual = document.getElementById('matrix-footer-visual');
|
|
const sectionTitle = document.getElementById('matrix-section-title');
|
|
const bizTones = [
|
|
{ bg: '#eef2ff', border: '#c7d2fe', text: '#4338ca' },
|
|
{ bg: '#ecfdf5', border: '#a7f3d0', text: '#047857' },
|
|
{ bg: '#fff7ed', border: '#fed7aa', text: '#c2410c' },
|
|
{ bg: '#fdf2f8', border: '#fbcfe8', text: '#be185d' },
|
|
{ bg: '#eff6ff', border: '#bfdbfe', text: '#1d4ed8' },
|
|
{ bg: '#f5f3ff', border: '#ddd6fe', text: '#6d28d9' }
|
|
];
|
|
|
|
const rawBizGroups = Object.entries(m || {}).map(([biz, projs]) => {
|
|
const projects = Object.entries(projs).map(([projName, d]) => ({
|
|
name: projName,
|
|
total: d.total,
|
|
peopleCount: d.ps.size,
|
|
peopleSet: d.ps,
|
|
rankDetails: d.rankDetails,
|
|
ownership: d.ownership || '\uC9C0\uC6D0',
|
|
pmName: d.pmName || ''
|
|
})).sort((a, b) => b.total - a.total);
|
|
return { biz, projects };
|
|
});
|
|
|
|
const allProjects = rawBizGroups.flatMap(group => group.projects);
|
|
const ownerCount = allProjects.filter(project => project.ownership === '\uC8FC\uAD00').length;
|
|
const supportCount = allProjects.length - ownerCount;
|
|
const visibleBizGroups = rawBizGroups.map(group => {
|
|
const projects = group.projects.filter(project => {
|
|
if (matrixProjectFilter === 'owner') return project.ownership === '\uC8FC\uAD00';
|
|
if (matrixProjectFilter === 'support') return project.ownership !== '\uC8FC\uAD00';
|
|
return true;
|
|
});
|
|
const peopleSet = new Set();
|
|
let total = 0;
|
|
projects.forEach(project => {
|
|
total += project.total;
|
|
project.peopleSet.forEach(name => peopleSet.add(name));
|
|
});
|
|
return {
|
|
biz: group.biz,
|
|
total,
|
|
peopleCount: peopleSet.size,
|
|
projects
|
|
};
|
|
}).filter(group => group.projects.length > 0).sort((a, b) => b.total - a.total);
|
|
|
|
const cardsHtml = visibleBizGroups.map((group, index) => {
|
|
const tone = bizTones[index % bizTones.length];
|
|
const groupKey = encodeURIComponent(group.biz);
|
|
const isOpen = matrixBizOpenState[groupKey] === true;
|
|
return `
|
|
<div class="mh-matrix-card bg-white border border-slate-100 shadow-sm hover:shadow-md transition-shadow" style="--biz-bg:${tone.bg}; --biz-border:${tone.border}; --biz-text:${tone.text};">
|
|
<button type="button" class="mh-matrix-toggle" aria-expanded="${isOpen ? 'true' : 'false'}" onclick="toggleMatrixGroup('${groupKey}', this)">
|
|
<div class="mh-matrix-card-head">
|
|
<div class="mh-matrix-card-title">
|
|
<span class="mh-matrix-toggle-icon"><i data-lucide="chevron-down"></i></span>
|
|
<div class="mh-matrix-card-main">
|
|
<h5>${group.biz}</h5>
|
|
<span class="mh-matrix-card-count">${group.projects.length}\uAC1C \uD504\uB85C\uC81D\uD2B8</span>
|
|
</div>
|
|
</div>
|
|
<div class="mh-matrix-card-actions">
|
|
<div class="mh-matrix-head-summary">
|
|
<div class="mh-matrix-head-item">
|
|
<span class="mh-matrix-head-label">총 투입시간</span>
|
|
<span class="mh-matrix-total-badge">${formatNum(group.total)}h</span>
|
|
</div>
|
|
<div class="mh-matrix-head-item">
|
|
<span class="mh-matrix-head-label">총 투입인원</span>
|
|
<span class="mh-matrix-head-meta">${group.peopleCount}\uBA85</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</button>
|
|
|
|
<div class="mh-matrix-card-body ${isOpen ? '' : 'hidden'}">
|
|
${group.projects.map(p => `
|
|
<div class="mh-matrix-project group">
|
|
<div class="mh-project-row">
|
|
<div class="mh-project-main">
|
|
<span onclick="showProjectMembers('${p.name.replace(/'/g, "\\'")}')" class="mh-project-name hover:underline cursor-pointer transition-colors">${p.name}</span>
|
|
${p.ownership === '\uC8FC\uAD00' ? `<span class="mh-project-owner-badge">PM</span>` : ''}
|
|
</div>
|
|
|
|
<div class="mh-rank-summary">
|
|
${Object.entries(p.rankDetails).filter(([r, info]) => info.mh > 0).map(([rank, info]) => `
|
|
<span class="mh-inline-pill">
|
|
<span class="rank">${rank}</span>
|
|
<span class="names">${Array.from(info.ps).join(', ')}</span>
|
|
<span class="hours">${formatNum(info.mh)}h</span>
|
|
</span>
|
|
`).join('')}
|
|
</div>
|
|
|
|
<div class="mh-project-meta">
|
|
<span class="mh-project-hours">${formatNum(p.total)}h</span>
|
|
<span class="mh-project-submeta">${p.peopleCount}\uBA85</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`).join('')}
|
|
</div>
|
|
</div>
|
|
`;
|
|
}).join('');
|
|
|
|
visualContainer.innerHTML = cardsHtml || '<div class="mh-empty-state text-slate-300 font-bold italic p-10 text-center w-full">\uD45C\uC2DC\uD560 \uD504\uB85C\uC81D\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.</div>';
|
|
if (sectionTitle) {
|
|
sectionTitle.innerHTML = `<i data-lucide="file-text" size="36" class="text-indigo-500"></i> \uD300\uBCC4 \uC9C4\uD589 \uD504\uB85C\uC81D\uD2B8`;
|
|
}
|
|
|
|
footerVisual.innerHTML = allProjects.length > 0 ? `
|
|
<button type="button" class="mh-matrix-meta-chip all mh-matrix-filter ${matrixProjectFilter === 'all' ? 'active' : ''}" onclick="setMatrixProjectFilter('all')">\uC804\uCCB4 ${allProjects.length}\uAC1C</button>
|
|
<button type="button" class="mh-matrix-meta-chip owner mh-matrix-filter ${matrixProjectFilter === 'owner' ? 'active' : ''}" onclick="setMatrixProjectFilter('owner')">\uC8FC\uAD00 ${ownerCount}\uAC1C</button>
|
|
<button type="button" class="mh-matrix-meta-chip support mh-matrix-filter ${matrixProjectFilter === 'support' ? 'active' : ''}" onclick="setMatrixProjectFilter('support')">\uC9C0\uC6D0 ${supportCount}\uAC1C</button>
|
|
` : '';
|
|
|
|
visualContainer.querySelectorAll('.mh-matrix-head-summary').forEach(summary => {
|
|
const labels = summary.querySelectorAll('.mh-matrix-head-label');
|
|
if (labels[0]) labels[0].textContent = '총 투입시간';
|
|
if (labels[1]) labels[1].textContent = '총 투입인원';
|
|
});
|
|
|
|
lucide.createIcons();
|
|
|
|
}
|
|
|
|
function setMatrixProjectFilter(filterKey) {
|
|
matrixProjectFilter = filterKey || 'all';
|
|
renderMatrix(currentMatrixData || {});
|
|
}
|
|
|
|
function toggleMatrixGroup(groupKey, trigger) {
|
|
matrixBizOpenState[groupKey] = !(matrixBizOpenState[groupKey] === true);
|
|
const card = trigger?.closest('.mh-matrix-card');
|
|
if (!card) return;
|
|
const body = card.querySelector('.mh-matrix-card-body');
|
|
const isOpen = matrixBizOpenState[groupKey] === true;
|
|
trigger.setAttribute('aria-expanded', isOpen ? 'true' : 'false');
|
|
if (body) body.classList.toggle('hidden', !isOpen);
|
|
}
|
|
|
|
function togglePersonChartRow(personKey, trigger) {
|
|
personChartOpenState[personKey] = !(personChartOpenState[personKey] === true);
|
|
const row = trigger?.closest('.mh-person-row');
|
|
if (!row) return;
|
|
const body = row.querySelector('.w-full');
|
|
const isOpen = personChartOpenState[personKey] === true;
|
|
trigger.setAttribute('aria-expanded', isOpen ? 'true' : 'false');
|
|
if (body) body.classList.toggle('hidden', !isOpen);
|
|
}
|
|
|
|
|
|
|
|
function drawChart(personRows, targetH, personF, startStr, endStr) {
|
|
const container = document.getElementById('chart_div');
|
|
const titleEl = document.getElementById('chart-title');
|
|
const iconEl = document.getElementById('chart-icon');
|
|
const chartGuide = document.getElementById('chart-guide');
|
|
const targetBadge = document.getElementById('target-badge');
|
|
const chartDesc = document.getElementById('chart-desc');
|
|
container.classList.remove('flex', 'items-center', 'justify-center');
|
|
container.classList.add('block');
|
|
|
|
titleEl.innerText = '개인별 현황';
|
|
if (chartGuide) {
|
|
chartGuide.innerHTML = '※ 인정시간: 평일(8시간+연장 3시간) 및 주말(5시간)<br>※ 아래 표시되는 시간은 1일(8시간) x 평일수 입니다.';
|
|
}
|
|
chartDesc.innerText = '';
|
|
chartDesc.classList.add('hidden');
|
|
targetBadge.classList.add('hidden');
|
|
iconEl.setAttribute('data-lucide', 'layout-grid');
|
|
|
|
const rows = (personF ? personRows.filter(p => p.personKey === personF || p.name === personF) : personRows) || [];
|
|
if (!rows.length) {
|
|
container.innerHTML = '<div class="text-slate-300 font-bold italic p-10 text-center w-full">표시할 데이터가 없습니다.</div>';
|
|
return;
|
|
}
|
|
|
|
const formatHour = (v) => {
|
|
const n = Number(v || 0);
|
|
if (!Number.isFinite(n)) return '0';
|
|
return Number.isInteger(n) ? String(n) : n.toFixed(1).replace(/\.0$/, '');
|
|
};
|
|
const calculateWeekdaySummaryHours = (start, end) => {
|
|
const s = new Date(start);
|
|
const e = new Date(end);
|
|
if (isNaN(s.getTime()) || isNaN(e.getTime()) || e < s) return 0;
|
|
const startUtc = Date.UTC(s.getFullYear(), s.getMonth(), s.getDate());
|
|
const endUtc = Date.UTC(e.getFullYear(), e.getMonth(), e.getDate());
|
|
const oneDay = 86400000;
|
|
let total = 0;
|
|
for (let dayUtc = startUtc; dayUtc <= endUtc; dayUtc += oneDay) {
|
|
const day = new Date(dayUtc);
|
|
const dayOfWeek = day.getUTCDay();
|
|
if (dayOfWeek !== 0 && dayOfWeek !== 6) total += 8;
|
|
}
|
|
return total;
|
|
};
|
|
const toShortDate = (s) => {
|
|
const d = new Date(s);
|
|
if (isNaN(d.getTime())) return s || '-';
|
|
const yy = String(d.getFullYear()).slice(2);
|
|
const mm = String(d.getMonth() + 1).padStart(2, '0');
|
|
const dd = String(d.getDate()).padStart(2, '0');
|
|
return `${yy}.${mm}.${dd}`;
|
|
};
|
|
const buildProjectBreakdownText = (project) => {
|
|
const normal = Number(project.normal || 0);
|
|
const extra = Number(project.extra || 0);
|
|
const holiday = Number(project.holiday || 0);
|
|
const extraCount = Number(project.extraCount || 0);
|
|
const holidayCount = Number(project.holidayCount || 0);
|
|
const normalHtml = normal > 0
|
|
? `<span class="seg normal"><span class="label">평일</span><span class="value">${formatHour(normal)}h</span></span>`
|
|
: `<span class="seg empty" aria-hidden="true"></span>`;
|
|
const extraHtml = extra > 0
|
|
? `<span class="seg extra"><span class="label">연장</span><span class="value">${formatHour(extra)}h${extraCount > 0 ? `(${extraCount}회)` : ''}</span></span>`
|
|
: `<span class="seg empty" aria-hidden="true"></span>`;
|
|
const holidayHtml = holiday > 0
|
|
? `<span class="seg holiday"><span class="label">휴일</span><span class="value">${formatHour(holiday)}h${holidayCount > 0 ? `(${holidayCount}회)` : ''}</span></span>`
|
|
: `<span class="seg empty" aria-hidden="true"></span>`;
|
|
return `<div class="mh-project-breakdown-inline">${normalHtml}${extraHtml}${holidayHtml}</div>`;
|
|
};
|
|
const summaryTargetH = calculateWeekdaySummaryHours(startStr, endStr);
|
|
|
|
container.innerHTML = `
|
|
<div class="space-y-3 w-full">
|
|
${rows.map(person => {
|
|
const total = Number(person.total || 0);
|
|
const over = total > summaryTargetH;
|
|
const overHour = Math.max(0, total - summaryTargetH);
|
|
const projects = person.projects || [];
|
|
const personKey = encodeURIComponent(`${person.personKey || person.name}|${person.rank}`);
|
|
const isOpen = personF ? true : personChartOpenState[personKey] === true;
|
|
return `
|
|
<div class="mh-person-row border border-slate-200 rounded-xl p-3">
|
|
<button type="button" class="mh-person-toggle" aria-expanded="${isOpen ? 'true' : 'false'}" onclick="togglePersonChartRow('${personKey}', this)">
|
|
<div class="mh-person-summary">
|
|
<div>
|
|
<div class="text-base font-black text-slate-900 leading-tight">
|
|
${person.displayName || person.name} <span class="text-xs text-slate-500 ml-1">${person.rank}</span>${over ? `<span class="mh-person-over-inline"><i data-lucide="alert-circle" size="12"></i><span>초과 ${formatHour(overHour)}h</span></span>` : ''}
|
|
</div>
|
|
</div>
|
|
<div class="mh-person-summary-right">
|
|
<div class="mh-person-summary-total">
|
|
${Number(person.extra || 0) + Number(person.holiday || 0) > 0 ? `<div class="mh-person-summary-formula">(<span class="normal">${formatHour(person.normal || 0)}h</span>+<span class="extra">${formatHour((Number(person.extra || 0) + Number(person.holiday || 0)))}h</span>)</div>` : ''}
|
|
<div class="mh-person-summary-total-main"><span class="current">${formatHour(total)}</span><span class="base">/${formatHour(summaryTargetH)}h</span></div>
|
|
</div>
|
|
<span class="mh-person-toggle-icon"><i data-lucide="chevron-down" size="16"></i></span>
|
|
</div>
|
|
</div>
|
|
</button>
|
|
<div class="w-full ${isOpen ? '' : 'hidden'}">
|
|
<div class="mh-person-projects">
|
|
${projects.length ? projects.map(project => {
|
|
const projectDateRangeText = `${toShortDate(project.firstDate)} ~ ${toShortDate(project.lastDate)}`;
|
|
const sharePct = total > 0 ? ((Number(project.total || 0) / total) * 100).toFixed(1) : '0.0';
|
|
const projectBreakdownText = buildProjectBreakdownText(project);
|
|
return `
|
|
<div class="mh-project-row">
|
|
<div class="mh-project-main">
|
|
<div class="mh-project-title">${project.projectName}</div>
|
|
</div>
|
|
<div class="mh-project-date">${projectDateRangeText}</div>
|
|
<div class="mh-project-time">
|
|
${projectBreakdownText}
|
|
</div>
|
|
<div class="mh-project-share">${sharePct}%</div>
|
|
</div>
|
|
`;
|
|
}).join('') : '<div class="text-slate-300 font-bold italic p-6">프로젝트 데이터가 없습니다.</div>'}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`;
|
|
}).join('')}
|
|
</div>
|
|
`;
|
|
}
|
|
|
|
|
|
|
|
window.onload = function() {
|
|
lucide.createIcons();
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|