Feat: 배치/미배치 근로자 분리 내보내기 기능 추가

This commit is contained in:
user01
2026-05-24 23:59:30 +09:00
parent e62c10e66f
commit a80e0ad109
2 changed files with 77 additions and 31 deletions

View File

@@ -24,7 +24,10 @@
<input type="file" id="workplaceFileInput" accept=".xlsx,.xls" hidden />
</form>
<button class="btn btn-info" onclick="openGoogleDriveModal()"><i class="fab fa-google-drive"></i> 구글 드라이브</button>
<button class="btn btn-success" onclick="exportExcel()"><i class="fas fa-download"></i> 내보내기</button>
<div class="btn-group" style="position:relative;display:inline-flex;">
<button class="btn btn-success" onclick="exportExcel('assigned')"><i class="fas fa-download"></i> 배치결과</button>
<button class="btn btn-warning" onclick="exportExcel('unassigned')" style="background:#f59e0b;color:#fff;"><i class="fas fa-user-clock"></i> 미배치</button>
</div>
<button class="btn btn-danger" onclick="resetAssignments()"><i class="fas fa-undo"></i> 초기화</button>
<span id="statusBadge" class="status-badge"></span>
</div>
@@ -953,11 +956,19 @@ async function resetAssignments() {
} catch { showToast('초기화 실패', 'error'); }
}
function exportExcel() {
function exportExcel(type) {
if (!activeTabId) { showToast('내보낼 탭이 없습니다.', 'warning'); return; }
const d = currentData();
if (d.workers.length === 0) { showToast('내보낼 데이터가 없습니다.', 'warning'); return; }
window.location.href = `/api/export?tab=${activeTabId}`;
if (type === 'unassigned') {
const unassigned = d.workers.filter(w => !d.assignments[w.id]);
if (unassigned.length === 0) { showToast('미배치 근로자가 없습니다.', 'info'); return; }
}
if (type === 'assigned') {
const assigned = d.workers.filter(w => d.assignments[w.id]);
if (assigned.length === 0) { showToast('배치된 근로자가 없습니다.', 'info'); return; }
}
window.location.href = `/api/export?tab=${activeTabId}&type=${type}`;
}
function getWorkplaceName(id) {