refactor: [barobill] 바로빌설정 페이지에서 테넌트 동기화 카드 및 관련 JS 제거

This commit is contained in:
김보곤
2026-02-21 11:06:14 +09:00
parent 1cf48f7c53
commit feb8cbe995

View File

@@ -151,41 +151,6 @@ class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg transition
</div>
</div>
<!-- 테넌트 동기화 카드 -->
<div class="bg-white rounded-lg shadow-sm border border-gray-100 mb-6">
<div class="px-6 py-4 border-b border-gray-100 flex items-center justify-between">
<div class="flex items-center gap-3">
<div class="p-2 rounded-lg bg-purple-50 text-purple-600">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
</svg>
</div>
<div>
<h3 class="font-semibold text-gray-800">테넌트(회원사) 동기화</h3>
<p class="text-xs text-gray-500">sales 시스템의 테넌트 데이터를 회원사로 동기화합니다</p>
</div>
</div>
<button
type="button"
onclick="syncCompanies()"
id="syncBtn"
class="px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg transition flex items-center gap-2 text-sm"
>
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
</svg>
동기화 실행
</button>
</div>
<div class="p-6">
<div id="companies-list" class="space-y-2">
<div class="text-center text-gray-400 py-4">
<p class="text-sm">테넌트 목록을 불러오는 ...</p>
</div>
</div>
</div>
</div>
<!-- 전체 설정 목록 테이블 -->
<div class="bg-white rounded-lg shadow-sm overflow-hidden">
<div class="px-6 py-4 border-b border-gray-100">
@@ -543,113 +508,9 @@ class="w-full px-3 py-2 text-sm border-2 border-dashed border-gray-300 text-gray
});
};
// 테넌트 목록 로드
async function loadCompanies() {
try {
const res = await fetch('/api/admin/barobill/companies', {
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}',
'Accept': 'application/json'
}
});
const result = await res.json();
const container = document.getElementById('companies-list');
if (result.success && result.data.length > 0) {
container.innerHTML = `
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200 text-sm">
<thead class="bg-gray-50">
<tr>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">ID</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">회사명</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">사업자번호</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">바로빌 ID</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">상태</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
${result.data.map(c => `
<tr class="hover:bg-gray-50">
<td class="px-4 py-2 text-gray-500">${c.id}</td>
<td class="px-4 py-2 font-medium text-gray-900">${c.company_name}</td>
<td class="px-4 py-2 text-gray-500">${c.corp_num}</td>
<td class="px-4 py-2 text-gray-500">${c.barobill_user_id}</td>
<td class="px-4 py-2">
<span class="px-2 py-1 text-xs rounded-full ${c.is_active ? 'bg-green-100 text-green-700' : 'bg-gray-100 text-gray-600'}">
${c.is_active ? '활성' : '비활성'}
</span>
</td>
</tr>
`).join('')}
</tbody>
</table>
</div>
<p class="text-xs text-gray-500 mt-3">총 ${result.data.length}개의 테넌트가 등록되어 있습니다.</p>
`;
} else {
container.innerHTML = `
<div class="text-center py-6 text-gray-400">
<svg class="w-12 h-12 mx-auto mb-3 opacity-50" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4" />
</svg>
<p class="text-sm">등록된 테넌트가 없습니다.</p>
<p class="text-xs mt-1">sales 시스템에서 테넌트를 등록해주세요.</p>
</div>
`;
}
} catch (error) {
console.error('테넌트 목록 로드 실패:', error);
document.getElementById('companies-list').innerHTML = `
<div class="text-center py-4 text-red-500">
<p class="text-sm">테넌트 목록을 불러오는데 실패했습니다.</p>
</div>
`;
}
}
// 동기화 실행
async function syncCompanies() {
const btn = document.getElementById('syncBtn');
const originalText = btn.innerHTML;
btn.disabled = true;
btn.innerHTML = `
<svg class="w-4 h-4 animate-spin" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
</svg>
동기화 중...
`;
try {
const res = await fetch('/api/admin/barobill/companies/sync', {
method: 'POST',
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}',
'Accept': 'application/json'
}
});
const result = await res.json();
if (result.success) {
showToast(result.message, 'success');
loadCompanies();
} else {
showToast(result.message || '동기화 실패', 'error');
}
} catch (error) {
showToast('통신 오류가 발생했습니다.', 'error');
} finally {
btn.disabled = false;
btn.innerHTML = originalText;
}
}
// 초기화
document.addEventListener('DOMContentLoaded', function() {
ConfigModal.init();
loadCompanies();
// 환경 변경 시 URL 자동 설정
document.getElementById('configForm').environment.addEventListener('change', function(e) {