fix(WEB): 수주 등록/수정 옵션 필드 저장 및 담당자 표시 문제 해결
- FormRequest에 options 필드 validation 추가 (StoreOrderRequest, UpdateOrderRequest) - shipping_cost_code, receiver, receiver_contact, shipping_address 등 - OrderService.show()에서 client 로드 시 manager_name 필드 추가 - 수주확정/생산지시 되돌리기 기능 추가 (revertOrderConfirmation, revertProductionOrder) - 견적 calculation_inputs 포함하여 로드 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -359,9 +359,7 @@ public function update(int $id, array $data): Quote
|
||||
'calculation_inputs' => $data['calculation_inputs'] ?? $quote->calculation_inputs,
|
||||
// 견적 옵션 (summary_items, expense_items, price_adjustments, detail_items, price_adjustment_data)
|
||||
// 기존 options와 새 options를 병합 (새 데이터가 기존 데이터를 덮어씀)
|
||||
'options' => isset($data['options'])
|
||||
? array_merge($quote->options ?? [], $data['options'])
|
||||
: $quote->options,
|
||||
'options' => $this->mergeOptions($quote->options, $data['options'] ?? null),
|
||||
// 감사
|
||||
'updated_by' => $userId,
|
||||
'current_revision' => $quote->current_revision + 1,
|
||||
@@ -711,4 +709,38 @@ public function findBySiteBriefingId(int $siteBriefingId): ?Quote
|
||||
->where('site_briefing_id', $siteBriefingId)
|
||||
->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* 견적 options 병합
|
||||
* 기존 options와 새 options를 병합하여 반환
|
||||
*/
|
||||
private function mergeOptions(?array $existingOptions, ?array $newOptions): ?array
|
||||
{
|
||||
\Log::info('🔍 [QuoteService::mergeOptions] 시작', [
|
||||
'existingOptions_keys' => $existingOptions ? array_keys($existingOptions) : null,
|
||||
'newOptions_keys' => $newOptions ? array_keys($newOptions) : null,
|
||||
'newOptions_detail_items_count' => isset($newOptions['detail_items']) ? count($newOptions['detail_items']) : 0,
|
||||
'newOptions_price_adjustment_data' => isset($newOptions['price_adjustment_data']) ? 'exists' : 'null',
|
||||
]);
|
||||
|
||||
if ($newOptions === null) {
|
||||
return $existingOptions;
|
||||
}
|
||||
|
||||
if ($existingOptions === null) {
|
||||
\Log::info('✅ [QuoteService::mergeOptions] 기존 없음, 새 options 반환', [
|
||||
'result_keys' => array_keys($newOptions),
|
||||
]);
|
||||
return $newOptions;
|
||||
}
|
||||
|
||||
$merged = array_merge($existingOptions, $newOptions);
|
||||
|
||||
\Log::info('✅ [QuoteService::mergeOptions] 병합 완료', [
|
||||
'merged_keys' => array_keys($merged),
|
||||
'merged_detail_items_count' => isset($merged['detail_items']) ? count($merged['detail_items']) : 0,
|
||||
]);
|
||||
|
||||
return $merged;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user