diff --git a/static/app.js b/static/app.js index aabe25f..9d2c492 100644 --- a/static/app.js +++ b/static/app.js @@ -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 = '조제완료'; + break; + case 'DISPENSED': + statusBadge = '출고완료'; + break; + case 'CANCELLED': + statusBadge = '취소'; + break; + default: + statusBadge = '대기'; + } + + tbody.append(` + + ${compound.compound_date || '-'} + ${compound.patient_name || '직접조제'} + ${compound.formula_name || '직접조제'} + ${compound.je_count}제 + ${compound.pouch_total}개 + ${statusBadge} + + `); + }); + } else { + tbody.html('조제 내역이 없습니다.'); + } } }); }