feat: 문서 rendered_html 스냅샷 저장 지원
- Document 모델 $fillable에 rendered_html 추가 - DocumentService create/update에서 rendered_html 저장 - StoreRequest/UpdateRequest에 rendered_html 검증 추가 - WorkOrderService 검사문서/작업일지 생성 시 rendered_html 전달 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2509,10 +2509,14 @@ public function createInspectionDocument(int $workOrderId, array $inspectionData
|
||||
])
|
||||
->toArray();
|
||||
|
||||
$document = $documentService->update($existingDocument->id, [
|
||||
$updateData = [
|
||||
'title' => $inspectionData['title'] ?? $existingDocument->title,
|
||||
'data' => array_merge($existingBasicFields, $documentDataRecords),
|
||||
]);
|
||||
];
|
||||
if (isset($inspectionData['rendered_html'])) {
|
||||
$updateData['rendered_html'] = $inspectionData['rendered_html'];
|
||||
}
|
||||
$document = $documentService->update($existingDocument->id, $updateData);
|
||||
|
||||
$action = 'inspection_document_updated';
|
||||
} else {
|
||||
@@ -2524,6 +2528,9 @@ public function createInspectionDocument(int $workOrderId, array $inspectionData
|
||||
'data' => $documentDataRecords,
|
||||
'approvers' => $inspectionData['approvers'] ?? [],
|
||||
];
|
||||
if (isset($inspectionData['rendered_html'])) {
|
||||
$documentData['rendered_html'] = $inspectionData['rendered_html'];
|
||||
}
|
||||
|
||||
$document = $documentService->create($documentData);
|
||||
$action = 'inspection_document_created';
|
||||
@@ -3140,20 +3147,28 @@ public function createWorkLog(int $workOrderId, array $workLogData): array
|
||||
$documentDataRecords = $this->transformWorkLogDataToRecords($workLogData, $workOrder, $template);
|
||||
|
||||
if ($existingDocument) {
|
||||
$document = $documentService->update($existingDocument->id, [
|
||||
$updateData = [
|
||||
'title' => $workLogData['title'] ?? $existingDocument->title,
|
||||
'data' => $documentDataRecords,
|
||||
]);
|
||||
];
|
||||
if (isset($workLogData['rendered_html'])) {
|
||||
$updateData['rendered_html'] = $workLogData['rendered_html'];
|
||||
}
|
||||
$document = $documentService->update($existingDocument->id, $updateData);
|
||||
$action = 'work_log_updated';
|
||||
} else {
|
||||
$document = $documentService->create([
|
||||
$createData = [
|
||||
'template_id' => $templateId,
|
||||
'title' => $workLogData['title'] ?? "작업일지 - {$workOrder->work_order_no}",
|
||||
'linkable_type' => 'work_order',
|
||||
'linkable_id' => $workOrderId,
|
||||
'data' => $documentDataRecords,
|
||||
'approvers' => $workLogData['approvers'] ?? [],
|
||||
]);
|
||||
];
|
||||
if (isset($workLogData['rendered_html'])) {
|
||||
$createData['rendered_html'] = $workLogData['rendered_html'];
|
||||
}
|
||||
$document = $documentService->create($createData);
|
||||
$action = 'work_log_created';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user