/**
  * show the activity details
  * @param $id
  * @return \Illuminate\View\View
  */
 public function show($id)
 {
     $activityData = $this->activityManager->getActivityData($id);
     if ($activityData->activity_workflow == 3) {
         $filename = $this->getPublishedActivityFilename($this->organization_id, $activityData);
         $activityPublishedStatus = $this->getPublishedActivityStatus($filename, $this->organization_id);
         $message = $this->getMessageForPublishedActivity($activityPublishedStatus, $filename);
     }
     if (Gate::denies('ownership', $activityData)) {
         return redirect()->route('activity.index')->withResponse($this->getNoPrivilegesMessage());
     }
     $activityDataList = $activityData->activity_data_list;
     $activityResult = $this->resultManager->getResults($id)->toArray();
     $activityTransaction = $this->transactionManager->getTransactions($id)->toArray();
     $activityDocumentLinks = $this->documentLinkManager->getDocumentLinks($id)->toArray();
     $activityDataList['results'] = $activityResult;
     $activityDataList['transaction'] = $activityTransaction;
     $activityDataList['document_links'] = $activityDocumentLinks;
     $activityDataList['reporting_org'] = $activityData->organization->reporting_org;
     if ($activityDataList['activity_workflow'] == 0) {
         $nextRoute = route('activity.complete', $id);
     } elseif ($activityDataList['activity_workflow'] == 1) {
         $nextRoute = route('activity.verify', $id);
     } else {
         $nextRoute = route('activity.publish', $id);
     }
     return view('Activity.show', compact('activityDataList', 'id', 'filename', 'activityPublishedStatus', 'message', 'nextRoute'));
 }
 /**
  * Remove document link from database.
  * @param  int $id
  * @param      $documentLinkId
  * @return \Illuminate\Http\Response
  */
 public function destroy($id, $documentLinkId)
 {
     $activityData = $this->activityManager->getActivityData($id);
     if (Gate::denies('ownership', $activityData)) {
         return redirect()->back()->withResponse($this->getNoPrivilegesMessage());
     }
     $this->authorize('delete_activity', $activityData);
     $activityDocumentLink = $this->documentLinkManager->getDocumentLink($documentLinkId, $id);
     if ($this->documentLinkManager->delete($activityDocumentLink)) {
         $this->activityManager->resetActivityWorkflow($id);
         $response = ['type' => 'success', 'code' => ['deleted', ['name' => 'Document Link']]];
     } else {
         $response = ['type' => 'danger', 'code' => ['delete_failed', ['name' => 'Document Link']]];
     }
     return redirect()->back()->withResponse($response);
 }