fix: 출근체크/근무현황 페이지 버그 수정

- workers API 기본 limit 10 → 100 변경 (작업자 누락 문제 해결)
- 작업자 필터 조건 수정 (status='active' + employment_status 체크)
- 근태 기록 저장 시 컬럼명 불일치 수정 (attendance_type_id)
- 근무현황 페이지에 저장 상태 표시 추가 (✓저장됨)
- 디버그 로그 제거

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-02-04 20:58:30 +09:00
parent b8ccde7f17
commit 7c38c555f5
10 changed files with 43 additions and 271 deletions

View File

@@ -251,12 +251,13 @@
try {
const [workersRes, checkinRes, recordsRes] = await Promise.all([
axios.get('/workers'),
axios.get('/workers?limit=100'),
axios.get(`/attendance/checkin-list?date=${selectedDate}`).catch(() => ({ data: { data: [] } })),
axios.get(`/attendance/daily-records?date=${selectedDate}`).catch(() => ({ data: { data: [] } }))
]);
workers = (workersRes.data.data || []).filter(w => w.employment_status === 'employed');
const allWorkers = workersRes.data.data || [];
workers = allWorkers.filter(w => w.status === 'active' && (!w.employment_status || w.employment_status === 'employed'));
const checkinList = checkinRes.data.data || [];
const records = recordsRes.data.data || [];

View File

@@ -149,7 +149,7 @@
async function loadWorkers() {
try {
const response = await axios.get('/workers');
const response = await axios.get('/workers?limit=100');
if (response.data.success) {
workers = response.data.data.filter(w => w.employment_status === 'employed');
}

View File

@@ -284,7 +284,7 @@
async function loadWorkers() {
try {
const response = await axios.get('/workers');
const response = await axios.get('/workers?limit=100');
if (response.data.success) {
workers = response.data.data.filter(w => w.employment_status === 'employed');

View File

@@ -367,11 +367,11 @@
try {
const [workersRes, recordsRes] = await Promise.all([
axios.get('/workers'),
axios.get('/workers?limit=100'),
axios.get(`/attendance/daily-records?date=${selectedDate}`).catch(() => ({ data: { data: [] } }))
]);
workers = (workersRes.data.data || []).filter(w => w.employment_status === 'employed');
workers = (workersRes.data.data || []).filter(w => w.status === 'active' && (!w.employment_status || w.employment_status === 'employed'));
const records = recordsRes.data.data || [];
// 출근 체크 데이터가 있는지 확인
@@ -415,7 +415,8 @@
isPresent: record.is_present === 1,
type: type,
hours: attendanceTypes.find(t => t.value === type)?.hours || 8,
overtimeHours: overtimeHours
overtimeHours: overtimeHours,
isSaved: record.attendance_type_id != null || record.total_work_hours > 0
};
} else {
// 데이터 없으면 기본값 (출근, 정시근무)
@@ -423,7 +424,8 @@
isPresent: true,
type: 'normal',
hours: 8,
overtimeHours: 0
overtimeHours: 0,
isSaved: false
};
}
});
@@ -451,11 +453,12 @@
const showOvertimeInput = s.type === 'overtime';
return `
<tr class="${isAbsent ? 'absent' : ''}">
<tr class="${isAbsent ? 'absent' : ''}" style="${s.isSaved ? 'background:#f0fdf4;' : ''}">
<td>
<div class="worker-cell">
<span class="worker-dot ${s.isPresent ? 'present' : 'absent'}"></span>
<span>${w.worker_name}</span>
${s.isSaved ? '<span style="margin-left:0.5rem;font-size:0.7rem;color:#10b981;">✓저장됨</span>' : ''}
</div>
</td>
<td>${s.isPresent ? '<span style="color:#10b981">출근</span>' : '<span style="color:#ef4444">결근</span>'}</td>
@@ -636,6 +639,13 @@
// 성공 - 오버레이 표시
showSaveOverlay(ok);
isAlreadySaved = true;
// 모든 작업자 저장됨 표시
workers.forEach(w => {
if (workStatus[w.worker_id]) {
workStatus[w.worker_id].isSaved = true;
}
});
render();
updateSaveStatus();
} else if (ok > 0) {
showToast(`${ok}명 성공, ${fail}명 실패`, 'error');