getDashboardData($request); return view('sales.dashboard.index', $data); } /** * HTMX 부분 새로고침용 데이터 반환 */ public function refresh(Request $request): View { $data = $this->getDashboardData($request); return view('sales.dashboard.partials.data-container', $data); } /** * 대시보드 데이터 조회 */ private function getDashboardData(Request $request): array { // 기간 설정 $period = $request->input('period', 'month'); // month or custom $year = $request->input('year', now()->year); $month = $request->input('month', now()->month); // 기간 설정 모드일 경우 if ($period === 'custom') { $startDate = $request->input('start_date', now()->startOfMonth()->format('Y-m-d')); $endDate = $request->input('end_date', now()->format('Y-m-d')); } else { $startDate = now()->startOfMonth()->format('Y-m-d'); $endDate = now()->endOfMonth()->format('Y-m-d'); } // 통계 데이터 (임시 데이터 - 추후 실제 데이터로 교체) $stats = [ 'total_membership_fee' => 0, // 총 가입비 'total_commission' => 0, // 총 수당 'commission_rate' => 0, // 지급 승인 완료 비율 'total_contracts' => 0, // 전체 건수 'pending_membership_approval' => 0, // 가입 승인 대기 'pending_payment_approval' => 0, // 지급 승인 대기 ]; // 역할별 수당 상세 $commissionByRole = [ [ 'name' => '판매자', 'rate' => 20, 'amount' => 0, 'color' => 'green', ], [ 'name' => '관리자', 'rate' => 5, 'amount' => 0, 'color' => 'blue', ], [ 'name' => '매뉴제작 협업수당', 'rate' => null, // 별도 'amount' => null, // 운영팀 산정 'color' => 'red', ], ]; // 총 가입비 대비 수당 $totalCommissionRatio = 0; // 수익 및 테넌트 관리 통계 (임시 데이터 - 추후 실제 데이터로 교체) $tenantStats = [ 'total_tenants' => 0, // 관리 테넌트 'total_membership_revenue' => 0, // 총 가입비 실적 'total_commission_accumulated' => 0, // 누적 가입비 수당 'confirmed_commission' => 0, // 확정 가입비 수당 ]; return compact( 'stats', 'commissionByRole', 'totalCommissionRatio', 'tenantStats', 'period', 'year', 'month', 'startDate', 'endDate' ); } }