feat:수퍼관리자 가망고객 삭제 기능 추가
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -224,7 +224,9 @@ private function getIndexData(Request $request): array
|
||||
];
|
||||
});
|
||||
|
||||
return compact('prospects', 'stats', 'salesPartners', 'partnerStats', 'filters');
|
||||
$isSuperAdmin = auth()->user()->isSuperAdmin();
|
||||
|
||||
return compact('prospects', 'stats', 'salesPartners', 'partnerStats', 'filters', 'isSuperAdmin');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -302,6 +304,29 @@ public function updateCommissionDate(int $id, Request $request)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 가망고객 삭제 (슈퍼관리자 전용)
|
||||
*/
|
||||
public function destroy(int $id)
|
||||
{
|
||||
$prospect = TenantProspect::findOrFail($id);
|
||||
|
||||
// 연관 데이터 삭제
|
||||
$management = SalesTenantManagement::where('tenant_prospect_id', $prospect->id)->first();
|
||||
if ($management) {
|
||||
SalesCommission::where('management_id', $management->id)->delete();
|
||||
$management->delete();
|
||||
}
|
||||
SalesScenarioChecklist::where('tenant_prospect_id', $prospect->id)->delete();
|
||||
|
||||
$prospect->delete();
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => "'{$prospect->company_name}' 가망고객이 삭제되었습니다.",
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 수당 날짜 삭제 (초기화)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user