feat:영업파트너 고객관리 개발 상태 변경 기능 추가
- 8단계 개발 상태(HQ Status) 드롭다운 추가 - updateHqStatus API 엔드포인트 및 컨트롤러 메서드 추가 - JavaScript AJAX 함수로 상태 변경 처리 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -132,4 +132,29 @@ public function modalShow(int $id): View
|
||||
|
||||
return view('sales.admin-prospects.partials.show-modal', compact('prospect', 'management', 'progress'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 개발 진행 상태 변경
|
||||
*/
|
||||
public function updateHqStatus(int $id, Request $request)
|
||||
{
|
||||
$this->checkAdminAccess();
|
||||
|
||||
$request->validate([
|
||||
'hq_status' => 'required|in:' . implode(',', array_keys(SalesTenantManagement::$hqStatusLabels)),
|
||||
]);
|
||||
|
||||
$prospect = TenantProspect::findOrFail($id);
|
||||
$management = SalesTenantManagement::findOrCreateByProspect($prospect->id);
|
||||
|
||||
$management->update([
|
||||
'hq_status' => $request->input('hq_status'),
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'hq_status' => $management->hq_status,
|
||||
'hq_status_label' => $management->hq_status_label,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,12 +142,18 @@ class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none foc
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-4 py-3 whitespace-nowrap text-center">
|
||||
<span class="px-2 py-1 text-xs font-medium rounded-full
|
||||
@if($prospect->hq_status === 'handover') bg-emerald-100 text-emerald-700
|
||||
@elseif($prospect->hq_status === 'pending') bg-gray-100 text-gray-600
|
||||
@else bg-purple-100 text-purple-700 @endif">
|
||||
{{ $prospect->hq_status_label }}
|
||||
</span>
|
||||
<select
|
||||
onchange="updateHqStatus({{ $prospect->id }}, this.value)"
|
||||
class="text-xs font-medium rounded-lg px-2 py-1 border cursor-pointer
|
||||
@if($prospect->hq_status === 'handover') bg-emerald-100 text-emerald-700 border-emerald-300
|
||||
@elseif($prospect->hq_status === 'pending') bg-gray-100 text-gray-600 border-gray-300
|
||||
@else bg-purple-100 text-purple-700 border-purple-300 @endif">
|
||||
@foreach(\App\Models\Sales\SalesTenantManagement::$hqStatusLabels as $status => $label)
|
||||
<option value="{{ $status }}" {{ $prospect->hq_status === $status ? 'selected' : '' }}>
|
||||
{{ $label }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</td>
|
||||
<td class="px-4 py-3 whitespace-nowrap">
|
||||
<span class="px-2 py-1 text-xs font-medium rounded-full {{ $prospect->status_color }}">
|
||||
@@ -200,6 +206,44 @@ class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none foc
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
function updateHqStatus(prospectId, status) {
|
||||
const selectEl = event.target;
|
||||
const originalValue = selectEl.dataset.originalValue || selectEl.value;
|
||||
|
||||
fetch(`/sales/admin-prospects/${prospectId}/hq-status`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
|
||||
'Accept': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ hq_status: status })
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(result => {
|
||||
if (result.success) {
|
||||
// 성공 시 색상 클래스 업데이트
|
||||
selectEl.className = 'text-xs font-medium rounded-lg px-2 py-1 border cursor-pointer ';
|
||||
if (status === 'handover') {
|
||||
selectEl.className += 'bg-emerald-100 text-emerald-700 border-emerald-300';
|
||||
} else if (status === 'pending') {
|
||||
selectEl.className += 'bg-gray-100 text-gray-600 border-gray-300';
|
||||
} else {
|
||||
selectEl.className += 'bg-purple-100 text-purple-700 border-purple-300';
|
||||
}
|
||||
selectEl.dataset.originalValue = status;
|
||||
} else {
|
||||
alert('상태 변경에 실패했습니다.');
|
||||
selectEl.value = originalValue;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
alert('상태 변경 중 오류가 발생했습니다.');
|
||||
selectEl.value = originalValue;
|
||||
});
|
||||
}
|
||||
|
||||
function openDetailModal(id) {
|
||||
const modal = document.getElementById('detailModal');
|
||||
const content = document.getElementById('detailModalContent');
|
||||
|
||||
@@ -931,6 +931,7 @@
|
||||
// 관리자용 전체 고객 관리 (관리자/슈퍼관리자 전용)
|
||||
Route::get('admin-prospects', [\App\Http\Controllers\Sales\AdminProspectController::class, 'index'])->name('admin-prospects.index');
|
||||
Route::get('admin-prospects/{id}/modal-show', [\App\Http\Controllers\Sales\AdminProspectController::class, 'modalShow'])->name('admin-prospects.modal-show');
|
||||
Route::post('admin-prospects/{id}/hq-status', [\App\Http\Controllers\Sales\AdminProspectController::class, 'updateHqStatus'])->name('admin-prospects.update-hq-status');
|
||||
|
||||
// 영업 시나리오 관리
|
||||
Route::prefix('scenarios')->name('scenarios.')->group(function () {
|
||||
|
||||
Reference in New Issue
Block a user