fix: 견적 선택 다이얼로그에서 수주 전환된 견적 제외
- QuoteIndexRequest: for_order 파라미터 추가
- Quote 모델: orders() HasMany 관계 추가 (Order.quote_id 기준)
- QuoteService: for_order 필터링 로직 추가
- whereNull('order_id') - 빠른 체크
- whereDoesntHave('orders') - 이중 체크
- OrderService: 수주 생성 시 견적 상태를 converted로 업데이트
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,12 @@ protected function prepareForValidation(): void
|
||||
'with_items' => filter_var($this->with_items, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE),
|
||||
]);
|
||||
}
|
||||
|
||||
if ($this->has('for_order')) {
|
||||
$this->merge([
|
||||
'for_order' => filter_var($this->for_order, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
@@ -58,6 +64,7 @@ public function rules(): array
|
||||
'sort_by' => 'nullable|in:registration_date,quote_number,client_name,total_amount,status,created_at',
|
||||
'sort_order' => 'nullable|in:asc,desc',
|
||||
'with_items' => 'nullable|boolean', // 수주 전환용 품목 포함 여부
|
||||
'for_order' => 'nullable|boolean', // 수주 전환용: 이미 수주가 생성된 견적 제외
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user