feat: [문서인쇄] 스냅샷 출력 + 절곡 전용 렌더링
- print.blade.php rendered_html 스냅샷 우선 출력 - bending-inspection-data, bending-worklog 파셜 추가 - documents/show.blade.php 개선 - DocumentTemplateSection 모델 보완 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -271,6 +271,22 @@ public function show(int $id): View
|
||||
// 기본정보 bf_ 자동 backfill
|
||||
$this->resolveAndBackfillBasicFields($document);
|
||||
|
||||
// 절곡 작업일지용: bending_info 추출
|
||||
$bendingInfo = null;
|
||||
if ($workOrder) {
|
||||
$woOptions = json_decode($workOrder->options ?? '{}', true);
|
||||
$bendingInfo = $woOptions['bending_info'] ?? null;
|
||||
}
|
||||
|
||||
// 절곡 중간검사용: inspection_data 스냅샷 추출 (work_order_items.options.inspection_data)
|
||||
$inspectionData = null;
|
||||
foreach ($workOrderItems as $item) {
|
||||
if (! empty($item->options['inspection_data'])) {
|
||||
$inspectionData = $item->options['inspection_data'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return view('documents.show', [
|
||||
'document' => $document,
|
||||
'workOrderItems' => $workOrderItems,
|
||||
@@ -279,6 +295,8 @@ public function show(int $id): View
|
||||
'materialInputLots' => $materialInputLots,
|
||||
'itemLotMap' => $itemLotMap ?? collect(),
|
||||
'blockHtml' => $this->renderBlockHtml($document->template, $document, 'view'),
|
||||
'bendingInfo' => $bendingInfo,
|
||||
'inspectionData' => $inspectionData,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -295,7 +313,7 @@ private function resolveAndBackfillBasicFields(Document $document): void
|
||||
}
|
||||
|
||||
// bf_ 레코드가 하나라도 있으면 이미 저장된 것 → skip
|
||||
$existingBfCount = $document->data
|
||||
$existingBfCount = ($document->data ?? collect())
|
||||
->filter(fn ($d) => str_starts_with($d->field_key, 'bf_'))
|
||||
->count();
|
||||
if ($existingBfCount > 0) {
|
||||
|
||||
Reference in New Issue
Block a user