1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00

Fixes for documents

This commit is contained in:
David Bomba 2022-03-17 13:20:58 +11:00
parent f3a94904ac
commit ae16eb66e5
3 changed files with 16 additions and 12 deletions

View File

@ -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());
}
}

View File

@ -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;
}
}

View File

@ -4,7 +4,7 @@
@keydown.window.escape="sidebarOpen = false"
id="main-sidebar">
@if($settings->enable_client_portal)
@if($settings && $settings->enable_client_portal)
<!-- Off-canvas menu for mobile -->
@include('portal.ninja2020.components.general.sidebar.mobile')
@ -15,7 +15,7 @@
@endif
<div class="flex flex-col w-0 flex-1 overflow-hidden">
@if($settings->enable_client_portal)
@if($settings && $settings->enable_client_portal)
@include('portal.ninja2020.components.general.sidebar.header')
@endif