fix: 대시보드 최근 조제 내역 표시 추가

## 개선사항
- 대시보드에 최근 조제 내역 5건 표시
- 조제일, 환자명, 처방명, 제수, 파우치, 상태 표시
- 상태별 배지 색상 구분
  - 조제완료: 녹색
  - 출고완료: 파란색
  - 취소: 빨간색

이제 대시보드에서 오늘 조제 수와 최근 조제 내역을 한눈에 확인 가능!

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
시골약사 2026-02-15 12:21:53 +00:00
parent 91ebfc2984
commit b58e46f8fd

View File

@ -68,12 +68,49 @@ $(document).ready(function() {
}
});
// 오늘 조제 수
// 오늘 조제 수 및 최근 조제 내역
$.get('/api/compounds', function(response) {
if (response.success) {
const today = new Date().toISOString().split('T')[0];
const todayCompounds = response.data.filter(c => c.compound_date === today);
$('#todayCompounds').text(todayCompounds.length);
// 최근 조제 내역 (최근 5개)
const tbody = $('#recentCompounds');
tbody.empty();
const recentCompounds = response.data.slice(0, 5);
if (recentCompounds.length > 0) {
recentCompounds.forEach(compound => {
let statusBadge = '';
switch(compound.status) {
case 'PREPARED':
statusBadge = '<span class="badge bg-success">조제완료</span>';
break;
case 'DISPENSED':
statusBadge = '<span class="badge bg-primary">출고완료</span>';
break;
case 'CANCELLED':
statusBadge = '<span class="badge bg-danger">취소</span>';
break;
default:
statusBadge = '<span class="badge bg-secondary">대기</span>';
}
tbody.append(`
<tr>
<td>${compound.compound_date || '-'}</td>
<td><strong>${compound.patient_name || '직접조제'}</strong></td>
<td>${compound.formula_name || '직접조제'}</td>
<td>${compound.je_count}</td>
<td>${compound.pouch_total}</td>
<td>${statusBadge}</td>
</tr>
`);
});
} else {
tbody.html('<tr><td colspan="6" class="text-center text-muted">조제 내역이 없습니다.</td></tr>');
}
}
});
}