style: Pint 포맷팅 적용

This commit is contained in:
김보곤
2026-02-25 11:45:01 +09:00
parent 68b1622a4e
commit 9a7c548246
199 changed files with 1420 additions and 1083 deletions

View File

@@ -141,7 +141,7 @@ private function getDashboardData(Request $request): array
],
];
if (!$isGroupPartner) {
if (! $isGroupPartner) {
$commissionByRole[] = [
'name' => '관리자',
'rate' => null, // 1개월 구독료 (퍼센트가 아닌 고정 금액)
@@ -181,7 +181,7 @@ private function getDashboardData(Request $request): array
// 수당 계산: 개발비 × 요율% (개인 20%, 단체 30%) - 1차/2차 분할은 calculateExpectedCommissionSummary에서 처리
$handoverPartnerRate = $isGroupPartner ? 0.30 : 0.20;
$handoverPartnerCommission = (int)($handoverTotalRegFee * $handoverPartnerRate);
$handoverPartnerCommission = (int) ($handoverTotalRegFee * $handoverPartnerRate);
// 내가 매니저로 지정된 인계 완료 건의 수당 계산
$managedHandoverManagements = SalesTenantManagement::where('manager_user_id', $currentUserId)
@@ -190,7 +190,7 @@ private function getDashboardData(Request $request): array
$managedHandoverManagementIds = $managedHandoverManagements->pluck('id')->toArray();
// 매니저 수당: 1개월 구독료 (퍼센트가 아닌 고정 금액)
$handoverManagerCommission = (int)SalesContractProduct::whereIn('management_id', $managedHandoverManagementIds)
$handoverManagerCommission = (int) SalesContractProduct::whereIn('management_id', $managedHandoverManagementIds)
->sum('subscription_fee');
// 기존 수당에 인계 완료 수당 추가
@@ -202,7 +202,7 @@ private function getDashboardData(Request $request): array
// 역할별 수당 업데이트 (실제 지급된 수당 기준)
// 참고: 예상 수당은 나중에 $totalExpectedCommission으로 별도 계산됨
$commissionByRole[0]['amount'] = $partnerCommissionTotal;
if (!$isGroupPartner) {
if (! $isGroupPartner) {
$commissionByRole[1]['amount'] = $managerCommissionTotal;
}
@@ -278,7 +278,7 @@ private function getDashboardData(Request $request): array
->toArray();
$devInProgressRegFee = SalesContractProduct::whereIn('management_id', $devInProgressManagementIds)
->sum('registration_fee');
$expectedFromDevInProgress = (int)($devInProgressRegFee * $handoverPartnerRate); // 개발비 × 요율 (개인 20%, 단체 30%)
$expectedFromDevInProgress = (int) ($devInProgressRegFee * $handoverPartnerRate); // 개발비 × 요율 (개인 20%, 단체 30%)
// 2) 인계 완료 중 지급 미완료 건
$handoverUnpaidRegFee = SalesContractProduct::whereIn('management_id', $handoverManagementIds)
@@ -288,7 +288,7 @@ private function getDashboardData(Request $request): array
->whereIn('management_id', $handoverManagementIds)
->where('status', SalesCommission::STATUS_PAID)
->sum('partner_commission');
$expectedFromHandover = (int)($handoverUnpaidRegFee * $handoverPartnerRate) - $paidCommissionFromHandover;
$expectedFromHandover = (int) ($handoverUnpaidRegFee * $handoverPartnerRate) - $paidCommissionFromHandover;
$expectedFromHandover = max(0, $expectedFromHandover);
// 총 예상 수당 (지급 완료 제외)
@@ -383,7 +383,7 @@ public function assignManager(int $tenantId, Request $request): JsonResponse
} else {
// 특정 매니저 지정
$manager = User::find($managerId);
if (!$manager) {
if (! $manager) {
return response()->json([
'success' => false,
'message' => '매니저를 찾을 수 없습니다.',
@@ -428,7 +428,7 @@ public function assignProspectManager(int $prospectId, Request $request): JsonRe
} else {
// 특정 매니저 지정
$manager = User::find($managerId);
if (!$manager) {
if (! $manager) {
return response()->json([
'success' => false,
'message' => '매니저를 찾을 수 없습니다.',
@@ -581,7 +581,7 @@ private function getManagerOnlyProspects(int $currentUserId): array
$prospect = $management->tenantProspect;
// 내가 등록한 건은 제외 (순수하게 매니저로만 참여한 건만)
if (!$prospect || $prospect->registered_by === $currentUserId) {
if (! $prospect || $prospect->registered_by === $currentUserId) {
continue;
}
@@ -615,7 +615,7 @@ private function getManagerOnlyProspects(int $currentUserId): array
foreach ($tenantManagements as $management) {
$tenant = $management->tenant;
if (!$tenant) {
if (! $tenant) {
continue;
}
@@ -676,12 +676,12 @@ private function calculatePartnerSummaryStats(array $partnerIds, int $currentUse
// 개인 파트너 예상 수당: 1개월 구독료
$individualProspectIds = TenantProspect::whereIn('registered_by', $individualPartnerIds)->pluck('id')->toArray();
$individualMgmtIds = SalesTenantManagement::whereIn('tenant_prospect_id', $individualProspectIds)->pluck('id')->toArray();
$individualExpected = (int)SalesContractProduct::whereIn('management_id', $individualMgmtIds)->sum('subscription_fee');
$individualExpected = (int) SalesContractProduct::whereIn('management_id', $individualMgmtIds)->sum('subscription_fee');
// 단체 파트너 예상 수당: 개발비 × 3%
$groupProspectIds = TenantProspect::whereIn('registered_by', $groupPartnerUserIds)->pluck('id')->toArray();
$groupMgmtIds = SalesTenantManagement::whereIn('tenant_prospect_id', $groupProspectIds)->pluck('id')->toArray();
$groupExpected = (int)(SalesContractProduct::whereIn('management_id', $groupMgmtIds)->sum('registration_fee') * 0.03);
$groupExpected = (int) (SalesContractProduct::whereIn('management_id', $groupMgmtIds)->sum('registration_fee') * 0.03);
$expectedFromFee = $individualExpected + $groupExpected;
@@ -727,16 +727,16 @@ private function calculatePartnerSummaryStats(array $partnerIds, int $currentUse
'expected_commission' => $expectedCommission,
'paid_commission' => $paidManagerCommission,
'first_commission' => [
'total' => (int)$halfExpected,
'pending' => (int)$halfPending,
'scheduled' => (int)$halfScheduled,
'paid' => (int)$halfPaid,
'total' => (int) $halfExpected,
'pending' => (int) $halfPending,
'scheduled' => (int) $halfScheduled,
'paid' => (int) $halfPaid,
],
'second_commission' => [
'total' => (int)$halfExpected,
'pending' => (int)$halfPending,
'scheduled' => (int)$halfScheduled,
'paid' => (int)$halfPaid,
'total' => (int) $halfExpected,
'pending' => (int) $halfPending,
'scheduled' => (int) $halfScheduled,
'paid' => (int) $halfPaid,
],
];
}
@@ -782,8 +782,8 @@ private function getPartnerActivitiesDetail($recruitedPartners, int $currentUser
// 단체 파트너: 협업지원금(개발비 × 3%), 개인 파트너: 관리자 수당(1개월 구독료)
$isRecruitedGroupPartner = $salesPartner && $salesPartner->isGroup();
$expectedCommission = $isRecruitedGroupPartner
? (int)($totalRegistrationFee * 0.03)
: (int)$totalSubscriptionFee;
? (int) ($totalRegistrationFee * 0.03)
: (int) $totalSubscriptionFee;
// 최종 수당 (확정 + 예상 중 큰 값)
$managerCommission = max($confirmedCommission, $expectedCommission);
@@ -864,7 +864,7 @@ private function getPartnerActivitiesDetail($recruitedPartners, int $currentUser
// 역할 정보
$roles = $partner->userRoles->pluck('role.name')->filter()->toArray();
$roleLabel = !empty($roles) ? implode(', ', $roles) : '영업';
$roleLabel = ! empty($roles) ? implode(', ', $roles) : '영업';
$activities[] = [
'partner' => $partner,
@@ -912,7 +912,7 @@ private function getCommissionData(): array
*/
private function getAllManagerUsers()
{
return User::whereHas('userRoles.role', fn($q) => $q->where('name', 'manager'))
return User::whereHas('userRoles.role', fn ($q) => $q->where('name', 'manager'))
->where('is_active', true)
->where('id', '!=', auth()->id()) // 본인 제외
->get(['id', 'name', 'email']);
@@ -930,7 +930,7 @@ public function searchManagers(Request $request): JsonResponse
// 디버깅: SQL 쿼리 로깅
\DB::enableQueryLog();
$managers = User::whereHas('userRoles.role', fn($q) => $q->where('name', 'manager'))
$managers = User::whereHas('userRoles.role', fn ($q) => $q->where('name', 'manager'))
->where('is_active', true)
->where('id', '!=', $authId)
->when($query, function ($q) use ($query) {
@@ -1012,24 +1012,24 @@ private function calculateExpectedCommissionSummary($commissions, int $totalExpe
return [
'scheduled_this_month' => $commissions
->where('status', SalesCommission::STATUS_APPROVED)
->filter(fn($c) => $c->scheduled_payment_date?->format('Y-m') === $thisMonth)
->filter(fn ($c) => $c->scheduled_payment_date?->format('Y-m') === $thisMonth)
->sum('partner_commission'),
'total_received' => $paidCommission,
'pending_amount' => $pendingAmount,
'contracts_this_month' => $commissions
->filter(fn($c) => $c->payment_date >= $thisMonthStart && $c->payment_date <= $thisMonthEnd)
->filter(fn ($c) => $c->payment_date >= $thisMonthStart && $c->payment_date <= $thisMonthEnd)
->count(),
'first_commission' => [
'total' => (int)$halfExpected,
'pending' => (int)$halfPending,
'scheduled' => (int)$halfScheduled,
'paid' => (int)$halfPaid,
'total' => (int) $halfExpected,
'pending' => (int) $halfPending,
'scheduled' => (int) $halfScheduled,
'paid' => (int) $halfPaid,
],
'second_commission' => [
'total' => (int)$halfExpected,
'pending' => (int)$halfPending,
'scheduled' => (int)$halfScheduled,
'paid' => (int)$halfPaid,
'total' => (int) $halfExpected,
'pending' => (int) $halfPending,
'scheduled' => (int) $halfScheduled,
'paid' => (int) $halfPaid,
],
'total_commission' => $totalExpectedCommission,
];
@@ -1053,7 +1053,7 @@ private function calculateCommissionSummaryFromCollection($commissions): array
return [
'scheduled_this_month' => $commissions
->where('status', SalesCommission::STATUS_APPROVED)
->filter(fn($c) => $c->scheduled_payment_date?->format('Y-m') === $thisMonth)
->filter(fn ($c) => $c->scheduled_payment_date?->format('Y-m') === $thisMonth)
->sum('partner_commission'),
'total_received' => $commissions
->where('status', SalesCommission::STATUS_PAID)
@@ -1062,7 +1062,7 @@ private function calculateCommissionSummaryFromCollection($commissions): array
->where('status', SalesCommission::STATUS_PENDING)
->sum('partner_commission'),
'contracts_this_month' => $commissions
->filter(fn($c) => $c->payment_date >= $thisMonthStart && $c->payment_date <= $thisMonthEnd)
->filter(fn ($c) => $c->payment_date >= $thisMonthStart && $c->payment_date <= $thisMonthEnd)
->count(),
'first_commission' => $firstCommission,
'second_commission' => $secondCommission,