Fix machine count display and pharmacy edit functionality

🔧 Machine Management Fixes:
- Fix duplicate machine counting (was showing 10 instead of 5)
- Update dashboard stats to use Headscale nodes instead of FARMQ profiles
- Fix JavaScript counting to only count active view (List/Card)
- Add view change listeners to update counters correctly

🏥 Pharmacy Management Fixes:
- Add API endpoint for individual pharmacy data retrieval
- Fix pharmacy edit modal to load existing data as form values
- Add proper form validation and error handling
- Implement edit vs add mode detection

📊 Database Integration:
- Improve machine counting logic using Headscale Node table
- Fix online/offline status calculation with 5-minute threshold
- Add debug logging for machine data retrieval

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-11 09:41:55 +09:00
parent 5d89277e5c
commit 1f0afd4cae
4 changed files with 287 additions and 17 deletions

View File

@@ -321,6 +321,9 @@ document.querySelectorAll('input[name="viewMode"]').forEach(radio => {
} else {
document.getElementById('cardView').classList.remove('d-none');
}
// 뷰 변경 시 카운터 업데이트
filterMachines();
});
});
@@ -343,7 +346,11 @@ function filterMachines() {
let onlineCount = 0;
let offlineCount = 0;
document.querySelectorAll('.machine-row, .machine-card').forEach(element => {
// 현재 활성화된 뷰만 선택 (List 또는 Card)
const isListView = document.getElementById('listView').checked;
const activeSelector = isListView ? '.machine-row' : '.machine-card';
document.querySelectorAll(activeSelector).forEach(element => {
const machineText = element.textContent.toLowerCase();
const machineStatus = element.dataset.status;