archivedRecordService->getArchivedRecordsBatched( $request->all(), $request->integer('per_page', 15) ); // HTMX 요청 시 HTML 직접 반환 if ($request->header('HX-Request')) { $html = view('archived-records.partials.table', compact('records'))->render(); return response($html)->header('Content-Type', 'text/html'); } // 일반 요청 시 JSON 반환 return response()->json([ 'success' => true, 'data' => $records->items(), 'meta' => [ 'current_page' => $records->currentPage(), 'last_page' => $records->lastPage(), 'per_page' => $records->perPage(), 'total' => $records->total(), ], ]); } /** * 특정 batch의 레코드 조회 */ public function show(Request $request, string $batchId): JsonResponse { $records = $this->archivedRecordService->getRecordsByBatchId($batchId); if ($records->isEmpty()) { return response()->json([ 'success' => false, 'message' => '아카이브 레코드를 찾을 수 없습니다.', ], 404); } // HTMX 요청 시 HTML 반환 if ($request->header('HX-Request')) { return response()->json([ 'html' => view('archived-records.partials.detail', compact('records'))->render(), ]); } return response()->json([ 'success' => true, 'data' => $records, ]); } /** * 아카이브 통계 */ public function stats(Request $request): JsonResponse { $stats = $this->archivedRecordService->getStats(); return response()->json([ 'success' => true, 'data' => $stats, ]); } }