コード例 #1
0
 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'));
 }
コード例 #2
0
 /**
  * @param Guard   $auth
  * @param Request $request
  * @param         $contractId
  * @return Response
  */
 public function updateStatus(Guard $auth, Request $request, $contractId)
 {
     $status = trim(strtolower($request->input('status')));
     if (!$auth->user()->can(sprintf('%s-annotation', config('nrgi.permission')[$status]))) {
         return back()->withError('Permission denied.');
     }
     if ($this->annotation->comment($contractId, $request->input('message'), $request->input('status'))) {
         return back()->withSuccess(trans('annotation.comment_created_successfully'));
     }
     return back()->withError(trans('annotation.invalid_status'));
 }
コード例 #3
0
 /**
  * Execute the console command.
  */
 public function fire()
 {
     $contracts = $this->contract->all();
     foreach ($contracts as $contract) {
         if ($contract->metadata_status == "published") {
             $this->elastic->postMetadata($contract->id);
             $this->info(sprintf('Contract %s : Metadata Indexed.', $contract->id));
         }
         if ($contract->text_status == "published") {
             $this->elastic->postText($contract->id);
             $this->info(sprintf('Contract %s : Text Indexed.', $contract->id));
         }
         if ($this->annotations->getStatus($contract->id) == "published") {
             $this->elastic->postAnnotation($contract->id);
             $this->info(sprintf('Contract %s : Annotations Indexed.', $contract->id));
         }
     }
 }
コード例 #4
0
 /**
  * Display specified contract
  *
  * @return Response
  */
 public function show($id)
 {
     $contract = $this->contract->findWithAnnotations($id);
     if (!$contract) {
         abort('404');
     }
     $translatedFrom = [];
     if (isset($contract->metadata->translated_from) && !empty($contract->metadata->translated_from)) {
         $translatedFrom = $this->contract->getcontracts($contract->metadata->translated_from);
     }
     $supportingDocument = $this->contract->getSupportingDocuments($contract->id);
     $status = $this->contract->getStatus($id);
     $annotationStatus = $this->annotation->getStatus($id);
     $annotations = $contract->annotations;
     $contract->metadata_comment = $this->comment->getLatest($contract->id, Comment::TYPE_METADATA);
     $contract->text_comment = $this->comment->getLatest($contract->id, Comment::TYPE_TEXT);
     $contract->annotation_comment = $this->comment->getLatest($contract->id, Comment::TYPE_ANNOTATION);
     return view('contract.show', compact('contract', 'status', 'annotations', 'annotationStatus', 'translatedFrom', 'supportingDocument'));
 }