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:
2026-01-15 16:13:17 +09:00
parent 566f34a4c9
commit f9fa7cfd1e
4 changed files with 45 additions and 3 deletions

View File

@@ -175,13 +175,22 @@ public function item(): BelongsTo
}
/**
* 전환된 수주
* 전환된 수주 (Quote.order_id 기준)
*/
public function order(): BelongsTo
{
return $this->belongsTo(Order::class);
}
/**
* 이 견적을 참조하는 수주들 (Order.quote_id 기준)
* 수주 전환 여부 확인 시 사용
*/
public function orders(): HasMany
{
return $this->hasMany(Order::class, 'quote_id');
}
/**
* 현장설명회 (자동생성 시 연결)
*/