@@ -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 = `
-
-
-
-
- | ID |
- 회사명 |
- 사업자번호 |
- 바로빌 ID |
- 상태 |
-
-
-
- ${result.data.map(c => `
-
- | ${c.id} |
- ${c.company_name} |
- ${c.corp_num} |
- ${c.barobill_user_id} |
-
-
- ${c.is_active ? '활성' : '비활성'}
-
- |
-
- `).join('')}
-
-
-
-
총 ${result.data.length}개의 테넌트가 등록되어 있습니다.
- `;
- } else {
- container.innerHTML = `
-
-
-
등록된 테넌트가 없습니다.
-
sales 시스템에서 테넌트를 등록해주세요.
-
- `;
- }
- } catch (error) {
- console.error('테넌트 목록 로드 실패:', error);
- document.getElementById('companies-list').innerHTML = `
-
-
테넌트 목록을 불러오는데 실패했습니다.
-
- `;
- }
- }
-
- // 동기화 실행
- async function syncCompanies() {
- const btn = document.getElementById('syncBtn');
- const originalText = btn.innerHTML;
-
- btn.disabled = true;
- btn.innerHTML = `
-
- 동기화 중...
- `;
-
- 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) {