feat: [ai-quotation] 제조 견적서 자동 생성 기능 추가
- AI 2단계 분석: 고객 인터뷰 → 요구사항 추출 → 견적 산출 - 모델 확장: AiQuotation(모드/견적번호), AiQuotationItem(규격/단가/금액) - AiQuotePriceTable 모델 신규 생성 - Create 페이지: 모듈/제조 모드 탭, 제품 카테고리, 고객 정보 입력 - Show 페이지: 제조 모드 분기 렌더링 (품목/금액/고객정보) - Edit 페이지: 품목 인라인 편집, 할인/부가세/조건 입력 - Document: 한국 표준 제조업 견적서 양식 템플릿 - Controller/Route: update 엔드포인트, edit 라우트 추가
This commit is contained in:
@@ -90,7 +90,12 @@ public function analyze(int $id): JsonResponse
|
||||
], 404);
|
||||
}
|
||||
|
||||
$result = $this->quotationService->runAnalysis($quotation);
|
||||
// 제조 모드는 제조용 분석 실행
|
||||
if ($quotation->isManufacture()) {
|
||||
$result = $this->quotationService->runManufactureAnalysis($quotation);
|
||||
} else {
|
||||
$result = $this->quotationService->runAnalysis($quotation);
|
||||
}
|
||||
|
||||
if ($result['ok']) {
|
||||
return response()->json([
|
||||
@@ -106,4 +111,26 @@ public function analyze(int $id): JsonResponse
|
||||
'error' => $result['error'],
|
||||
], 422);
|
||||
}
|
||||
|
||||
/**
|
||||
* 견적 편집 저장
|
||||
*/
|
||||
public function update(Request $request, int $id): JsonResponse
|
||||
{
|
||||
$result = $this->quotationService->updateQuotation($id, $request->all());
|
||||
|
||||
if ($result['ok']) {
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => '견적이 저장되었습니다.',
|
||||
'data' => $result['quotation'],
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '견적 저장에 실패했습니다.',
|
||||
'error' => $result['error'] ?? null,
|
||||
], 422);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,4 +91,26 @@ public function showQuotation(Request $request, int $id): View|\Illuminate\Http\
|
||||
|
||||
return view('rd.ai-quotation.show', compact('quotation'));
|
||||
}
|
||||
|
||||
/**
|
||||
* AI 견적 편집 (제조 모드)
|
||||
*/
|
||||
public function editQuotation(Request $request, int $id): View|\Illuminate\Http\Response
|
||||
{
|
||||
if ($request->header('HX-Request')) {
|
||||
return response('', 200)->header('HX-Redirect', route('rd.ai-quotation.edit', $id));
|
||||
}
|
||||
|
||||
$quotation = $this->quotationService->getById($id);
|
||||
|
||||
if (! $quotation) {
|
||||
abort(404, 'AI 견적을 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
if (! $quotation->isCompleted()) {
|
||||
abort(403, '완료된 견적만 편집할 수 있습니다.');
|
||||
}
|
||||
|
||||
return view('rd.ai-quotation.edit', compact('quotation'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user