feat:가망고객 상태 토글 기능 추가 (영업중 ↔ 완료)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -209,6 +209,7 @@ private function getIndexData(Request $request): array
|
||||
'active' => TenantProspect::where('status', TenantProspect::STATUS_ACTIVE)->count(),
|
||||
'expired' => TenantProspect::where('status', TenantProspect::STATUS_EXPIRED)->count(),
|
||||
'converted' => TenantProspect::where('status', TenantProspect::STATUS_CONVERTED)->count(),
|
||||
'completed' => TenantProspect::where('status', TenantProspect::STATUS_COMPLETED)->count(),
|
||||
'progress_complete' => $progressCompleteCount,
|
||||
];
|
||||
|
||||
@@ -334,6 +335,34 @@ public function updateCommissionDate(int $id, Request $request)
|
||||
return response()->json($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 상태 토글 (영업중 ↔ 완료)
|
||||
*/
|
||||
public function toggleStatus(int $id)
|
||||
{
|
||||
$this->checkAdminAccess();
|
||||
|
||||
$prospect = TenantProspect::findOrFail($id);
|
||||
|
||||
if ($prospect->status === TenantProspect::STATUS_ACTIVE) {
|
||||
$prospect->update(['status' => TenantProspect::STATUS_COMPLETED]);
|
||||
} elseif ($prospect->status === TenantProspect::STATUS_COMPLETED) {
|
||||
$prospect->update(['status' => TenantProspect::STATUS_ACTIVE]);
|
||||
} else {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '영업중 또는 완료 상태만 변경할 수 있습니다.',
|
||||
], 422);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'status' => $prospect->status,
|
||||
'status_label' => $prospect->status_label,
|
||||
'status_color' => $prospect->status_color,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 가망고객 삭제 (슈퍼관리자 전용)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user