fix:내보내기 Alpine.js v3 호환성 수정 (__x.$data → DOM 가시성 기반 탭 감지)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
김보곤
2026-02-20 20:15:18 +09:00
parent b183ddfd36
commit d7eaa1dd76

View File

@@ -335,29 +335,27 @@ function formatCommissionInput(el) {
}
function exportCurrentTable() {
// 현재 활성 탭 감지
const activeTabEl = document.querySelector('[x-data]');
const activeTab = activeTabEl ? activeTabEl.__x.$data.activeTab : 'commission';
let table, filename;
const today = new Date().toISOString().slice(0, 10).replace(/-/g, '');
if (activeTab === 'commission') {
// 수당 관리 - 현재 보이는 서브탭 테이블
const subTab = activeTabEl.__x.$data.commissionSubTab;
if (subTab === 'manager') {
table = document.querySelector('#manager-table-container table');
filename = `매니저수당_${today}.csv`;
} else {
table = document.querySelector('#commission-table-container table');
filename = `영업파트너수당_${today}.csv`;
}
} else if (activeTab === 'customer') {
table = document.querySelector('#customer-content table');
// 현재 보이는 탭의 테이블 감지 (display !== 'none'인 컨테이너)
const commissionPanel = document.querySelector('#commission-table-container');
const managerPanel = document.querySelector('#manager-table-container');
const customerPanel = document.querySelector('#customer-content');
const subscriptionPanel = document.querySelector('#subscription-content');
if (customerPanel && customerPanel.closest('[x-show]')?.style.display !== 'none' && customerPanel.querySelector('table')) {
table = customerPanel.querySelector('table');
filename = `고객사정산_${today}.csv`;
} else if (activeTab === 'subscription') {
table = document.querySelector('#subscription-content table');
} else if (subscriptionPanel && subscriptionPanel.closest('[x-show]')?.style.display !== 'none' && subscriptionPanel.querySelector('table')) {
table = subscriptionPanel.querySelector('table');
filename = `구독관리_${today}.csv`;
} else if (managerPanel && managerPanel.closest('[x-show]')?.style.display !== 'none' && managerPanel.querySelector('table')) {
table = managerPanel.querySelector('table');
filename = `매니저수당_${today}.csv`;
} else if (commissionPanel && commissionPanel.querySelector('table')) {
table = commissionPanel.querySelector('table');
filename = `영업파트너수당_${today}.csv`;
}
if (!table) {