feat: [dashboard] 비본사/영업팀/소속없음 사용자는 주간 날씨만 표시

- HQ(코드브릿지엑스) 테넌트가 아닌 경우 날씨 카드만 노출
- 소속 부서가 없거나 영업팀만 소속인 경우 날씨 카드만 노출
- Quick Actions, 달력, 일정 모달은 본사 직원만 표시
This commit is contained in:
김보곤
2026-03-05 15:59:59 +09:00
parent a63b501964
commit 810242ecdf

View File

@@ -4,6 +4,22 @@
@section('page-title', '대시보드') @section('page-title', '대시보드')
@section('content') @section('content')
@php
$user = auth()->user();
$currentTenantId = session('selected_tenant_id');
$currentTenant = $currentTenantId ? $user->tenants()->find($currentTenantId) : $user->currentTenant();
$isHQ = $currentTenant && $currentTenant->tenant_type === 'HQ';
// 부서 확인 (소속 없음 또는 영업팀이면 제한)
$departments = $currentTenantId ? $user->getDepartmentsForTenant($currentTenantId) : collect();
$hasDepartment = $departments->isNotEmpty();
$isSalesOnly = $hasDepartment && $departments->every(fn($d) => $d->name === '영업팀');
// 전체 대시보드 표시 조건: HQ 테넌트 + 소속 있음 + 영업팀만이 아닌 경우
$showFullDashboard = $isHQ && $hasDepartment && !$isSalesOnly;
@endphp
@if($showFullDashboard)
<!-- Quick Actions --> <!-- Quick Actions -->
<div class="mt-6 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"> <div class="mt-6 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<div class="bg-white rounded-lg shadow p-6 hover:shadow-lg transition-shadow"> <div class="bg-white rounded-lg shadow p-6 hover:shadow-lg transition-shadow">
@@ -39,6 +55,7 @@
</a> </a>
</div> </div>
</div> </div>
@endif
<!-- Weather Widget --> <!-- Weather Widget -->
<div class="mt-6 bg-white rounded-lg shadow p-6"> <div class="mt-6 bg-white rounded-lg shadow p-6">
@@ -70,6 +87,7 @@
</div> </div>
</div> </div>
@if($showFullDashboard)
<!-- Calendar Section --> <!-- Calendar Section -->
<div class="mt-6 bg-white rounded-lg shadow p-6"> <div class="mt-6 bg-white rounded-lg shadow p-6">
<div id="calendar-container" <div id="calendar-container"
@@ -85,6 +103,7 @@
</div> </div>
</div> </div>
</div> </div>
@endif
<!-- User Info Bar (floating bottom) --> <!-- User Info Bar (floating bottom) -->
<style> <style>
@@ -104,6 +123,7 @@
</span> </span>
</div> </div>
@if($showFullDashboard)
<!-- Schedule Modal --> <!-- Schedule Modal -->
<div id="schedule-modal" class="fixed inset-0 z-50 hidden"> <div id="schedule-modal" class="fixed inset-0 z-50 hidden">
<div class="fixed inset-0 bg-black/50" onclick="closeModal()"></div> <div class="fixed inset-0 bg-black/50" onclick="closeModal()"></div>
@@ -266,8 +286,10 @@ class="border-2 border-dashed border-gray-300 rounded-lg p-4 text-center transit
</div> </div>
</div> </div>
</div> </div>
@endif
@endsection @endsection
@if($showFullDashboard)
@push('scripts') @push('scripts')
<script> <script>
const CSRF_TOKEN = '{{ csrf_token() }}'; const CSRF_TOKEN = '{{ csrf_token() }}';
@@ -731,3 +753,4 @@ function refreshCalendar() {
}); });
</script> </script>
@endpush @endpush
@endif