From ae16eb66e581307d4299deb908c5f57080e5e124 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 17 Mar 2022 13:20:58 +1100 Subject: [PATCH] Fixes for documents --- app/Http/Controllers/DocumentController.php | 3 +-- app/Repositories/DocumentRepository.php | 21 ++++++++++++------- .../components/general/sidebar/main.blade.php | 4 ++-- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/app/Http/Controllers/DocumentController.php b/app/Http/Controllers/DocumentController.php index cf673fcbe7..dd785fca7f 100644 --- a/app/Http/Controllers/DocumentController.php +++ b/app/Http/Controllers/DocumentController.php @@ -189,12 +189,11 @@ class DocumentController extends BaseController */ $documents->each(function ($document, $key) use ($action) { if (auth()->user()->can('edit', $document)) { - $this->{$action}($document); + $this->document_repo->{$action}($document); } }); /* Need to understand which permission are required for the given bulk action ie. view / edit */ - return $this->listResponse(Document::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()); } } diff --git a/app/Repositories/DocumentRepository.php b/app/Repositories/DocumentRepository.php index 25a381853b..9c85d9c5a1 100644 --- a/app/Repositories/DocumentRepository.php +++ b/app/Repositories/DocumentRepository.php @@ -19,6 +19,7 @@ use App\Utils\Ninja; */ class DocumentRepository extends BaseRepository { + public function delete($document) { $document->deleteFile(); @@ -27,14 +28,18 @@ class DocumentRepository extends BaseRepository public function restore($document) { - if (! $document->trashed()) { - return; - } - - $document->restore(); - - // if (class_exists($className)) { - // event(new $className($document, $document->company, Ninja::eventVars())); + return; + // if (! $document->trashed()) { + // return; // } + + // $document->restore(); + } + + public function archive($document) + { + return; + } + } diff --git a/resources/views/portal/ninja2020/components/general/sidebar/main.blade.php b/resources/views/portal/ninja2020/components/general/sidebar/main.blade.php index 7182395724..8044253e01 100644 --- a/resources/views/portal/ninja2020/components/general/sidebar/main.blade.php +++ b/resources/views/portal/ninja2020/components/general/sidebar/main.blade.php @@ -4,7 +4,7 @@ @keydown.window.escape="sidebarOpen = false" id="main-sidebar"> - @if($settings->enable_client_portal) + @if($settings && $settings->enable_client_portal) @include('portal.ninja2020.components.general.sidebar.mobile') @@ -15,7 +15,7 @@ @endif
- @if($settings->enable_client_portal) + @if($settings && $settings->enable_client_portal) @include('portal.ninja2020.components.general.sidebar.header') @endif