diff --git a/system1-factory/web/pages/attendance/work-status.html b/system1-factory/web/pages/attendance/work-status.html
index 8e6fd0e..aff847f 100644
--- a/system1-factory/web/pages/attendance/work-status.html
+++ b/system1-factory/web/pages/attendance/work-status.html
@@ -6,7 +6,7 @@
근무 현황 - TK 공장관리
-
+
@@ -449,6 +459,16 @@
}
function render() {
+ const isMobile = window.innerWidth <= 768;
+
+ if (isMobile) {
+ renderMobile();
+ } else {
+ renderDesktop();
+ }
+ }
+
+ function renderMobile() {
const tbody = document.getElementById('workerTableBody');
if (workers.length === 0) {
@@ -456,10 +476,93 @@
return;
}
+ // 모바일에서는 테이블을 숨기고 카드 뷰 사용
+ const table = tbody.closest('table');
+ table.style.display = 'none';
+
+ // 기존 모바일 컨테이너 제거
+ let mobileContainer = document.getElementById('mobileWorkCards');
+ if (!mobileContainer) {
+ mobileContainer = document.createElement('div');
+ mobileContainer.id = 'mobileWorkCards';
+ table.parentNode.insertBefore(mobileContainer, table.nextSibling);
+ }
+
+ mobileContainer.className = 'mobile-work-cards';
+ mobileContainer.innerHTML = workers.map((w, idx) => {
+ const s = workStatus[w.user_id];
+
+ if (s.isNotHired) {
+ return `
+
+
+ ${w.worker_name} 미입사
+ 입사일: ${formatDisplayDate(s.joinDate)}
+
+
-
+
+ `;
+ }
+
+ const typeInfo = attendanceTypes.find(t => t.value === s.type);
+ const isLeaveType = typeInfo?.isLeave || false;
+ const showOvertimeInput = s.type === 'overtime';
+ const baseHours = s.hours;
+ const totalHours = s.type === 'overtime' ? baseHours + s.overtimeHours : baseHours;
+
+ let rowClass = '';
+ if (s.isSaved) rowClass = isLeaveType ? 'leave' : 'saved';
+ else if (!s.isPresent) rowClass = isLeaveType ? 'leave' : 'absent-no-leave';
+
+ let statusText = '', statusClass = '';
+ if (isLeaveType) { statusText = typeInfo.label; statusClass = 'color:#a16207;'; }
+ else if (s.isPresent) { statusText = '출근'; statusClass = 'color:#10b981;'; }
+ else { statusText = '⚠️ 결근'; statusClass = 'color:#dc2626;font-weight:600;'; }
+
+ let tag = '';
+ if (s.isSaved) tag = '저장됨';
+ else if (isLeaveType) tag = '연차';
+
+ return `
+
+
+ ${w.worker_name} ${tag}
+ ${statusText}
+
+
+
+ ${showOvertimeInput ? `
+
+ ` : ''}
+ ${totalHours}h
+
+
+ `;
+ }).join('');
+ }
+
+ function renderDesktop() {
+ const tbody = document.getElementById('workerTableBody');
+ const table = tbody.closest('table');
+ table.style.display = '';
+
+ // 모바일 컨테이너 숨기기
+ const mobileContainer = document.getElementById('mobileWorkCards');
+ if (mobileContainer) mobileContainer.remove();
+
+ if (workers.length === 0) {
+ tbody.innerHTML = '| 작업자가 없습니다 |
';
+ return;
+ }
+
tbody.innerHTML = workers.map((w, idx) => {
const s = workStatus[w.user_id];
- // 미입사 상태 처리
if (s.isNotHired) {
return `
@@ -483,36 +586,18 @@
const baseHours = s.hours;
const totalHours = s.type === 'overtime' ? baseHours + s.overtimeHours : baseHours;
- // 행 클래스 결정
let rowClass = '';
- if (s.isSaved) {
- rowClass = isLeaveType ? 'leave' : 'saved';
- } else if (!s.isPresent) {
- // 출근 안 했는데 연차 정보도 없으면 경고
- rowClass = isLeaveType ? 'leave' : 'absent-no-leave';
- }
+ if (s.isSaved) rowClass = isLeaveType ? 'leave' : 'saved';
+ else if (!s.isPresent) rowClass = isLeaveType ? 'leave' : 'absent-no-leave';
- // 출근 상태 텍스트 및 클래스 결정
- let statusText = '';
- let statusClass = '';
- if (isLeaveType) {
- statusText = typeInfo.label;
- statusClass = 'status-leave';
- } else if (s.isPresent) {
- statusText = '출근';
- statusClass = 'status-present';
- } else {
- statusText = '⚠️ 결근';
- statusClass = 'status-absent-warning';
- }
+ let statusText = '', statusClass = '';
+ if (isLeaveType) { statusText = typeInfo.label; statusClass = 'status-leave'; }
+ else if (s.isPresent) { statusText = '출근'; statusClass = 'status-present'; }
+ else { statusText = '⚠️ 결근'; statusClass = 'status-absent-warning'; }
- // 태그 표시
let tag = '';
- if (s.isSaved) {
- tag = '저장됨';
- } else if (isLeaveType) {
- tag = '연차';
- }
+ if (s.isSaved) tag = '저장됨';
+ else if (isLeaveType) tag = '연차';
return `
@@ -521,9 +606,7 @@
${w.worker_name}
${tag}
- |
- ${statusText}
- |
+ ${statusText} |
|