public function compare(Request $request, $contractId1, $contractId2) { $page = $this->pages->getText($contractId1, $request->input('page', '1')); $action = $request->input('action', ''); $canEdit = $action == "edit" ? 'true' : 'false'; $canAnnotate = $action == "annotate" ? 'true' : 'false'; $contract = $this->contract->findWithPages($contractId1); $pages = $contract->pages; $contract1Meta = $this->contract->findWithPages($contractId1); $contract1AnnotationsObj = $this->annotation->getContractPagesWithAnnotations($contractId1); $contract1Annotations = []; foreach ($contract1AnnotationsObj->annotations as $annotation) { $tags = []; foreach ($annotation->annotation->tags as $tag) { $tags[] = $tag; } $contract1Annotations[] = ['page' => $annotation->document_page_no, 'quote' => $annotation->annotation->quote, 'text' => $annotation->annotation->text, 'tags' => $tags]; } $contract2Meta = $this->contract->findWithPages($contractId2); $contract2AnnotationsObj = $this->annotation->getContractPagesWithAnnotations($contractId2); $contract2Annotations = []; foreach ($contract2AnnotationsObj->annotations as $annotation) { $tags = []; foreach ($annotation->annotation->tags as $tag) { $tags[] = $tag; } $contract2Annotations[] = ['page' => $annotation->document_page_no, 'quote' => $annotation->annotation->quote, 'text' => $annotation->annotation->text, 'tags' => $tags]; } $contract1 = ['metadata' => $contract1Meta, 'pages' => $contract1Meta->pages, 'annotations' => $contract1Annotations]; $contract2 = ['metadata' => $contract2Meta, 'pages' => $contract2Meta->pages, 'annotations' => $contract2Annotations]; return view('contract.page.compare', compact('contract', 'contract1', 'contract2', 'pages', 'page', 'canEdit', 'canAnnotate')); }
/** * @param Request $request * @param $contractId */ public function show(Request $request, $contractId) { try { $page = $request->input('page', '1'); $contract = $this->annotation->getContractPagesWithAnnotations($contractId); $status = $this->annotation->getStatus($contractId); $pages = $contract->pages; } catch (\Exception $e) { return back()->withError($e->getMessage()); } return view('annotations.show', compact('contract', 'pages', 'page', 'status')); }