fix:테넌트 목록을 현재 사용자가 등록한 것만 표시

- registered_by로 현재 로그인 사용자가 등록한 테넌트만 조회
- 영업 진행 버튼 → 영업실적 등록 페이지 연결
- 상세계약 설정 버튼 → 테넌트 편집 페이지 연결
- 매니저 진행 버튼 → 영업담당자 관리 페이지 연결
- 삭제 버튼에 확인 다이얼로그 추가

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
pro
2026-01-28 20:22:54 +09:00
parent f993d3de79
commit 70300ccf3a
2 changed files with 52 additions and 17 deletions

View File

@@ -94,8 +94,10 @@ private function getDashboardData(Request $request): array
'confirmed_commission' => 0, // 확정 가입비 수당
];
// 테넌트 목록 (HQ 제외)
// 테넌트 목록 (현재 로그인한 사용자가 등록한 테넌트만)
$currentUser = auth()->user();
$tenants = Tenant::where('tenant_type', '!=', 'HQ')
->where('registered_by', $currentUser->id)
->orderBy('created_at', 'desc')
->get();

View File

@@ -51,19 +51,16 @@
<!-- 담당자 (영업/관리) -->
<div class="col-span-3 flex items-center gap-2">
<span class="inline-flex items-center px-2.5 py-1 rounded text-xs font-medium bg-gray-100 text-gray-700">
영업: {{ $tenant->salesManager->name ?? '영업담당자' }}
영업: {{ auth()->user()->name }}
</span>
<div class="relative">
<button type="button" class="inline-flex items-center gap-1 px-2.5 py-1 rounded text-xs font-medium bg-blue-50 text-blue-700 border border-blue-200 hover:bg-blue-100 transition-colors">
<span class="inline-flex items-center gap-1 px-2.5 py-1 rounded text-xs font-medium bg-blue-50 text-blue-700 border border-blue-200">
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
</svg>
관리: {{ $tenant->adminManager->name ?? '본인' }}
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
</svg>
</button>
관리: 본인
</span>
</div>
</div>
@@ -74,34 +71,40 @@
<!-- 계약관리 버튼들 -->
<div class="col-span-4 flex items-center justify-center gap-2">
<button type="button" class="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-blue-600 text-white hover:bg-blue-700 transition-colors">
<a href="{{ route('sales.records.create', ['tenant_id' => $tenant->id]) }}"
class="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-blue-600 text-white hover:bg-blue-700 transition-colors">
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7l5 5m0 0l-5 5m5-5H6" />
</svg>
영업 진행
</button>
<button type="button" class="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-gray-100 text-gray-700 border border-gray-300 hover:bg-gray-200 transition-colors">
</a>
<a href="{{ route('tenants.edit', $tenant->id) }}"
class="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-gray-100 text-gray-700 border border-gray-300 hover:bg-gray-200 transition-colors">
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
</svg>
상세계약 설정
</button>
<button type="button" class="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-white text-green-700 border border-green-500 hover:bg-green-50 transition-colors">
</a>
<a href="{{ route('sales.managers.index', ['tenant_id' => $tenant->id]) }}"
class="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-white text-green-700 border border-green-500 hover:bg-green-50 transition-colors">
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
매니저 진행
</button>
</a>
<!-- 수정/삭제 아이콘 -->
<div class="flex items-center gap-1 ml-2">
<button type="button" class="p-1.5 text-gray-400 hover:text-blue-600 transition-colors" title="수정">
<a href="{{ route('tenants.edit', $tenant->id) }}"
class="p-1.5 text-gray-400 hover:text-blue-600 transition-colors" title="수정">
<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="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z" />
</svg>
</button>
<button type="button" class="p-1.5 text-gray-400 hover:text-red-600 transition-colors" title="삭제">
</a>
<button type="button"
onclick="confirmDeleteTenant({{ $tenant->id }}, '{{ $tenant->company_name }}')"
class="p-1.5 text-gray-400 hover:text-red-600 transition-colors" title="삭제">
<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="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" />
</svg>
@@ -147,4 +150,34 @@
});
});
});
// 테넌트 삭제 확인
function confirmDeleteTenant(tenantId, companyName) {
if (confirm(`"${companyName}" 테넌트를 삭제하시겠습니까?\n\n이 작업은 되돌릴 수 없습니다.`)) {
// API를 통한 삭제 요청
fetch(`/api/admin/tenants/${tenantId}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content')
}
})
.then(response => {
if (response.ok) {
// 성공 시 행 제거
const row = document.querySelector(`.tenant-row[data-tenant-id="${tenantId}"]`);
if (row) {
row.remove();
}
alert('테넌트가 삭제되었습니다.');
} else {
alert('삭제에 실패했습니다.');
}
})
.catch(error => {
console.error('Error:', error);
alert('삭제 중 오류가 발생했습니다.');
});
}
}
</script>